core = &$core;
$this->rs = &$rs;
$this->rs_count = $rs_count;
$this->html_prev = __('« prev.');
$this->html_next = __('next »');
}
public function display($page, $nb_per_page, $enclose_block, $filter = false)
{
if ($this->rs->isEmpty()) {
if ($filter) {
echo '
' . __('No short link matches the filter') . '
';
} else {
echo '' . __('No short link') . '
';
}
} else {
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
$entries = [];
if (isset($_REQUEST['entries'])) {
foreach ($_REQUEST['entries'] as $v) {
$entries[(integer) $v] = true;
}
}
$blocks = explode('%s', sprintf($enclose_block,
'' .
($filter ?
'' . sprintf(__('List of %s links matching the filter.'), $this->rs_count) . '' :
'' . sprintf(__('List of links (%s)'), $this->rs_count) . ''
) .
'' .
'' . __('Hash') . ' | ' .
'' . __('Link') . ' | ' .
'' . __('Date') . ' | ' .
'' . __('Service') . ' | ' .
'
%s
%s
'
));
echo $pager->getLinks().$blocks[0];
while ($this->rs->fetch()) {
$type = $this->rs->kut_type;
$hash = $this->rs->kut_hash;
if (null !== ($o = kutrl::quickService($type))) {
$type = '' . $o->name . '';
$hash = '' . $hash . '';
}
echo
'' .
'' .
form::checkbox(['entries[]'], $this->rs->kut_id, ['checked' => isset($entries[$this->rs->kut_id])]) .
' | ' .
'' .
$hash .
' | ' .
'' .
'' . $this->rs->kut_url . '' .
' | ' .
'' .
dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->kut_dt, $this->core->auth->getInfo('user_tz')) .
' | ' .
'' .
$type .
' | ' .
'
';
}
echo $blocks[1].$blocks[2].$pager->getLinks();
}
}
}