Beispiel #1
0
 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;
 }
Beispiel #2
0
 function __construct($metas)
 {
     parent::__construct('utf-8');
     $config = Zend_Registry::get('config');
     if (is_string($metas)) {
         $title = $metas;
         $metas = $config->metas->toArray();
         $metas['title'] = $title;
         $metas = new Wtk_Metas($metas);
     }
     $id = $config->get('system/short_title', 'STRASS');
     $title = "[" . $id . "] " . $metas->title;
     $this->setSubject($title);
     $this->addTo(null);
     $this->_doc = $d = new Wtk_Document($metas);
     $d->level += 2;
     $d->addStyleComponents('mail');
     $d->setStyle(Wtk_Document_Style::factory($config->system->style));
     $d->embedStyle();
     $d->addFlags('mail');
     // :P
     $this->addHeader('X-Mailer', 'Strass');
     $this->addHeader('X-MailGenerator', 'Wtk');
 }