Example #1
0
 static function bootstrapStage2()
 {
     /* Initialise une installation existante (avec Wtk, styles, etc.). */
     require_once 'Wtk.php';
     Wtk::init();
     Wtk_Document_Style::$path = array(Strass::getPrefix() . 'static/styles/', 'data/styles/');
     Wtk_Document_Style::$basestyle = Strass::getPrefix() . 'static/styles/strass/';
 }
Example #2
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;
 }
Example #3
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');
 }
Example #4
0
 function parametresAction()
 {
     $this->metas(array('DC.Title' => 'Paramètres'));
     $this->branche->append();
     $config = Zend_Registry::get('config');
     $this->view->model = $m = new Wtk_Form_Model('parametres');
     $g = $m->addGroup('metas', "Informations");
     $g->addString('title', 'Titre', $config->metas->title);
     $g->addString('short_title', 'Titre court', $config->system->short_title);
     $g->addString('subject', 'Mots clefs', $config->metas->subject);
     $g->addString('author', 'Créateur du site', $config->metas->author);
     $g->addInteger('creation', 'Date de création du site', $config->metas->creation);
     $g = $m->addGroup('system', 'Système');
     $enum = array();
     foreach (Wtk_Document_Style::listAvailables() as $style) {
         $enum[$style->id] = $style->title;
     }
     $g->addEnum('style', 'Style', $config->system->style, $enum);
     $g->addString('admin', 'E-mail système', $config->system->admin);
     $g = $g->addGroup('mail');
     $i0 = $g->addBool('enable', 'Envoyer les mails', $config->system->mail->enable);
     $i1 = $g->addString('smtp', 'Serveur SMTP', $config->system->mail->smtp);
     $m->addConstraintDepends($i1, $i0);
     $m->addNewSubmission('enregistrer', 'Enregistrer');
     if ($m->validate()) {
         $new = new Strass_Config_Php('strass', $m->get());
         /* Migration en douceur de mouvement vers association. */
         if ($config->system->mouvement) {
             $new->system->association = $config->system->mouvement;
             unset($new->system->mouvement);
         }
         $new->system->short_title = $new->metas->short_title;
         unset($new->metas->short_title);
         $config->merge($new);
         $config->write();
         $this->logger->warn("Configuration mise-à-jour");
         $this->redirectSimple('index');
     }
 }