public static function getRequest() { if (!isset(self::$request)) { self::$request = new shnRequest(); } return self::$request; }
public function __construct() { $this->request = shnRequest::getRequest(); }
/** * render_pages will render page links in html * * @access public * @return void */ public function render_pages($id = null) { $request = shnRequest::getRequest(); $args = $_GET; unset($args['mod']); unset($args['act']); if ($this->argumentEncoder instanceof ArgumentEncoder) { $args = $this->argumentEncoder->encode($args); } ?> <div class="row" style="margin-left:0px;"> <?php if ($this->show_all) { ?> <div class="pages pagination <?php echo $id; ?> " style="margin:0px;padding-top: 0px;width:auto"> <ul> <li><a href="<?php $args['request_page'] = 1; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo _t('PAGINATE_RESULTS'); ?> </a></li> </ul> </div> <?php } else { ?> <div class="pages pagination span <?php echo $id; ?> " style="margin:0px;padding-top: 0px;width:auto"> <ul> <?php if ($this->request_page != 1) { ?> <li><a href="<?php $args['request_page'] = $this->request_page - 1; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo _t('BACK'); ?> </a></li> <?php } ?> <?php //paging logic $start = $this->request_page - 5; $end = $this->request_page + 5; if ($this->request_page < 6) { $end = 5 - $this->request_page + $end; $start = 1; } if ($this->last_page < $end) { $start = $start - ($end - $this->last_page); $end = $this->last_page; } if ($start < 1) { $start = 1; } ?> <?php if ($start > 1) { ?> <li><a href="<?php $args['request_page'] = $start - 1; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo '<<'; ?> </a></li> <?php } ?> <?php for ($i = $start; $i <= $end; $i++) { ?> <?php if ($i == $this->request_page) { ?> <li class="active"><a href="#"><?php echo $i; ?> </a></li> <?php continue; } ?> <li><a href="<?php $args['request_page'] = $i; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo $i; ?> </a> <?php } ?> <?php if ($end < $this->last_page) { ?> <li> <a href="<?php $args['request_page'] = $end + 1; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo '>>'; ?> </a></li> <?php } ?> <?php if ($this->request_page != $this->last_page) { ?> <li><a href="<?php $args['request_page'] = $this->request_page + 1; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo _t('NEXT'); ?> </a></li> <?php } ?> <li><a href="<?php $args['request_page'] = 'all'; get_url($request->module, $request->action, $request->tpl, $args); ?> " ><?php echo _t('SHOW_ALL'); ?> </a></li> </ul> </div> <div class="input-prepend input-append span" style="width:auto"> <span class="add-on"><?php echo _t('RECORDS_PER_PAGE'); ?> </span> <input style="width:22px;" type='text' id="rpp" name="rpp" size='3' value="<?php echo $this->rpp; ?> " onchange="/*$('#rpp_set').attr('href',$('#rpp_set').attr('href')+ '&rpp=' + $(this).val());*/"/> <span class="add-on"><a id="rpp_set" href="<?php $args['request_page'] = 1; get_url($request->module, $request->action, $request->tpl, $args); $args2 = $args; unset($args2['rpp']); ?> " onclick="$(this).attr('href', '<?php get_url($request->module, $request->action, $request->tpl, $args2); ?> '+ '&rpp=' + $('#rpp').val())" ><?php echo _t('SET'); ?> </a> </span> </div> <div class="span well well-small" style="padding: 4px;width:auto"> <?php echo _t('PAGE__') . " " . $this->request_page . ' / ' . $this->last_page; ?> </div> <?php } ?> </div> <?php }