public function indexAction() { $form = new BuscaForm('Pesquise por nome do evento ou local'); if ($this->getRequest()->isPost()) { $search = $this->getRequest()->getPost(); $form->setData($search); if ($form->isValid()) { $values = $form->getData(); } } $collection = new ArrayCollection($this->getService('Admin\\Service\\Agenda')->fetchAll($values)); $paginator = new Paginator(new Adapter($collection)); $paginator->setCurrentPageNumber($this->params()->fromQuery('page', 1))->setItemCountPerPage(10); return new ViewModel(array('agenda' => $paginator, 'form' => $form)); }
public function indexAction() { $form = new BuscaForm('Ṕesquise pelo título, descrição, ou texto'); if ($this->getRequest()->isPost()) { $search = $this->getRequest()->getPost(); $form->setData($search); if ($form->isValid()) { $values = $form->getData(); } } $collection = new ArrayCollection($this->getService('Admin\\Service\\Informativo')->fetchAll($values)); $paginator = new Paginator(new Adapter($collection)); $paginator->setCurrentPageNumber($this->params()->fromQuery('page', 1))->setItemCountPerPage(10); return new ViewModel(array('informativos' => $paginator, 'form' => $form)); }