public function indexAction()
 {
     $type = $this->dispatcher->getParam('type', 'string');
     $typeModel = Type::getCachedBySlug($type);
     if (!$typeModel) {
         throw new Exception("Publication hasn't type = '{$type}''");
     }
     $typeLimit = $typeModel->getLimit() ? $typeModel->getLimit() : 10;
     $limit = $this->request->getQuery('limit', 'string', $typeLimit);
     if ($limit != 'all') {
         $paginatorLimit = (int) $limit;
     } else {
         $paginatorLimit = 9999;
     }
     $page = $this->request->getQuery('page', 'int', 1);
     $publications = Publication::find(array("type_id = {$typeModel->getId()}", "order" => "date DESC"));
     $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $publications, "limit" => $paginatorLimit, "page" => $page));
     $this->view->paginate = $paginator->getPaginate();
     $this->helper->title()->append($typeModel->getHead_title());
     if ($page > 1) {
         $this->helper->title()->append($this->helper->translate('Страница №') . ' ' . $page);
     }
     $this->view->title = $typeModel->getTitle();
     $this->view->format = $typeModel->getFormat();
     $this->view->type = $type;
     $this->helper->menu->setActive($type);
 }
 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);
 }
 public function indexAction()
 {
     $type = $this->dispatcher->getParam('type', 'string');
     if (!$type || !in_array($type, array_keys(Publication::$types))) {
         throw new Exception("Publication hasn't type = '{$type}''");
     }
     $limit = $this->request->getQuery('limit', 'string', 10);
     if ($limit != 'all') {
         $paginatorLimit = (int) $limit;
     } else {
         $paginatorLimit = 9999;
     }
     $page = $this->request->getQuery('page', 'int', 1);
     $publications = Publication::find(array("type = '{$type}'", "order" => "date DESC"));
     $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $publications, "limit" => $paginatorLimit, "page" => $page));
     $this->view->paginate = $paginator->getPaginate();
     $title = Publication::$types[$type];
     $this->helper->title()->append($title);
     $this->view->title = $title;
     //$this->view->limit = $limit;
     $this->view->type = $type;
 }
 public function indexAction()
 {
     $this->view->entries = Publication::find(array("order" => "type ASC, date DESC, id DESC"));
     $this->view->title = 'Список публикаций';
     $this->helper->title('Список публикаций');
 }