public function getName($object)
 {
     if ($sName = parent::getName($object)) {
         return $sName;
     }
     if ($this->arrChildContainers) {
         foreach ($this->arrChildContainers as $sContainerName => $aContainer) {
             if ($sName = $aContainer->getName($object)) {
                 return $sContainerName . '-' . $sName;
             }
         }
     }
 }
Example #2
0
 /**
  * @param string $contentType The name of the handler that the template engine should use to render the output.
  *                            Types: XHTML, RSS, XML, JSON, JSONp, JavaScript, SerializedPHP, PlainText, HTTPGET
  *                            A template engine may or may not support all of these handlers.
  *
  * @throws Exception If template engine doesn't support requested content type (thrown from TemplateEngine)
  * @throws Exception If no template engine is capable of rendering the view template supplied
  * @throws Exception If the template engine doesn't support the handler type.
  */
 public function renderView(View $view, $contentType, $cacheEnabled = true, $pushCache = false)
 {
     $this->view = $view;
     $this->contentType = $contentType;
     $this->cacheEnabled = $cacheEnabled;
     $this->pushCache = $pushCache;
     $this->noTemplatesCalled = true;
     //VIEW DATA (MODEL) IS USED AS GLOBAL VARIABLES DURING TEMPLATE RENDER
     $globals = $view->getData() == null ? array() : $view->getData();
     $templateEngine = $this->getTemplateEngine($view->getName());
     $this->Logger->debug("Starting render [{$view->getName()}] - " . ($cacheEnabled == true ? 'WITH' : 'WITHOUT') . " CACHING");
     if ($this->benchmarkRendering) {
         $this->Benchmark->start('render-' . $view->getName());
     }
     $content = $templateEngine->firstPass($view->getName(), $contentType, $globals, $this);
     foreach ($this->invokedTemplateEngines as $te) {
         $this->Logger->debug("Starting finalPass for [" . get_class($te) . "]");
         $content = $te->finalPass($content, $contentType, $globals, $this);
     }
     $this->Logger->debug("Completed rendering view [{$view->getName()}]");
     if ($this->benchmarkRendering) {
         $this->Benchmark->end('render-' . $view->getName());
     }
     $this->noTemplatesCalled = true;
     return array($content, $globals);
 }