2017-05-16 00:46:20 +02:00
|
|
|
<?php
|
|
|
|
|
2018-07-18 22:44:42 +02:00
|
|
|
echo Bootstrap::pageTitle(array('title'=>$L->g('Content'), 'icon'=>'layers'));
|
2017-05-16 00:46:20 +02:00
|
|
|
|
2018-07-17 23:58:01 +02:00
|
|
|
function table($type) {
|
2018-07-17 19:13:01 +02:00
|
|
|
global $url;
|
2018-08-05 17:54:20 +02:00
|
|
|
global $L;
|
2017-09-10 23:09:44 +02:00
|
|
|
global $published;
|
|
|
|
global $drafts;
|
|
|
|
global $scheduled;
|
2017-09-20 23:00:03 +02:00
|
|
|
global $static;
|
2018-03-27 18:40:03 +02:00
|
|
|
global $sticky;
|
2017-08-06 17:27:30 +02:00
|
|
|
|
2018-07-17 23:58:01 +02:00
|
|
|
if ($type=='published') {
|
2017-09-10 23:09:44 +02:00
|
|
|
$list = $published;
|
2018-05-02 19:59:45 +02:00
|
|
|
if (empty($list)) {
|
|
|
|
echo '<p class="mt-4 text-muted">';
|
2018-08-05 17:54:20 +02:00
|
|
|
echo $L->g('There are no pages at this moment.');
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '</p>';
|
|
|
|
return false;
|
|
|
|
}
|
2018-07-17 23:58:01 +02:00
|
|
|
} elseif ($type=='draft') {
|
2017-09-10 23:09:44 +02:00
|
|
|
$list = $drafts;
|
2018-05-02 19:59:45 +02:00
|
|
|
if (empty($list)) {
|
|
|
|
echo '<p class="mt-4 text-muted">';
|
2018-08-05 17:54:20 +02:00
|
|
|
echo $L->g('There are no draft pages at this moment.');
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '</p>';
|
|
|
|
return false;
|
|
|
|
}
|
2018-07-17 23:58:01 +02:00
|
|
|
} elseif ($type=='scheduled') {
|
2017-09-10 23:09:44 +02:00
|
|
|
$list = $scheduled;
|
2018-05-02 19:59:45 +02:00
|
|
|
if (empty($list)) {
|
|
|
|
echo '<p class="mt-4 text-muted">';
|
2018-08-05 17:54:20 +02:00
|
|
|
echo $L->g('There are no scheduled pages at this moment.');
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '</p>';
|
|
|
|
return false;
|
|
|
|
}
|
2018-07-17 23:58:01 +02:00
|
|
|
} elseif ($type=='static') {
|
2017-09-20 23:00:03 +02:00
|
|
|
$list = $static;
|
2018-05-02 19:59:45 +02:00
|
|
|
if (empty($list)) {
|
|
|
|
echo '<p class="mt-4 text-muted">';
|
2018-08-05 17:54:20 +02:00
|
|
|
echo $L->g('There are no static pages at this moment.');
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '</p>';
|
|
|
|
return false;
|
|
|
|
}
|
2018-07-17 23:58:01 +02:00
|
|
|
} elseif ($type=='sticky') {
|
2018-03-27 18:40:03 +02:00
|
|
|
$list = $sticky;
|
2018-05-02 19:59:45 +02:00
|
|
|
if (empty($list)) {
|
|
|
|
echo '<p class="mt-4 text-muted">';
|
2018-08-05 17:54:20 +02:00
|
|
|
echo $L->g('There are no sticky pages at this moment.');
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '</p>';
|
|
|
|
return false;
|
|
|
|
}
|
2017-09-10 23:09:44 +02:00
|
|
|
}
|
|
|
|
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '
|
|
|
|
<table class="table mt-3">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2018-08-05 17:54:20 +02:00
|
|
|
<th style="font-size: 0.8em;" class="border-0 text-uppercase text-muted" scope="col">'.$L->g('Title').'</th>
|
|
|
|
<th style="font-size: 0.8em;" class="border-0 d-none d-lg-table-cell text-uppercase text-muted" scope="col">'.$L->g('URL').'</th>
|
|
|
|
<th style="font-size: 0.8em;" class="border-0 text-center d-none d-sm-table-cell text-uppercase text-muted" scope="col">'.$L->g('Actions').'</th>
|
2018-05-02 19:59:45 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
';
|
2017-09-10 23:09:44 +02:00
|
|
|
|
2018-01-21 23:23:22 +01:00
|
|
|
if (ORDER_BY=='position') {
|
|
|
|
foreach ($list as $pageKey) {
|
2018-07-17 23:58:01 +02:00
|
|
|
try {
|
2018-08-02 17:06:53 +02:00
|
|
|
$page = new Page($pageKey);
|
2018-07-17 23:58:01 +02:00
|
|
|
if (!$page->isChild() || $type!='published') {
|
2018-01-22 00:21:47 +01:00
|
|
|
echo '<tr>
|
|
|
|
<td>
|
2018-08-28 19:23:21 +02:00
|
|
|
<div>
|
|
|
|
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
|
|
|
|
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
|
|
|
.'</a>
|
|
|
|
</div>
|
|
|
|
<div>
|
2018-08-28 19:25:28 +02:00
|
|
|
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?$L->g('Position').': '.$page->position():$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
2018-08-28 19:23:21 +02:00
|
|
|
</div>
|
2018-05-02 19:59:45 +02:00
|
|
|
</td>';
|
2018-01-22 00:21:47 +01:00
|
|
|
|
2018-07-17 19:13:01 +02:00
|
|
|
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key();
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
|
|
|
|
|
2019-01-28 20:30:52 +01:00
|
|
|
echo '<td class="contentTools pt-3 text-center d-sm-table-cell w-25">'.PHP_EOL;
|
2019-05-10 15:08:02 +02:00
|
|
|
echo '<a class="text-secondary d-none d-md-inline" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
|
2019-01-04 14:18:40 +01:00
|
|
|
if (count($page->children())==0) {
|
2019-05-10 15:08:02 +02:00
|
|
|
echo '<a href="#" class="ml-2 text-danger deletePageButton d-block d-sm-inline" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
|
2019-01-04 14:18:40 +01:00
|
|
|
}
|
2018-08-28 19:23:21 +02:00
|
|
|
echo '</td>';
|
2018-05-02 19:59:45 +02:00
|
|
|
|
2018-01-22 00:21:47 +01:00
|
|
|
echo '</tr>';
|
2018-01-21 23:23:22 +01:00
|
|
|
|
2018-02-15 20:08:00 +01:00
|
|
|
foreach ($page->children() as $child) {
|
2018-01-22 00:21:47 +01:00
|
|
|
if ($child->published()) {
|
2018-01-21 23:23:22 +01:00
|
|
|
echo '<tr>
|
2018-08-28 19:23:21 +02:00
|
|
|
<td class="child">
|
|
|
|
<div>
|
|
|
|
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">'
|
|
|
|
.($child->title()?$child->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
|
|
|
.'</a>
|
|
|
|
</div>
|
|
|
|
<div>
|
2018-08-28 19:25:28 +02:00
|
|
|
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?$L->g('Position').': '.$child->position():$child->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
2018-08-28 19:23:21 +02:00
|
|
|
</div>
|
2018-05-02 19:59:45 +02:00
|
|
|
</td>';
|
2018-01-21 23:23:22 +01:00
|
|
|
|
2018-07-17 19:13:01 +02:00
|
|
|
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$child->key() : '/'.$url->filters('page').'/'.$child->key();
|
2019-05-10 15:08:02 +02:00
|
|
|
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
|
2018-05-02 19:59:45 +02:00
|
|
|
|
2019-01-28 20:30:52 +01:00
|
|
|
echo '<td class="contentTools pt-3 text-center d-sm-table-cell w-25">'.PHP_EOL;
|
2019-05-10 15:08:02 +02:00
|
|
|
echo '<a class="text-secondary d-none d-md-inline" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
|
|
|
|
echo '<a class="ml-2 text-danger deletePageButton d-block d-sm-inline" href="#" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$child->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
|
2018-08-28 19:23:21 +02:00
|
|
|
echo '</td>';
|
2018-05-02 19:59:45 +02:00
|
|
|
|
2018-01-21 23:23:22 +01:00
|
|
|
echo '</tr>';
|
2018-01-22 00:21:47 +01:00
|
|
|
}
|
2018-01-21 23:23:22 +01:00
|
|
|
}
|
|
|
|
}
|
2018-07-17 23:58:01 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
// Continue
|
2018-01-21 23:23:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
foreach ($list as $pageKey) {
|
2018-07-17 23:58:01 +02:00
|
|
|
try {
|
2018-08-02 17:06:53 +02:00
|
|
|
$page = new Page($pageKey);
|
2018-01-21 23:23:22 +01:00
|
|
|
echo '<tr>';
|
2018-07-28 18:33:37 +02:00
|
|
|
echo '<td class="pt-3">
|
|
|
|
<div>
|
|
|
|
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
|
2018-08-05 17:54:20 +02:00
|
|
|
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
2018-07-28 18:33:37 +02:00
|
|
|
.'</a>
|
|
|
|
</div>
|
|
|
|
<div>
|
2018-12-30 13:35:31 +01:00
|
|
|
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ($type=='scheduled')?$L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT):$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
2018-07-28 18:33:37 +02:00
|
|
|
</div>
|
2018-01-21 23:23:22 +01:00
|
|
|
</td>';
|
|
|
|
|
2018-07-17 19:13:01 +02:00
|
|
|
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key();
|
2018-07-28 18:33:37 +02:00
|
|
|
echo '<td class="pt-3 d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
|
2018-05-02 19:59:45 +02:00
|
|
|
|
2019-01-28 20:30:52 +01:00
|
|
|
echo '<td class="contentTools pt-3 text-center d-sm-table-cell w-25">'.PHP_EOL;
|
2019-05-10 15:08:02 +02:00
|
|
|
echo '<a class="text-secondary d-none d-md-inline" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
|
2019-01-04 14:18:40 +01:00
|
|
|
if (count($page->children())==0) {
|
2019-05-10 15:08:02 +02:00
|
|
|
echo '<a href="#" class="ml-2 text-danger deletePageButton d-block d-sm-inline" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
|
2019-01-04 14:18:40 +01:00
|
|
|
}
|
2018-07-28 18:33:37 +02:00
|
|
|
echo '</td>';
|
2018-05-02 19:59:45 +02:00
|
|
|
|
2018-01-21 23:23:22 +01:00
|
|
|
echo '</tr>';
|
2018-07-17 23:58:01 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
// Continue
|
2018-01-21 23:23:22 +01:00
|
|
|
}
|
2017-12-17 21:16:30 +01:00
|
|
|
}
|
2017-08-02 01:11:57 +02:00
|
|
|
}
|
2017-05-16 00:46:20 +02:00
|
|
|
|
2018-05-02 19:59:45 +02:00
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
';
|
2017-09-10 23:09:44 +02:00
|
|
|
}
|
2017-08-02 01:11:57 +02:00
|
|
|
|
2017-07-07 23:38:01 +02:00
|
|
|
?>
|
|
|
|
|
2018-05-02 19:59:45 +02:00
|
|
|
<!-- TABS -->
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
|
|
<li class="nav-item">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="nav-link active" id="pages-tab" data-toggle="tab" href="#pages" role="tab"><?php $L->p('Pages') ?></a>
|
2018-05-02 19:59:45 +02:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="nav-link" id="static-tab" data-toggle="tab" href="#static" role="tab"><?php $L->p('Static') ?></a>
|
2018-05-02 19:59:45 +02:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="nav-link" id="sticky-tab" data-toggle="tab" href="#sticky" role="tab"><?php $L->p('Sticky') ?></a>
|
2018-05-02 19:59:45 +02:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="nav-link" id="scheduled-tab" data-toggle="tab" href="#scheduled" role="tab"><?php $L->p('Scheduled') ?> <?php if (count($scheduled)>0) { echo '<span class="badge badge-danger">'.count($scheduled).'</span>'; } ?></a>
|
2018-05-02 19:59:45 +02:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="nav-link" id="draft-tab" data-toggle="tab" href="#draft" role="tab"><?php $L->p('Draft') ?> <?php if (count($drafts)>0) { echo '<span class="badge badge-danger">'.count($drafts).'</span>'; } ?></a>
|
2018-05-02 19:59:45 +02:00
|
|
|
</li>
|
2017-07-07 23:38:01 +02:00
|
|
|
</ul>
|
2018-05-02 19:59:45 +02:00
|
|
|
<div class="tab-content">
|
|
|
|
<!-- TABS PAGES -->
|
|
|
|
<div class="tab-pane show active" id="pages" role="tabpanel">
|
2018-07-18 23:16:30 +02:00
|
|
|
<?php table('published'); ?>
|
|
|
|
|
2018-08-06 21:46:58 +02:00
|
|
|
<?php if (Paginator::numberOfPages() > 1): ?>
|
2018-07-18 23:16:30 +02:00
|
|
|
<!-- Paginator -->
|
|
|
|
<nav class="paginator">
|
|
|
|
<ul class="pagination flex-wrap justify-content-center">
|
|
|
|
|
2018-07-18 23:26:43 +02:00
|
|
|
<!-- First button -->
|
2018-07-20 18:36:47 +02:00
|
|
|
<li class="page-item <?php if (!Paginator::showPrev()) echo 'disabled' ?>">
|
2019-05-13 18:26:35 +02:00
|
|
|
<a class="page-link" href="<?php echo Paginator::firstPageUrl() ?>"><span class="align-middle fa fa-media-skip-backward"></span> <?php echo $L->get('First'); ?></a>
|
2018-07-18 23:16:30 +02:00
|
|
|
</li>
|
|
|
|
|
2018-07-18 23:26:43 +02:00
|
|
|
<!-- Previous button -->
|
|
|
|
<li class="page-item <?php if (!Paginator::showPrev()) echo 'disabled' ?>">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="page-link" href="<?php echo Paginator::previousPageUrl() ?>"><?php echo $L->get('Previous'); ?></a>
|
2018-07-18 23:16:30 +02:00
|
|
|
</li>
|
|
|
|
|
|
|
|
<!-- Next button -->
|
|
|
|
<li class="page-item <?php if (!Paginator::showNext()) echo 'disabled' ?>">
|
2018-08-05 17:54:20 +02:00
|
|
|
<a class="page-link" href="<?php echo Paginator::nextPageUrl() ?>"><?php echo $L->get('Next'); ?></a>
|
2018-07-18 23:16:30 +02:00
|
|
|
</li>
|
|
|
|
|
2018-07-18 23:26:43 +02:00
|
|
|
<!-- Last button -->
|
2018-07-20 18:36:47 +02:00
|
|
|
<li class="page-item <?php if (!Paginator::showNext()) echo 'disabled' ?>">
|
2019-05-13 18:26:35 +02:00
|
|
|
<a class="page-link" href="<?php echo Paginator::lastPageUrl() ?>"><?php echo $L->get('Last'); ?> <span class="align-middle fa fa-media-skip-forward"></span></a>
|
2018-07-18 23:26:43 +02:00
|
|
|
</li>
|
|
|
|
|
2018-07-18 23:16:30 +02:00
|
|
|
</ul>
|
|
|
|
</nav>
|
2018-07-28 18:33:37 +02:00
|
|
|
<?php endif; ?>
|
2018-05-02 19:59:45 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- TABS STATIC -->
|
|
|
|
<div class="tab-pane" id="static" role="tabpanel">
|
|
|
|
<?php table('static'); ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- TABS STICKY -->
|
|
|
|
<div class="tab-pane" id="sticky" role="tabpanel">
|
|
|
|
<?php table('sticky'); ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- TABS SCHEDULED -->
|
|
|
|
<div class="tab-pane" id="scheduled" role="tabpanel">
|
|
|
|
<?php table('scheduled'); ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- TABS DRAFT -->
|
|
|
|
<div class="tab-pane" id="draft" role="tabpanel">
|
|
|
|
<?php table('draft'); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-07-28 18:33:37 +02:00
|
|
|
|
|
|
|
<!-- Modal for delete page -->
|
2018-11-07 15:40:22 +01:00
|
|
|
<?php
|
|
|
|
echo Bootstrap::modal(array(
|
|
|
|
'buttonPrimary'=>$L->g('Delete'),
|
2018-11-09 00:59:06 +01:00
|
|
|
'buttonPrimaryClass'=>'btn-danger deletePageModalAcceptButton',
|
2018-11-07 15:40:22 +01:00
|
|
|
'buttonSecondary'=>$L->g('Cancel'),
|
2018-11-28 22:01:55 +01:00
|
|
|
'buttonSecondaryClass'=>'btn-link',
|
2018-11-07 15:40:22 +01:00
|
|
|
'modalTitle'=>$L->g('Delete content'),
|
|
|
|
'modalText'=>$L->g('Are you sure you want to delete this page'),
|
|
|
|
'modalId'=>'jsdeletePageModal'
|
|
|
|
));
|
2018-07-28 18:33:37 +02:00
|
|
|
?>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
var key = false;
|
|
|
|
|
|
|
|
// Button for delete a page in the table
|
|
|
|
$(".deletePageButton").on("click", function() {
|
|
|
|
key = $(this).data('key');
|
|
|
|
});
|
|
|
|
|
|
|
|
// Event from button accept from the modal
|
|
|
|
$(".deletePageModalAcceptButton").on("click", function() {
|
|
|
|
|
|
|
|
var form = jQuery('<form>', {
|
|
|
|
'action': HTML_PATH_ADMIN_ROOT+'edit-content/'+key,
|
|
|
|
'method': 'post',
|
|
|
|
'target': '_top'
|
|
|
|
}).append(jQuery('<input>', {
|
|
|
|
'type': 'hidden',
|
|
|
|
'name': 'tokenCSRF',
|
|
|
|
'value': tokenCSRF
|
|
|
|
}).append(jQuery('<input>', {
|
|
|
|
'type': 'hidden',
|
|
|
|
'name': 'key',
|
|
|
|
'value': key
|
|
|
|
}).append(jQuery('<input>', {
|
|
|
|
'type': 'hidden',
|
|
|
|
'name': 'type',
|
|
|
|
'value': 'delete'
|
|
|
|
}))));
|
|
|
|
|
|
|
|
form.hide().appendTo("body").submit();
|
|
|
|
});
|
|
|
|
});
|
2018-08-01 14:46:12 +02:00
|
|
|
</script>
|
2019-01-26 12:50:48 +01:00
|
|
|
|
|
|
|
<script>
|
|
|
|
// Open the tab defined in the URL
|
|
|
|
const anchor = window.location.hash;
|
|
|
|
$(`a[href="${anchor}"]`).tab('show');
|
|
|
|
</script>
|