Changeset 1909:e73d8d511f5c for inc
- Timestamp:
- 09/16/13 14:50:24 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.pager.php
r1670 r1909 12 12 if (!defined('DC_RC_PATH')) { return; } 13 13 14 class dcPager extends pager 15 { 16 17 protected function getLink($li_class,$href,$img_src,$img_alt,$enable_link) { 18 if ($enable_link) { 19 $formatter = '<li class="%s"><a href="%s"><img src="%s" alt="%s"/>'. 20 '<span class="hidden">%s</span></a></li>'; 21 return sprintf ($formatter, 22 $li_class,$href,$img_src,$img_alt,$img_alt); 23 } else { 24 $formatter = '<li class="%s"><img src="%s" alt="%s"/>'. 25 '<span class="hidden">%s</span></li>'; 26 return sprintf ($formatter, 27 $li_class,$img_src,$img_alt,$img_alt); 28 } 29 } 30 31 /** 32 * Pager Links 33 * 34 * Returns pager links 35 * 36 * @return string 37 */ 38 public function getLinks() 39 { 40 $this->setURL(); 41 $htmlFirst = $this->getLink( 42 "first", 43 sprintf($this->page_url,1), 44 "style/page/pagination_1_first.png", 45 __('First page'), 46 ($this->env > 1) 47 ); 48 $htmlPrev = $this->getLink( 49 "prev", 50 sprintf($this->page_url,$this->env-1), 51 "style/page/pagination_1_previous.png", 52 __('Previous page'), 53 ($this->env > 1) 54 ); 55 $htmlNext = $this->getLink( 56 "next", 57 sprintf($this->page_url,$this->env+1), 58 "style/page/pagination_1_next.png", 59 __('Next page'), 60 ($this->env < $this->nb_pages) 61 ); 62 $htmlLast = $this->getLink( 63 "last", 64 sprintf($this->page_url,$this->nb_pages), 65 "style/page/pagination_1_last.png", 66 __('Last page'), 67 ($this->env < $this->nb_pages) 68 ); 69 $htmlCurrent = 70 '<li class="active"><strong>'. 71 sprintf(__('Page %s / %s'),$this->env,$this->nb_pages). 72 '</strong></li>'; 73 74 $htmlDirect = 75 sprintf('<p>'.__('Direct access page %s'), 76 form::field(array('page'),3,10)). 77 '<input type="submit" value="'.__('Ok').'" '. 78 'name="ok" /></p>'; 79 80 $res = 81 '<form action="'.$this->page_url.'" method="get">'. 82 '<div class="pagination"><ul>'. 83 $htmlFirst. 84 $htmlPrev. 85 $htmlCurrent. 86 $htmlNext. 87 $htmlLast. 88 '</ul>'. 89 $htmlDirect. 90 '</div>'. 91 '</form>' 92 ; 93 94 return $this->nb_elements > 0 ? $res : ''; 95 } 96 } 97 14 98 class adminGenericList 15 99 { … … 23 107 $this->rs =& $rs; 24 108 $this->rs_count = $rs_count; 25 $this->html_prev = __('« prev.');26 $this->html_next = __('next »');27 109 } 28 110 } … … 38 120 else 39 121 { 40 $pager = new pager($page,$this->rs_count,$nb_per_page,10); 41 $pager->html_prev = $this->html_prev; 42 $pager->html_next = $this->html_next; 43 $pager->var_page = 'page'; 122 $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); 44 123 $entries = array(); 45 124 if (isset($_REQUEST['entries'])) { … … 63 142 } 64 143 65 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';144 echo $pager->getLinks(); 66 145 67 146 $blocks = explode('%s',$html_block); … … 76 155 echo $blocks[1]; 77 156 78 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';157 echo $pager->getLinks(); 79 158 } 80 159 } … … 159 238 { 160 239 $pager = new pager($page,$this->rs_count,$nb_per_page,10); 161 $pager->html_prev = $this->html_prev;162 $pager->html_next = $this->html_next;163 $pager->var_page = 'page';164 240 165 241 $html_block = … … 175 251 } 176 252 177 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';253 echo $pager->getLinks(); 178 254 179 255 $blocks = explode('%s',$html_block); … … 188 264 echo $blocks[1]; 189 265 190 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';266 echo $pager->getLinks(); 191 267 } 192 268 } … … 254 330 { 255 331 $pager = new pager($page,$this->rs_count,$nb_per_page,10); 256 $pager->html_prev = $this->html_prev;257 $pager->html_next = $this->html_next;258 $pager->var_page = 'page';259 332 260 333 $html_block = … … 271 344 } 272 345 273 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';346 echo $pager->getLinks(); 274 347 275 348 $blocks = explode('%s',$html_block); … … 284 357 echo $blocks[1]; 285 358 286 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';359 echo $pager->getLinks(); 287 360 } 288 361 } … … 382 455 } 383 456 384 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';457 echo $pager->getLinks(); 385 458 386 459 $blocks = explode('%s',$html_block); … … 395 468 echo $blocks[1]; 396 469 397 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';470 echo $pager->getLinks(); 398 471 } 399 472 }
Note: See TracChangeset
for help on using the changeset viewer.