Example #1
0
 function initPage()
 {
     /* On préserve la page entre les appels à init, cela permet de
        préserver les liens, branches, etc. en cas d'erreur. */
     try {
         return Zend_Registry::get('page');
     } catch (Exception $e) {
         $config = Zend_Registry::get('config');
         $t = new Unites();
         $racine = $t->findRacines()->current();
         /* instanciation de la page courante */
         $metas = $config->metas;
         $site = Strass::getSiteTitle();
         $page = new Strass_Page(new Wtk_Metas(array('DC.Title' => $metas->title, 'DC.Title.alternative' => $metas->title, 'DC.Subject' => $metas->subject, 'DC.Language' => $metas->language, 'DC.Creator' => $metas->author, 'DC.Date.created' => $metas->creation, 'DC.Date.available' => strftime('%Y-%m-%d'), 'organization' => $metas->organization, 'site' => $site)));
         Zend_Registry::set('page', $page);
         $this->branche = $page->addon(new Strass_Addon_Branche());
         $this->connexes = $page->addon(new Strass_Addon_Liens('connexes', 'Pages connexes'));
         $page->addon(new Strass_Addon_Formats());
         $label = 'Administrer';
         if ($this->assert(null, 'site', 'admin')) {
             $label = new Wtk_Link($this->_helper->Url('index', 'admin', null, null, true), $label);
         }
         $this->actions = $page->addon(new Strass_Addon_Liens('admin', $label));
         $page->addon(new Strass_Addon_Console($this->_helper->Auth));
         $page->addon(new Strass_Addon_Citation());
         $page->addon(new Strass_Addon_Menu());
         if ($config->system->short_title) {
             $this->branche->append($config->system->short_title, array(), array(), true);
         }
         if ($this->_afficherMenuUniteRacine && $racine) {
             $this->_helper->Unite->liensConnexes($racine, $action = 'index', $controller = 'unites');
         }
         if (!$this instanceof Strass_Controller_ErrorController && $this->_titreBranche) {
             $this->branche->append($this->_titreBranche, array('controller' => strtolower($this->_request->getControllerName())), array(), true);
         }
         return $page;
     }
 }