add periods list columns to user pref
This commit is contained in:
parent
7888922dce
commit
779b46aca8
3 changed files with 156 additions and 127 deletions
18
_admin.php
18
_admin.php
|
@ -29,6 +29,10 @@ $core->addBehavior(
|
||||||
'adminFiltersLists',
|
'adminFiltersLists',
|
||||||
['adminPeriodical', 'adminFiltersLists']
|
['adminPeriodical', 'adminFiltersLists']
|
||||||
);
|
);
|
||||||
|
$core->addBehavior(
|
||||||
|
'adminColumnsLists',
|
||||||
|
['adminPeriodical', 'adminColumnsLists']
|
||||||
|
);
|
||||||
|
|
||||||
if ($core->blog->settings->periodical->periodical_active) {
|
if ($core->blog->settings->periodical->periodical_active) {
|
||||||
|
|
||||||
|
@ -139,6 +143,20 @@ class adminPeriodical
|
||||||
$blog_settings->periodical->put('periodical_updurl', !empty($_POST['periodical_updurl']));
|
$blog_settings->periodical->put('periodical_updurl', !empty($_POST['periodical_updurl']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function adminColumnsLists(dcCore $core, $cols)
|
||||||
|
{
|
||||||
|
$cols['periodical'] = [
|
||||||
|
__('Periodical'),
|
||||||
|
[
|
||||||
|
'curdt' => [true, __('Next update')],
|
||||||
|
'pub_int' => [true, __('Frequency')],
|
||||||
|
'pub_nb' => [true, __('Pub per update')],
|
||||||
|
'nbposts' => [true, __('Entries')],
|
||||||
|
'enddt' => [true, __('End date')]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public static function adminFiltersLists(dcCore $core, $sorts)
|
public static function adminFiltersLists(dcCore $core, $sorts)
|
||||||
{
|
{
|
||||||
$sorts['periodical'] = [
|
$sorts['periodical'] = [
|
||||||
|
|
|
@ -22,91 +22,111 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
*/
|
*/
|
||||||
class adminPeriodicalList extends adminGenericList
|
class adminPeriodicalList extends adminGenericList
|
||||||
{
|
{
|
||||||
public function periodDisplay($page, $nb_per_page, $enclose_block='')
|
public function periodDisplay($filter, $enclose_block='')
|
||||||
{
|
{
|
||||||
$echo = '';
|
$echo = '';
|
||||||
if ($this->rs->isEmpty()) {
|
if ($this->rs->isEmpty()) {
|
||||||
$echo .= '<p><strong>' .__('No period') .'</strong></p>';
|
if ($filter->show()) {
|
||||||
|
echo '<p><strong>' . __('No period matches the filter') . '</strong></p>';
|
||||||
} else {
|
} else {
|
||||||
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
echo '<p><strong>' . __('No period') . '</strong></p>';
|
||||||
$pager->html_prev = $this->html_prev;
|
}
|
||||||
$pager->html_next = $this->html_next;
|
} else {
|
||||||
|
$pager = new dcPager($filter->page, $this->rs_count, $filter->nb, 10);
|
||||||
$pager->var_page = 'page';
|
$pager->var_page = 'page';
|
||||||
|
|
||||||
$html_block =
|
$periods = [];
|
||||||
'<div class="table-outer">' .
|
if (isset($_REQUEST['periods'])) {
|
||||||
'<table class="clear">' .
|
foreach ($_REQUEST['periods'] as $v) {
|
||||||
'<tr>' .
|
$periods[(integer) $v] = true;
|
||||||
'<th colspan="2" class="nowrap">' . __('Name') . '</th>' .
|
}
|
||||||
'<th class="nowrap">' . __('Next update') . '</th>' .
|
}
|
||||||
'<th class="nowrap">' . __('Frequency') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Publications') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Entries') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('End date') . '</th>' .
|
|
||||||
'</tr>%s</table>' .
|
|
||||||
'</div>';
|
|
||||||
|
|
||||||
|
$html_block = '<div class="table-outer"><table><caption>' . ($filter->show() ?
|
||||||
|
sprintf(__('List of %s periods matching the filter.'), $this->rs_count) :
|
||||||
|
sprintf(__('List of %s periods.'), $this->rs_count)
|
||||||
|
). '</caption>';
|
||||||
|
|
||||||
|
$cols = new ArrayObject([
|
||||||
|
'name' => '<th colspan="2" class="first">' . __('Name') . '</th>',
|
||||||
|
'curdt' => '<th scope="col" class="nowrap">' . __('Next update') . '</th>',
|
||||||
|
'pub_int' => '<th scope="col" class="nowrap">' . __('Frequency') . '</th>',
|
||||||
|
'pub_nb' => '<th scope="col" class="nowrap">' . __('Pub per update') . '</th>',
|
||||||
|
'nbposts' => '<th scope="col" class="nowrap">' . __('Entries') . '</th>',
|
||||||
|
'enddt' => '<th scope="col" class="nowrap">' . __('End date') . '</th>'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->userColumns('periodical', $cols);
|
||||||
|
|
||||||
|
$html_block .= '<tr>' . implode(iterator_to_array($cols)) . '</tr>%s</table>%s</div>';
|
||||||
if ($enclose_block) {
|
if ($enclose_block) {
|
||||||
$html_block = sprintf($enclose_block, $html_block);
|
$html_block = sprintf($enclose_block, $html_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
$echo .= $pager->getLinks();
|
|
||||||
|
|
||||||
$blocks = explode('%s', $html_block);
|
$blocks = explode('%s', $html_block);
|
||||||
|
|
||||||
$echo .= $blocks[0];
|
echo $pager->getLinks() . $blocks[0];
|
||||||
|
|
||||||
while ($this->rs->fetch()) {
|
while ($this->rs->fetch()) {
|
||||||
$echo .= $this->periodLine();
|
echo $this->periodLine(isset($periods[$this->rs->periodical_id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$echo .= $blocks[1];
|
echo $blocks[1] . $blocks[2] . $pager->getLinks();
|
||||||
|
}
|
||||||
$echo .= $pager->getLinks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $echo;
|
private function periodLine($checked)
|
||||||
}
|
|
||||||
|
|
||||||
private function periodLine()
|
|
||||||
{
|
{
|
||||||
$nb_posts = $this->rs->periodical->getPosts(['periodical_id' => $this->rs->periodical_id], true);
|
$nb_posts = $this->rs->periodical->getPosts(['periodical_id' => $this->rs->periodical_id], true)->f(0);
|
||||||
$nb_posts = $nb_posts->f(0);
|
$url = $this->core->adminurl->get('admin.plugin.periodical', ['part' => 'period', 'period_id' => $this->rs->periodical_id]);
|
||||||
$style = !$nb_posts ? ' offline' : '';
|
|
||||||
$posts_links = !$nb_posts ?
|
|
||||||
'0' :
|
|
||||||
'<a href="plugin.php?p=periodical&part=period&period_id=' . $this->rs->periodical_id . '#posts" title="' . __('view related entries') . '">' . $nb_posts . '</a>';
|
|
||||||
|
|
||||||
$pub_int = in_array($this->rs->periodical_pub_int, $this->rs->periodical->getTimesCombo()) ?
|
$name = '<a href="' . $url . '#period" title="' . __('edit period') . '">' . html::escapeHTML($this->rs->periodical_title) . '</a>';
|
||||||
|
|
||||||
|
$posts = $nb_posts ?
|
||||||
|
'<a href="' . $url . '#posts" title="' . __('view related entries') . '">' . $nb_posts . '</a>' :
|
||||||
|
'0';
|
||||||
|
|
||||||
|
$interval = in_array($this->rs->periodical_pub_int, $this->rs->periodical->getTimesCombo()) ?
|
||||||
__(array_search($this->rs->periodical_pub_int, $this->rs->periodical->getTimesCombo())) : __('Unknow frequence');
|
__(array_search($this->rs->periodical_pub_int, $this->rs->periodical->getTimesCombo())) : __('Unknow frequence');
|
||||||
|
|
||||||
$res =
|
$cols = new ArrayObject([
|
||||||
'<tr class="line' . $style . '">' .
|
'check' => '<td class="nowrap">' . form::checkbox(['periods[]'], $this->rs->periodical_id, ['checked' => $checked]) . '</td>',
|
||||||
'<td class="nowrap">' . form::checkbox(['periods[]'], $this->rs->periodical_id) . '</td>' .
|
'name' => '<td class="maximal">' . $name . '</td>',
|
||||||
'<td class="maximal"><a href="plugin.php?p=periodical&part=period&period_id=' . $this->rs->periodical_id . '#period" title="' .
|
'curdt' => '<td class="nowrap count">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->periodical_curdt) . '</td>',
|
||||||
__('edit period') . '">' . html::escapeHTML($this->rs->periodical_title) . '</a></td>' .
|
'pub_int' => '<td class="nowrap">' . $interval . '</td>',
|
||||||
'<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->periodical_curdt) . '</td>' .
|
'pub_nb' => '<td class="nowrap count">' . $this->rs->periodical_pub_nb . '</td>',
|
||||||
'<td class="nowrap">' . $pub_int . '</td>' .
|
'nbposts' => '<td class="nowrap count">' . $posts. '</td>',
|
||||||
'<td class="nowrap">' . $this->rs->periodical_pub_nb .'</td>' .
|
'enddt' => '<td class="nowrap count">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->periodical_enddt) . '</td>'
|
||||||
'<td class="nowrap">' . $posts_links . '</td>' .
|
]);
|
||||||
'<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->periodical_enddt) . '</td>' .
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
return $res;
|
$this->userColumns('periodical', $cols);
|
||||||
|
|
||||||
|
return
|
||||||
|
'<tr class="line ' . ($nb_posts ? '' : ' offline') . '" id="p' . $this->rs->periodical_id . '">' .
|
||||||
|
implode(iterator_to_array($cols)) .
|
||||||
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postDisplay($page, $nb_per_page, $base_url, $enclose_block='')
|
public function postDisplay($filter, $base_url, $enclose_block='')
|
||||||
{
|
{
|
||||||
$echo = '';
|
$echo = '';
|
||||||
if ($this->rs->isEmpty()) {
|
if ($this->rs->isEmpty()) {
|
||||||
$echo .= '<p><strong>' . __('No entry') . '</strong></p>';
|
if ($filter->show()) {
|
||||||
|
echo '<p><strong>' . __('No entry matches the filter') . '</strong></p>';
|
||||||
} else {
|
} else {
|
||||||
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
echo '<p><strong>' . __('No entry') . '</strong></p>';
|
||||||
$pager->html_prev = $this->html_prev;
|
}
|
||||||
$pager->html_next = $this->html_next;
|
} else {
|
||||||
|
$pager = new dcPager($filter->page, $this->rs_count, $filter->nb, 10);
|
||||||
$pager->base_url = $base_url;
|
$pager->base_url = $base_url;
|
||||||
$pager->var_page = 'page';
|
$pager->var_page = 'page';
|
||||||
|
|
||||||
|
$periodical_entries = [];
|
||||||
|
if (isset($_REQUEST['periodical_entries'])) {
|
||||||
|
foreach ($_REQUEST['periodical_entries'] as $v) {
|
||||||
|
$periodical_entries[(integer) $v] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$html_block =
|
$html_block =
|
||||||
'<table class="clear"><tr>' .
|
'<table class="clear"><tr>' .
|
||||||
'<th colspan="2">' . __('Title') . '</th>' .
|
'<th colspan="2">' . __('Title') . '</th>' .
|
||||||
|
@ -128,7 +148,7 @@ class adminPeriodicalList extends adminGenericList
|
||||||
$echo .= $blocks[0];
|
$echo .= $blocks[0];
|
||||||
|
|
||||||
while ($this->rs->fetch()) {
|
while ($this->rs->fetch()) {
|
||||||
$echo .= $this->postLine();
|
$echo .= $this->postLine(isset($periodical_entries[$this->rs->post_id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$echo .= $blocks[1];
|
$echo .= $blocks[1];
|
||||||
|
@ -139,7 +159,7 @@ class adminPeriodicalList extends adminGenericList
|
||||||
return $echo;
|
return $echo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function postLine()
|
private function postLine($checked)
|
||||||
{
|
{
|
||||||
if ($this->core->auth->check('categories', $this->core->blog->id)) {
|
if ($this->core->auth->check('categories', $this->core->blog->id)) {
|
||||||
$cat_link = '<a href="category.php?id=%s">%s</a>';
|
$cat_link = '<a href="category.php?id=%s">%s</a>';
|
||||||
|
|
105
index.php
105
index.php
|
@ -18,12 +18,10 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
dcPage::check('usage,contentadmin');
|
dcPage::check('usage,contentadmin');
|
||||||
|
|
||||||
# Objects
|
# Objects
|
||||||
$s = $core->blog->settings->periodical;
|
|
||||||
$per = new periodical($core);
|
$per = new periodical($core);
|
||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
$action = isset($_POST['action']) ? $_POST['action'] : '';
|
$action = isset($_POST['action']) ? $_POST['action'] : '';
|
||||||
$part = isset($_REQUEST['part']) && $_REQUEST['part'] == 'period' ? 'period' : 'periods';
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
#
|
#
|
||||||
|
@ -31,7 +29,7 @@ $part = isset($_REQUEST['part']) && $_REQUEST['part'] == 'period' ? 'period' : '
|
||||||
#
|
#
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
if ($part == 'period') {
|
if ($_REQUEST['part'] == 'period') {
|
||||||
|
|
||||||
$starting_script = '';
|
$starting_script = '';
|
||||||
|
|
||||||
|
@ -58,14 +56,11 @@ if ($part == 'period') {
|
||||||
$period_pub_int = $rs->periodical_pub_int;
|
$period_pub_int = $rs->periodical_pub_int;
|
||||||
$period_curdt = date('Y-m-d H:i', strtotime($rs->periodical_curdt));
|
$period_curdt = date('Y-m-d H:i', strtotime($rs->periodical_curdt));
|
||||||
$period_enddt = date('Y-m-d H:i', strtotime($rs->periodical_enddt));
|
$period_enddt = date('Y-m-d H:i', strtotime($rs->periodical_enddt));
|
||||||
|
|
||||||
//todo load related posts
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set period
|
# Set period
|
||||||
if ($action == 'setperiod') {
|
if ($action == 'setperiod') {
|
||||||
|
|
||||||
# Get POST values
|
# Get POST values
|
||||||
if (!empty($_POST['period_title'])) {
|
if (!empty($_POST['period_title'])) {
|
||||||
$period_title = $_POST['period_title'];
|
$period_title = $_POST['period_title'];
|
||||||
|
@ -74,7 +69,8 @@ if ($part == 'period') {
|
||||||
$period_pub_nb = abs((integer) $_POST['period_pub_nb']);
|
$period_pub_nb = abs((integer) $_POST['period_pub_nb']);
|
||||||
}
|
}
|
||||||
if (!empty($_POST['period_pub_int'])
|
if (!empty($_POST['period_pub_int'])
|
||||||
&& in_array($_POST['period_pub_int'], $per->getTimesCombo())) {
|
&& in_array($_POST['period_pub_int'], $per->getTimesCombo())
|
||||||
|
) {
|
||||||
$period_pub_int = $_POST['period_pub_int'];
|
$period_pub_int = $_POST['period_pub_int'];
|
||||||
}
|
}
|
||||||
if (!empty($_POST['period_curdt'])) {
|
if (!empty($_POST['period_curdt'])) {
|
||||||
|
@ -104,7 +100,6 @@ if ($part == 'period') {
|
||||||
|
|
||||||
# If no error, set period
|
# If no error, set period
|
||||||
if (!$core->error->flag()) {
|
if (!$core->error->flag()) {
|
||||||
|
|
||||||
$cur = $per->openCursor();
|
$cur = $per->openCursor();
|
||||||
$cur->periodical_title = $period_title;
|
$cur->periodical_title = $period_title;
|
||||||
$cur->periodical_curdt = $period_curdt;
|
$cur->periodical_curdt = $period_curdt;
|
||||||
|
@ -114,7 +109,6 @@ if ($part == 'period') {
|
||||||
|
|
||||||
# Update period
|
# Update period
|
||||||
if ($period_id) {
|
if ($period_id) {
|
||||||
|
|
||||||
$per->updPeriod($period_id, $cur);
|
$per->updPeriod($period_id, $cur);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
|
@ -122,7 +116,6 @@ if ($part == 'period') {
|
||||||
);
|
);
|
||||||
# Create period
|
# Create period
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$period_id = $per->addPeriod($cur);
|
$period_id = $per->addPeriod($cur);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
|
@ -130,16 +123,16 @@ if ($part == 'period') {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
http::redirect(empty($_POST['redir']) ?
|
if (!empty($_POST['redir'])) {
|
||||||
$p_url . '&part=period&period_id=' . $period_id . '#period' :
|
http::redirect($_POST['redir']);
|
||||||
$_POST['redir']
|
} else {
|
||||||
);
|
$core->adminurl->redirect('admin.plugin.periodical', ['part' => 'period', 'period_id' => $period_id], '#period');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Actions on related posts
|
# Actions on related posts
|
||||||
if (!$core->error->flag() && $period_id && $action && !empty($_POST['periodical_entries'])) {
|
if (!$core->error->flag() && $period_id && $action && !empty($_POST['periodical_entries'])) {
|
||||||
|
|
||||||
# Publish posts
|
# Publish posts
|
||||||
if ($action == 'publish') {
|
if ($action == 'publish') {
|
||||||
try {
|
try {
|
||||||
|
@ -153,10 +146,11 @@ if ($part == 'period') {
|
||||||
__('Entries successfully published.')
|
__('Entries successfully published.')
|
||||||
);
|
);
|
||||||
|
|
||||||
http::redirect(empty($_POST['redir']) ?
|
if (!empty($_POST['redir'])) {
|
||||||
$p_url . '&part=period&period_id=' . $period_id . '#posts' :
|
http::redirect($_POST['redir']);
|
||||||
$_POST['redir']
|
} else {
|
||||||
);
|
$core->adminurl->redirect('admin.plugin.periodical', ['part' => 'period', 'period_id' => $period_id], '#posts');
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -175,10 +169,11 @@ if ($part == 'period') {
|
||||||
__('Entries successfully unpublished.')
|
__('Entries successfully unpublished.')
|
||||||
);
|
);
|
||||||
|
|
||||||
http::redirect(empty($_POST['redir']) ?
|
if (!empty($_POST['redir'])) {
|
||||||
$p_url . '&part=period&period_id=' . $period_id . '#posts' :
|
http::redirect($_POST['redir']);
|
||||||
$_POST['redir']
|
} else {
|
||||||
);
|
$core->adminurl->redirect('admin.plugin.periodical', ['part' => 'period', 'period_id' => $period_id], '#posts');
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -196,10 +191,11 @@ if ($part == 'period') {
|
||||||
__('Entries successfully removed.')
|
__('Entries successfully removed.')
|
||||||
);
|
);
|
||||||
|
|
||||||
http::redirect(empty($_POST['redir']) ?
|
if (!empty($_POST['redir'])) {
|
||||||
$p_url . '&part=period&period_id=' . $period_id . '#posts' :
|
http::redirect($_POST['redir']);
|
||||||
$_POST['redir']
|
} else {
|
||||||
);
|
$core->adminurl->redirect('admin.plugin.periodical', ['part' => 'period', 'period_id' => $period_id], '#posts');
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -213,6 +209,7 @@ if ($part == 'period') {
|
||||||
$post_filter->add('part', 'period');
|
$post_filter->add('part', 'period');
|
||||||
|
|
||||||
$params = $post_filter->params();
|
$params = $post_filter->params();
|
||||||
|
$params['periodical_id'] = $period_id;
|
||||||
$params['no_content'] = true;
|
$params['no_content'] = true;
|
||||||
|
|
||||||
# Get posts
|
# Get posts
|
||||||
|
@ -249,9 +246,7 @@ if ($part == 'period') {
|
||||||
|
|
||||||
# Period form
|
# Period form
|
||||||
echo '
|
echo '
|
||||||
<div class="multi-part" title="' .
|
<div id="period"><h3>' . (null === $period_id ? __('New period') : __('Edit period')) . '</h3>
|
||||||
(null === $period_id ? __('New period') : __('Edit period')) .
|
|
||||||
'" id="period">
|
|
||||||
<form method="post" action="' . $p_url . '">
|
<form method="post" action="' . $p_url . '">
|
||||||
|
|
||||||
<p><label for="period_title">' . __('Title:') . '</label>' .
|
<p><label for="period_title">' . __('Title:') . '</label>' .
|
||||||
|
@ -311,22 +306,18 @@ if ($part == 'period') {
|
||||||
'#posts';
|
'#posts';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="multi-part" title="' .
|
<div id="posts"><h3>' . __('Entries linked to this period') . '</h3>';
|
||||||
__('Entries linked to this period') .
|
|
||||||
'" id="posts">';
|
|
||||||
|
|
||||||
# Filters
|
# Filters
|
||||||
$post_filter->display(['admin.plugin.periodical', '#posts'],
|
$post_filter->display(['admin.plugin.periodical', '#posts'],
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
$core->adminurl->getHiddenFormFields('admin.plugin.periodical', [
|
||||||
'p' => 'periodical',
|
'period_id' => $period_id,
|
||||||
'part' => 'period',
|
'part' => 'period'
|
||||||
'period_id' => $period_id
|
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
# Posts list
|
# Posts list
|
||||||
echo
|
echo $post_list->postDisplay($post_filter, $base_url,
|
||||||
$post_list->postDisplay($post_filter->page, $post_filter->nb, $base_url,
|
|
||||||
'<form action="' . $p_url . '" method="post" id="form-entries">' .
|
'<form action="' . $p_url . '" method="post" id="form-entries">' .
|
||||||
|
|
||||||
'%s' .
|
'%s' .
|
||||||
|
@ -337,10 +328,10 @@ if ($part == 'period') {
|
||||||
'<p class="col right">' . __('Selected entries action:') . ' ' .
|
'<p class="col right">' . __('Selected entries action:') . ' ' .
|
||||||
form::combo('action', $combo_action) .
|
form::combo('action', $combo_action) .
|
||||||
'<input type="submit" value="' . __('ok') . '" /></p>' .
|
'<input type="submit" value="' . __('ok') . '" /></p>' .
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.periodical', $post_filter->values()) .
|
$core->adminurl->getHiddenFormFields('admin.plugin.periodical', array_merge($post_filter->values(), [
|
||||||
form::hidden(['period_id'], $period_id) .
|
'period_id' => $period_id,
|
||||||
form::hidden(['p'], 'periodical') .
|
'redir' => sprintf($base_url, $post_filter->page)
|
||||||
form::hidden(['redir'], sprintf($base_url, $post_filter->page)) .
|
])) .
|
||||||
$core->formNonce() .
|
$core->formNonce() .
|
||||||
'</div>' .
|
'</div>' .
|
||||||
'</form>'
|
'</form>'
|
||||||
|
@ -371,10 +362,11 @@ if ($part == 'period') {
|
||||||
__('Periods removed.')
|
__('Periods removed.')
|
||||||
);
|
);
|
||||||
|
|
||||||
http::redirect(empty($_POST['redir']) ?
|
if (!empty($_POST['redir'])) {
|
||||||
$p_url.'&part=periods' :
|
http::redirect($_POST['redir']);
|
||||||
$_POST['redir']
|
} else {
|
||||||
);
|
$core->adminurl->redirect('admin.plugin.periodical', ['part' => 'periods']);
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -391,10 +383,11 @@ if ($part == 'period') {
|
||||||
__('Periods emptied.')
|
__('Periods emptied.')
|
||||||
);
|
);
|
||||||
|
|
||||||
http::redirect(empty($_POST['redir']) ?
|
if (!empty($_POST['redir'])) {
|
||||||
$p_url.'&part=periods' :
|
http::redirect($_POST['redir']);
|
||||||
$_POST['redir']
|
} else {
|
||||||
);
|
$core->adminurl->redirect('admin.plugin.periodical', ['part' => 'periods']);
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -428,12 +421,10 @@ if ($part == 'period') {
|
||||||
'</head>' .
|
'</head>' .
|
||||||
'<body>' .
|
'<body>' .
|
||||||
|
|
||||||
dcPage::breadcrumb(
|
dcPage::breadcrumb([
|
||||||
[
|
|
||||||
html::escapeHTML($core->blog->name) => '',
|
html::escapeHTML($core->blog->name) => '',
|
||||||
__('Periodical') => ''
|
__('Periodical') => ''
|
||||||
]
|
]) .
|
||||||
) .
|
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<p class="top-add">
|
'<p class="top-add">
|
||||||
|
@ -443,8 +434,8 @@ if ($part == 'period') {
|
||||||
# Filters
|
# Filters
|
||||||
$p_filter->display('admin.plugin.periodical', form::hidden('p', 'periodical') . form::hidden('part', 'periods'));
|
$p_filter->display('admin.plugin.periodical', form::hidden('p', 'periodical') . form::hidden('part', 'periods'));
|
||||||
|
|
||||||
# Posts list
|
# Periods list
|
||||||
echo $period_list->periodDisplay($p_filter->page, $p_filter->nb,
|
$period_list->periodDisplay($p_filter,
|
||||||
'<form action="' . $p_url . '" method="post" id="form-periods">' .
|
'<form action="' . $p_url . '" method="post" id="form-periods">' .
|
||||||
|
|
||||||
'%s' .
|
'%s' .
|
||||||
|
|
Loading…
Reference in a new issue