コード例 #1
0
ファイル: Abstract.php プロジェクト: knatorski/SMS
 public function paginator($namespace = null, $moreActions = array())
 {
     $this->getFilterData($namespace);
     if (!$this->paginator) {
         $db = $this->dbModelTable;
         $expr = new Zend_Db_Expr('(' . $this->getSql() . ')');
         $select = $db->select()->from($expr)->setIntegrityCheck(false);
         if (isset($this->sort) && isset($this->order)) {
             $select->order($this->sort . ' ' . $this->order);
         }
         $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
         if ($this->getCountSql()) {
             $adapter->setRowCount($db->select()->from(new Zend_Db_Expr('(' . $this->getCountSql() . ')'), array(Zend_Paginator_Adapter_DbSelect::ROW_COUNT_COLUMN => 'zend_paginator_row_count'))->setIntegrityCheck(false));
         }
         $paginator = new Base_Paginator($adapter, $moreActions);
         $paginator->setCurrentPageNumber(isset($this->page) ? $this->page : 1);
         if ($this->page_size) {
             $paginator->setItemCountPerPage($this->page_size);
         }
         $this->paginator = $paginator;
     }
     return $this->paginator;
 }