postWidgetText/inc/lib.pwt.list.php

100 lines
3 KiB
PHP
Raw Normal View History

2021-09-10 19:06:49 +00:00
<?php
2021-09-10 19:18:51 +00:00
/**
* @brief postWidgetText, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-09-10 19:06:49 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
2021-09-10 19:18:51 +00:00
return null;
2021-09-10 19:06:49 +00:00
}
/**
* @ingroup DC_PLUGIN_POSTWIDGETTEXT
* @brief postWidgetText - admin list methods.
* @since 2.6
*/
2021-10-30 13:48:56 +00:00
class listPostWidgetText extends adminGenericList
2021-09-10 19:06:49 +00:00
{
2021-10-29 22:36:04 +00:00
public function display($page, $nb_per_page, $enclose = '')
2021-09-10 19:18:51 +00:00
{
if ($this->rs->isEmpty()) {
2021-09-10 19:06:49 +00:00
2021-09-10 19:18:51 +00:00
return '<p><strong>'.__('No widget').'</strong></p>';
}
2021-09-10 19:06:49 +00:00
2021-10-29 22:36:04 +00:00
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
2021-09-10 19:18:51 +00:00
$pager->html_prev = $this->html_prev;
$pager->html_next = $this->html_next;
$pager->var_page = 'page';
2021-09-10 19:06:49 +00:00
2021-09-10 19:18:51 +00:00
$content =
2021-10-29 23:12:43 +00:00
'<div class="table-outer">' .
'<table class="clear">' .
'<thead>' .
'<tr>' .
'<th colspan="2" class="nowrap">' . __('Post title') . '</th>' .
'<th class="nowrap">' . __('Post date') . '</th>' .
'<th class="nowrap">' . __('Widget title') . '</th>' .
'<th class="nowrap">' . __('Widget date') . '</th>' .
'<th class="nowrap">' . __('Author') . '</th>' .
'<th class="nowrap">' . __('Type') . '</th>' .
2021-09-10 19:18:51 +00:00
'</tr></thead><tbody>';
2021-09-10 19:06:49 +00:00
2021-09-10 19:18:51 +00:00
while ($this->rs->fetch()) {
2021-09-10 19:06:49 +00:00
2021-09-10 19:18:51 +00:00
$w_title = html::escapeHTML($this->rs->option_title);
if ($w_title == '') {
2021-10-29 23:12:43 +00:00
$w_title = '<em>' . context::global_filter(
2021-09-10 19:18:51 +00:00
$this->rs->option_content, 1, 1, 80, 0, 0
2021-10-29 23:12:43 +00:00
) . '</em>';
2021-09-10 19:18:51 +00:00
}
2021-09-10 19:06:49 +00:00
2021-09-10 19:18:51 +00:00
$content .=
2021-10-29 23:12:43 +00:00
'<tr class="line' . ($this->rs->post_status != 1 ?
2021-09-10 19:18:51 +00:00
' offline' : ''
2021-10-29 23:12:43 +00:00
) . '" id="p' . $this->rs->post_id . '">' .
'<td class="nowrap">' .
2021-09-10 19:18:51 +00:00
form::checkbox(
array('widgets[]'),
$this->rs->option_id,
'', '', '',
!$this->rs->isEditable()
2021-10-29 23:12:43 +00:00
) . '</td>' .
'<td class="maximal"><a href="' .
2021-09-10 19:18:51 +00:00
$this->core->getPostAdminURL(
$this->rs->post_type,
$this->rs->post_id
2021-10-29 23:12:43 +00:00
) . '#post-wtext-form">' .
html::escapeHTML($this->rs->post_title) .
'</a></td>' .
'<td class="nowrap">' . dt::dt2str(
2021-09-10 19:18:51 +00:00
__('%Y-%m-%d %H:%M'),
$this->rs->post_dt
2021-10-29 23:12:43 +00:00
) . '</td>' .
'<td class="nowrap">' . $w_title . '</td>' .
'<td class="nowrap">' . dt::dt2str(
2021-09-10 19:18:51 +00:00
__('%Y-%m-%d %H:%M'),
$this->rs->option_upddt
2021-10-29 23:12:43 +00:00
) . '</td>' .
'<td class="nowrap">' . $this->rs->user_id . '</td>' .
'<td class="nowrap">' . $this->rs->post_type . '</td>' .
2021-09-10 19:18:51 +00:00
'</tr>';
}
$content .=
'</tbody></table></div>';
2021-10-29 22:36:04 +00:00
echo
2021-10-29 23:12:43 +00:00
$pager->getLinks() .
sprintf($enclose, $content) .
2021-09-10 19:18:51 +00:00
$pager->getLinks();
}
}