rs->isEmpty()) { echo '

' . __('No page') . '

'; } 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; } } $html_block = '
' . ''; $cols = [ 'title' => '', 'date' => '', 'author' => '', 'comments' => '', 'trackbacks' => '', 'status' => '' ]; $cols = new ArrayObject($cols); $this->core->callBehavior('adminPagesListHeader', $this->core, $this->rs, $cols); // Cope with optional columns $this->userColumns('pages', $cols); $html_block .= '' . implode(iterator_to_array($cols)) . '%s
' . __('Title') . '' . __('Date') . '' . __('Author') . '' . __('Status') . '
'; if ($enclose_block) { $html_block = sprintf($enclose_block, $html_block); } echo $pager->getLinks(); $blocks = explode('%s', $html_block); echo $blocks[0]; $count = 0; while ($this->rs->fetch()) { echo $this->postLine($count, isset($entries[$this->rs->post_id])); $count++; } echo $blocks[1]; echo $pager->getLinks(); } } private function postLine($count, $checked) { $img = '%1$s'; $sts_class = ''; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img, __('Published'), 'check-on.png', 'published'); $sts_class = 'sts-online'; break; case 0: $img_status = sprintf($img, __('Unpublished'), 'check-off.png', 'unpublished'); $sts_class = 'sts-offline'; break; case -1: $img_status = sprintf($img, __('Scheduled'), 'scheduled.png', 'scheduled'); $sts_class = 'sts-scheduled'; break; case -2: $img_status = sprintf($img, __('Pending'), 'check-wrn.png', 'pending'); $sts_class = 'sts-pending'; break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img, __('Protected'), 'locker.png', 'locked'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img, __('Hidden'), 'hidden.png', 'hidden'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png', 'attach'); } $res = ''; $cols = [ 'position' => '' . form::number(['order[' . $this->rs->post_id . ']'], [ 'min' => 1, 'default' => $count + 1, 'class' => 'position', 'extra_html' => 'title="' . sprintf(__('position of %s'), html::escapeHTML($this->rs->post_title)) . '"' ]) . '', 'check' => '' . form::checkbox(['entries[]'], $this->rs->post_id, [ 'checked' => $checked, 'disabled' => !$this->rs->isEditable(), 'extra_html' => 'title="' . __('Select this page') . '"' ] ) . '', 'title' => '' . html::escapeHTML($this->rs->post_title) . '', 'date' => '' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '', 'author' => '' . $this->rs->user_id . '', 'comments' => '' . $this->rs->nb_comment . '', 'trackbacks' => '' . $this->rs->nb_trackback . '', 'status' => '' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '' ]; $cols = new ArrayObject($cols); $this->core->callBehavior('adminPagesListValue', $this->core, $this->rs, $cols); // Cope with optional columns $this->userColumns('pages', $cols); $res .= implode(iterator_to_array($cols)); $res .= ''; return $res; } }