Ejemplo n.º 1
0
 function get_results()
 {
     $qs = $this->get_query_set();
     $pagerParams = '';
     $pagerParamsArr = array();
     foreach ($this->params as $key => $value) {
         $pagerParamsArr[] = $key . '=' . $value;
     }
     $pagerParams = implode('&', $pagerParamsArr);
     //PagerLayoutWithArrows   Doctrine_Pager_Layout
     $pagerLayout = new PagerLayoutWithArrows(new \Doctrine_Pager($this->query_set, $this->page_num, $this->list_per_page), new \Doctrine_Pager_Range_Sliding(array('chunk' => $this->chunk_length)), '?p={%page_number}&' . $pagerParams);
     $pagerLayout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
     $pagerLayout->setSelectedTemplate('<li class="disabled"><a href="#">{%page}</a></li>');
     $pager = $pagerLayout->getPager();
     $rs = $pager->execute();
     //Doctrine_Query_Exception,Doctrine_Connection_Mysql_Exception
     $this->result_list = $rs;
     $this->full_result_count = $pager->getNumResults();
     $this->result_count = count($this->result_list);
     $this->can_show_all = $this->result_count <= MAX_SHOW_ALL_ALLOWED;
     $this->multi_page = $this->result_count > $this->list_per_page;
     $this->paginator = $pager;
     $this->paginator_display = '<ul>' . $pagerLayout->display(array(), true) . '</ul>';
 }
Ejemplo n.º 2
0
 protected function setDefaultPaggingLayout(PagerLayoutWithArrows $pagerLayout)
 {
     $pagerLayout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
     $pagerLayout->setSelectedTemplate('<li>{%page}</li>');
     $pagerLayout->setSeparatorTemplate('<span class="pager_separator">::</span>');
 }