예제 #1
0
파일: Unite.php 프로젝트: bersace/strass
 function direct($throw = true)
 {
     $slug = $this->getRequest()->getParam('unite');
     $t = new Unites();
     try {
         if ($slug) {
             $unite = $t->findBySlug($slug);
         } else {
             $unite = $t->findRacine();
         }
     } catch (Strass_Db_Table_NotFound $e) {
         if ($throw) {
             if ($slug) {
                 throw new Strass_Controller_Action_Exception_NotFound("Unité " . $slug . " inconnue");
             } else {
                 $url = $this->_actionController->_helper->Url('fonder', 'unites', null, null, true);
                 $aide = "Vous devez [" . $url . " enregistrer une unité] pour commencer.";
                 throw new Strass_Controller_Action_Exception_Notice("Pas d'unité !", 404, $aide);
             }
         } else {
             return null;
         }
     }
     $this->liensConnexes($unite);
     $page = Zend_Registry::get('page');
     $fn = $unite->getFullname();
     if (!$page->metas->get('DC.Title')) {
         $page->metas->set('DC.Title', $fn);
     }
     $page->metas->set('DC.Creator', $fn);
     return $unite;
 }
예제 #2
0
파일: Wtk.php 프로젝트: bersace/strass
 function _preRender($controller)
 {
     $config = Zend_Registry::get('config');
     $page = Zend_Registry::get('page');
     /* création du document, widget racine */
     $request = $controller->getRequest();
     $cn = strtolower($request->getControllerName());
     $an = strtolower($request->getActionName());
     $mn = strtolower($request->getModuleName());
     $association = $config->get('system/association');
     $view = $controller->view;
     $document = new Wtk_Document($page->metas);
     $document->sitemap = '/sitemap';
     $document->addFlags($mn, $cn, $an);
     $style = $config->get('system/style', 'joubert');
     try {
         $document->setStyle(Wtk_Document_Style::factory($style));
     } catch (Wtk_Document_Style_NotFound $e) {
         error_log("Style " . $style . " inconnu.");
     }
     $document->addStyleComponents('layout', 'common', $cn, $mn, $association);
     if ($view->unite) {
         $unite = $view->unite;
     } else {
         try {
             $t = new Unites();
             $unite = $t->findRacine();
         } catch (Exception $e) {
             $unite = null;
         }
     }
     if ($unite) {
         $document->addFlags($unite->slug, $unite->findParentTypesUnite()->slug);
     }
     $document->addFlags(Strass::onDevelopment() ? 'development' : 'production');
     $document->addFlags($association);
     $document->header->addFlags($association);
     $document->footer->addSection('wrapper');
     $link = new Wtk_Link('/', $page->metas->site);
     $document->header->setTitle($link);
     foreach ($page->formats as $format) {
         if ($format->suffix != $this->suffix) {
             $document->addAlternative($controller->view->url(array('format' => $format->suffix)), $format->title, $format->mimeType);
         }
     }
     $view->page = $page;
     $view->document = $document;
 }
예제 #3
0
파일: Strass.php 프로젝트: bersace/strass
 static function getSiteTitle()
 {
     $config = Zend_Registry::get('config');
     $t = new Unites();
     if (@$config->metas->title) {
         return $config->metas->title;
     } else {
         try {
             $racine = $t->findRacine();
             return $racine->getName();
         } catch (Exception $e) {
             return null;
         }
     }
 }