2021-10-24 21:38:49 +00:00
|
|
|
<?php
|
2021-10-31 22:22:34 +00:00
|
|
|
/**
|
|
|
|
* @brief enhancePostContent, a plugin for Dotclear 2
|
2021-11-01 09:33:43 +00:00
|
|
|
*
|
2021-10-31 22:22:34 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-01 09:33:43 +00:00
|
|
|
*
|
2021-10-31 22:22:34 +00:00
|
|
|
* @author Jean-Christian Denis and Contributors
|
2021-11-01 09:33:43 +00:00
|
|
|
*
|
2021-10-31 22:22:34 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-10-24 21:38:49 +00:00
|
|
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup DC_PLUGIN_PERIODICAL
|
|
|
|
* @brief Periodical - admin pager methods.
|
|
|
|
* @since 2.6
|
|
|
|
*/
|
|
|
|
class adminEpcList extends adminGenericList
|
|
|
|
{
|
2021-11-01 09:33:43 +00:00
|
|
|
public function display($filter, $pager_url, $enclose_block = '')
|
2021-10-24 21:38:49 +00:00
|
|
|
{
|
|
|
|
if ($this->rs->isEmpty()) {
|
|
|
|
if ($filter->show()) {
|
|
|
|
echo '<p><strong>' . __('No record matches the filter') . '</strong></p>';
|
|
|
|
} else {
|
|
|
|
echo '<p><strong>' . __('No record') . '</strong></p>';
|
|
|
|
}
|
|
|
|
} else {
|
2021-11-01 09:33:43 +00:00
|
|
|
$pager = new dcPager($filter->page, $this->rs_count, $filter->nb, 10);
|
2021-10-24 21:38:49 +00:00
|
|
|
$pager->base_url = $pager_url;
|
|
|
|
|
|
|
|
$epc_id = [];
|
|
|
|
if (isset($_REQUEST['epc_id'])) {
|
|
|
|
foreach ($_REQUEST['epc_id'] as $v) {
|
|
|
|
$epc_id[(integer) $v] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$cols = [
|
|
|
|
'key' => '<th colspan="2" class="first">' . __('Key') . '</th>',
|
|
|
|
'value' => '<th scope="col">' . __('Value') . '</th>',
|
|
|
|
'date' => '<th scope="col">' . __('Date') . '</th>'
|
|
|
|
];
|
|
|
|
|
2021-11-01 09:33:43 +00:00
|
|
|
$html_block = '<div class="table-outer"><table><caption>' .
|
|
|
|
(
|
|
|
|
$filter->show() ?
|
2021-10-24 21:38:49 +00:00
|
|
|
sprintf(__('List of %s records matching the filter.'), $this->rs_count) :
|
|
|
|
sprintf(__('List of %s records.'), $this->rs_count)
|
2021-11-01 09:33:43 +00:00
|
|
|
) . '</caption>' .
|
2021-10-24 21:38:49 +00:00
|
|
|
'<tr>' . implode($cols) . '</tr>%s</table>%s</div>';
|
|
|
|
|
|
|
|
if ($enclose_block) {
|
|
|
|
$html_block = sprintf($enclose_block, $html_block);
|
|
|
|
}
|
|
|
|
$blocks = explode('%s', $html_block);
|
|
|
|
|
|
|
|
echo $pager->getLinks() . $blocks[0];
|
|
|
|
|
|
|
|
while ($this->rs->fetch()) {
|
|
|
|
echo $this->line(isset($epc_id[$this->rs->epc_id]));
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $blocks[1] . $blocks[2] . $pager->getLinks();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function line($checked)
|
|
|
|
{
|
|
|
|
$cols = [
|
2021-11-01 09:33:43 +00:00
|
|
|
'check' => '<td class="nowrap">' . form::checkbox(['epc_id[]'], $this->rs->epc_id, ['checked' => $checked]) . '</td>',
|
2021-10-24 21:38:49 +00:00
|
|
|
'key' => '<td class="nowrap">' . html::escapeHTML($this->rs->epc_key) . '</td>',
|
|
|
|
'value' => '<td class="maximal">' . html::escapeHTML($this->rs->epc_value) . '</td>',
|
|
|
|
'date' => '<td class="nowrap count">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->epc_upddt) . '</td>'
|
|
|
|
];
|
|
|
|
|
2021-11-01 09:33:43 +00:00
|
|
|
return
|
2021-10-24 21:38:49 +00:00
|
|
|
'<tr class="line" id="p' . $this->rs->epc_id . '">' .
|
2021-11-01 09:33:43 +00:00
|
|
|
implode($cols) .
|
2021-10-24 21:38:49 +00:00
|
|
|
'</tr>';
|
|
|
|
}
|
2021-11-01 09:33:43 +00:00
|
|
|
}
|