コード例 #1
0
/**
 * 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_HttpRequest::getRoute()->getModuleName();
    $file = ROOT_MOD . $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 clansuite/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);
    }
}