public function init() { $this->_modelList = new Modules_Publications_Model_List(); $this->_modelFields = new Modules_Publications_Model_Fields(); $this->_model = new Modules_Publications_Model_Table($this->_name); /* Устанавливаем рубрику к которой привязаны публикации */ $this->_routeId = Zend_Registry::get('RouteCurrentId'); if ($this->getParam('route_id')) { $this->_routeId = $this->getParam('route_id'); } if ($this->getParam('skip_route')) { $this->_routeId = null; } $this->view->route_id = $this->_routeId; $this->_model->setRouteId($this->_routeId); /* Находим текущий тип публикаций */ $this->_currentPublicationType = $this->_modelList->getRubricInfo($this->_name); if ($this->_currentPublicationType) { $this->view->pub_rubric_id = $this->_currentPublicationType->rubric_id; } else { throw new Exception('Тип публикации "' . $this->_name . '" не найден'); } }
/** * Просмотр добавленных публикаций * * @param int $_REQUEST['rubric_id'] ID рубрики в которую добавлены материалы */ public function viewAction() { if (!$this->_rubric) { throw new Exception('rubric_id не определён'); } $this->_modelPublications->setRouteId($this->getParam('route_id')); $this->view->publications = $this->_modelPublications->fetchAll($this->_modelPublications->select()->order('sort')); $this->view->route_id = $this->getParam('route_id'); $this->view->route = Modules_Router_Model_Router::getInstance()->getItem($this->getParam('route_id')); try { // пробуем подключить пользовательский шаблон $this->renderScript('admin/view_' . $this->_rubric->rubric_id . '.ajax.phtml'); } catch (Exception $e) { } }