Changeset 3707:3a350757c847 for plugins/pages/class.listpage.php
- Timestamp:
- 02/17/18 18:03:29 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/pages/class.listpage.php
r3265 r3707 15 15 class adminPagesList extends adminGenericList 16 16 { 17 public function display($page,$nb_per_page,$enclose_block='') 18 { 19 if ($this->rs->isEmpty()) 20 { 21 echo '<p><strong>'.__('No page').'</strong></p>'; 22 } 23 else 24 { 25 $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); 26 $entries = array(); 27 if (isset($_REQUEST['entries'])) { 28 foreach ($_REQUEST['entries'] as $v) { 29 $entries[(integer)$v]=true; 30 } 31 } 32 $html_block = 33 '<div class="table-outer">'. 34 '<table class="maximal dragable"><thead><tr>'; 17 public function display($page, $nb_per_page, $enclose_block = '') 18 { 19 if ($this->rs->isEmpty()) { 20 echo '<p><strong>' . __('No page') . '</strong></p>'; 21 } else { 22 $pager = new dcPager($page, $this->rs_count, $nb_per_page, 10); 23 $entries = array(); 24 if (isset($_REQUEST['entries'])) { 25 foreach ($_REQUEST['entries'] as $v) { 26 $entries[(integer) $v] = true; 27 } 28 } 29 $html_block = 30 '<div class="table-outer">' . 31 '<table class="maximal dragable"><thead><tr>'; 35 32 36 37 'title' => '<th colspan="3" scope="col" class="first">'.__('Title').'</th>',38 'date' => '<th scope="col">'.__('Date').'</th>',39 'author' => '<th scope="col">'.__('Author').'</th>',40 'comments' => '<th scope="col"><img src="images/comments.png" alt="" title="'.__('Comments').41 '" /><span class="hidden">'.__('Comments').'</span></th>',42 'trackbacks' => '<th scope="col"><img src="images/trackbacks.png" alt="" title="'.__('Trackbacks').43 '" /><span class="hidden">'.__('Trackbacks').'</span></th>',44 'status' => '<th scope="col">'.__('Status').'</th>'45 33 $cols = array( 34 'title' => '<th colspan="3" scope="col" class="first">' . __('Title') . '</th>', 35 'date' => '<th scope="col">' . __('Date') . '</th>', 36 'author' => '<th scope="col">' . __('Author') . '</th>', 37 'comments' => '<th scope="col"><img src="images/comments.png" alt="" title="' . __('Comments') . 38 '" /><span class="hidden">' . __('Comments') . '</span></th>', 39 'trackbacks' => '<th scope="col"><img src="images/trackbacks.png" alt="" title="' . __('Trackbacks') . 40 '" /><span class="hidden">' . __('Trackbacks') . '</span></th>', 41 'status' => '<th scope="col">' . __('Status') . '</th>' 42 ); 46 43 47 48 $this->core->callBehavior('adminPagesListHeader',$this->core,$this->rs,$cols);44 $cols = new ArrayObject($cols); 45 $this->core->callBehavior('adminPagesListHeader', $this->core, $this->rs, $cols); 49 46 50 51 $this->userColumns('pages',$cols);47 // Cope with optional columns 48 $this->userColumns('pages', $cols); 52 49 53 $html_block .= '<tr>'.implode(iterator_to_array($cols)).54 50 $html_block .= '<tr>' . implode(iterator_to_array($cols)) . 51 '</tr></thead><tbody id="pageslist">%s</tbody></table></div>'; 55 52 56 57 $html_block = sprintf($enclose_block,$html_block);58 53 if ($enclose_block) { 54 $html_block = sprintf($enclose_block, $html_block); 55 } 59 56 60 57 echo $pager->getLinks(); 61 58 62 $blocks = explode('%s',$html_block);59 $blocks = explode('%s', $html_block); 63 60 64 61 echo $blocks[0]; 65 62 66 $count = 0; 67 while ($this->rs->fetch()) 68 { 69 echo $this->postLine($count,isset($entries[$this->rs->post_id])); 70 $count ++; 71 } 63 $count = 0; 64 while ($this->rs->fetch()) { 65 echo $this->postLine($count, isset($entries[$this->rs->post_id])); 66 $count++; 67 } 72 68 73 69 echo $blocks[1]; 74 70 75 76 77 71 echo $pager->getLinks(); 72 } 73 } 78 74 79 private function postLine($count,$checked)80 81 $img= '<img alt="%1$s" title="%1$s" src="images/%2$s" />';82 83 84 85 $img_status = sprintf($img,__('Published'),'check-on.png');86 $sts_class= 'sts-online';87 88 89 $img_status = sprintf($img,__('Unpublished'),'check-off.png');90 $sts_class= 'sts-offline';91 92 93 $img_status = sprintf($img,__('Scheduled'),'scheduled.png');94 $sts_class= 'sts-scheduled';95 96 97 $img_status = sprintf($img,__('Pending'),'check-wrn.png');98 $sts_class= 'sts-pending';99 100 75 private function postLine($count, $checked) 76 { 77 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 78 $sts_class = ''; 79 switch ($this->rs->post_status) { 80 case 1: 81 $img_status = sprintf($img, __('Published'), 'check-on.png'); 82 $sts_class = 'sts-online'; 83 break; 84 case 0: 85 $img_status = sprintf($img, __('Unpublished'), 'check-off.png'); 86 $sts_class = 'sts-offline'; 87 break; 88 case -1: 89 $img_status = sprintf($img, __('Scheduled'), 'scheduled.png'); 90 $sts_class = 'sts-scheduled'; 91 break; 92 case -2: 93 $img_status = sprintf($img, __('Pending'), 'check-wrn.png'); 94 $sts_class = 'sts-pending'; 95 break; 96 } 101 97 102 103 104 $protected = sprintf($img,__('Protected'),'locker.png');105 98 $protected = ''; 99 if ($this->rs->post_password) { 100 $protected = sprintf($img, __('Protected'), 'locker.png'); 101 } 106 102 107 108 109 $selected = sprintf($img,__('Hidden'),'hidden.png');110 103 $selected = ''; 104 if ($this->rs->post_selected) { 105 $selected = sprintf($img, __('Hidden'), 'hidden.png'); 106 } 111 107 112 $attach= '';113 114 115 116 $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png');117 108 $attach = ''; 109 $nb_media = $this->rs->countMedia(); 110 if ($nb_media > 0) { 111 $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); 112 $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png'); 113 } 118 114 119 $res = '<tr class="line '.($this->rs->post_status != 1 ? 'offline ' : '').$sts_class.'"'.120 ' id="p'.$this->rs->post_id.'">';115 $res = '<tr class="line ' . ($this->rs->post_status != 1 ? 'offline ' : '') . $sts_class . '"' . 116 ' id="p' . $this->rs->post_id . '">'; 121 117 122 $cols = array( 123 'position' => '<td class="nowrap handle minimal">'. 124 form::field(array('order['.$this->rs->post_id.']'),2,3,$count+1,'position','',false,'title="'.sprintf(__('position of %s'),html::escapeHTML($this->rs->post_title)).'"').'</td>', 125 'check' => '<td class="nowrap">'. 126 form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable(),'title="'.__('Select this page').'"').'</td>', 127 'title' => '<td class="maximal" scope="row"><a href="'. 128 $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. 129 html::escapeHTML($this->rs->post_title).'</a></td>', 130 'date' => '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>', 131 'author' => '<td class="nowrap">'.$this->rs->user_id.'</td>', 132 'comments' => '<td class="nowrap count">'.$this->rs->nb_comment.'</td>', 133 'trackbacks' => '<td class="nowrap count">'.$this->rs->nb_trackback.'</td>', 134 'status' => '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>' 135 ); 118 $cols = array( 119 'position' => '<td class="nowrap handle minimal">' . 120 form::field(array('order[' . $this->rs->post_id . ']'), 2, 3, $count + 1, 'position', '', false, 'title="' . sprintf(__('position of %s'), html::escapeHTML($this->rs->post_title)) . '"') . '</td>', 121 'check' => '<td class="nowrap">' . 122 form::checkbox(array('entries[]'), $this->rs->post_id, 123 array( 124 'checked' => $checked, 125 'disabled' => !$this->rs->isEditable(), 126 'extra_html' => 'title="' . __('Select this page') . '"' 127 ) 128 ) . '</td>', 129 'title' => '<td class="maximal" scope="row"><a href="' . 130 $this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '">' . 131 html::escapeHTML($this->rs->post_title) . '</a></td>', 132 'date' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>', 133 'author' => '<td class="nowrap">' . $this->rs->user_id . '</td>', 134 'comments' => '<td class="nowrap count">' . $this->rs->nb_comment . '</td>', 135 'trackbacks' => '<td class="nowrap count">' . $this->rs->nb_trackback . '</td>', 136 'status' => '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>' 137 ); 136 138 137 138 $this->core->callBehavior('adminPagesListValue',$this->core,$this->rs,$cols);139 $cols = new ArrayObject($cols); 140 $this->core->callBehavior('adminPagesListValue', $this->core, $this->rs, $cols); 139 141 140 141 $this->userColumns('pages',$cols);142 // Cope with optional columns 143 $this->userColumns('pages', $cols); 142 144 143 144 145 $res .= implode(iterator_to_array($cols)); 146 $res .= '</tr>'; 145 147 146 147 148 return $res; 149 } 148 150 }
Note: See TracChangeset
for help on using the changeset viewer.