Example #1
0
File: Ztal.php Project: jo-m/ecamp3
 /**
  * Pre-dispatch hook to create and install a replacement View object.
  *
  * @param Zend_Controller_Request_Abstract $request The requst object.
  *
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     // Unregister the built-in autoloader
     spl_autoload_unregister(array('PHPTAL', 'autoload'));
     // Register the autoloader through Zend
     Zend_Loader_Autoloader::getInstance()->pushAutoloader(array('PHPTAL', 'autoload'), 'PHPTAL');
     // We create an instance of our view wrapper and configure it
     // It extends Zend_View so we can configure it the same way
     $view = new Ztal_Tal_View($this->_options);
     if (Zend_Registry::isRegistered('Zend_Translate')) {
         //setup the translation facilities in PHPTal
         $translator = new Ztal_Tal_ZendTranslateTranslator($this->_options);
         $translator->useDomain($request->getControllerName());
         $view->getEngine()->setTranslator($translator);
     }
     // Call out to an overloadable method to pickup the paths for
     // templates for the current module
     foreach ($this->_currentModuleTemplatePaths($request) as $currentPath) {
         $view->addTemplateRepositoryPath($currentPath);
     }
     // We configure the view renderer in order to use our PHPTAL view
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setViewSuffix('phtml');
     $view->layout()->setViewSuffix('phtml');
     $viewRenderer->setView($view);
     Zend_Registry::set('Ztal_View', $view);
 }
Example #2
0
File: Mail.php Project: jo-m/ecamp3
 /**
  * Set the html body of the email to the output from the named template.
  *
  * @param string $template The name of the template.
  * @param string $charset  The charset to use for the content.
  * @param int    $encoding The encoding to use for the content.
  *
  * @return Ztal_Mail
  */
 public function setBodyHtmlFromTemplate($template, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE)
 {
     $this->view->ztalMailMacro = $this->_calculateTemplatePath($template) . '/html';
     return $this->setBodyHtml($this->view->render($this->_template()), $charset, $encoding);
 }
Example #3
0
 /**
  * Revert the layout back to its previous state.
  *
  * @return void
  */
 protected function _revertLayout()
 {
     if ($this->_layoutWasEnabled) {
         $this->view->layout()->enableLayout();
     }
 }