示例#1
0
 function init()
 {
     $this->conf = Zend_Registry::get('conf');
     $this->initView();
     $this->viewScript = 'main.phtml';
     $this->view->host = Zx_FrontEnd::getHttpPrefix();
     // используется в хелперах меню
     $this->view->pathParts = Zx_FrontEnd::getPathParts($this->getRequest());
     //@TODO? use $this->p instead
     $this->view->divider = ' - ';
     // title / headers divider
     $this->view->content = '';
     //--> get parameters from request
     $this->id = $this->_getParam('id', null);
     if ($this->id) {
         $this->view->id = $this->id;
     }
     $this->view->topicId = $this->topicId = (int) $this->_getParam('topicId');
     $this->view->subtopicId = $this->subtopicId = (int) $this->_getParam('subtopicId');
     $sectionId = $this->getRequest()->getParam('sectionId');
     if ($sectionId) {
         Zend_Registry::set('sectionId', $sectionId);
         $this->view->sectionId = $this->sectionId = $sectionId;
     }
     $subsectionId = $this->getRequest()->getParam('subsectionId');
     if ($subsectionId) {
         Zend_Registry::set('subsectionId', $subsectionId);
         $this->subsectionId = $subsectionId;
     }
     $this->page = $this->_getParam('page', 1);
     Zend_Registry::set('page', $this->page);
     $this->view->p = $this->p = $this->getRequest()->getParams();
     /*
     [controller] => stores
     [action] => index
     [module] => default
     */
     $this->view->baseUrl = $this->getRequest()->getBaseUrl();
     $this->view->requestUri = $this->getRequest()->getRequestUri();
     #$this->view->refererUri = $this->getRequest()->getServer('HTTP_REFERER');#getHeader('REFERER')
     // base current controller URI
     $this->cURI = '/' . $this->p['controller'] . '/';
     // common models init
     if (empty($this->conf->app->FrontEnd)) {
         $this->fe = new Zx_FrontEnd();
     }
     $this->model('Articles', 'db');
     #$this->Articles = new Zx_Db_Table_Articles();
     $this->model('Content', 'db');
     #$this->Content = new Zx_Db_Table_Content();
     #$this->model('Feedback', 'db');#$this->Feedback = new Zx_Db_Table_Feedback();
     #$this->model('Topics', 'db');#$this->Topics = new Zx_Db_Table_Topics();
     $this->Topics = new Zx_Db_Table_TopicsTree();
     // since 5/21/2009
     // Создание экземпляров классов
     if (!empty($this->conf->libload)) {
         $a = $this->conf->libload->toArray();
         foreach ($a as $k => $v) {
             if ($v === true) {
                 $v = $k;
             }
             $this->{$k} = new $v();
         }
     }
     /*
     Array
     (
         [id] => women
         [module] => default
         [controller] => index
         [action] => index
     )
     */
     #echo "DEBUG:<br><textarea rows=10 cols=100>" . print_r($this->view->p, 1) . "</textarea><br>";die;
     //<--
     $this->initStrings();
     //TODO: move to projects?
     if (is_object($this->conf->auth) && empty($this->conf->auth->strict)) {
         $this->initAuth($this->conf->auth);
     }
     // todo!
     $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $this->view->messages = $this->_flashMessenger->getMessages();
     #d($this->view->messages);
 }