function _moduleContent(&$smarty, $module_name) { global $arrConf; global $arrLang; require_once "modules/agent_console/libs/elastix2.lib.php"; require_once "modules/agent_console/libs/paloSantoConsola.class.php"; require_once "modules/agent_console/getinfo.php"; require_once "modules/agent_console/libs/JSON.php"; require_once "modules/{$module_name}/configs/default.conf.php"; require_once "modules/{$module_name}/libs/queue_waiting2.class.php"; // Directorio de este módulo $sDirScript = dirname($_SERVER['SCRIPT_FILENAME']); // Se fusiona la configuración del módulo con la configuración global $arrConf = array_merge($arrConf, $arrConfModule); /* Se pide el archivo de inglés, que se elige a menos que el sistema indique otro idioma a usar. Así se dispone al menos de la traducción al inglés si el idioma elegido carece de la cadena. */ load_language_module($module_name); // Asignación de variables comunes y directorios de plantillas $sDirPlantillas = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes'; $sDirLocalPlantillas = "{$sDirScript}/modules/{$module_name}/" . $sDirPlantillas . '/' . $arrConf['theme']; $smarty->assign("MODULE_NAME", $module_name); // Incluir todas las bibliotecas y CSS necesarios generarRutaJQueryModulo($smarty, $module_name); $sAction = ''; $sContenido = ''; $sAction = getParameter('action'); $oPaloConsola = new PaloSantoConsola(); switch ($sAction) { case 'checkStatus': $sContenido = agent_monitoring_checkStatus($module_name, $smarty, $sDirLocalPlantillas, $oPaloConsola); break; case 'queueWaitingStatus': $sContenido = queue_waiting_checkStatus($module_name, $smarty, $sDirLocalPlantillas, $oPaloConsola); break; case 'show_call_history': $sContenido = refreshCallHistory(); break; case "viewNote": $sContenido = viewNote(); break; case "viewDelivery": $sContenido = viewDelivery(); break; default: $sContenido = agent_monitoring_HTML($module_name, $smarty, $sDirLocalPlantillas, $oPaloConsola); break; } $oPaloConsola->desconectarTodo(); return $sContenido; }
function _moduleContent(&$smarty, $module_name) { //include module files include_once "modules/{$module_name}/configs/default.conf.php"; include_once "modules/{$module_name}/libs/paloSantoMonitoring.class.php"; include_once "libs/paloSantoACL.class.php"; require_once "modules/{$module_name}/libs/JSON.php"; require_once "modules/agent_console/getinfo.php"; //include file language agree to elastix configuration //if file language not exists, then include language by default (en) $lang = get_language(); $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); // Include language file for EN, then for local, and merge the two. include_once "modules/{$module_name}/lang/en.lang"; $lang_file = "modules/{$module_name}/lang/{$lang}.lang"; if (file_exists("{$base_dir}/{$lang_file}")) { $arrLanEN = $arrLangModule; include_once $lang_file; $arrLangModule = array_merge($arrLanEN, $arrLangModule); } //global variables global $arrConf; global $arrConfModule; global $arrLang; global $arrLangModule; $arrConf = array_merge($arrConf, $arrConfModule); $arrLang = array_merge($arrLang, $arrLangModule); //folder path for custom templates $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; //conexion resource $arrConf['dsn_conn_database'] = generarDSNSistema('asteriskuser', 'asteriskcdrdb'); $pDB = new paloDB($arrConf['dsn_conn_database']); $pDBACL = new paloDB($arrConf['elastix_dsn']['acl']); $pACL = new paloACL($pDBACL); $user = isset($_SESSION['elastix_user']) ? $_SESSION['elastix_user'] : ""; //$extension = $pACL->getUserExtension($user); $extension = '6868'; //$esAdministrador = $pACL->isUserAdministratorGroup($user); $esAdministrador = true; if ($extension == "" || is_null($extension)) { if ($esAdministrador) { $smarty->assign("mb_message", "<b>" . _tr("no_extension") . "</b>"); } else { $smarty->assign("mb_message", "<b>" . _tr("contact_admin") . "</b>"); return ""; } } //actions $action = getAction(); $content = ""; switch ($action) { case 'delete': //$content = deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador); break; case 'download': $content = downloadFile($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador); break; case "display_record": $content = display_record($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador); break; case "viewNote": $content = viewNote(); break; case "viewDelivery": $content = viewDelivery(); break; default: $content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador); break; } return $content; }