Example #1
0
 function postDispatch()
 {
     $page = Zend_Registry::get('page');
     $page->addFormat(Strass_Format::factory('Html5'));
     $page->selectFormat('html');
     $this->viewSuffix = $page->format->viewSuffix . '.php';
     $response = $this->getResponse();
     // rendu effectif du document.
     $output = $page->format->render($this);
     $response->setHeader('Content-Type', $page->format->mimeType . '; charset=utf-8');
     $response->appendBody($output);
 }
Example #2
0
 function postDispatch()
 {
     $format = $this->_getParam('format');
     $page = Zend_Registry::get('page');
     if (!in_array($format, $this->_formats)) {
         $format = 'html';
     }
     //throw new Strass_Controller_Action_Exception("Ce document n'est pas disponible dans ce format.");
     $available_formats = (require Strass::getPrefix() . 'include/Strass/formats.php');
     foreach ($available_formats as $name) {
         if (!($f = Strass_Format::factory($name))) {
             continue;
         }
         if (in_array($f->suffix, $this->_formats)) {
             $page->addFormat($f);
         }
     }
     // choper le format actuel
     $page->selectFormat($format);
     $this->viewSuffix = $page->format->viewSuffix . '.php';
     $response = $this->getResponse();
     // rendu effectif du document.
     $output = $page->format->render($this);
     $response->setHeader('Content-Type', $page->format->mimeType . '; charset=utf-8');
     if ($page->format->download) {
         $filename = $page->format->getFilename($this->view);
         $response->setHeader('Content-Disposition', 'attachment; filename=' . urlencode($filename));
     }
     $response->appendBody($output);
 }