serviceManager = $serviceManager; return $this; } public function add($data,$ctl,$limit = 10,$route = "",$viewPartial = "layout/manager/pagination") { $page = $ctl->params()->fromRoute('page'); if(is_array($data)) $data = new ArrayAdapter($data); if($data instanceof Select) { $dbService = $this->serviceManager->get('Db'); $zendDb = $dbService->getZendDb(); $data = new DbSelect($data,$zendDb); } if($data instanceof TableGateway) $data = new DbTableGateway($data,$this->sqlQuery,$this->sqlOrder,$this->sqlGroup,$this->sqlHaving); $paginator = new Zend_Paginator($data); $paginator->setCurrentPageNumber($page) ->setItemCountPerPage($limit) ->setPageRange(6); $pagination = $ctl->getServiceLocator()->get('viewhelpermanager')->get('PaginationControl'); $pageSliding = $pagination($paginator,'Sliding',$viewPartial,array('route'=>$route)); $ctl->ViewModel->setVariable('pagination',$pageSliding); $ctl->ViewModel->setVariable('paginator',$paginator); } }