コード例 #1
0
 private function listAction()
 {
     $numberPage = 1;
     if (!$this->request->isPost()) {
         $numberPage = $this->request->getQuery('page', 'int');
     }
     $parameters = $this->persistent->parameters;
     if (!is_array($parameters)) {
         $parameters = array();
     }
     //        $count = Motorbikes::count($parameters);
     $itemsPerPage = $this->getDI()->get('config')->setting->itemsPerPage;
     //        $parameters['offset'] = $itemsPerPage * $numberPage;
     //        $parameters['limit'] = $itemsPerPage;
     $motorbike = Motorbikes::find($parameters);
     if (count($motorbike) == 0) {
         $this->flash->notice('The search did not find any motorbike');
         return $this->forward('motorbikes/index');
     }
     //        var_dump($motorbike);
     $paginator = new Paginator(array('data' => $motorbike, 'limit' => $itemsPerPage, 'page' => $numberPage));
     // Pick "motorbike/search" as view to render
     $this->view->pick("motorbikes/search");
     $this->view->page = $paginator->getPaginate();
     $this->view->sortForm = new MotorbikesSortForm();
 }
コード例 #2
0
 /**
  * Default action. Set the public layout (layouts/default.volt)
  */
 public function indexAction()
 {
     $motorbikes = Motorbikes::find(array('order' => 'created_at DESC', 'limit' => 2));
     $this->view->motorbikes = $motorbikes;
     $this->view->setTemplateBefore('default');
 }