function _moduleContent(&$smarty, $module_name) { //folder path for custom templates $local_templates_dir = getWebDirModule($module_name); //user credentials $arrCredentiasls = getUserCredentials($_SESSION['elastix_user']); //user permissions global $arrPermission; $arrPermission = getResourceActionsByUser($arrCredentiasls['idUser'], $module_name); if ($arrPermission == false) { header("Location: index.php"); } //actions $action = getAction(); $content = ""; switch ($action) { case "save_new": $content = saveApplets_Admin($module_name); break; default: // view_form $content = showApplets_Admin($module_name); break; } return $content; }
private function includeModule($module) { global $arrConf; //comprobamos que exista el index del modulo if (!file_exists("{$arrConf['elxPath']}/apps/{$module}/index.php")) { return array('data' => "Error: The module <b>{$arrConf['elxPath']}/apps/{$module}/index.php</b> could not be found!<br/>"); } require_once "apps/{$module}/index.php"; //si existe el archivo de configuracion del modulo se los incluye y se cargan las configuraciones //especificas del modulo elegido if (file_exists("{$arrConf['elxPath']}/apps/{$module}/configs/default.conf.php")) { include_once "apps/{$module}/configs/default.conf.php"; global $arrConf; global $arrConfModule; if (is_array($arrConfModule)) { $arrConf = array_merge($arrConf, $arrConfModule); } } //se incluyen las librerias que esten dentro de apps/$module/libs $dirLibs = "{$arrConf['elxPath']}/apps/{$module}/libs"; if (is_dir($dirLibs)) { $arr_libs = $this->obtainFiles($dirLibs, "class.php"); if ($arr_libs != false && count($arr_libs) > 0) { for ($i = 0; $i < count($arr_libs); $i++) { include_once "apps/{$module}/libs/" . $arr_libs[$i]; } } } // Cargar las traducciones para el módulo elegido load_language_module($module); // Cargar las creadenciales del usuario global $arrCredentials; $arrCredentials = getUserCredentials($_SESSION['elastix_user']); if ($arrCredentials == false) { return array('data' => "Error to load User Credentials: {$_SESSION['elastix_user']}"); } //cargar los permisos del modulo global $arrPermission; $arrPermission = getResourceActionsByUser($arrCredentials['idUser'], $module); if ($arrPermission == false) { return array('data' => "Error to load Module Permissions: {$module}"); } if (!function_exists("_moduleContent")) { return array('data' => "Wrong module: apps/{$module}/index.php"); } $CssJsModule = $this->putHEAD_MODULE_HTML($module); $moduleContent = _moduleContent($this->_smarty, $module); return array("data" => $moduleContent, "JS_CSS_HEAD" => $CssJsModule); }