Changeset 873:f9ef04edef05 for inc/admin/lib.pager.php
- Timestamp:
- 08/14/12 15:43:05 (13 years ago)
- Branch:
- sexy
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.pager.php
r852 r873 15 15 { 16 16 protected $core; 17 protected $ rs;18 protected $ rs_count;19 20 public function __construct($core,$ rs,$rs_count)17 protected $items; 18 protected $item_count; 19 20 public function __construct($core,$items,$item_count) 21 21 { 22 22 $this->core =& $core; 23 $this-> rs =& $rs;24 $this-> rs_count = $rs_count;23 $this->items =& $items; 24 $this->item_count = $item_count; 25 25 $this->html_prev = __('«prev.'); 26 26 $this->html_next = __('next»'); … … 32 32 public function display($page,$nb_per_page,$enclose_block='') 33 33 { 34 if ( $this->rs->isEmpty())34 if (count($this->items) == 0) 35 35 { 36 36 echo '<p><strong>'.__('No entry').'</strong></p>'; … … 38 38 else 39 39 { 40 $pager = new pager($page,$this-> rs_count,$nb_per_page,10);40 $pager = new pager($page,$this->item_count,$nb_per_page,10); 41 41 $pager->html_prev = $this->html_prev; 42 42 $pager->html_next = $this->html_next; … … 61 61 echo $blocks[0]; 62 62 63 while ($this->rs->fetch())63 foreach ($this->items as $item) 64 64 { 65 echo $this->postLine( );65 echo $this->postLine($item); 66 66 } 67 67 … … 72 72 } 73 73 74 private function postLine( )74 private function postLine($item) 75 75 { 76 76 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 77 switch ($ this->rs->post_status) {77 switch ($item->post_status) { 78 78 case 1: 79 79 $img_status = sprintf($img,__('published'),'check-on.png'); … … 91 91 92 92 $protected = ''; 93 if ($ this->rs->post_password) {93 if ($item->post_password) { 94 94 $protected = sprintf($img,__('protected'),'locker.png'); 95 95 } 96 96 97 97 $selected = ''; 98 if ($ this->rs->post_selected) {98 if ($item->post_selected) { 99 99 $selected = sprintf($img,__('selected'),'selected.png'); 100 100 } 101 101 102 102 103 $res = '<tr class="line'.($ this->rs->post_status != 1 ? ' offline' : '').'"'.104 ' id="p'.$ this->rs->post_id.'">';103 $res = '<tr class="line'.($item->post_status != 1 ? ' offline' : '').'"'. 104 ' id="p'.$item->post_id.'">'; 105 105 106 106 $res .= 107 107 '<td class="nowrap">'. 108 form::checkbox(array('entries[]'),$ this->rs->post_id,'','','',!$this->rs->isEditable()).'</td>'.109 '<td class="maximal"><a href="'.$this->core->getPostAdminURL($ this->rs->post_type,$this->rs->post_id).'">'.110 html::escapeHTML($ this->rs->post_title).'</a></td>'.111 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$ this->rs->post_dt).'</td>'.112 '<td class="nowrap">'.$ this->rs->user_id.'</td>'.108 form::checkbox(array('entries[]'),$item->post_id,'','','',!$item->isEditable()).'</td>'. 109 '<td class="maximal"><a href="'.$this->core->getPostAdminURL($item->post_type,$item->post_id).'">'. 110 html::escapeHTML($item->post_title).'</a></td>'. 111 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$item->post_dt).'</td>'. 112 '<td class="nowrap">'.$item->user_id.'</td>'. 113 113 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.'</td>'. 114 114 '</tr>'; … … 122 122 public function display($page,$nb_per_page,$enclose_block='') 123 123 { 124 if ( $this->rs->isEmpty())124 if (count($this->items) == 0) 125 125 { 126 126 echo '<p><strong>'.__('No entry').'</strong></p>'; … … 128 128 else 129 129 { 130 $pager = new pager($page,$this-> rs_count,$nb_per_page,10);130 $pager = new pager($page,$this->item_count,$nb_per_page,10); 131 131 $pager->html_prev = $this->html_prev; 132 132 $pager->html_next = $this->html_next; … … 151 151 echo $blocks[0]; 152 152 153 while ($this->rs->fetch())153 foreach ($this->items as $item) 154 154 { 155 echo $this->postLine( );155 echo $this->postLine($item); 156 156 } 157 157 … … 162 162 } 163 163 164 private function postLine( )164 private function postLine($item) 165 165 { 166 166 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 167 switch ($ this->rs->post_status) {167 switch ($item->post_status) { 168 168 case 1: 169 169 $img_status = sprintf($img,__('published'),'check-on.png'); … … 181 181 182 182 $protected = ''; 183 if ($ this->rs->post_password) {183 if ($item->post_password) { 184 184 $protected = sprintf($img,__('protected'),'locker.png'); 185 185 } 186 186 187 187 $selected = ''; 188 if ($ this->rs->post_selected) {188 if ($item->post_selected) { 189 189 $selected = sprintf($img,__('selected'),'selected.png'); 190 190 } 191 191 192 192 193 $res = '<tr class="line'.($ this->rs->post_status != 1 ? ' offline' : '').'"'.194 ' id="p'.$ this->rs->post_id.'">';193 $res = '<tr class="line'.($item->post_status != 1 ? ' offline' : '').'"'. 194 ' id="p'.$item->post_id.'">'; 195 195 196 196 $res .= 197 '<td class="maximal"><a href="'.$this->core->getPostAdminURL($ this->rs->post_type,$this->rs->post_id).'" '.198 'title="'.html::escapeHTML($ this->rs->getURL()).'">'.199 html::escapeHTML($ this->rs->post_title).'</a></td>'.200 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$ this->rs->post_dt).'</td>'.201 '<td class="nowrap">'.$ this->rs->user_id.'</td>'.197 '<td class="maximal"><a href="'.$this->core->getPostAdminURL($item->post_type,$item->post_id).'" '. 198 'title="'.html::escapeHTML($item->getURL()).'">'. 199 html::escapeHTML($item->post_title).'</a></td>'. 200 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$item->post_dt).'</td>'. 201 '<td class="nowrap">'.$item->user_id.'</td>'. 202 202 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.'</td>'. 203 203 '</tr>'; … … 211 211 public function display($page,$nb_per_page,$enclose_block='') 212 212 { 213 if ( $this->rs->isEmpty())213 if (count($this->items) == 0) 214 214 { 215 215 echo '<p><strong>'.__('No user').'</strong></p>'; … … 217 217 else 218 218 { 219 $pager = new pager($page,$this-> rs_count,$nb_per_page,10);219 $pager = new pager($page,$this->item_count,$nb_per_page,10); 220 220 $pager->html_prev = $this->html_prev; 221 221 $pager->html_next = $this->html_next; … … 241 241 echo $blocks[0]; 242 242 243 while ($this->rs->fetch())243 foreach ($this->items as $item) 244 244 { 245 echo $this->userLine( );245 echo $this->userLine($item); 246 246 } 247 247 … … 252 252 } 253 253 254 private function userLine( )254 private function userLine($item) 255 255 { 256 256 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 257 257 $img_status = ''; 258 258 259 $p = $this->core->getUserPermissions($ this->rs->user_id);259 $p = $this->core->getUserPermissions($item->user_id); 260 260 261 261 if (isset($p[$this->core->blog->id]['p']['admin'])) { 262 262 $img_status = sprintf($img,__('admin'),'admin.png'); 263 263 } 264 if ($ this->rs->user_super) {264 if ($item->user_super) { 265 265 $img_status = sprintf($img,__('superadmin'),'superadmin.png'); 266 266 } 267 267 return 268 268 '<tr class="line">'. 269 '<td class="nowrap">'.form::hidden(array('nb_post[]'),(integer) $ this->rs->nb_post).270 form::checkbox(array('user_id[]'),$ this->rs->user_id).'</td>'.271 '<td class="maximal"><a href="user.php?id='.$ this->rs->user_id.'">'.272 $ this->rs->user_id.'</a> '.$img_status.'</td>'.273 '<td class="nowrap">'.$ this->rs->user_firstname.'</td>'.274 '<td class="nowrap">'.$ this->rs->user_name.'</td>'.275 '<td class="nowrap">'.$ this->rs->user_displayname.'</td>'.276 '<td class="nowrap"><a href="posts.php?user_id='.$ this->rs->user_id.'">'.277 $ this->rs->nb_post.'</a></td>'.269 '<td class="nowrap">'.form::hidden(array('nb_post[]'),(integer) $item->nb_post). 270 form::checkbox(array('user_id[]'),$item->user_id).'</td>'. 271 '<td class="maximal"><a href="user.php?id='.$item->user_id.'">'. 272 $item->user_id.'</a> '.$img_status.'</td>'. 273 '<td class="nowrap">'.$item->user_firstname.'</td>'. 274 '<td class="nowrap">'.$item->user_name.'</td>'. 275 '<td class="nowrap">'.$item->user_displayname.'</td>'. 276 '<td class="nowrap"><a href="posts.php?user_id='.$item->user_id.'">'. 277 $item->nb_post.'</a></td>'. 278 278 '</tr>'; 279 279 }
Note: See TracChangeset
for help on using the changeset viewer.