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

145 lines
4.2 KiB
PHP
Raw Normal View History

2017-05-16 00:46:20 +02:00
<?php
2017-10-02 22:42:18 +02:00
HTML::title(array('title'=>$L->g('Manage content'), 'icon'=>'folder'));
2017-05-16 00:46:20 +02:00
2017-10-02 22:42:18 +02:00
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'new-content"><i class="uk-icon-plus"></i> '.$L->g('Add new content').'</a>';
2017-05-16 00:46:20 +02:00
echo '
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>'.$L->g('Title').'</th>
';
echo '<th class="uk-text-center">'.( (ORDER_BY=='date') ? $L->g('Date') : $L->g('Position') ).'</th>';
echo '
2017-05-16 00:46:20 +02:00
<th>'.$L->g('URL').'</th>
</tr>
</thead>
<tbody>
';
2018-01-21 23:23:22 +01:00
function table($status, $icon='arrow-circle-o-down') {
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;
2017-08-06 17:27:30 +02:00
if ($status=='published') {
$list = $published;
} elseif ($status=='draft') {
$list = $drafts;
} elseif ($status=='scheduled') {
$list = $scheduled;
2017-09-20 23:00:03 +02:00
} elseif ($status=='static') {
$list = $static;
}
if (!empty($list)) {
echo '<tr>
2018-01-21 23:23:22 +01:00
<td style="color: #aaa; font-size: 0.9em; text-transform: uppercase;">'.$Language->g($status).'</td>
<td></td>
<td></td>
</tr>';
}
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>
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-'.$icon.'"></i> '
.($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.'</a>
</td>
<td class="uk-text-center">'.$page->position().'</td>';
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
echo '<td><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
2018-01-21 23:23:22 +01:00
foreach ($page->children() as $childKey) {
$child = buildPage($childKey);
2018-01-22 00:21:47 +01:00
if ($child->published()) {
2018-01-21 23:23:22 +01:00
echo '<tr>
<td class="child-title">
2018-01-22 20:33:53 +01:00
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-angle-right"></i> '
2018-01-21 23:23:22 +01:00
.($child->title()?$child->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.'</a>
</td>
<td class="uk-text-center">'.$child->position().'</td>';
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$child->key() : '/'.$Url->filters('page').'/'.$child->key();
echo '<td><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
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>
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-'.$icon.'"></i> '
.($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.'</a>
</td>';
echo '<td class="uk-text-center">'.( (ORDER_BY=='date') ? $page->dateRaw(ADMIN_PANEL_DATE_FORMAT) : $page->position() ).'</td>';
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
echo '<td><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
}
2017-12-17 21:16:30 +01:00
}
}
2017-05-16 00:46:20 +02:00
}
if ($Url->pageNumber()==1) {
table('draft', 'spinner');
table('scheduled', 'clock-o');
2017-09-20 23:00:03 +02:00
table('static', 'thumb-tack');
}
2018-01-22 21:56:56 +01:00
table('published', '');
2017-05-16 00:46:20 +02:00
echo '
</tbody>
</table>
2017-07-07 23:38:01 +02:00
';
?>
<!-- Paginator -->
<div id="paginator">
<ul>
<?php
// Show previus page link
if(Paginator::showPrev()) {
2017-10-08 20:33:21 +02:00
echo '<li><a href="'.Paginator::prevPageUrl().'" class="previous"><i class="fa fa-arrow-circle-o-left"></i> '.$Language->g('Previous').'</a></li>';
2017-09-04 23:09:45 +02:00
} else {
2017-10-06 18:28:06 +02:00
echo '<li class="disabled"><i class="fa fa-arrow-circle-o-left"></i> '.$Language->g('Previous').'</li>';
2017-07-07 23:38:01 +02:00
}
for($i=1; $i<=Paginator::amountOfPages(); $i++) {
2017-07-30 23:15:33 +02:00
echo '<li><a href="'.Paginator::numberUrl($i).'" class="page">'.$i.'</a></li>';
2017-07-07 23:38:01 +02:00
}
// Show next page link
if(Paginator::showNext()) {
2017-10-06 18:28:06 +02:00
echo '<li><a href="'.Paginator::nextPageUrl().'" class="next">'.$Language->g('Next').' <i class="fa fa-arrow-circle-o-right"></i></a></li>';
2017-09-04 23:09:45 +02:00
} else {
2017-10-08 20:33:21 +02:00
echo '<li class="disabled">'.$Language->g('Next').' <i class="fa fa-arrow-circle-o-right"></i></li>';
2017-07-07 23:38:01 +02:00
}
?>
</ul>
2017-09-04 23:09:45 +02:00
</div>