| | |
| | | $dataIgnore = $this->useCRUDjs ? '' : ' data-ignore'; |
| | | ?> |
| | | <section class="items-list <?= esc_attr($this->dataType) ?> crud" data-content="<?= esc_attr($this->dataType) ?>" data-singular="<?=$this->singular?>" data-plural="<?=$this->plural?>" data-view="<?= $this->defaultView?>"<?=$dataIgnore?>> |
| | | <div class="wrap"> |
| | | <div id="item-wrap"> |
| | | <?php |
| | | $this->renderControlsAndFilters(); |
| | | |
| | |
| | | ?> |
| | | <template class="contentTable"> |
| | | <form class="table" |
| | | <!-- data-save="content"--> |
| | | data-content="<?= esc_attr($this->dataType) ?>" |
| | | data-form-id="content-table-<?= esc_attr($this->dataType) ?>" |
| | | <?= $permissions?>> |
| | |
| | | <?= $this->renderItemSelect() ?> |
| | | </td> |
| | | <?php |
| | | if (array_key_exists('status', $this->fields)){ |
| | | if (array_key_exists('post_status', $this->fields)){ |
| | | ?> |
| | | <td class="status" data-field="post_status"> |
| | | <td class="post_status" data-field="post_status" data-field-type="radio"> |
| | | <?= $this->renderStatusRadios() ?> |
| | | </td> |
| | | <?php |
| | |
| | | 'radio' |
| | | ]; |
| | | foreach ($this->fields as $name => $config): |
| | | if (array_key_exists('hidden', $config) || $name === 'status'){ |
| | | if ((array_key_exists('hidden', $config) && $config['hidden'] === true) || $name === 'post_status'){ |
| | | continue; |
| | | } |
| | | $makeThisDetailed = (in_array($config['type'], $makeDetails)); |
| | |
| | | ?> |
| | | <template class="contentTable"> |
| | | <form class="table" |
| | | <!-- data-save="content"--> |
| | | data-content="<?= esc_attr($this->dataType) ?>" |
| | | data-form-id="content-table-<?= esc_attr($this->dataType) ?>"> |
| | | <?= jvbFormStatus() ?> |
| | |
| | | </td> |
| | | <?php |
| | | foreach ($this->fields as $name => $config) { |
| | | if(array_key_exists('hidden', $config) || $name === 'post_status') { |
| | | if((array_key_exists('hidden', $config) && $config['hidden'] === true) || $name === 'post_status') { |
| | | continue; |
| | | } |
| | | if (!in_array($name, $this->timelineUniqueFields)) { |
| | |
| | | * Render table header |
| | | */ |
| | | protected function renderTableHeader(): string { |
| | | ob_start(); |
| | | |
| | | ?> |
| | | <tr> |
| | | $out = '<tr> |
| | | <th scope="col" class="select-header"> |
| | | <input type="checkbox" id="select-all" name="select-all"> |
| | | <label for="select-all">All</label> |
| | | </th> |
| | | <?php if (array_key_exists('status', $this->fields)) { ?> |
| | | <th scope="col" class="status-header">Status</th> |
| | | <?php } ?> |
| | | <?php foreach ($this->fields as $name => $config): |
| | | if (array_key_exists('hidden', $config) || $name === 'status'){ |
| | | continue; |
| | | } |
| | | ?> |
| | | <th scope="col" class="show-<?= esc_attr($name) ?>"<?= (in_array($name, $this->stuck)) ? ' data-stuck':''?>> |
| | | <?= esc_html($config['label']) ?> |
| | | </th> |
| | | <?php endforeach; |
| | | if (!empty($this->itemActions)) { |
| | | ?> |
| | | <th scope="col" class="show-actions"> |
| | | Actions |
| | | </th> |
| | | <?php |
| | | } |
| | | ?> |
| | | </th>'; |
| | | |
| | | </tr> |
| | | <?php |
| | | return ob_get_clean(); |
| | | if (array_key_exists('post_status', $this->fields)){ |
| | | $out .= '<th scope="col" class="status-header">Status</th>'; |
| | | } |
| | | |
| | | foreach ($this->fields as $name => $config) { |
| | | if ($name === 'post_status' || (array_key_exists('hidden', $config) && $config['hidden'] === true)) { |
| | | continue; |
| | | } |
| | | $out .= sprintf( |
| | | '<th scope="col" class="show-%s"%s>%s</th>', |
| | | esc_attr($name), |
| | | in_array($name, $this->stuck) ? ' data-stuck' : '', |
| | | esc_html($config['label']) |
| | | ); |
| | | } |
| | | |
| | | if (!empty($this->itemActions)) { |
| | | $out .= '<th scope="col" class="show-actions">Actions</th>'; |
| | | } |
| | | $out .= '</tr>'; |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | protected function renderTimelineTableHeader(): string { |
| | | ob_start(); |
| | | |
| | | ?> |
| | | <tr> |
| | | $out = '<tr> |
| | | <th scope="col" class="select-header"> |
| | | <input type="checkbox" id="select-all" name="select-all"> |
| | | <label for="select-all">All</label> |
| | | </th> |
| | | <th scope="col" class="show-post_status"> |
| | | Status |
| | | </th> |
| | | <?php foreach ($this->fields as $name => $config): |
| | | if (array_key_exists('hidden', $config) || $name === 'post_status'){ |
| | | continue; |
| | | } |
| | | ?> |
| | | <th scope="col" class="show-<?= esc_attr($name) ?>"<?= (in_array($name, $this->stuck)) ? ' data-stuck':''?>> |
| | | <?= esc_html($config['label']) ?> |
| | | </th> |
| | | <?php endforeach; ?> |
| | | </tr> |
| | | <?php |
| | | return ob_get_clean(); |
| | | </th>'; |
| | | |
| | | foreach ($this->fields as $name => $config) { |
| | | if ($name === 'post_status' || (array_key_exists('hidden', $config) && $config['hidden'] === true)) { |
| | | continue; |
| | | } |
| | | $out .= sprintf( |
| | | '<th scope="col" class="show-%s"%s>%s</th>th>', |
| | | esc_attr($name), |
| | | in_array($name, $this->stuck) ? ' data-stuck':'', |
| | | esc_html($config['label']) |
| | | ); |
| | | } |
| | | $out .= '</tr>'; |
| | | return $out; |
| | | } |
| | | |
| | | /** |
| | |
| | | return ob_get_clean(); |
| | | } |
| | | |
| | | protected function renderStatusRadios(): string { |
| | | ob_start(); |
| | | ?> |
| | | <div class="radio-options status-options row" data-field="post_status" data-field-type="radio"> |
| | | <?php foreach ($this->statuses as $status): |
| | | if ($status === 'all') continue; |
| | | if (!array_key_exists($status, $this->allowedStatuses)) continue; |
| | | $config = $this->allowedStatuses[$status]; |
| | | ?> |
| | | protected function renderStatusRadios(): string |
| | | { |
| | | $out = '<div class="radio-options status-options row">'; |
| | | foreach ($this->statuses as $status) { |
| | | if ($status === 'all' || !array_key_exists($status, $this->allowedStatuses)) continue; |
| | | $config = $this->allowedStatuses[$status]; |
| | | |
| | | <input type="radio" |
| | | $out .= sprintf( |
| | | '<input type="radio" |
| | | name="post_status" |
| | | id="status-<?= esc_attr($status) ?>" |
| | | value="<?= esc_attr($status) ?>"> |
| | | <label for="status-<?= esc_attr($status) ?>"> |
| | | <?= jvbDashIcon($config['icon']) ?> |
| | | <span class="screen-reader-text"><?= esc_html($config['label']) ?></span> |
| | | </label> |
| | | <?php endforeach; ?> |
| | | <span class="validation-message" hidden role="alert"></span> |
| | | </div> |
| | | <?php |
| | | return ob_get_clean(); |
| | | id="post_status-%s" |
| | | class="btn" |
| | | value="%s"> |
| | | <label for="post_status-%s" title="%s"> |
| | | %s |
| | | <span class="screen-reader-text">%s</span> |
| | | </label>', |
| | | esc_attr($status), |
| | | esc_attr($status), |
| | | esc_attr($status), |
| | | esc_html($config['label']), |
| | | jvbDashIcon($config['icon']), |
| | | esc_html($config['label']) |
| | | ); |
| | | } |
| | | $out .= '<span class="validation-message" hidden role="alert"></span> |
| | | </div>'; |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | |
| | | protected function editForm():string |
| | | { |
| | | ob_start(); |
| | | /* <form class="edit-form" data-save="content" data-form-id="edit-<?=$this->dataType?>" data-autosave<?= ($this->isTimeline) ? ' data-timeline' : ''*/ |
| | | ?> |
| | | <!-- <form class="edit-form" data-save="content" data-form-id="edit---><?php //=$this->dataType?><!--" data-autosave--><?php //= ($this->isTimeline) ? ' data-timeline' : ''?><!-->--> |
| | | |
| | | <form class="edit-form" data-form-id="edit-<?=$this->dataType?>" data-autosave<?= ($this->isTimeline) ? ' data-timeline' : ''?>> |
| | | <?= jvbFormStatus() ?> |
| | | <input type="hidden" name="form-id" value="<?=uniqid('new-')?>" /> |
| | |
| | | { |
| | | if (empty($this->bulkActions)) return; |
| | | ob_start(); |
| | | /* <form class="bulk-edit-form" data-save="content" data-form-id="bulk-edit-<?=$this->dataType?>">*/ |
| | | ?> |
| | | <!-- <form class="bulk-edit-form" data-save="content" data-form-id="bulk-edit---><?php //=$this->dataType?><!--">--> |
| | | |
| | | <form class="bulk-edit-form" data-form-id="bulk-edit-<?=$this->dataType?>"> |
| | | <?= jvbFormStatus() ?> |
| | | <div class="selected"></div> |