rs->isEmpty()) {
if ($filter) {
echo '
' . __('No feeds matches the filter') . '
';
} else {
echo '' . __('No feeds') . '
';
}
} else {
$this->zc = new zoneclearFeedServer();
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
$entries = [];
if (isset($_REQUEST['feeds'])) {
foreach ($_REQUEST['feeds'] as $v) {
$entries[(int) $v] = true;
}
}
$html_block = '' .
'
' .
'' . (
$filter ?
sprintf(__('List of %s feeds matching the filter.'), $this->rs_count) :
sprintf(__('List of feeds (%s)'), $this->rs_count)
) . '';
$cols = [
'title' => '' . __('Name') . ' | ',
'desc' => '' . __('Feed') . ' | ',
'period' => '' . __('Frequency') . ' | ',
'update' => '' . __('Last update') . ' | ',
'entries' => '' . __('Entries') . ' | ',
'status' => '' . __('Status') . ' | ',
];
$cols = new ArrayObject($cols);
dcCore::app()->callBehavior('adminZcfsFeedsListHeader', $this->rs, $cols);
$this->userColumns('zcfs_feeds', $cols);
$html_block .= '' . implode(iterator_to_array($cols)) . '
%s
%s
';
if ($enclose_block) {
$html_block = sprintf($enclose_block, $html_block);
}
echo $pager->getLinks();
$blocks = explode('%s', $html_block);
echo $blocks[0];
while ($this->rs->fetch()) {
echo $this->feedsLine(isset($entries[$this->rs->feed_id]));
}
echo $blocks[1];
echo $blocks[2];
echo $pager->getLinks();
}
}
private function feedsLine($checked)
{
$combo_status = zoneclearFeedServer::getAllStatus();
$combo_upd_int = zoneclearFeedServer::getAllUpdateInterval();
$status = $this->rs->feed_status ?
'' :
'';
$entries_count = $this->zc->getPostsByFeed(['feed_id' => $this->rs->feed_id], true)->f(0);
$shunk_feed = $this->rs->feed_feed;
if (strlen($shunk_feed) > 83) {
$shunk_feed = substr($shunk_feed, 0, 50) . '...' . substr($shunk_feed, -20);
}
$url = dcCore::app()->adminurl->get('admin.plugin.' . basename(dirname('../' . __DIR__)), ['part' => 'feed', 'feed_id' => $this->rs->feed_id]);
$cols = [
'check' => '' .
form::checkbox(['feeds[]'], $this->rs->feed_id, ['checked' => $checked]) .
' | ',
'title' => '' .
'' . html::escapeHTML($this->rs->feed_name) . '' .
' | ',
'desc' => '' .
'' . html::escapeHTML($shunk_feed) . '' .
' | ',
'period' => '' .
array_search($this->rs->feed_upd_int, $combo_upd_int) .
' | ',
'update' => '' .
(
$this->rs->feed_upd_last < 1 ?
__('never') :
dt::str(__('%Y-%m-%d %H:%M'), (int) $this->rs->feed_upd_last, dcCore::app()->auth->getInfo('user_tz'))
) . ' | ',
'entries' => '' .
(
$entries_count ?
'' . $entries_count . '' :
$entries_count
) . ' | ',
'status' => '' . $status . ' | ',
];
$cols = new ArrayObject($cols);
dcCore::app()->callBehavior('adminZcfsFeedsListValue', $this->rs, $cols);
$this->userColumns('zcfs_feeds', $cols);
return
'' .
implode(iterator_to_array($cols)) .
'
';
}
}