$L->g('Content'), 'icon'=>'archive')); function moveTypeIcon($type) { $icons = array( 'published' => 'fa-file-text-o', 'sticky' => 'fa-thumb-tack', 'static' => 'fa-file', 'draft' => 'fa-pencil', ); return isset($icons[$type]) ? $icons[$type] : 'fa-file'; } function moveTypeLabel($current, $target, $L) { if ($target === 'sticky') { return $L->g('Sticky'); } if ($current === 'sticky' && $target === 'published') { return $L->g('Unstick'); } $labels = array( 'published' => $L->g('Move to Page'), 'static' => $L->g('Move to Static'), 'draft' => $L->g('Move to Draft'), ); return isset($labels[$target]) ? $labels[$target] : $target; } // Render a single row (or row + nested children) for a page key. // $type controls which columns/buttons are shown; $isSticky adds the Sticky badge // and flips the toggle button into "Unstick" mode. function tableRow($pageKey, $type, $isSticky = false, $renderChildren = false) { global $url; global $L; try { $page = new Page($pageKey); } catch (Exception $e) { return; } $showURL = ($type === 'published' || $type === 'static' || $type === 'sticky'); // Allowed "Move to" transitions per current type. $moves = array( 'published' => array('sticky', 'static', 'draft'), 'sticky' => array('published', 'static', 'draft'), 'draft' => array('published', 'static'), 'static' => array('published', 'draft'), ); $dateLabel = ''; if ($type === 'scheduled') { $dateLabel = $L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT); } elseif ((ORDER_BY === 'position') || ($type !== 'published' && $type !== 'sticky')) { $dateLabel = $L->g('Position').': '.$page->position(); } else { $dateLabel = $page->date(MANAGE_CONTENT_DATE_FORMAT); } echo ''; echo ''; echo '
'; echo ''; echo ($page->title() ? $page->title() : ''.$L->g('Empty title').' '); echo ''; if ($isSticky) { echo ' '.$L->g('Sticky').''; } echo '
'; echo '

'.$dateLabel.'

'; echo ''; if ($showURL) { $friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key(); echo ''.$friendlyURL.''; } echo ''.PHP_EOL; echo ''; echo ''; echo ''; if ($renderChildren) { foreach ($page->children() as $child) { echo ''; echo ''; echo '
'; echo ''; echo ($child->title() ? $child->title() : ''.$L->g('Empty title').' '); echo ''; echo '
'; echo '

'.$L->g('Position').': '.$child->position().'

'; echo ''; if ($showURL) { $friendlyChildURL = Text::isEmpty($url->filters('page')) ? '/'.$child->key() : '/'.$url->filters('page').'/'.$child->key(); echo ''.$friendlyChildURL.''; } echo ''.PHP_EOL; echo ''; echo ''; echo ''; } } } // Render rows for a list, applying the parent/child nesting rules used by the // Static tab and by the Pages/Sticky lists when ORDER_BY is "position". function tableRows($list, $type, $isSticky = false) { $nestChildren = ($type === 'static') || (ORDER_BY === 'position'); foreach ($list as $pageKey) { try { $page = new Page($pageKey); } catch (Exception $e) { continue; } if ($nestChildren) { if ($page->isChild()) { continue; } tableRow($pageKey, $type, $isSticky, true); } else { tableRow($pageKey, $type, $isSticky, false); } } } // Render a full table for a single tab (Static, Scheduled, Draft, Autosave). function table($type) { global $L; global $drafts; global $scheduled; global $static; global $autosave; if ($type === 'draft') { $list = $drafts; $emptyMessage = $L->g('There are no draft pages at this moment.'); } elseif ($type === 'scheduled') { $list = $scheduled; $emptyMessage = $L->g('There are no scheduled pages at this moment.'); } elseif ($type === 'static') { $list = $static; $emptyMessage = $L->g('There are no static pages at this moment.'); } elseif ($type === 'autosave') { $list = $autosave; $emptyMessage = ''; } else { return; } if (empty($list) && $type !== 'autosave') { echo '

'.$emptyMessage.'

'; return; } echo ''; echo ''; if ($type === 'static') { echo ''; } echo ''; echo ''; tableRows($list, $type); echo '
'.$L->g('Title').''.$L->g('URL').''.$L->g('Actions').'
'; } // Render the Pages tab: sticky rows first, then the paginated published list, // in a single table. function tablePages() { global $L; global $published; global $sticky; global $url; $isFirstPage = ($url->pageNumber() <= 1); if (empty($published) && (empty($sticky) || !$isFirstPage)) { echo '

'.$L->g('There are no pages at this moment.').'

'; return; } echo ''; echo ''; echo ''; echo ''; echo ''; if (!empty($sticky) && $isFirstPage) { tableRows($sticky, 'sticky', true); } if (!empty($published)) { tableRows($published, 'published', false); } echo '
'.$L->g('Title').''.$L->g('URL').''.$L->g('Actions').'
'; } ?>
1): ?>
$L->g('Delete'), 'buttonPrimaryClass'=>'btn-danger deletePageModalAcceptButton', 'buttonSecondary'=>$L->g('Cancel'), 'buttonSecondaryClass'=>'btn-link', 'modalTitle'=>$L->g('Delete content'), 'modalText'=>$L->g('Are you sure you want to delete this page'), 'modalId'=>'jsdeletePageModal' )); ?>