function mostrar_menu() { global $arrLangModule; global $arrConf; $jsonObject = new PaloSantoJSON(); $respuesta = array(); $level = getParameter("level"); $parent_1_existing = getParameter("parent_1_existing"); $parent_2_existing = getParameter("parent_2_existing"); $id_parent = getParameter("id_parent"); //Nivel 2 if ($level == 0) { //Padre nivel 1 SI existe if ($parent_1_existing == 0) { $pDB_menu = new paloDB($arrConf['elastix_dsn']['menu']); if (!empty($pDB_menu->errMsg)) { $jsonObject->set_error("ERROR DE DB: {$pDB_menu->errMsg}"); return $jsonObject->createJSON(); } $pMenu = new paloMenu($pDB_menu); $arrMenuOptions = $pMenu->getRootMenus(); $parent_Menu = "<td align='left'><b>{$arrLangModule["Level 1 Parent"]}: <span class='required'>*</span></b></td>"; $parent_Menu .= "<td align='left'>"; $parent_Menu .= "<select name='parent_module' id='parent_module'>"; foreach ($arrMenuOptions as $key => $valor) { $parent_Menu .= "<option value='{$key}'>{$valor}</option>"; } $parent_Menu .= "</select>"; $parent_Menu .= "</td>"; } else { $parent_Menu = "<td align='left'><b>{$arrLangModule["Level 1 Parent Name"]}: <span class='required'>*</span></b></td>"; $parent_Menu .= "<td align='left' width='21%'><input type='text' name='parent_1_name' id='parent_1_name' value='' onkeyup='generateId(this,\"parent_1_id\")'></td>"; $parent_Menu .= "<td align='left' width='11%'><b>{$arrLangModule["Level 1 Parent Id"]}: </b></td>"; $parent_Menu .= "<td align='left'><i id='parent_1_id'></i></td>"; } $respuesta["parent_menu_1"] = $parent_Menu; $respuesta["level2_exist"] = ""; $respuesta["parent_menu_2"] = ""; $respuesta["label_level2"] = ""; } else { //Padre nivel 1 SI existe if ($parent_1_existing == 0) { //Padre nivel 2 SI existe if ($parent_2_existing == 0) { require_once 'libs/paloSantoNavigation.class.php'; $pMenu = new paloMenu($arrConf['elastix_dsn']['menu']); $arrMenu = $pMenu->cargar_menu(); $smarty = NULL; $pNav = new paloSantoNavigation($arrMenu, $smarty); $arrMenuOptions = $pNav->getArrSubMenu($id_parent); if (is_array($arrMenuOptions)) { $parent_Menu2 = "<td align='left'><b>{$arrLangModule["Level 2 Parent"]}: <span class='required'>*</span></b></td>"; $parent_Menu2 .= "<td>"; $parent_Menu2 .= "<select name='parent_module_2' id='parent_module_2'>"; foreach ($arrMenuOptions as $key => $valor) { $parent_Menu2 .= "<option value='{$key}'>{$valor['Name']}</option>"; } $parent_Menu2 .= "</select>"; $parent_Menu2 .= "</td>"; $parent_Menu2 .= "<td></td><td></td><td></td>"; $respuesta["parent_menu_2"] = $parent_Menu2; } } else { if ($parent_2_existing == 1) { $parent_Menu2 = "<td align='left'><b>{$arrLangModule["Level 2 Parent Name"]}: <span class='required'>*</span></b></td>"; $parent_Menu2 .= "<td align='left' width='21%'><input type='text' name='parent_2_name' id='parent_2_name' value='' onkeyup='generateId(this,\"parent_2_id\")'></td>"; $parent_Menu2 .= "<td align='left' width='11%'><b>{$arrLangModule["Level 2 Parent Id"]}: </b></td>"; $parent_Menu2 .= "<td align='left'><i id='parent_2_id'></i></td>"; $respuesta["parent_menu_2"] = $parent_Menu2; } else { $pDB_menu = new paloDB($arrConf['elastix_dsn']['menu']); if (!empty($pDB_menu->errMsg)) { $jsonObject->set_error("ERROR DE DB: {$pDB_menu->errMsg}"); return $jsonObject->createJSON(); } $pMenu = new paloMenu($pDB_menu); $arrMenuOptions = $pMenu->getRootMenus(); $parent_Menu = "<td align='left'><b>{$arrLangModule["Level 1 Parent"]}: <span class='required'>*</span></b></td>"; $parent_Menu .= "<td align='left'>"; $parent_Menu .= "<select name='parent_module' id='parent_module' onchange='mostrar_menu()'>"; foreach ($arrMenuOptions as $key => $valor) { $parent_Menu .= "<option value='{$key}'>{$valor}</option>"; } $parent_Menu .= "</select>"; $parent_Menu .= "</td>"; $parent_Menu .= "<td></td><td></td><td></td>"; $respuesta["parent_menu_1"] = $parent_Menu; //$respuesta->addAssign("parent_menu_1","innerHTML", ""); $parent_exist = "<b>{$arrLangModule["Level 2 Parent Exists"]}: <span class='required'>*</span></b>"; $respuesta["label_level2"] = $parent_exist; $parent_option = "<select id='parent_2_existing_option' name='parent_2_existing_option' onchange='mostrar_menu()'>"; $parent_option .= "<option value='{$arrLangModule["Yes"]}'>{$arrLangModule["Yes"]}</option>"; $parent_option .= "<option value='{$arrLangModule["No"]}' selected='selected'>{$arrLangModule["No"]}</option>"; $parent_option .= "</select>"; $respuesta["level2_exist"] = $parent_option; $parent_Menu2 = "<td align='left'><b>{$arrLangModule["Level 2 Parent Name"]}: <span class='required'>*</span></b></td>"; $parent_Menu2 .= "<td align='left' width='22%'><input type='text' name='parent_2_name' id='parent_2_name' value='' onkeyup='generateId(this,\"parent_2_id\")'></td>"; $parent_Menu2 .= "<td align='left' width='11%'><b>{$arrLangModule["Level 2 Parent Id"]}: </b></td>"; $parent_Menu2 .= "<td align='left'><i id='parent_2_id'></i></td>"; $respuesta["parent_menu_2"] = $parent_Menu2; } } } else { $parent_Menu = "<td align='left'><b>{$arrLangModule["Level 1 Parent Name"]}: <span class='required'>*</span></b></td>"; $parent_Menu .= "<td align='left' width='22%'><input type='text' name='parent_1_name' id='parent_1_name' value='' onkeyup='generateId(this,\"parent_1_id\")'></td>"; $parent_Menu .= "<td align='left' width='11%'><b>{$arrLangModule["Level 1 Parent Id"]}: </b></td>"; $parent_Menu .= "<td align='left'><i id='parent_1_id'></i></td>"; $respuesta["parent_menu_1"] = $parent_Menu; $parent_Menu2 = "<td align='left'><b>{$arrLangModule["Level 2 Parent Name"]}: <span class='required'>*</span></b></td>"; $parent_Menu2 .= "<td align='left' width='22%'><input type='text' name='parent_2_name' id='parent_2_name' value='' onkeyup='generateId(this,\"parent_2_id\")'></td>"; $parent_Menu2 .= "<td align='left' width='11%'><b>{$arrLangModule["Level 2 Parent Id"]}: </b></td>"; $parent_Menu2 .= "<td align='left'><i id='parent_2_id'></i></td>"; $respuesta["parent_menu_2"] = $parent_Menu2; $respuesta["level2_exist"] = ""; $respuesta["label_level2"] = ""; } } $jsonObject->set_message($respuesta); return $jsonObject->createJSON(); }
} $smarty->assign('MENU', count($arrMenuFiltered) > 0 ? $smarty->fetch("_common/_menu.tpl") : _tr('No modules')); } $smarty->display("_common/index.tpl"); } } else { $rawmode = getParameter("rawmode"); if (isset($rawmode) && $rawmode == 'yes') { include_once "libs/paloSantoJSON.class.php"; $jsonObject = new PaloSantoJSON(); $jsonObject->set_status("ERROR_SESSION"); $jsonObject->set_error(_tr("Your session has expired. If you want to do a login please press the button 'Accept'.")); $jsonObject->set_message(null); Header('Content-Type: application/json'); echo $jsonObject->createJSON(); } else { $oPn = new paloSantoNavigation(array(), $smarty); $oPn->putHEAD_JQUERY_HTML(); $smarty->assign("THEMENAME", $arrConf['mainTheme']); $smarty->assign("WEBPATH", "web/"); $smarty->assign("WEBCOMMON", "../" . $arrConf['webCommon'] . "/"); $smarty->assign("currentyear", date("Y")); $smarty->assign("PAGE_NAME", _tr('Login page')); $smarty->assign("WELCOME", _tr('Welcome to Elastix')); $smarty->assign("ENTER_USER_PASSWORD", _tr('Please enter your username and password')); $smarty->assign("USERNAME", _tr('Username')); $smarty->assign("PASSWORD", _tr('Password')); $smarty->assign("SUBMIT", _tr('Submit')); $smarty->display("_common/login.tpl"); } }
function mostrar_menu($level, $id_module_level_1, $id_module_level_2, $id_module_level_3) { require_once 'libs/paloSantoMenu.class.php'; global $arrLangModule; global $arrConf; $respuesta = new xajaxResponse(); //Nivel 1 if ($level == 1) { $respuesta->addAssign("level_2", "innerHTML", ""); $respuesta->addAssign("level_3", "innerHTML", ""); } //Nivel 2 if ($level == 2 || $level == 3) { require_once 'libs/paloSantoNavigation.class.php'; $pMenu = new paloMenu($arrConf['elastix_dsn']['menu']); $arrMenu = $pMenu->cargar_menu(); $smarty = NULL; $pNav = new paloSantoNavigation($arrMenu, $smarty); $arrMenuLevel_2 = $pNav->getArrSubMenu($id_module_level_1); $level_2 = "<td align='left'><b>{$arrLangModule["Level 2"]}:</b></td>"; $level_2 .= "<td>"; $level_2 .= "<select onchange='mostrar_menu()' name='module_level_2' id='module_level_2'>"; $tmp_level_2 = ""; $tmp_id_module_level_2 = ""; $i = 0; foreach ($arrMenuLevel_2 as $key => $valor) { if ($i == 0) { $tmp_id_module_level_2 = $key; } if ($key == $id_module_level_2) { $tmp_level_2 = $key; $level_2 .= "<option value='{$key}' selected>{$valor['Name']}</option>"; } else { $level_2 .= "<option value='{$key}'>{$valor['Name']}</option>"; } $i++; } if ($tmp_level_2 == "") { $id_module_level_2 = $tmp_id_module_level_2; } $level_2 .= "</select>"; $level_2 .= "</td>"; $respuesta->addAssign("level_2", "innerHTML", $level_2); $respuesta->addAssign("level_3", "innerHTML", ""); } //Nivel 3 if ($level == 3) { $level_3 = "<td align='left'><b>{$arrLangModule["Level 3"]}:</b></td>"; require_once 'libs/paloSantoNavigation.class.php'; $pMenu = new paloMenu($arrConf['elastix_dsn']['menu']); $arrMenu = $pMenu->cargar_menu(); $smarty = NULL; $pNav = new paloSantoNavigation($arrMenu, $smarty); $arrMenuLevel_3 = $pNav->getArrSubMenu($id_module_level_2); if ($arrMenuLevel_3 && count($arrMenuLevel_3) > 0) { $level_3 = "<td align='left'><b>{$arrLangModule["Level 3"]}:</b></td>"; $level_3 .= "<td>"; $level_3 .= "<select onchange='mostrar_menu()' name='module_level_3' id='module_level_3'>"; foreach ($arrMenuLevel_3 as $key2 => $valor2) { if ($key2 == $id_module_level_3) { $level_3 .= "<option value='{$key2}' selected>{$valor2['Name']}</option>"; } else { $level_3 .= "<option value='{$key2}'>{$valor2['Name']}</option>"; } } $level_3 .= "</select>"; } else { $level_3 .= "<td align='left'>" . $arrLangModule["This module don't have level 3"] . "</td>"; } $level_3 .= "</td>"; $respuesta->addAssign("level_3", "innerHTML", $level_3); } return $respuesta; }