bludit/bl-kernel/admin/views/content.php

180 lines
5.2 KiB
PHP
Raw Normal View History

2017-05-16 00:46:20 +02:00
<?php
2018-05-02 19:59:45 +02:00
echo Bootstrap::pageTitle(array('title'=>$L->g('Content'), 'icon'=>'cog'));
2017-05-16 00:46:20 +02:00
2018-05-02 19:59:45 +02:00
function table($status) {
global $Url;
2017-08-06 17:27:30 +02:00
global $Language;
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
if ($status=='published') {
$list = $published;
2018-05-02 19:59:45 +02:00
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $Language->g('There are not pages in this moment.');
echo '</p>';
return false;
}
} elseif ($status=='draft') {
$list = $drafts;
2018-05-02 19:59:45 +02:00
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $Language->g('There are not draft pages in this moment.');
echo '</p>';
return false;
}
} elseif ($status=='scheduled') {
$list = $scheduled;
2018-05-02 19:59:45 +02:00
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $Language->g('There are not scheduled pages in this moment.');
echo '</p>';
return false;
}
2017-09-20 23:00:03 +02:00
} elseif ($status=='static') {
$list = $static;
2018-05-02 19:59:45 +02:00
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $Language->g('There are not static pages in this moment.');
echo '</p>';
return false;
}
2018-03-27 18:40:03 +02:00
} elseif ($status=='sticky') {
$list = $sticky;
2018-05-02 19:59:45 +02:00
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $Language->g('There are not sticky pages in this moment.');
echo '</p>';
return false;
}
}
2018-05-02 19:59:45 +02:00
echo '
<table class="table mt-3">
<thead>
<tr>
<th class="border-0" scope="col">'.$Language->g('Title').'</th>
<th class="border-0 d-none d-lg-table-cell" scope="col">'.$Language->g('URL').'</th>
<th class="border-0 text-center" scope="col">'.( ((ORDER_BY=='position') || ($status!='published'))?$Language->g('Position'):$Language->g('Creation date')).'</th>
</tr>
</thead>
<tbody>
';
2018-01-21 23:23:22 +01:00
if (ORDER_BY=='position') {
foreach ($list as $pageKey) {
$page = buildPage($pageKey);
if ($page) {
2018-01-22 20:33:53 +01:00
if (!$page->isChild() || $status!='published') {
2018-01-22 00:21:47 +01:00
echo '<tr>
<td>
2018-05-02 19:59:45 +02:00
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
.($page->title()?$page->title():'<span>'.$Language->g('Empty title').'</span> ')
2018-01-22 00:21:47 +01:00
.'</a>
2018-05-02 19:59:45 +02:00
</td>';
2018-01-22 00:21:47 +01: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>';
echo '<td class="text-center">'.$page->position().'</td>';
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-05-02 19:59:45 +02:00
<td>
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">'
.($child->title()?$child->title():'<span>'.$Language->g('Empty title').'</span> ')
2018-01-21 23:23:22 +01:00
.'</a>
2018-05-02 19:59:45 +02:00
</td>';
2018-01-21 23:23:22 +01:00
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$child->key() : '/'.$Url->filters('page').'/'.$child->key();
echo '<td><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
2018-05-02 19:59:45 +02:00
echo '<td>'.$child->position().'</td>';
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
}
}
}
}
} else {
foreach ($list as $pageKey) {
$page = buildPage($pageKey);
if ($page) {
echo '<tr>';
echo '<td>
2018-05-02 19:59:45 +02:00
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
2018-01-21 23:23:22 +01:00
.($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.'</a>
</td>';
$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>';
echo '<td class="text-center">'.( ((ORDER_BY=='position') || ($status!='published'))?$page->position():$page->dateRaw(ADMIN_PANEL_DATE_FORMAT) ).'</td>';
2018-01-21 23:23:22 +01:00
echo '</tr>';
}
2017-12-17 21:16:30 +01:00
}
}
2017-05-16 00:46:20 +02:00
2018-05-02 19:59:45 +02:00
echo '
</tbody>
</table>
';
}
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">
<a class="nav-link active" id="pages-tab" data-toggle="tab" href="#pages" role="tab">Pages</a>
</li>
<li class="nav-item">
<a class="nav-link" id="static-tab" data-toggle="tab" href="#static" role="tab">Static</a>
</li>
<li class="nav-item">
<a class="nav-link" id="sticky-tab" data-toggle="tab" href="#sticky" role="tab">Sticky</a>
</li>
<li class="nav-item">
2018-05-08 23:25:18 +02:00
<a class="nav-link" id="scheduled-tab" data-toggle="tab" href="#scheduled" role="tab">Schedule <?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-05-08 23:25:18 +02:00
<a class="nav-link" id="draft-tab" data-toggle="tab" href="#draft" role="tab">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">
<?php table('published'); ?>
</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>