Exemplo n.º 1
0
 /**
  * Конструктор модели
  * @param null|\Zend_Application_Bootstrap_Bootstrap $bootstrap
  */
 public function __construct(Zend_Application_Bootstrap_Bootstrap $bootstrap = null)
 {
     if ($bootstrap instanceof Zend_Application_Bootstrap_Bootstrap) {
         $this->_boot = $bootstrap;
     } else {
         $this->_boot = Zend_Controller_Front::getInstance()->getParam('bootstrap');
     }
     $this->_cnf = $this->_boot->getOptions();
     $this->_request = $this->_boot->getResource('Request');
     $this->_params = $this->_request->getParams();
     $this->_usersession = $this->_boot->getResource('UserSession');
     $this->_db = $this->_boot->getResource('Db');
     $this->_translate = $this->_boot->getResource('Translate');
     if (isset($this->_params['module'])) {
         $this->setModule($this->_params['module']);
     }
     if (method_exists($this, 'init')) {
         $this->init();
     }
 }
Exemplo n.º 2
0
 /**
  * Инициализация контроллера
  * 
  * @return void
  */
 public function init()
 {
     /**
      * Вытаскиваем ресурсы из реестра загрузки
      */
     $this->_boot = $this->getInvokeArg('bootstrap');
     $this->_cnf = $this->_boot->getOptions();
     $this->_params = $this->_request->getParams();
     $this->_usersession = $this->_boot->getResource('UserSession');
     $this->_translate = $this->_boot->getResource('Translate');
     /**
      * Переопределяем информацию об MVC-ресурсе в случае перенаправлений (форвардов)
      */
     if (!isset($this->_params['mvcinfo']) || ($this->_params['mvcinfo']['module'] != $this->_params['module'] || $this->_params['mvcinfo']['controller'] != $this->_params['controller'] || $this->_params['mvcinfo']['action'] != $this->_params['action'])) {
         $Mvc = new Phorm_Mvc();
         $this->_params['mvcinfo'] = $Mvc->getCurrentMvcInfo();
         $this->_setParam('WidgetSetId', $this->_params['mvcinfo']['widgetssetid']);
         $this->_setParam('mvcinfo', $this->_params['mvcinfo']);
         $this->_params['isfwd'] = true;
     }
     //print_r($this->_request->getParams());
 }