/** * Adds breadcrumbs dynamically based on current module, submodule and action. * This might look a bit rough to the user. * Please prefer adding breadcrumbs manually via add(). */ public static function addDynamicBreadcrumbs() { $moduleName = strtolower(TargetRoute::getModuleName()); $submoduleName = strtolower(TargetRoute::getSubModuleName()); $actionName = TargetRoute::getActionNameWithoutPrefix(); if (isset($moduleName) and $moduleName !== 'controlcenter') { $url = 'index.php?mod=' . $moduleName; // Level 2 if ($submoduleName !== '') { $url .= '&sub=' . $submoduleName; $moduleName .= ' ' . $submoduleName; } self::add($moduleName, $url); // Level 3 if ($actionName !== '') { $url .= '&action=' . $actionName; self::add($actionName, $url); } } }
/** * 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()); #} } }
/** * Returns Module Template Paths * * @return array Module Template Paths */ public static function getModuleTemplatePaths() { // fetch modulename for template path construction $module = TargetRoute::getModuleName(); // fetch renderer name for template path construction $renderer = HttpRequest::getRoute()->getRenderEngine(); // compose templates paths in the module dir $module_paths = array(ROOT_MOD, ROOT_MOD . $module . DIRECTORY_SEPARATOR, ROOT_MOD . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR, ROOT_MOD . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . $renderer . DIRECTORY_SEPARATOR); return $module_paths; }