/** * Returns the Template Name * Maps the action name to a template. * * @return Returns the templateName as String */ public function getTemplateName() { // if the templateName was not set manually, we construct it from module/action infos if (empty($this->template) === true) { // construct template name $template = TargetRoute::getActionName() . '.tpl'; $this->setTemplate($template); } return $this->template; }
/** * Renderer_Smarty->render. * * Returns the mainframe layout with inserted modulcontent (templatename). * * 1. assign common values and constants * 2. fetch the modultemplate and assigns it as $content * 3. return the wrapper layout tpl * * @param string $template Template Filename * * @return null|string tpl layout */ public function render($template = null, $viewdata = null) { if ($viewdata !== null) { $this->assign($viewdata); } // assign common template values and Application constants as Smarty Template Variables. $constants = $this->getConstants(); foreach ($constants as $const => $value) { $this->renderer->assignGlobal($const, $value); } /* * Assign the original template name and the requested module * This is used in template_not_found.tpl to provide a link to the templateeditor */ $this->renderer->assignGlobal('modulename', TargetRoute::getModule()); $this->renderer->assignGlobal('actionname', TargetRoute::getActionName()); $this->renderer->assignGlobal('templatename', $template); /* * Rendering depends on the RenderMode. * * The RenderMode "PARTIAL" means, that only the content template is rendered. * * The RenderMode "LAYOUT" means, that the content template is embedded, * into a layout template, by replacing the {$content} placeholder. */ if ($this->getRenderMode() === 'PARTIAL') { return $this->fetch($template); } if ($this->getRenderMode() === 'LAYOUT') { // assign the modulecontent $this->assign('content', $this->fetch($template)); return $this->fetch($this->getLayoutTemplate()); } }
/** * Renderer_Smarty->render * * Returns the mainframe layout with inserted modulcontent (templatename). * * 1. assign common values and constants * 2. fetch the modultemplate and assigns it as $content * 3. return the wrapper layout tpl * * @param string $templatename Template Filename * @param array|object $data Data to assign to the view. * @return wrapper tpl layout */ public function render($template, $viewdata = null) { if ($viewdata !== null) { $this->assign($viewdata); } // 1. assign common template values and Application constants as Smarty Template Variables. $this->renderer->assignGlobal($this->getConstants()); /** * Assign the original template name and the requested module * This is used in template_not_found.tpl to provide a link to the templateeditor */ $this->renderer->assignGlobal('modulename', TargetRoute::getModuleName()); $this->renderer->assignGlobal('actionname', TargetRoute::getActionName()); $this->renderer->assignGlobal('templatename', $template); /** * Rendering depends on the RenderMode. * * RenderMode "NOLAYOUT" means that only the (module) content template is rendered. * * RenderMode "LAYOUT" means that the (module) content template is embedded, * into a layout template, by replacing the {$content} placeholder. */ if ($this->getRenderMode() === 'NOLAYOUT') { return $this->fetch($template); } if ($this->getRenderMode() === 'LAYOUT') { // ensure that smarty tags {$content} and {copyright} are present in the layout template #if(true === $this->preRenderChecks()) #{ // assign the modulecontent $this->assign('content', $this->fetch($template)); return $this->fetch($this->getLayoutTemplate()); #} } }