/** * Redirect to Referer. */ public function redirectToReferer() { $referer = $this->request->getReferer(); // we have a referer in the environment if (empty($referer) === false) { $this->redirect(SERVER_URL . $referer); } else { // build referer on base of the current module $route = $this->request->getRoute(); // we use internal rewrite style here: /module/action $redirect_to = '/' . $route->getModuleName(); $submodule = $route->getSubModuleName(); if (empty($submodule) === false) { $redirect_to .= '/' . $submodule; } // redirect() builds the url $this->response->redirect($redirect_to); } }
/** * Smarty ModuleNavigation * Displays a Module Navigation Element * depends on module configuration file. * * Examples: * <pre> * {modulnavigation} * </pre> * * Type: function<br> * Name: modulenavigation<br> * Purpose: display modulenavigation<br> * * @param array $params * @param Smarty $smarty * * @return string */ function Smarty_function_modulenavigation($params, $smarty) { $module = \Koch\Http\HttpRequest::getRoute()->getModule(); $file = APPLICATION_MODULES_PATH . $module . DIRECTORY_SEPARATOR . $module . '.menu.php'; if (is_file($file)) { // this includes the file, which contains a php array name $modulenavigation include $file; // push the $modulenavigation array to a callback function // for further processing of the menu items $modulenavigation = array_map('applyCallbacks', $modulenavigation); $smarty->assign('modulenavigation', $modulenavigation); // The file is located in /themes/core/view/smarty/modulenavigation-generic.tpl return $smarty->fetch('modulenavigation-generic.tpl'); } else { // the module menu navigation file is missing $smarty->assign('modulename', $module); $errormessage = $smarty->fetch('modulenavigation_not_found.tpl'); trigger_error($errormessage); } }
/** * Returns the fullpath to Template by searching in the Module Template Path. * * @param string $template Template Filename * @param string $module * * @return string */ public static function getModuleTemplatePath($template, $module = null) { $paths = self::getModuleTemplatePaths($module); // check if template exists in one of the defined paths $module_template = self::findFileInPaths($paths, $template); #\Koch\Debug\Debug::firebug('Module Template: ' . $module_template . '<br />'); if ($module_template !== null) { return $module_template; } else { // fetch renderer name for template path construction $renderer = HttpRequest::getRoute()->getRenderEngine(); // the template with that name is not found on our default paths // @todo if this would be a html template, we could skip determining the render engine return APPLICATION_PATH . 'themes/core/view/' . $renderer . '/template_not_found.tpl'; } }
/** * Returns the fullpath to Template by searching in the Module Template Path * * @param string $template Template Filename * @return string */ public static function getModuleTemplatePath($template) { $paths = self::getModuleTemplatePaths(); $module_template = null; // check if template exists in one of the defined paths $module_template = self::findFileInPaths($paths, $template); if ($module_template != null) { return $module_template; } else { // fetch renderer name for template path construction $renderer = HttpRequest::getRoute()->getRenderEngine(); // the template with that name is not found on our default paths return ROOT_THEMES_CORE . 'view' . DIRECTORY_SEPARATOR . $renderer . DIRECTORY_SEPARATOR . 'template_not_found.tpl'; } }
/** * Returns the object Koch_Theme for accessing Configuration Values * * @return object Koch_Theme */ public function getTheme() { if ($this->theme === null) { $themename = HttpRequest::getRoute()->getThemeName(); $this->theme = new \Koch\View\Helper\Theme($themename); } return $this->theme; }