Exemple #1
0
 public function __construct($model_name, $options = array())
 {
     $options['id'] = $model_name;
     parent::__construct($options);
     $this->_modelList = new Modules_Publications_Model_List();
     $this->_modelFields = new Modules_Publications_Model_Fields();
     $this->_rubric = $this->_modelList->getRubricInfo($model_name);
     $this->_addElements();
     if (Zend_Registry::isRegistered('current_route')) {
         $this->setAction(Zend_Registry::get('view')->url(array('route_id' => Zend_Registry::get('current_route')->route_id)));
     }
 }
 /**
  * Выводим список маршрутов к которому подключён раздел
  *
  */
 public function routesAction()
 {
     if ($rubric_id = $this->getParam('rubric_id')) {
         $rubricInfo = $this->_modelList->getRubricInfo($rubric_id);
         $this->view->routes = Modules_Router_Model_Router::getInstance()->fetchAll($sql = Modules_Router_Model_Router::getInstance()->select()->setIntegrityCheck(false)->from(array('r' => Modules_Router_Model_Router::getInstance()->info('name')))->join(array('p' => $this->_modelPublications->info('name')), 'p.route_id = r.route_id', array())->group('r.route_id'));
         $this->view->rubric_id = $rubric_id;
         $this->view->publications = $this->_modelPublications->getWithoutRubrics($this->getParam('page', 1));
         $this->view->paginator = $this->view->publications;
     }
 }
 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 . '" не найден');
     }
 }
Exemple #4
0
 /**
  * Получаем информацию о полях в определённой таблице
  *
  * @param string $tableName
  * @return Zend_Db_Rowset
  */
 public function fetchAllByTableName($tableName)
 {
     $modelList = new Modules_Publications_Model_List();
     return $this->fetchAll($this->select()->setIntegrityCheck(false)->from(array('f' => $this->info('name')), '*')->join(array('r' => $modelList->info('name')), 'f.rubric_id = r.rubric_id', array())->where('r.table_name = ?', $tableName));
 }