Beispiel #1
0
 /**
  * Render a hook's content
  *
  * @param string $name template to use
  * @param string $module module to fetch template from
  * @param string $controller controller to fetch template from, defaults to 'hooks'
  *
  * @return string Rendered content
  *
  */
 public function render($name, $module, $controller = "hooks")
 {
     $layout = Zend_Layout::getMvcInstance();
     // Reset view script paths
     $this->view->setScriptPath(null);
     // Build new ones for hooks
     $this->view->addBasePath(ZfApplication::$_base_path . "/app/{$module}/views", $module . "_View");
     //$this->view->addScriptPath(ZfApplication::$_base_path."/app/$module/Views/");
     $this->view->addScriptPath($layout->getLayoutPath() . "default/templates/{$module}");
     $this->view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/{$module}");
     return $this->view->render($controller . "/" . $name);
 }
Beispiel #2
0
 /**
  * Render a panel region
  * @param array $region
  * @param array $blocks
  * @return string
  */
 function renderRegion($region, $blocks = array())
 {
     if ($blocks || $this->is_admin_page) {
         $rendered_blocks = array();
         if ($blocks) {
             foreach ($blocks as $block) {
                 $block->options['region'] = $region;
                 if (!$this->is_admin_page) {
                     $rendered_blocks[$block->id] = $block->render();
                 } else {
                     $rendered_blocks[$block->id] = $this->renderAdminBlock($block);
                 }
             }
         }
         $this->view->assign('region', $region);
         $this->view->assign('blocks', $rendered_blocks);
         if ($this->is_admin_page) {
             $template = "region_admin";
         } else {
             $template = "region_" . (isset($region['template']) && $region['template'] != "" ? $region['template'] : "standard");
         }
         return $this->view->render($template);
     }
     return "";
 }
 public function __toString()
 {
     if (null === ($verb = $this->getParam('verb'))) {
         $this->_view->errors = array('badArgument' => 'Required verb is missing');
         return $this->_view->render('index/error.phtml');
     } else {
         try {
             try {
                 $this->checkParams($verb);
             } catch (OaiPmh_Exception $e) {
                 $this->_view->errors = array($e->getCodeAsString() => $e->getMessage());
                 return $this->_view->render('index/error.phtml');
             }
             try {
                 return $this->{$verb}();
             } catch (Exception $e) {
                 $this->_view->errors = array($e->getCodeAsString() => $e->getMessage());
                 return $this->_view->render('index/error.phtml');
             }
         } catch (OaiPmh_Exception $e) {
             $this->_view->errors = array($e->getCodeAsString() => $e->getMessage());
             return $this->_view->render('index/error.phtml');
         } catch (Exception $e) {
             $this->_view->errors = array('badArgument' => $e->getMessage());
             return $this->_view->render;
         }
     }
 }
 /**
  * Wraper for parent's render method so preRender method
  * can be called (that will bind the plugin proxy to the
  * engine.
  *
  * @see Zend_View_Abstract::render
  * @return string The script output.
  */
 public function render($name)
 {
     $this->preRender();
     return parent::render($name);
 }
Beispiel #5
0
 /**
  * Processes a view script and returns the output.
  * Hack for Zend_Layout => force the view suffix
  * depending on template engine
  *
  * @param string $name The script name to process.
  * @return string The script output.
  */
 public function render($name)
 {
     // hack for Zend_Layout which has its own view suffix handling
     $filename = $name;
     $suffix = $this->getTemplateEngine()->getViewSuffix();
     $fileParts = pathinfo($name);
     $filename = str_replace('.' . $fileParts['extension'], '.' . $suffix, $name);
     return parent::render($filename);
 }
Beispiel #6
0
 /**
  * Print the output
  *
  * The next method output() is a wrapper on the render() method from Zend_View_Abstract. It just sets some headers before printing the output.
  *
  * @param <type> $name
  */
 public function output($name)
 {
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Cache-Control: no-cache");
     header("Pragma: no-cache");
     header("Cache-Control: post-check=0, pre-check=0", false);
     print parent::render($name);
 }
Beispiel #7
0
 /**
  * Processes a view script and returns the output.
  *
  * @param string $name The script script name to process.
  * @return string The script output.
  */
 public function render($name)
 {
     // Revert to no stream
     if (!$this->getStreamFlag()) {
         return parent::render($name);
     }
     // Get stream class
     $stream = $this->getStreamWrapper();
     $streamProtocol = $this->getStreamProtocol();
     // Do extra work if something already registered our protocol
     $previousWrapperExists = false;
     // Unregister existing wrapper
     if (in_array($streamProtocol, stream_get_wrappers())) {
         stream_wrapper_unregister($streamProtocol);
         $previousWrapperExists = true;
     }
     // Load stream wrapper
     $this->_loadStreamWrapper($stream);
     // Register wrapper
     stream_wrapper_register($streamProtocol, $stream);
     // Render!
     $return = parent::render($name);
     // Unregister wrapper
     if (in_array($streamProtocol, stream_get_wrappers())) {
         stream_wrapper_unregister($streamProtocol);
     }
     // Register any old wrapper
     if ($previousWrapperExists) {
         @stream_wrapper_restore($streamProtocol);
     }
     return $return;
 }
Beispiel #8
0
 /**
  * When rendering, check to see if there's a master view
  * to also render.
  *
  * @return string the render result
  */
 public function render($view)
 {
     $this->setScriptPaths();
     if ($view == null) {
         echo "NO VIEW SUPPLIED<br/>";
         debug_print_backtrace();
         exit;
     }
     $viewToRender = $view;
     if ($this->viewFile != '') {
         $viewToRender = $this->viewFile;
     } else {
         $this->setViewFile($view);
     }
     // first off, render this view.
     $result = parent::render($viewToRender);
     // If there's a parent view to be rendered, render it, after setting
     // this view's content as a variable in that parent view.
     if ($this->master != null) {
         $this->master->setChildView($this);
         $this->master->childViewContent = $result;
         $result = $this->master->render('null');
     }
     return $result;
 }