postWidgetText/inc/lib.pwt.list.php

100 lines
3.0 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
*/
class postWidgetTextList extends adminGenericList
{
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 =
'<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>'.
'</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 == '') {
$w_title = '<em>'.context::global_filter(
$this->rs->option_content, 1, 1, 80, 0, 0
).'</em>';
}
2021-09-10 19:06:49 +00:00
2021-09-10 19:18:51 +00:00
$content .=
'<tr class="line'.($this->rs->post_status != 1 ?
' offline' : ''
).'" id="p'.$this->rs->post_id.'">'.
'<td class="nowrap">'.
form::checkbox(
array('widgets[]'),
$this->rs->option_id,
'', '', '',
!$this->rs->isEditable()
).'</td>'.
'<td class="maximal"><a href="'.
$this->core->getPostAdminURL(
$this->rs->post_type,
$this->rs->post_id
).'#post-wtext-form">'.
html::escapeHTML($this->rs->post_title).
'</a></td>'.
'<td class="nowrap">'.dt::dt2str(
__('%Y-%m-%d %H:%M'),
$this->rs->post_dt
).'</td>'.
'<td class="nowrap">'.$w_title.'</td>'.
'<td class="nowrap">'.dt::dt2str(
__('%Y-%m-%d %H:%M'),
$this->rs->option_upddt
).'</td>'.
'<td class="nowrap">'.$this->rs->user_id.'</td>'.
'<td class="nowrap">'.$this->rs->post_type.'</td>'.
'</tr>';
}
$content .=
'</tbody></table></div>';
2021-10-29 22:36:04 +00:00
echo
2021-09-10 19:18:51 +00:00
$pager->getLinks().
sprintf($enclose, $content).
$pager->getLinks();
}
}