core = &$core; $this->rs = &$rs; $this->rs_count = $rs_count; $this->html_prev = __('« prev.'); $this->html_next = __('next »'); } public function userColumns($type, $cols) { $cols_user = @$this->core->auth->user_prefs->interface->cols; if (is_array($cols_user) || $cols_user instanceof ArrayObject) { if (isset($cols_user[$type])) { foreach ($cols_user[$type] as $cn => $cd) { if (!$cd && isset($cols[$cn])) { unset($cols[$cn]); } } } } } public function display($page, $nb_per_page, $enclose_block = '', $filter = false, $redir = '') { $this->redir = $redir; if ($this->rs->isEmpty()) { if ($filter) { echo '

' . __('No link matches the filter') . '

'; } else { echo '

' . __('No link') . '

'; } } else { $pager = new dcPager($page, $this->rs_count, $nb_per_page, 10); $links = []; if (isset($_REQUEST['links'])) { foreach ($_REQUEST['links'] as $v) { $links[(int) $v] = true; } } $cols = [ 'title' => '' . __('Title') . '', 'author' => '' . __('Author') . '', 'desc' => '' . __('Description') . '', 'link' => '' . __('Links') . '', 'cat' => '' . __('Category') . '', 'note' => '' . __('Rating') . '', 'date' => '' . __('Date') . '' ]; $cols = new ArrayObject($cols); $this->userColumns('c2link', $cols); $html_block = '
' . '' . '' . '' . '' . implode(iterator_to_array($cols)) . '' . '' . '%s' . '
' . ( $filter ? sprintf(__('List of %s links matching the filter.'), $this->rs_count) : sprintf(__('List of links (%s)'), $this->rs_count) ) . '
' . '%s
'; 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->linkLine(isset($links[$this->rs->link_id])); } echo $blocks[1] . $blocks[2] . $pager->getLinks(); } } private function linkLine($checked) { $cols = [ 'check' => '' . form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) . '', 'title' => '' . '' . html::escapeHTML($this->rs->link_title) . '' . '', 'author' => '' . html::escapeHTML($this->rs->link_author) . '', 'desc' => '' . html::escapeHTML($this->rs->link_desc) . '', 'link' => '' . '' . __('URL') . ' ' . '' . __('image') . ' ' . '', 'cat' => '' . '' . html::escapeHTML($this->rs->cat_title) . '' . '', 'note' => '' . '' . html::escapeHTML($this->rs->link_note) . '/20' . '', 'date' => '' . dt::dt2str( $this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format, $this->rs->link_upddt, $this->core->auth->getInfo('user_tz') ) . '' ]; $cols = new ArrayObject($cols); $this->userColumns('c2link', $cols); return '' . implode(iterator_to_array($cols)) . '' . "\n"; } }