Exemplo n.º 1
0
 public function indexAction()
 {
     $page = $this->request->getQuery('page', 'int', 1);
     $type = $this->dispatcher->getParam('type');
     $type_id = null;
     $types = Type::find();
     $cond_array = [];
     if ($type) {
         $typeEntity = Type::getCachedBySlug($type);
         $type_id = $typeEntity->getId();
         $cond_array[] = "type_id = {$type_id}";
     }
     $conditions = implode(' AND ', $cond_array);
     $publications = Publication::find(["conditions" => $conditions, "order" => "date DESC, id DESC"]);
     $paginator = new \Phalcon\Paginator\Adapter\Model(["data" => $publications, "limit" => 20, "page" => $page]);
     $this->view->paginate = $paginator->getPaginate();
     $this->view->types = $types;
     $this->view->type = $type;
     $this->view->type_id = $type_id;
     $this->helper->title($this->helper->at('Manage Publications'), true);
 }
Exemplo n.º 2
0
 public function indexAction()
 {
     $this->view->entries = Type::find();
     $this->helper->title('Manage Types of Publication', true);
 }