function formNetwork($smarty, $module_name, $local_templates_dir, $pNet, $arrEths) { $arrNetwork = $pNet->obtener_configuracion_red(); if (is_array($arrNetwork)) { $arrNetworkData['dns1'] = isset($arrNetwork['dns'][0]) ? $arrNetwork['dns'][0] : ''; $arrNetworkData['dns2'] = isset($arrNetwork['dns'][1]) ? $arrNetwork['dns'][1] : ''; $arrNetworkData['host'] = isset($arrNetwork['host']) ? $arrNetwork['host'] : ''; $arrNetworkData['gateway'] = isset($arrNetwork['gateway']) ? $arrNetwork['gateway'] : ''; } $arrFormNetwork = createFormNetwork(); $oForm = new paloForm($smarty, $arrFormNetwork); $oForm->setViewMode(); // SECCION ETHERNET LIST $arrData = array(); $end = count($arrEths); foreach ($arrEths as $idEth => $arrEth) { $arrTmp = array(); $arrTmp[0] = " <a href='?menu=network&action=editInterfase&id={$idEth}'>" . $arrEth['Name'] . "</a>"; $arrTmp[1] = strtoupper($arrEth['Type']); $arrTmp[2] = $arrEth['Inet Addr']; $arrTmp[3] = $arrEth['Mask']; $arrTmp[4] = $arrEth['HWaddr']; $arrTmp[5] = isset($arrEth['HW_info']) ? $arrEth['HW_info'] : ''; //- Deberia acotar este campo pues puede ser muy largo $arrTmp[6] = $arrEth['Running'] == "Yes" ? "<font color=green>" . _tr("Connected") . "</font>" : "<font color=red>" . _tr("Not Connected") . "</font>"; $arrData[] = $arrTmp; } $oGrid = new paloSantoGrid($smarty); $oGrid->pagingShow(false); $arrGrid = array("title" => _tr("Ethernet Interfaces List"), "icon" => "web/apps/{$module_name}/images/system_hardware_detector.png", "width" => "99%", "start" => "1", "end" => $end, "total" => $end, "columns" => array(0 => array("name" => _tr("Device"), "property1" => ""), 1 => array("name" => _tr("Type"), "property1" => ""), 2 => array("name" => _tr("IP"), "property1" => ""), 3 => array("name" => _tr("Mask"), "property1" => ""), 4 => array("name" => _tr("MAC Address"), "property1" => ""), 5 => array("name" => _tr("HW Info"), "property1" => ""), 6 => array("name" => _tr("Status"), "property1" => ""))); $htmlGrid = $oGrid->fetchGrid($arrGrid, $arrData); $smarty->assign("ETHERNET_INTERFASES_LIST", $htmlGrid); $smarty->assign("EDIT_PARAMETERS", _tr("Edit Network Parameters")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("icon", "web/apps/{$module_name}/images/system_network_network_parameters.png"); $strReturn = $oForm->fetchForm("{$local_templates_dir}/network.tpl", _tr("Network Parameters"), $arrNetworkData); return $strReturn; }
function viewFormEliminacióndebases($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pEliminacióndebases = new paloSantoEliminacióndebases($pDB); $arrFormEliminacióndebases = createFieldForm($pEliminacióndebases); $oForm = new paloForm($smarty, $arrFormEliminacióndebases); //begin, Form data persistence to errors and other events. $_DATA = $_POST; $action = getParameter("action"); $id = getParameter("id"); $smarty->assign("ID", $id); //persistence id with input hidden in tpl if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("save_edit")) { $oForm->setEditMode(); } } //end, Form data persistence to errors and other events. if ($action == "view" || $action == "view_edit") { // the action is to view or view_edit. $dataEliminacióndebases = $pEliminacióndebases->getEliminacióndebasesById($id); if (is_array($dataEliminacióndebases) & count($dataEliminacióndebases) > 0) { $_DATA = $dataEliminacióndebases; } else { $smarty->assign("mb_title", _tr("Error get Data")); $smarty->assign("mb_message", $pEliminacióndebases->errMsg); } } $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("IMG", "images/list.png"); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Eliminación de bases"), $_DATA); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function handleJSON_registerform($smarty, $module_name, $appletlist) { $respuesta = array('status' => 'success', 'message' => '(no message)'); $smarty->assign(array("SAVE" => _tr("Save"), "CANCEL" => _tr("Cancel"), "Card_Register" => _tr("Card Register"), 'MSG_UNREGISTERED' => _tr('Card has not been Registered'))); $oForm = new paloForm($smarty, $this->_getFormFields()); if (isset($_REQUEST['hwd'])) { $db = $this->_getdb(); $tupla = $db->getFirstRowQuery('SELECT * FROM car_system WHERE hwd = ?', TRUE, array($_REQUEST['hwd'])); if (is_array($tupla) && count($tupla) > 0) { $_REQUEST['vendor'] = $tupla['vendor']; $_REQUEST['num_serie'] = $tupla['num_serie']; if (!empty($tupla['num_serie'])) { // Tarjeta ya ha sido registrada $oForm->setViewMode(); } } } $local_templates_dir = dirname($_SERVER['SCRIPT_FILENAME']) . "/modules/{$module_name}/applets/TelephonyHardware/tpl"; $respuesta['title'] = _tr('Card Register'); $respuesta['html'] = $oForm->fetchForm("{$local_templates_dir}/_register.tpl", $respuesta['title'], $_REQUEST); $json = new Services_JSON(); Header('Content-Type: application/json'); return $json->encode($respuesta); }
function viewFormInterfazdeAgente($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pInterfazdeAgente = new paloSantoInterfazdeAgente($pDB); $oForm = new paloForm($smarty, $arrFormInterfazdeAgente); //begin, Form data persistence to errors and other events. $_DATA = $_POST; $action = getParameter("action"); $id = getParameter("id"); $smarty->assign("ID", $id); //persistence id with input hidden in tpl if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("save_edit")) { $oForm->setEditMode(); } } //end, Form data persistence to errors and other events. if ($action == "view" || $action == "view_edit") { // the action is to view or view_edit. $dataInterfazdeAgente = $pInterfazdeAgente->getInterfazdeAgenteById($id); if (is_array($dataInterfazdeAgente) & count($dataInterfazdeAgente) > 0) { $_DATA = $dataInterfazdeAgente; } else { $smarty->assign("mb_title", _tr("Error get Data")); $smarty->assign("mb_message", $pInterfazdeAgente->errMsg); } } $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("IMG", "images/list.png"); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Información del cliente"), $_DATA); $content = mostrarDatosClienteHTML($smarty, $pInterfazdeAgente); return $content; }
function _moduleContent(&$smarty, $module_name) { include_once "libs/paloSantoGrid.class.php"; include_once "libs/paloSantoDB.class.php"; include_once "libs/paloSantoForm.class.php"; include_once "libs/paloSantoConfig.class.php"; include_once "libs/paloSantoTrunk.class.php"; require_once "libs/misc.lib.php"; //include module files include_once "modules/{$module_name}/configs/default.conf.php"; $lang = get_language(); $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $lang_file = "modules/{$module_name}/lang/{$lang}.lang"; if (file_exists("{$base_dir}/{$lang_file}")) { include_once "{$lang_file}"; } else { include_once "modules/{$module_name}/lang/en.lang"; } //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 $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; $contenido = ''; $msgError = ''; $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*"); $arrConfig = $pConfig->leer_configuracion(false); $dsn = $arrConfig['AMPDBENGINE']['valor'] . "://" . $arrConfig['AMPDBUSER']['valor'] . ":" . $arrConfig['AMPDBPASS']['valor'] . "@" . $arrConfig['AMPDBHOST']['valor'] . "/asterisk"; $pDB = new paloDB($dsn); $pDBSetting = new paloDB($arrConf['elastix_dsn']['settings']); $pDBTrunk = new paloDB($arrConfModule['dsn_conn_database_1']); $arrForm = array("default_rate" => array("LABEL" => $arrLang["Default Rate"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "float", "VALIDATION_EXTRA_PARAM" => ""), "default_rate_offset" => array("LABEL" => $arrLang["Default Rate Offset"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "float", "VALIDATION_EXTRA_PARAM" => "")); $oForm = new paloForm($smarty, $arrForm); $oForm->setViewMode(); //obtener el valor de la tarifa por defecto $arrDefaultRate['default_rate'] = get_key_settings($pDBSetting, "default_rate"); $arrDefaultRate['default_rate_offset'] = get_key_settings($pDBSetting, "default_rate_offset"); $smarty->assign("EDIT", $arrLang["Edit"]); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $strReturn = $oForm->fetchForm("{$local_templates_dir}/default_rate.tpl", $arrLang["Default Rate Configuration"], $arrDefaultRate); if (isset($_POST['edit_default'])) { $arrDefaultRate['default_rate'] = get_key_settings($pDBSetting, "default_rate"); $arrDefaultRate['default_rate_offset'] = get_key_settings($pDBSetting, "default_rate_offset"); $oForm = new paloForm($smarty, $arrForm); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("SAVE", $arrLang["Save"]); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $strReturn = $oForm->fetchForm("{$local_templates_dir}/default_rate.tpl", $arrLang["Default Rate Configuration"], $arrDefaultRate); } else { if (isset($_POST['save_default'])) { $oForm = new paloForm($smarty, $arrForm); $arrDefaultRate['default_rate'] = $_POST['default_rate']; $arrDefaultRate['default_rate_offset'] = $_POST['default_rate_offset']; if ($oForm->validateForm($_POST)) { $bValido = set_key_settings($pDBSetting, 'default_rate', $arrDefaultRate['default_rate']); $bValido = set_key_settings($pDBSetting, 'default_rate_offset', $arrDefaultRate['default_rate_offset']); if (!$bValido) { echo $arrLang["Error when saving default rate"]; } else { header("Location: index.php?menu=billing_setup"); } } else { // Error $smarty->assign("mb_title", $arrLang["Validation Error"]); $smarty->assign("mb_message", $arrLang["Value for rate is not valid"]); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("SAVE", $arrLang["Save"]); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $strReturn = $oForm->fetchForm("{$local_templates_dir}/default_rate.tpl", $arrLang["Default Rate Configuration"], $arrDefaultRate); } } } $arrTrunks = array(); $arrData = array(); $arrTrunksBill = array(); //obtener todos los trunks $oTrunk = new paloTrunk($pDBTrunk); //obtener todos los trunks que son para billing //$arrTrunksBill=array("DAHDI/g0","DAHDI/g1"); getTrunksBillFiltrado($pDB, $oTrunk, $arrConfig, $arrTrunks, $arrTrunksBill); if (isset($_POST['submit_bill_trunks'])) { //obtengo las que estan guardadas y las que ahora no estan $selectedTrunks = isset($_POST['trunksBills']) ? array_keys($_POST['trunksBills']) : array(); if (count($selectedTrunks) > 0) { foreach ($selectedTrunks as $selectedTrunk) { $nuevaListaTrunks[] = base64_decode($selectedTrunk); } } else { $nuevaListaTrunks = array(); } $listaTrunksNuevos = array_diff($nuevaListaTrunks, $arrTrunksBill); $listaTrunksAusentes = array_diff($arrTrunksBill, $nuevaListaTrunks); //tengo que borrar los trunks ausentes //tengo que agregar los trunks nuevos // print_r($listaTrunksNuevos); //print_r($listaTrunksAusentes); if (count($listaTrunksAusentes) > 0) { $bExito = $oTrunk->deleteTrunksBill($listaTrunksAusentes); if (!$bExito) { $msgError = $oTrunk->errMsg; } } if (count($listaTrunksNuevos) > 0) { $bExito = $oTrunk->saveTrunksBill($listaTrunksNuevos); if (!$bExito) { $msgError .= $oTrunk->errMsg; } } if (!empty($msgError)) { $smarty->assign("mb_message", $msgError); } } getTrunksBillFiltrado($pDB, $oTrunk, $arrConfig, $arrTrunks, $arrTrunksBill); $end = count($arrTrunks); if (is_array($arrTrunks)) { foreach ($arrTrunks as $trunk) { $arrTmp = array(); $checked = in_array($trunk[1], $arrTrunksBill) ? "checked" : ""; $arrTmp[0] = "<input type='checkbox' name='trunksBills[" . base64_encode($trunk[1]) . "]' {$checked}>"; $arrTmp[1] = $trunk[1]; $arrData[] = $arrTmp; } } $arrGrid = array("title" => $arrLang["Trunk Bill Configuration"], "icon" => "/modules/{$module_name}/images/reports_billing_setup.png", "width" => "99%", "start" => $end == 0 ? 0 : 1, "end" => $end, "total" => $end, "columns" => array(0 => array("name" => "", "property1" => ""), 1 => array("name" => $arrLang["Trunk"], "property1" => ""))); $oGrid = new paloSantoGrid($smarty); $oGrid->pagingShow(false); $oGrid->customAction('submit_bill_trunks', _tr('Billing Capable')); $trunk_config = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang); if (strpos($trunk_config, '<form') === FALSE) { $trunk_config = "<form style='margin-bottom:0;' method='POST' action='?menu=billing_setup'>{$trunk_config}</form>"; } //mostrar los dos formularios $contenido .= $strReturn . $trunk_config; return $contenido; }
function viewFormOtherDestinations($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $arrOtherDestinations = array(); $action = getParameter("action"); $idOtherDestinations = getParameter("id"); if ($action == "view" || $action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idOtherDestinations)) { $error = _tr("Invalid Other Destination ID"); } else { $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pOtherDestinations = new paloSantoOtherDestinations($pDB, $domain); $arrOtherDestinations = $pOtherDestinations->getOtherDestinationsById($idOtherDestinations); if ($arrOtherDestinations === false) { $error = _tr($pOtherDestinations->errMsg); } else { if (count($arrOtherDestinations) == 0) { $error = _tr("Other Destination doesn't exist"); } else { if (getParameter("save_edit")) { $arrOtherDestinations = $_POST; } } } } if ($error != "") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $error); return reportOtherDestinations($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } else { // new, create if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_other_destination")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } $pOtherDestinations = new paloSantoOtherDestinations($pDB, $domain); if (getParameter("create_other_destination")) { $arrOtherDestinations["destdial"] = ""; $arrOtherDestinations["description"] = ""; } else { $arrOtherDestinations = $_POST; } } $arrFormOrgz = createFieldForm(); $oForm = new paloForm($smarty, $arrFormOrgz); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } //permission $arrAD = $pOtherDestinations->getAdditionalsDestinations(); $smarty->assign("arrAditionalsDestinations", $arrAD); $smarty->assign("EDIT_OD", in_array('edit', $arrPermission)); $smarty->assign("CREATE_OD", in_array('create', $arrPermission)); $smarty->assign("DEL_OD", in_array('delete', $arrPermission)); $smarty->assign("FeatureCodes", _tr("Feature Codes")); $smarty->assign("ShortcutApps", _tr("Shortcut Apps")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("OPTIONS", _tr("Options")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id", $idOtherDestinations); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Other Destinations"), $arrOtherDestinations); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormCrearcampaña($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pCrearcampaña = new paloSantoCrearcampaña($pDB); $arrFormCrearcampaña = createFieldForm($pDB); $oForm = new paloForm($smarty, $arrFormCrearcampaña); if (!is_array($arrFormCrearcampaña)) { // Si no es un arreglo, debe haber un error. $smarty->assign("mb_title", "Error"); // hago print de un string, no de un Array. $smarty->assign("mb_message", "<br>No es posible regestionar la campaña.<br>" . $arrFormCrearcampaña); return ""; } //begin, Form data persistence to errors and other events. $_DATA = $_POST; $action = getParameter("action"); $id = getParameter("id"); $smarty->assign("ID", $id); //persistence id with input hidden in tpl if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("save_edit")) { $oForm->setEditMode(); } } //end, Form data persistence to errors and other events. if ($action == "view" || $action == "view_edit") { // the action is to view or view_edit. $dataCrearcampaña = $pCrearcampaña->getCrearcampañaById($id); if (is_array($dataCrearcampaña) & count($dataCrearcampaña) > 0) { $_DATA = $dataCrearcampaña; } else { $smarty->assign("mb_title", _tr("Error get Data")); $smarty->assign("mb_message", $pCrearcampaña->errMsg); } } elseif ($_POST['save_edit'] != "Editar") { // si no está en modo view_edit, toca colocar la fecha de hoy en ambos campos $_DATA['fecha_inicio'] = date("Y-m-d"); $_DATA['fecha_fin'] = date("Y-m-d"); } $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("IMG", "images/list.png"); $smarty->assign("CAMPANIA_PADRE", $_DATA['nombre']); // La regestión hereda todo de la campaña padre. $smarty->assign("fecha_inicio", $_DATA['fecha_inicio']); $smarty->assign("fecha_fin", $_DATA['fecha_fin']); $smarty->assign("id_form", $_DATA['id_form']); $smarty->assign("script", $_DATA['script']); $_DATA['nombre'] = ""; // Para que aparezca en blanco el input del nombre if (isset($_POST['save_edit']) && $_POST['save_edit'] == "Editar") { $pCrearcampaña->actualizarCampania($_DATA); Header("Location: index.php?menu=hispana_listado_campanias"); } $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Regestionar campaña"), $_DATA); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormMoH($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials, $arrFiles = array()) { global $arrPermission; $error = ""; $arrMoH = array(); $action = getParameter("action"); if ($credentials['userlevel'] == 'superadmin') { $pMoH = new paloSantoMoH($pDB, ""); } else { $domain = $credentials['domain']; $pMoH = new paloSantoMoH($pDB, $domain); } $idMoH = getParameter("id_moh"); if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idMoH)) { $error = _tr("Invalid Music on Hold Class"); } $arrMoH = $pMoH->getMoHByClass($idMoH); $smarty->assign('NAME_MOH', $arrMoH["name"]); $smarty->assign('MODE_MOH', $arrMoH["mode_moh"]); if ($error == "") { if ($arrMoH === false) { $error = _tr($pMoH->errMsg); } else { if (count($arrMoH) == 0) { $error = _tr("MoH doesn't exist"); } else { $smarty->assign('j', 0); $smarty->assign('items', $arrMoH["listFiles"]); if (getParameter("save_edit")) { $arrMoH = $_POST; } } } } if ($error != "") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $error); return reportMoH($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } else { if ($credentials['userlevel'] == 'superadmin') { $pMoH = new paloSantoMoH($pDB, ""); } else { $pMoH = new paloSantoMoH($pDB, $domain); } $smarty->assign('j', 0); $smarty->assign('items', $arrFiles); $smarty->assign('arrFiles', "1"); $arrMoH = $_POST; } $arrForm = createFieldForm($pMoH->getAudioFormatAsterisk(), $credentials['userlevel'] == 'superadmin'); $oForm = new paloForm($smarty, $arrForm); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } //permission $smarty->assign("EDIT_MOH", in_array("edit", $arrPermission)); $smarty->assign("DEL_MOH", in_array("delete", $arrPermission)); //$smarty->assign("ERROREXT",_tr($pTrunk->errMsg)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("OPTIONS", _tr("Options")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_moh", $idMoH); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ADD_FILE", _tr("Add New file")); $max_upload = (int) ini_get('upload_max_filesize'); $max_post = (int) ini_get('post_max_size'); $memory_limit = (int) ini_get('memory_limit'); $upload_mb = min($max_upload, $max_post, $memory_limit) * 1048576; $smarty->assign("max_size", $upload_mb); $smarty->assign("alert_max_size", _tr("File size exceeds the limit. ")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("MoH Route"), $arrMoH); $content = "<form method='POST' enctype='multipart/form-data' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewQueue($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $arrQueue = array(); $action = getParameter("action"); $qname = getParameter("qname"); if ($action == "view" || $action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { if (!isset($qname)) { $error = _tr("Invalid Queue"); } else { $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pQueue = new paloQueuePBX($pDB, $domain); $arrTmp = $pQueue->getQueueByName($qname); if ($arrTmp === false) { $error = _tr("Error with database connection. ") . $pQueue->errMsg; } elseif (count($arrTmp) == false) { $error = _tr("Queue doesn't exist"); } else { $smarty->assign("QUEUE", $arrTmp["queue_number"]); if (getParameter("save_edit")) { $arrQueue = $_POST; } else { $arrMember = $pQueue->getQueueMembers($qname); if ($arrMember === false) { $error = _tr("Problems getting queue members. ") . $pQueue->errMsg; $arrMember = array(); } $arrQueue = showQueueSetting($arrTmp, $arrMember); } } } } else { if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_queue")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } $pQueue = new paloQueuePBX($pDB, $domain); if (getParameter("create_queue")) { $arrQueue = $pQueue->defaultOptions(); } else { $arrQueue = $_POST; } } if ($error != "") { $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", $error); return reportQueue($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } $category = $pQueue->getCategoryDefault($domain); if ($category === false) { $category = array(); } $res = $pQueue->getDefaultDestination($domain, $arrQueue["category"]); $destiny = $res == false ? array() : $res; $arrForm = createFieldForm($pQueue->getRecordingsSystem($domain), getArrayExtens($pDB, $domain), $category, $destiny, $pQueue->getMoHClass($domain)); $oForm = new paloForm($smarty, $arrForm); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } //permission $smarty->assign("EDIT_QUEUE", in_array('edit', $arrPermission)); $smarty->assign("CREATE_QUEUE", in_array('create', $arrPermission)); $smarty->assign("DEL_QUEUE", in_array('delete', $arrPermission)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("qname", $qname); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $smarty->assign("GENERAL", _tr("General")); $smarty->assign("MEMBERS", _tr("Queue Members")); $smarty->assign("ADVANCED", _tr("Advanced Options")); $smarty->assign("TIME_OPTIONS", _tr("Timing Options")); $smarty->assign("EMPTY_OPTIONS", _tr("Empty Options")); $smarty->assign("RECORDING", _tr("Recording Options")); $smarty->assign("ANN_OPTIONS", _tr("Announce Options")); $smarty->assign("PER_OPTIONS", _tr("Periodic Announce Options")); $smarty->assign("DEFAULT_DEST", _tr("Default Destination")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Queues"), $arrQueue); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormUser($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { $pACL = new paloACL($pDB); $pORGZ = new paloSantoOrganization($pDB); $arrFill = array(); $action = getParameter("action"); $arrOrgz = array(0 => "Select one Organization"); if ($credentials["userlevel"] == "superadmin") { $orgTmp = $pORGZ->getOrganization(array()); } else { $orgTmp = $pORGZ->getOrganization(array("id" => $credentials["id_organization"])); } if ($orgTmp === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pORGZ->errMsg)); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } elseif (count($orgTmp) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("You need yo have at least one organization created before you can create a user")); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if (($action == "new_user" || $action == "save_new") && count($orgTmp) <= 1) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("It's necesary you create a new organization so you can create new user")); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } foreach ($orgTmp as $value) { $arrOrgz[$value["id"]] = $value["name"]; $arrDomains[$value["id"]] = $value["domain"]; } $smarty->assign("ORGANIZATION", htmlentities($orgTmp[0]["name"], ENT_COMPAT, 'UTF-8')); } $idUser = getParameter("id"); $arrFill = $_POST; if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idUser)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid User")); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if ($credentials["userlevel"] == "superadmin") { $arrUsers = $pACL->getUsers($idUser); } else { $arrUsers = $pACL->getUsers($idUser, $credentials["id_organization"], null, null); } } if ($arrUsers === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pACL->errMsg)); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if (count($arrUsers) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("User doesn't exist")); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { $picture = $pACL->getUserPicture($idUser); if ($picture !== false) { $smarty->assign("ShowImg", 1); } foreach ($arrUsers as $value) { $arrFill["username"] = $value[1]; $arrFill["name"] = $value[2]; $arrFill["password1"] = ""; $arrFill["password2"] = ""; $arrFill["organization"] = $value[4]; $arrFill["group"] = $value[7]; $extu = isset($value[5]) ? $value[5] : _tr("Not assigned yet"); $extf = isset($value[6]) ? $value[6] : _tr("Not assigned yet"); $arrFill["extension"] = $extu; $arrFill["fax_extension"] = $extf; } if ($arrFill["organization"] != 1) { $smarty->assign("ORGANIZATION", htmlentities($arrOrgz[$arrFill["organization"]], ENT_COMPAT, 'UTF-8')); } $smarty->assign("USERNAME", $arrFill["username"]); $nGroup = $pACL->getGroupNameByid($arrFill["group"]); if ($nGroup == "superadmin") { } $nGroup = _tr("NONE"); $smarty->assign("GROUP", $nGroup); $_POST["organization"] = $arrFill["organization"]; //ahora obtenemos las configuraciones de fax dle usuario $pFax = new paloFax($pACL->_DB); $listFaxs = $pFax->getFaxList(array("exten" => $extf, "organization_domain" => $arrDomains[$arrFill["organization"]])); if ($listFaxs != false) { $faxUser = $listFaxs[0]; $arrFill["country_code"] = $faxUser["country_code"]; $arrFill["area_code"] = $faxUser["area_code"]; $arrFill["clid_number"] = $faxUser["clid_number"]; $arrFill["clid_name"] = $faxUser["clid_name"]; } //ahora obtenemos la cuenta del email $arrFill["email_quota"] = $pACL->getUserProp($idUser, "email_quota"); if ($idUser == "1") { $arrFill["email_contact"] = $pACL->getUserProp($idUser, "email_contact"); } $smarty->assign("EMAILQOUTA", $arrFill["email_quota"]); $smarty->assign("EXTENSION", $extu); $smarty->assign("FAX_EXTENSION", $extf); if (getParameter("save_edit")) { $arrFill = $_POST; } } } } if ($credentials["userlevel"] != "superadmin") { $idOrgSel = $credentials["id_organization"]; } else { $idOrgSel = getParameter("organization"); } if (!isset($idOrgSel)) { $idOrgSel = 0; } if ($idOrgSel == 0) { $arrGrupos = array(); } else { $temp = $pACL->getGroupsPaging(null, null, $idOrgSel); if ($temp === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pACL->errMsg)); return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentiasls); } foreach ($temp as $value) { $arrGrupos[$value[0]] = $value[1]; } } if (getParameter("create_user")) { $arrFill["country_code"] = $pORGZ->getOrganizationProp($idOrgSel, "country_code"); $arrFill["area_code"] = $pORGZ->getOrganizationProp($idOrgSel, "area_code"); $arrFill["email_quota"] = $pORGZ->getOrganizationProp($idOrgSel, "email_quota"); } $arrFormOrgz = createFieldForm($arrGrupos, $arrOrgz); $oForm = new paloForm($smarty, $arrFormOrgz); $smarty->assign("HEIGHT", "310px"); $smarty->assign("MARGIN_PIC", 'style="margin-top: 40px;"'); $smarty->assign("MARGIN_TAB", ""); if ($action == "view") { $smarty->assign("HEIGHT", "220px"); $smarty->assign("MARGIN_PIC", ""); $smarty->assign("MARGIN_TAB", "margin-top: 10px;"); $oForm->setViewMode(); $arrFill["password1"] = "*****"; $arrFill["password2"] = "*****"; $smarty->assign("HEIGHT", "220px"); } else { if (getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } global $arrPermission; if (in_array('create_user', $arrPermission)) { $smarty->assign("CREATE_USER", true); } if (in_array('edit_user', $arrPermission)) { $smarty->assign("EDIT_USER", true); } if (in_array('delete_user', $arrPermission)) { $smarty->assign("DEL_USER", true); } $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("icon", "../web/_common/images/user_info.png"); $smarty->assign("FAX_SETTINGS", _tr("Fax Settings")); $smarty->assign("EMAIL_SETTINGS", _tr("Email Settings")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("userLevel", $credentials["userlevel"]); $smarty->assign("id_user", $idUser); if (isset($arrUsers[0][1])) { $smarty->assign("isSuperAdmin", $pACL->isUserSuperAdmin($arrUsers[0][1])); } else { $smarty->assign("isSuperAdmin", FALSE); } $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("User"), $arrFill); $content = "<form method='POST' enctype='multipart/form-data' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormDatosbasicos($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pDatosbasicos = new paloSantoDatosbasicos($pDB); $arrFormDatosbasicos = createFieldForm(); $oForm = new paloForm($smarty, $arrFormDatosbasicos); $pDBSqlite = new paloDB("sqlite3:////var/www/db/acl.db"); $pACL = new paloACL($pDBSqlite); if ($pACL->isUserAdministratorGroup($_SESSION['elastix_user'])) { $smarty->assign("esAdmin", true); } else { $smarty->assign("esAdmin", false); } //begin, Form data persistence to errors and other events. $_DATA = $_POST; $action = getParameter("action"); if (isset($_SESSION['ci'])) { // si esta seteado la cedula en la session, procedo a editar $action = "view_edit"; } $id = getParameter("id"); $smarty->assign("ID", $id); //persistence id with input hidden in tpl if ($_GET["ci"]) { $smarty->assign("CI", getParameter("ci")); //persistence ci with input hidden in tpl $smarty->assign("action_edit", "yes"); //persistence ci with input hidden in tpl $_SESSION["ci"] = getParameter("ci"); } else { $smarty->assign("CI", $_SESSION['ci']); //persistence ci with input hidden in tpl } //Clientes Recargables if ($_GET["id_cliente"]) { $dataDatosbasicos = $pDatosbasicos->getDatosbasicosByIdCliente(getParameter("id_cliente")); $smarty->assign("CI", $dataDatosbasicos["ci"]); //persistence ci with input hidden in tpl $smarty->assign("action_edit", "yes"); //persistence ci with input hidden in tpl $_SESSION["id_cliente"] = getParameter("id_cliente"); $_SESSION["ci"] = $dataDatosbasicos["ci"]; } if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("save_edit")) { $oForm->setEditMode(); } } //end, Form data persistence to errors and other events. if ($action == "view" || $action == "view_edit") { // the action is to view or view_edit. // $dataDatosbasicos = $pDatosbasicos->getDatosbasicosById($id); // Cambiado para editar al cliente de la Sesión //if(!empty($_SESSION["id_campania_cliente_recargable"])){ // $dataDatosbasicos = $pDatosbasicos->getDatosbasicosByIdCampaniaRecargable($_SESSION['id_campania_cliente_recargable']); //}else{ $dataDatosbasicos = $pDatosbasicos->getDatosbasicosByCI($_SESSION['ci']); //} if ($_GET["id_cliente"]) { $dataDatosbasicos = $pDatosbasicos->getDatosbasicosByIdCliente($_SESSION['id_cliente']); $dataDatosbasicos["cedula"] = $dataDatosbasicos["ci"]; } if (is_array($dataDatosbasicos) & count($dataDatosbasicos) > 0) { $_DATA = $dataDatosbasicos; } else { $smarty->assign("mb_title", _tr("Error get Data")); $smarty->assign("mb_message", $pDatosbasicos->errMsg); } } if (empty($_DATA["cedula"])) { $_DATA["cedula"] = getParameter("ci"); } $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("IMG", "images/list.png"); $smarty->assign("IMG", "images/list.png"); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Datos básicos"), $_DATA); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function _moduleContent(&$smarty, $module_name) { include_once "libs/paloSantoForm.class.php"; include_once "libs/paloSantoFax.class.php"; include_once "libs/paloSantoDB.class.php"; //include module files include_once "modules/{$module_name}/configs/default.conf.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']); $lang_file = "modules/{$module_name}/lang/{$lang}.lang"; if (file_exists("{$base_dir}/{$lang_file}")) { include_once "{$lang_file}"; } else { include_once "modules/{$module_name}/lang/en.lang"; } //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']; $contenidoModulo = ''; $arrFormElements = array("name" => array("LABEL" => $arrLang["Virtual Fax Name"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "email" => array("LABEL" => $arrLang["Destination Email"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "email", "VALIDATION_EXTRA_PARAM" => ""), "extension" => array("LABEL" => "{$arrLang['Fax Extension']} (IAX)", "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "secret" => array("LABEL" => "{$arrLang['Secret']} (IAX)", "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "clid_name" => array("LABEL" => $arrLang["Caller ID Name"], "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "clid_number" => array("LABEL" => $arrLang["Caller ID Number"], "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "country_code" => array("LABEL" => $arrLang["Country Code"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "area_code" => array("LABEL" => $arrLang["Area Code"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "port" => array("LABEL" => "Port", "REQUIRED" => "no", "INPUT_TYPE" => "HIDDEN", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "dev_id" => array("LABEL" => "DevId", "REQUIRED" => "no", "INPUT_TYPE" => "HIDDEN", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "")); $oForm = new paloForm($smarty, $arrFormElements); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("APPLY_CHANGES", $arrLang["Apply changes"]); $smarty->assign("SAVE", $arrLang["Save"]); $smarty->assign("EDIT", $arrLang["Edit"]); $smarty->assign("DELETE", $arrLang["Delete"]); $smarty->assign("CONFIRM_CONTINUE", $arrLang["Are you sure you wish to continue?"]); $smarty->assign("icon", "/modules/{$module_name}/images/fax_virtual_fax_list.png"); if (isset($_POST['save'])) { if ($oForm->validateForm($_POST)) { // Exito, puedo procesar los datos ahora. $oFax = new paloFax(); // TODO: Debo revisar por errores aqui $oFax->createFaxExtension($_POST['name'], $_POST['extension'], $_POST['secret'], $_POST['email'], $_POST['clid_name'], $_POST['clid_number'], $_POST['country_code'], $_POST['area_code']); header("Location: ?menu=faxlist"); } else { // Error $smarty->assign("mb_title", $arrLang["Validation Error"]); $arrErrores = $oForm->arrErroresValidacion; $strErrorMsg = "<b>{$arrLang['The following fields contain errors']}:</b><br>"; foreach ($arrErrores as $k => $v) { $strErrorMsg .= "{$k}, "; } $strErrorMsg .= ""; $smarty->assign("mb_message", $strErrorMsg); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["New Virtual Fax"], $_POST); } } else { if (isset($_POST['apply_changes'])) { $oForm->setEditMode(); if ($oForm->validateForm($_POST)) { // Exito, puedo procesar los datos ahora. $oFax = new paloFax(); $oFax->editFaxExtension($_POST['id_fax'], $_POST['name'], $_POST['extension'], $_POST['secret'], $_POST['email'], $_POST['clid_name'], $_POST['clid_number'], $_POST['dev_id'], $_POST['port'], $_POST['country_code'], $_POST['area_code']); header("Location: ?menu=faxlist"); } else { // Error $smarty->assign("mb_title", $arrLang["Validation Error"]); $arrErrores = $oForm->arrErroresValidacion; $strErrorMsg = "<b>{$arrLang['The following fields contain errors']}:</b><br>"; foreach ($arrErrores as $k => $v) { $strErrorMsg .= "{$k}, "; } $strErrorMsg .= ""; $smarty->assign("mb_message", $strErrorMsg); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["Edit Virtual Fax"], $_POST); ///////////////////////////////// } } else { if (isset($_POST['delete'])) { //- TODO: Validar el id de fax $oFax = new paloFax(); $oFax->deleteFaxExtensionById($_POST['id_fax']); header("Location: ?menu=faxlist"); } else { if (isset($_POST['edit'])) { //- TODO: Tengo que validar que el id sea valido, si no es valido muestro un mensaje de error // Aqui hago un query por el id de fax $oFax = new paloFax(); $oForm->setEditMode(); // Esto es para activar el modo "edit" $arrFax = $oFax->getFaxById($_GET['id']); $smarty->assign("id_fax", $_GET['id']); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["Edit Virtual Fax"], $arrFax); // hay que pasar el arreglo } else { if (isset($_GET['action']) && $_GET['action'] == "view") { //- TODO: Tengo que validar que el id sea valido, si no es valido muestro un mensaje de error // Aqui hago un query por el id de fax $oFax = new paloFax(); $oForm->setViewMode(); // Esto es para activar el modo "preview" $arrFax = $oFax->getFaxById($_GET['id']); $smarty->assign("id_fax", $_GET['id']); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["View Virtual Fax"], $arrFax); // hay que pasar el arreglo } else { //incializar los valores if (!isset($_POST['name'])) { $_POST['name'] = ''; } if (!isset($_POST['email'])) { $_POST['email'] = ''; } if (!isset($_POST['extension'])) { $_POST['extension'] = ''; } if (!isset($_POST['secret'])) { $_POST['secret'] = ''; } if (!isset($_POST['clid_name'])) { $_POST['clid_name'] = ''; } if (!isset($_POST['clid_number'])) { $_POST['clid_number'] = ''; } if (!isset($_POST['port'])) { $_POST['port'] = ''; } if (!isset($_POST['dev_id'])) { $_POST['dev_id'] = ''; } if (!isset($_POST['country_code'])) { $_POST['country_code'] = ''; } if (!isset($_POST['area_code'])) { $_POST['area_code'] = ''; } $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["New Virtual Fax"], $_POST); } } } } } return $contenidoModulo; }
function listParameterFaxMail($smarty, $module_name, $local_templates_dir, $pDB, $credentials) { $arrData = array(); $oFax = new paloFax($pDB); global $arrPermission; $smarty->assign("EDIT", in_array('edit', $arrPermission)); if (getParameter("submit_apply_change")) { $arrParameterFaxMail = $_POST; } else { $arrParameterFaxMail = $oFax->getConfigurationSendingFaxMailOrg($credentials['id_organization']); if ($arrParameterFaxMail === false) { $smarty->assign("mb_title", "ERROR"); $smarty->assign("mb_message", "An error has ocurred to retrieved email fax configutaion"); } } // Definición del formulario $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("EDIT_PARAMETERS", _tr("Edit Parameters")); $smarty->assign("icon", "web/apps/{$module_name}/images/fax_email_template.png"); $arrFaxConfig = createForm(); $oForm = new paloForm($smarty, $arrFaxConfig); if (getParameter("submit_apply_change") || getParameter("submit_edit")) { $oForm->setEditMode(); } else { $oForm->setViewMode(); } return $oForm->fetchForm("{$local_templates_dir}/parameterFaxMail.tpl", _tr("Configuration Sending Fax Mail"), $arrParameterFaxMail); }
function viewFormIVR($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials, $arrDestine = array()) { global $arrPermission; $error = ""; $arrIvr = array(); $action = getParameter("action"); $idIVR = getParameter("id_ivr"); if ($action == "view" || $action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idIVR)) { $error = _tr("Invalid IVR"); } else { $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pIVR = new paloIvrPBX($pDB, $domain); $arrIVR = $pIVR->getIvrById($idIVR); if ($arrIVR === false) { $error = _tr($pIVR->errMsg); } else { if (count($arrIVR) == 0) { $error = _tr("IVR doesn't exist"); } else { //para que se muestren los destinos $smarty->assign('j', 0); $arrGoTo = $pIVR->getCategoryDefault($domain); $smarty->assign('arrGoTo', $arrGoTo); if ($action == "view" || getParameter("edit")) { $arrDestine = $pIVR->getArrDestine($idIVR); } $smarty->assign('items', $arrDestine); if (getParameter("save_edit")) { $arrIVR = $_POST; } $arrIVR["mesg_invalid"] = is_null($arrIVR["mesg_invalid"]) ? "none" : $arrIVR["mesg_invalid"]; $arrIVR["mesg_timeout"] = is_null($arrIVR["mesg_timeout"]) ? "none" : $arrIVR["mesg_timeout"]; $arrIVR["announcement"] = is_null($arrIVR["announcement"]) ? "none" : $arrIVR["announcement"]; if (isset($arrIVR["retvm"])) { if ($arrIVR["retvm"] == "yes") { $smarty->assign("CHECKED", "checked"); } } if (getParameter("retvm")) { $smarty->assign("CHECKED", "checked"); } } } } } else { if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_ivr")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } $pIVR = new paloIvrPBX($pDB, $domain); //para que se muestren los destinos $smarty->assign('j', 0); $arrGoTo = $pIVR->getCategoryDefault($domain); $smarty->assign('arrGoTo', $arrGoTo); $smarty->assign('items', $arrDestine); if (getParameter("create_ivr")) { $arrIVR["timeout"] = "10"; $arrIVR["loops"] = "2"; $arrIVR["directdial"] = "no"; } else { $arrIVR = $_POST; } } $arrFormOrgz = createFieldForm($pIVR->getRecordingsSystem($domain), $arrGoTo); $oForm = new paloForm($smarty, $arrFormOrgz); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } $smarty->assign("EDIT_IVR", in_array('edit', $arrPermission)); $smarty->assign("CREATE_IVR", in_array('create', $arrPermission)); $smarty->assign("DEL_IVR", in_array('delete', $arrPermission)); $smarty->assign("ERROREXT", _tr($pIVR->errMsg)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_ivr", $idIVR); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $smarty->assign("RETIVR", _tr("Return to IVR")); $smarty->assign("DIGIT", _tr("Exten")); $smarty->assign("OPTION", _tr("Option")); $smarty->assign("DESTINE", _tr("Destine")); $smarty->assign("GENERAL", _tr("General")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", "IVR", $arrIVR); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormOrganization($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { $pOrganization = new paloSantoOrganization($pDB); $pACL = new paloACL($pDB); $dataOrgz = false; $arrFill = $_POST; $action = getParameter("action"); $id = getParameter("id"); $check_e = isset($_POST["max_num_exten_chk"]) ? "checked" : ""; $check_q = isset($_POST["max_num_queues_chk"]) ? "checked" : ""; $check_u = isset($_POST["max_num_user_chk"]) ? "checked" : ""; $smarty->assign("edit_entity", 0); if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if ($id == "1") { //no se puede editar ni observar la organizacion principal $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid ID Organization")); return reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } if ($credentials['userlevel'] != "superadmin" && $id != $credentials['id_organization']) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Organization")); return reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } $dataOrgz = $pOrganization->getOrganizationById($id); if (is_array($dataOrgz) & count($dataOrgz) > 0) { $num_exten = $pOrganization->getOrganizationProp($id, "max_num_exten"); $num_queues = $pOrganization->getOrganizationProp($id, "max_num_queues"); $num_users = $pOrganization->getOrganizationProp($id, "max_num_user"); if ($credentials['userlevel'] != "superadmin") { $check_e = empty($num_exten) ? _tr("unlimited") : $num_exten; $check_q = empty($num_queues) ? _tr("unlimited") : $num_queues; $check_u = empty($num_users) ? _tr("unlimited") : $num_users; } if (!getParameter("save_edit")) { $arrFill['name'] = $dataOrgz['name']; $arrFill['country'] = $dataOrgz['country']; $arrFill['city'] = $dataOrgz['city']; $arrFill['address'] = $dataOrgz['address']; $arrFill['email_contact'] = $dataOrgz['email_contact']; $arrFill['country_code'] = $pOrganization->getOrganizationProp($id, "country_code"); $arrFill['area_code'] = $pOrganization->getOrganizationProp($id, "area_code"); $arrFill['quota'] = $pOrganization->getOrganizationProp($id, "email_quota"); $arrFill['domain'] = $dataOrgz['domain']; if ($credentials['userlevel'] == "superadmin") { if (empty($num_exten)) { $check_e = "checked"; } else { $check_e = ""; $arrFill["max_num_exten"] = $num_exten; } if (empty($num_queues)) { $check_q = "checked"; } else { $check_q = ""; $arrFill["max_num_queues"] = $num_queues; } if (empty($num_users)) { $check_u = "checked"; } else { $check_u = ""; $arrFill["max_num_user"] = $num_users; } } } $smarty->assign("domain_name", $dataOrgz['domain']); } else { $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("An error has ocurred to try retrieve organization data")); return reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } else { //solo el superadmin tiene permitido crear organizaciones if ($credentials['userlevel'] != "superadmin") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("You are not authorized to perform this action")); return reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } if (getParameter("new_organization")) { $arrFill['quota'] = 30; $check_e = "checked"; $check_u = "checked"; $check_q = "checked"; } } $smarty->assign("ID", $id); //persistence id with input hidden in tpl $smarty->assign("ORG_RESTRINCTION", _tr("Organization Limits")); $smarty->assign("UNLIMITED", _tr("unlimited")); $smarty->assign("CHECK_U", $check_u); $smarty->assign("CHECK_E", $check_e); $smarty->assign("CHECK_Q", $check_q); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("APLICAR_CAMBIOS", _tr("Apply Changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); // $smarty->assign("icon", "web/apps/organizaciones/images/organization.png"); //variable usadas en el tpl //estas acciones solosp pueden ser realizadas por el susperadmin global $arrPermission; if ($credentials['userlevel'] == "superadmin") { if (in_array('create_org', $arrPermission)) { $smarty->assign('CREATE_ORG', TRUE); } if (in_array('delete_org', $arrPermission)) { $smarty->assign('DELETE_ORG', TRUE); } } if (in_array('edit_org', $arrPermission)) { $smarty->assign('EDIT_ORG', TRUE); } $arrFormOrgz = createFieldForm(); $oForm = new paloForm($smarty, $arrFormOrgz); if ($action == "view") { $oForm->setViewMode(); $smarty->assign("edit_entity", 1); } else { if (getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); $smarty->assign("edit_entity", 1); } } $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Organization"), $arrFill); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormTC($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $arrRG = array(); $action = getParameter("action"); $idTC = getParameter("id_tc"); if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idTC)) { $error = _tr("Invalid Time Conditions"); } else { $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pTC = new paloSantoTC($pDB, $domain); $arrTC = $pTC->getTCById($idTC); if ($arrTC === false) { $error = _tr($pTC->errMsg); } else { if (count($arrTC) == 0) { $error = _tr("TC doesn't exist"); } else { if (getParameter("save_edit")) { $arrTC = $_POST; } } } } if ($error != "") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $error); return reportTC($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } else { if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_tc")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } $pTC = new paloSantoTC($pDB, $domain); if (getParameter("create_tc")) { $arrTC["goto_m"] = ""; $arrTC["goto_f"] = ""; } else { $arrTC = $_POST; } } $goto = $pTC->getCategoryDefault($domain); if ($goto === false) { $goto = array(); } $res1 = $pTC->getDefaultDestination($domain, $arrTC["goto_m"]); $destiny1 = $res1 == false ? array() : $res1; $res2 = $pTC->getDefaultDestination($domain, $arrTC["goto_f"]); $destiny2 = $res2 == false ? array() : $res2; $arrForm = createFieldForm($goto, $destiny1, $destiny2, $pTC->getTimeGroup()); $oForm = new paloForm($smarty, $arrForm); if ($action == "view") { $oForm->setViewMode(); } else { if (getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } //permission $smarty->assign("EDIT_TC", in_array('edit', $arrPermission)); $smarty->assign("CREATE_TC", in_array('create', $arrPermission)); $smarty->assign("DEL_TC", in_array('delete', $arrPermission)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("OPTIONS", _tr("Options")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_tc", $idTC); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $smarty->assign("SETDESTINATION_M", _tr("Destination If Match")); $smarty->assign("SETDESTINATION_F", _tr("Destination If Fail")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("TC Route"), $arrTC); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormDHCP_Configuration($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $edit = "true") { $pDHCP_Configuration = new paloSantoDHCP_Configuration($pDB); $arrFormDHCP_Configuration = createFieldForm(); $oForm = new paloForm($smarty, $arrFormDHCP_Configuration); //begin, Form data persistence to errors and other events. $_DATA = $_POST; $action = getParameter("action"); $id = getParameter("id"); $smarty->assign("ID", $id); //persistence id with input hidden in tpl if ($action == "view_dhcpconf") { $oForm->setViewMode(); } else { if ($edit == "true") { $oForm->setEditMode(); } } //end, Form data persistence to errors and other events. if ($action == "view_dhcpconf" || $edit == "true") { // the action is to view or view_edit. $dataDhcpConfig = $pDHCP_Configuration->leerInfoIPFija($id); if (is_array($dataDhcpConfig) & count($dataDhcpConfig) > 0) { $_DATA = $dataDhcpConfig; } else { $smarty->assign("mb_title", _tr('Error get Data')); $smarty->assign("mb_message", $pDHCP_Configuration->errMsg); } } $smarty->assign("SAVE", _tr('Save')); $smarty->assign("EDIT", _tr('Edit')); $smarty->assign("CANCEL", _tr('Cancel')); $smarty->assign("REQUIRED_FIELD", _tr('Required field')); $smarty->assign("icon", "modules/{$module_name}/images/system_network_assign_ip_address.png"); $smarty->assign("HOST_NAME", _tr('ex_hostname')); $smarty->assign("IP_ADDRESS", _tr('ex_ipaddress')); $smarty->assign("MAC_ADDRESS", _tr('ex_mac_address')); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr('Assign IP Address to Host'), $_DATA); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormExten($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $pExten = new paloSantoExtensions($pDB); $error = ""; $arrExten = array(); $action = getParameter("action"); $smarty->assign("DIV_VM", "yes"); $idExten = getParameter("id_exten"); if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idExten)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Exten")); return reportExten($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $arrExten = $pExten->getExtensionById($idExten, $domain); if ($arrExten === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pExten->errMsg)); return reportExten($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if (count($arrExten) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Extension doesn't exist")); return reportExten($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { $smarty->assign("EXTEN", $arrExten["exten"]); if ($arrExten["technology"] == "iax2") { $tech = "iax2"; $smarty->assign("isIax", TRUE); $smarty->assign("TECHNOLOGY", strtoupper("Iax2")); } elseif ($arrExten["technology"] == "sip") { $tech = "sip"; $smarty->assign("TECHNOLOGY", strtoupper("Sip")); } else { $tech = null; } //comprabar si la extension pertence a un usuario, //si pertenece a un usuario el secret no puede ser modificado $belonguser = extenBelongToUser($pDB, $arrExten["exten"], $arrExten["domain"]); if ($belonguser) { $smarty->assign("USER_EXTEN", false); } else { $smarty->assign("USER_EXTEN", true); } if (getParameter("save_edit")) { $arrExten = $_POST; } $smarty->assign("DISPLAY_VM", "style='display: none;'"); if (isset($arrExten["create_vm"])) { if ($arrExten["create_vm"] == "yes") { $smarty->assign("VALVM", "value='yes'"); $smarty->assign("CHECKED", "checked"); $smarty->assign("DISPLAY_VM", "style='visibility: visible;'"); } else { if ($action == "view") { $smarty->assign("DIV_VM", "no"); } else { $arrVM = $pExten->getVMdefault($domain); $arrExten["vmcontext"] = $arrVM["vmcontext"]; $arrExten["vmattach"] = $arrVM["vmattach"]; $arrExten["vmdelete"] = $arrVM["vmdelete"]; $arrExten["vmsaycid"] = $arrVM["vmsaycid"]; $arrExten["vmenvelope"] = $arrVM["vmenvelope"]; $arrExten["vmemailsubject"] = $arrVM["vmemailsubject"]; $arrExten["vmemailbody"] = $arrVM["vmemailbody"]; $arrExten["vmx_locator"] = "enabled"; $arrExten["vmx_use"] = "both"; $arrExten["vmx_operator"] = "on"; } } } } } } else { $tech = null; $smarty->assign("USER_EXTEN", true); if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_exten")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } if (getParameter("create_exten")) { $arrExten["technology"] = "sip"; $arrExten = $pExten->getDefaultSettings($domain, "sip"); } else { $arrExten = $_POST; } if (isset($_POST["create_vm"])) { $smarty->assign("VALVM", "value='yes'"); $smarty->assign("CHECKED", "checked"); } } $arrFormOrgz = createFieldForm($tech); $oForm = new paloForm($smarty, $arrFormOrgz); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); $mostrar = getParameter("mostra_adv"); if (isset($mostrar)) { if ($mostrar == "yes") { $smarty->assign("SHOW_MORE", "style='visibility: visible;'"); $smarty->assign("mostra_adv", "yes"); } else { $smarty->assign("SHOW_MORE", "style='display: none;'"); $smarty->assign("mostra_adv", "no"); } } else { $smarty->assign("SHOW_MORE", "style='display: none;'"); $smarty->assign("mostra_adv", "yes"); } } } //permission $smarty->assign("EDIT_EXTEN", in_array('edit', $arrPermission)); $smarty->assign("CREATE_EXTEN", in_array('create', $arrPermission)); $smarty->assign("DEL_EXTEN", in_array('delete', $arrPermission)); $smarty->assign("ERROREXT", _tr($pExten->errMsg)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("VOICEMAIL_SETTINGS", _tr("Voicemail Settings")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_exten", $idExten); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $smarty->assign("CREATE_VM", _tr("Enabled Voicemail")); $smarty->assign("DEV_OPTIONS", _tr("Device Settings")); $smarty->assign("ADV_OPTIONS", _tr("Advanced Settings")); $smarty->assign("DICT_OPTIONS", _tr("Dictation Settings")); $smarty->assign("REC_OPTIONS", _tr("Recording Settings")); $smarty->assign("VM_OPTIONS", _tr("Voicemail Settings")); $smarty->assign("EXTENSION", _tr("GENERAL")); $smarty->assign("DEVICE", _tr("DEVICE")); $smarty->assign("VOICEMAIL", _tr("VOICEMAIL")); $smarty->assign("LOCATOR", _tr("Vmx Locator")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Extensions"), $arrExten); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormIngresodeBasedeClientes($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pIngresodeBasedeClientes = new paloSantoIngresodeBasedeClientes($pDB); $arrFormIngresodeBasedeClientes = createFieldForm($pDB); if (!is_array($arrFormIngresodeBasedeClientes)) { return $arrFormIngresodeBasedeClientes; } $oForm = new paloForm($smarty, $arrFormIngresodeBasedeClientes); //begin, Form data persistence to errors and other events. $_DATA = $_POST; $action = getParameter("action"); $id = getParameter("id"); $smarty->assign("ID", $id); //persistence id with input hidden in tpl if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("save_edit")) { $oForm->setEditMode(); } } //end, Form data persistence to errors and other events. if ($action == "view" || $action == "view_edit") { // the action is to view or view_edit. $dataIngresodeBasedeClientes = $pIngresodeBasedeClientes->getIngresodeBasedeClientesById($id); if (is_array($dataIngresodeBasedeClientes) & count($dataIngresodeBasedeClientes) > 0) { $_DATA = $dataIngresodeBasedeClientes; } else { $smarty->assign("mb_title", _tr("Error get Data")); $smarty->assign("mb_message", $pIngresodeBasedeClientes->errMsg); } } $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("IMG", "images/list.png"); //Editar base $edit_base = getParameter("edit_base"); $id_base = getParameter("id_base"); $id_campania = getParameter("id_campania"); if ($edit_base == "si") { $base = $pIngresodeBasedeClientes->getDatosBase($id_base, $id_campania); $_DATA = $base; $smarty->assign("view_edit", "si"); $smarty->assign("id_campania", $id_campania); $smarty->assign("id_base", $id_base); } $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Ingreso de Base de Clientes"), $_DATA); $content = "<form method='POST' enctype='multipart/form-data' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function NewViewPuerto($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $action) { $arrFormNew = createFieldFormNew(); $oForm = new paloForm($smarty, $arrFormNew); $titulo = ""; $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("icon", "images/list.png"); $protocol = getParameter("protocol"); if ($action == 'new') { $smarty->assign("SAVE", _tr("Save")); if ($protocol == "ICMP") { $smarty->assign("port_style", "style = 'display:none;'"); $smarty->assign("protocol_style", "style = 'display:none;'"); } elseif ($protocol == "IP") { $smarty->assign("port_style", "style = 'display:none;'"); $smarty->assign("type_style", "style = 'display:none;'"); $smarty->assign("code_style", "style = 'display:none;'"); } else { $smarty->assign("protocol_style", "style = 'display:none;'"); $smarty->assign("type_style", "style = 'display:none;'"); $smarty->assign("code_style", "style = 'display:none;'"); } $titulo = _tr('Define Port'); } else { if ($action == 'edit') { $id = $_POST['idtemp']; $smarty->assign("IDTEMP", $id); $smarty->assign("SAVE", _tr("Save")); $oPalo = new paloSantoPortService($pDB); $result = $oPalo->loadPuerto($id); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("IDTEMP", $id); $_POST['name'] = $result['name']; $_POST['protocol'] = $result['protocol']; if ($result['protocol'] == "TCP" || $result['protocol'] == "UDP") { $hasGuion = 'yes'; $arrPort = explode(':', $result['details']); $_POST['port'] = $arrPort[0]; $_POST['port2'] = isset($arrPort[1]) ? $arrPort[1] : ''; $smarty->assign("type_style", "style = 'display:none;'"); $smarty->assign("code_style", "style = 'display:none;'"); $smarty->assign("protocol_style", "style = 'display:none;'"); if ($_POST['port2'] == '') { $hasGuion = 'no'; } $smarty->assign("HAS", $hasGuion); } elseif ($result['protocol'] == "ICMP") { $smarty->assign("port_style", "style = 'display:none;'"); $smarty->assign("protocol_style", "style = 'display:none;'"); $value = explode(":", $result['details']); $_POST['type'] = $value[0]; $_POST['code'] = $value[1]; } else { $smarty->assign("port_style", "style = 'display:none;'"); $smarty->assign("type_style", "style = 'display:none;'"); $smarty->assign("code_style", "style = 'display:none;'"); $_POST['protocol_number'] = $result['details']; } $_POST['comment'] = $result['comment']; $titulo = _tr('Edit Port'); } else { if ($action == 'view') { $id = $_GET['id']; $oPalo = new paloSantoPortService($pDB); $result = $oPalo->loadPuerto($id); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("IDTEMP", $id); $_POST['name'] = $result['name']; $_POST['protocol'] = $result['protocol']; if ($result['protocol'] == "TCP" || $result['protocol'] == "UDP") { $hasGuion = 'yes'; $arrPort = explode(':', $result['details']); $_POST['port'] = $arrPort[0]; $_POST['port2'] = isset($arrPort[1]) ? $arrPort[1] : ''; $smarty->assign("type_style", "style = 'display:none;'"); $smarty->assign("code_style", "style = 'display:none;'"); $smarty->assign("protocol_style", "style = 'display:none;'"); if ($_POST['port2'] == '') { $hasGuion = 'no'; } $smarty->assign("HAS", $hasGuion); } elseif ($result['protocol'] == "ICMP") { $smarty->assign("port_style", "style = 'display:none;'"); $smarty->assign("protocol_style", "style = 'display:none;'"); $value = explode(":", $result['details']); $_POST['type'] = $value[0]; $_POST['code'] = $value[1]; } else { $smarty->assign("port_style", "style = 'display:none;'"); $smarty->assign("type_style", "style = 'display:none;'"); $smarty->assign("code_style", "style = 'display:none;'"); $_POST['protocol_number'] = $result['details']; } $_POST['comment'] = $result['comment']; $oForm->setViewMode(); $titulo = _tr('View Port'); } } } $smarty->assign("MODE", $action); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", $titulo, $_POST); $contenidoModulo = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $contenidoModulo; }
function viewFormAnnouncement($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $arrAnnouncement = array(); $action = getParameter("action"); $idAnnouncement = getParameter("id_ann"); if ($action == "view" || $action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idAnnouncement)) { $error = _tr("Invalid Announcement ID"); } else { $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pAnnouncement = new paloSantoAnnouncement($pDB, $domain); $arrAnnouncement = $pAnnouncement->getAnnouncementById($idAnnouncement); if ($arrAnnouncement === false) { $error = _tr($pAnnouncement->errMsg); } else { if (count($arrAnnouncement) == 0) { $error = _tr("Announcement doesn't exist"); } else { if (getParameter("save_edit")) { $arrAnnouncement = $_POST; } } } } if ($error != "") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $error); return reportAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } else { // new, create if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_announcement")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } $pAnnouncement = new paloSantoAnnouncement($pDB, $domain); if (getParameter("create_announcement")) { $arrAnnouncement["description"] = ""; $arrAnnouncement["recording_id"] = "none"; $arrAnnouncement["allow_skip"] = "no"; $arrAnnouncement["return_ivr"] = "no"; $arrAnnouncement["noanswer"] = "no"; $arrAnnouncement["repeat_msg"] = "disable"; $arrAnnouncement["destination"] = ""; $arrAnnouncement["goto"] = ""; } else { $arrAnnouncement = $_POST; } } $goto = $pAnnouncement->getCategoryDefault($domain); if ($goto === false) { $goto = array(); } $res = $pAnnouncement->getDefaultDestination($domain, $arrAnnouncement["goto"]); $destiny = $res == false ? array() : $res; $arrFormOrgz = createFieldForm($goto, $destiny, $pDB, $domain); $oForm = new paloForm($smarty, $arrFormOrgz); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } //permission $smarty->assign("EDIT_ANN", in_array('edit', $arrPermission)); $smarty->assign("CREATE_ANN", in_array('create', $arrPermission)); $smarty->assign("DEL_ANN", in_array('delete', $arrPermission)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("OPTIONS", _tr("Options")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_ann", $idAnnouncement); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Announcement"), $arrAnnouncement); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormOutbound($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials, $arrDialPattern = array()) { global $arrPermission; $error = ""; $arrOutbound = array(); $action = getParameter("action"); $idOutbound = getParameter("id_outbound"); if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idOutbound)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Outbound")); return reportOutbound($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pOutbound = new paloSantoOutbound($pDB, $domain); $arrOutbound = $pOutbound->getOutboundById($idOutbound); if ($arrOutbound === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pOutbound->errMsg)); return reportOutbound($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if (count($arrOutbound) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Outbound doesn't exist")); return reportOutbound($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if ($arrOutbound["outcid_mode"] == "on") { $check_mode = "CHECKED"; } else { $check_mode = ""; } $smarty->assign("CHECKED_MODE", $check_mode); $smarty->assign('j', 0); $smarty->assign('k', 0); $arrAllTrunks = $arrTrunks = $pOutbound->getTrunks(); $arrTrunk = getParameter("arrTrunks"); if (sizeof($arrTrunk) == 0 || $arrTrunk == "" || !isset($arrTrunk)) { $arrTrunkPriority = $pOutbound->getArrTrunkPriority($idOutbound); $smarty->assign('trunks', $arrTrunkPriority); if (is_array($arrAllTrunks) && is_array($arrTrunkPriority)) { $arrDif = array_diff_assoc($arrAllTrunks, $arrTrunkPriority); } else { $arrDif = array(); } $smarty->assign('arrDif', $arrDif); } else { $arrTrunks = array(); $tmp = explode(",", $arrTrunk); $arrTrunk = array_values(array_diff($tmp, array(''))); if (is_array($arrTrunk) && is_array($arrAllTrunks)) { $arrTrunks = array_intersect($arrTrunk, array_keys($arrAllTrunks)); } $arrTrunkPriority = array(); foreach ($arrTrunks as $trunk) { $val = $pOutbound->getTrunkById($trunk); $arrTrunkPriority[$val["trunkid"]] = $val["name"] . "/" . strtoupper($val["tech"]); } $smarty->assign('trunks', $arrTrunkPriority); $arrDif = array_diff_assoc($arrAllTrunks, $arrTrunkPriority); $smarty->assign('arrDif', $arrDif); } if ($action == "view" || getParameter("edit")) { $arrDialPattern = $pOutbound->getArrDestine($idOutbound); } $smarty->assign('items', $arrDialPattern); if (getParameter("save_edit")) { $arrOutbound = $_POST; } } } } else { $arrOutbound = $_POST; $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pOutbound = new paloSantoOutbound($pDB, $domain); $domain = $pOutbound->getDomain(); if (empty($domain)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Organization")); return reportOutbound($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } $smarty->assign('j', 0); $smarty->assign('items', $arrDialPattern); $arrTrunks = array(); //todas las truncales que han sido asignadas a la organizacion $arrAllTrunks = $pOutbound->getTrunks(); //conjunto de id de las truncales que han sido seleccionadas para la ruta $arrTrunk = getParameter("arrTrunks"); $tmp = explode(",", $arrTrunk); $arrTrunk = array_values(array_diff($tmp, array(''))); //verifico que los indices de las truncales dadas existan y que hayan sido asiganados a la organizacion if (is_array($arrTrunk) && is_array($arrAllTrunks)) { $arrTrunks = array_intersect($arrTrunk, array_keys($arrAllTrunks)); } $arrTrunkPriority = array(); foreach ($arrTrunks as $trunk) { $val = $pOutbound->getTrunkById($trunk); $arrTrunkPriority[$val["trunkid"]] = $val["name"] . "/" . strtoupper($val["tech"]); } $smarty->assign('trunks', $arrTrunkPriority); $arrDif = array_diff_assoc($arrAllTrunks, $arrTrunkPriority); $smarty->assign('arrDif', $arrDif); } $arrForm = createFieldForm($pDB, $domain); $oForm = new paloForm($smarty, $arrForm); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } $smarty->assign("EDIT_ROUTE", in_array('edit', $arrPermission)); $smarty->assign("CREATE_ROUTE", in_array('create', $arrPermission)); $smarty->assign("DELETE_ROUTE", in_array('delete', $arrPermission)); //$smarty->assign("ERROREXT",_tr($pTrunk->errMsg)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_outbound", $idOutbound); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $smarty->assign("CALLERID", _tr("Caller Id")); $smarty->assign("PREPEND", _tr("Prepend")); $smarty->assign("PREFIX", _tr("Prefix")); $smarty->assign("MATCH_PATTERN", _tr("Match Pattern")); $smarty->assign("RULES", _tr("Dial Patterns")); $smarty->assign("GENERAL", _tr("General")); $smarty->assign("TRUNK_SEQUENCE", _tr("Trunk Sequence for Matched Routes")); $smarty->assign("DRAGANDDROP", _tr("Drag and Drop Trunk into Sequence Trunk Area")); $smarty->assign("TRUNKS", _tr("TRUNKS")); $smarty->assign("SEQUENCE", _tr("TRUNKS SEQUENCE")); $smarty->assign("SETTINGS", _tr("Settings")); $smarty->assign("PEERDETAIL", _tr("PEER Details")); $smarty->assign("USERDETAIL", _tr("USER Details")); $smarty->assign("REGISTRATION", _tr("Registration")); $smarty->assign("OUTGOING_SETTINGS", _tr("Outgoing Settings")); $smarty->assign("INCOMING_SETTINGS", _tr("Incoming Settings")); $smarty->assign("OVEREXTEN", _tr("Override Extension")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Outbound Route"), $arrOutbound); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormGroup($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $userLevel1, $userAccount, $idOrganization) { $pACL = new paloACL($pDB); $pORGZ = new paloSantoOrganization($pDB); $arrFill = array(); $action = getParameter("action"); $arrOrgz = array(0 => _tr("Select one Organization")); if ($userLevel1 == "superadmin") { $orgTmp = $pORGZ->getOrganization(array()); } else { $orgTmp = $pORGZ->getOrganization(array("id" => $idOrganization)); } if ($orgTmp === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pORGZ->errMsg)); return reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); } else { if (count($orgTmp) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("You haven't created any organization")); return reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); } foreach ($orgTmp as $value) { $arrOrgz[$value["id"]] = $value["name"]; } } $idGroup = getParameter("id"); $arrFill = $_POST; if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idGroup)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Group")); return reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); } else { if ($userLevel1 == "superadmin") { $arrGroup = $pACL->getGroups($idGroup); } else { $arrGroup = $pACL->getGroups($idGroup, $idOrganization); } } if ($arrGroup === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pACL->errMsg)); return reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); } elseif (count($arrGroup) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Group doesn't exist")); return reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); } else { if ($arrGroup[0][3] == 1) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Group doesn't exist")); return reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); } $arrFill["group"] = _tr($arrGroup[0][1]); $arrFill["description"] = _tr($arrGroup[0][2]); $arrFill["organization"] = $arrGroup[0][3]; $smarty->assign("GROUP", $arrFill["group"]); $smarty->assign("ORGANIZATION", $arrOrgz[$arrFill["organization"]]); } if (getParameter("save_edit")) { $arrFill["description"] = $_POST["description"]; } } $arrFormGroup = createFieldForm($arrOrgz); $oForm = new paloForm($smarty, $arrFormGroup); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } global $arrPermission; if (in_array('create_group', $arrPermission)) { $smarty->assign("CREATE_GROUP", true); } if (in_array('edit_group', $arrPermission)) { $smarty->assign("EDIT_GROUP", true); } if (in_array('delete_group', $arrPermission)) { $smarty->assign("DELETE_GROUP", true); } $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("icon", "web/apps/{$module_name}/images/system_groups.png"); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("USERLEVEL", $userLevel1); $smarty->assign("id_group", $idGroup); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("Group"), $arrFill); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function _moduleContent(&$smarty, $module_name) { include_once "libs/paloSantoDB.class.php"; include_once "libs/paloSantoGrid.class.php"; include_once "libs/paloSantoACL.class.php"; include_once "modules/{$module_name}/configs/default.conf.php"; load_language_module($module_name); //global variables global $arrConf; global $arrConfModule; $arrConf = array_merge($arrConf, $arrConfModule); /////conexion a php $pDB = new paloDB($arrConf['elastix_dsn']['acl']); //folder path for custom templates $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; if (!empty($pDB->errMsg)) { echo "ERROR DE DB: {$pDB->errMsg} <br>"; } $arrData = array(); $pACL = new paloACL($pDB); if (!empty($pACL->errMsg)) { echo "ERROR DE ACL: {$pACL->errMsg} <br>"; } $arrFormElements = array("description" => array("LABEL" => _tr("Description"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "group" => array("LABEL" => _tr("Group"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "")); //description id name $contenidoModulo = ""; $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("icon", "modules/{$module_name}/images/system_groups.png"); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); if (isset($_POST['submit_create_group'])) { // Implementar include_once "libs/paloSantoForm.class.php"; $arrFillGroup['group'] = ''; $arrFillGroup['description'] = ''; $oForm = new paloForm($smarty, $arrFormElements); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("New Group"), $arrFillGroup); } else { if (isset($_POST['edit'])) { // Tengo que recuperar la data del usuario $pACL = new paloACL($pDB); $arrGroup = $pACL->getGroups($_POST['id_group']); if (!is_array($arrGroup)) { $contenidoModulo = ''; Header("Location: ?menu={$module_name}"); } else { if ($arrGroup[0][1] == 'administrator') { $arrGroup[0][1] = _tr('administrator'); } else { if ($arrGroup[0][1] == 'operator') { $arrGroup[0][1] = _tr('operator'); } else { if ($arrGroup[0][1] == 'extension') { $arrGroup[0][1] = _tr('extension'); } } } if ($arrGroup[0][2] == 'total access') { $arrGroup[0][2] = _tr('total access'); } else { if ($arrGroup[0][2] == 'operator') { $arrGroup[0][2] = _tr('operator'); } else { if ($arrGroup[0][2] == 'extension user') { $arrGroup[0][2] = _tr('extension user'); } } } $arrFillGroup['group'] = $arrGroup[0][1]; $arrFillGroup['description'] = $arrGroup[0][2]; // Implementar include_once "libs/paloSantoForm.class.php"; $oForm = new paloForm($smarty, $arrFormElements); $oForm->setEditMode(); $smarty->assign("id_group", htmlspecialchars($_POST['id_group'], ENT_COMPAT, 'UTF-8')); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr('Edit Group') . " \"" . $arrFillGroup['group'] . "\"", $arrFillGroup); } } else { if (isset($_POST['submit_save_group'])) { include_once "libs/paloSantoForm.class.php"; $oForm = new paloForm($smarty, $arrFormElements); if ($oForm->validateForm($_POST)) { // Exito, puedo procesar los datos ahora. $pACL = new paloACL($pDB); // Creo el Grupo $pACL->createGroup($_POST['group'], $_POST['description']); if (!empty($pACL->errMsg)) { // Ocurrio algun error aqui $smarty->assign("mb_message", "ERROR: {$pACL->errMsg}"); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("New Group"), $_POST); } else { header("Location: ?menu=grouplist"); } } else { // Error $smarty->assign("mb_title", _tr("Validation Error")); $arrErrores = $oForm->arrErroresValidacion; $strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br>"; foreach ($arrErrores as $k => $v) { $strErrorMsg .= "{$k}, "; } $strErrorMsg .= ""; $smarty->assign("mb_message", $strErrorMsg); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("New Group"), $_POST); } } else { if (isset($_POST['submit_apply_changes'])) { $arrGroup = $pACL->getGroups($_POST['id_group']); if (!is_array($arrGroup)) { $contenidoModulo = ''; Header("Location: ?menu={$module_name}"); } else { $group = $arrGroup[0][1]; $description = $arrGroup[0][2]; include_once "libs/paloSantoForm.class.php"; $oForm = new paloForm($smarty, $arrFormElements); $oForm->setEditMode(); if ($oForm->validateForm($_POST)) { // Exito, puedo procesar los datos ahora. $pACL = new paloACL($pDB); if (!$pACL->updateGroup($_POST['id_group'], $_POST['group'], $_POST['description'])) { // Ocurrio algun error aqui $smarty->assign("mb_message", "ERROR: {$pACL->errMsg}"); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("Edit Group"), $_POST); } else { header("Location: ?menu=grouplist"); } } else { // Manejo de Error $smarty->assign("mb_title", _tr("Validation Error")); $arrErrores = $oForm->arrErroresValidacion; $strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br>"; foreach ($arrErrores as $k => $v) { $strErrorMsg .= "{$k}, "; } $strErrorMsg .= ""; $smarty->assign("mb_message", $strErrorMsg); $arrFillGroup['group'] = $_POST['group']; $arrFillGroup['description'] = $_POST['description']; $smarty->assign("id_group", htmlspecialchars($_POST['id_group'], ENT_COMPAT, 'UTF-8')); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("Edit Group"), $arrFillGroup); } } } else { if (isset($_GET['action']) && $_GET['action'] == "view") { include_once "libs/paloSantoForm.class.php"; $oForm = new paloForm($smarty, $arrFormElements); //- TODO: Tengo que validar que el id sea valido, si no es valido muestro un mensaje de error $oForm->setViewMode(); // Esto es para activar el modo "preview" $arrGroup = $pACL->getGroups($_GET['id']); if (!is_array($arrGroup)) { $contenidoModulo = ''; Header("Location: ?menu={$module_name}"); } else { // Conversion de formato if ($arrGroup[0][1] == 'administrator') { $arrGroup[0][1] = _tr('administrator'); } else { if ($arrGroup[0][1] == 'operator') { $arrGroup[0][1] = _tr('operator'); } else { if ($arrGroup[0][1] == 'extension') { $arrGroup[0][1] = _tr('extension'); } } } if ($arrGroup[0][2] == 'total access') { $arrGroup[0][2] = _tr('total access'); } else { if ($arrGroup[0][2] == 'operator') { $arrGroup[0][2] = _tr('operator'); } else { if ($arrGroup[0][2] == 'extension user') { $arrGroup[0][2] = _tr('extension user'); } } } $arrTmp['group'] = $arrGroup[0][1]; $arrTmp['description'] = $arrGroup[0][2]; $smarty->assign("id_group", htmlspecialchars($_GET['id'], ENT_COMPAT, 'UTF-8')); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/grouplist.tpl", _tr("View Group"), $arrTmp); // hay que pasar el arreglo } } else { if (isset($_POST['delete'])) { //- TODO: Validar el id de group if (isset($_POST['id_group']) && $_POST['id_group'] == '1') { // No se puede eliminar al grupo admin $smarty->assign("mb_message", _tr("The administrator group cannot be deleted because is the default Elastix Group. You can delete any other group.")); } else { if ($pACL->HaveUsersTheGroup($_POST['id_group']) == TRUE) { $smarty->assign("mb_message", _tr("The Group have users assigned. You can delete any group that does not have any users assigned in it.")); } else { $pACL->deleteGroup($_POST['id_group']); } } } $nav = getParameter("nav"); $start = getParameter("start"); $total = $pACL->getNumGroups(); $total = $total == NULL ? 0 : $total; $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $oGrid->pagingShow(true); $oGrid->setURL("?menu=grouplist"); $offset = $oGrid->calculateOffset(); $end = $oGrid->getEnd(); $arrGroups = $pACL->getGroupsPaging($limit, $offset); $end = count($arrGroups); $arrData = array(); foreach ($arrGroups as $group) { $arrTmp = array(); if ($group[1] == 'administrator') { $group[1] = _tr('administrator'); } else { if ($group[1] == 'operator') { $group[1] = _tr('operator'); } else { if ($group[1] == 'extension') { $group[1] = _tr('extension'); } } } if ($group[2] == 'total access') { $group[2] = _tr('total access'); } else { if ($group[2] == 'operator') { $group[2] = _tr('operator'); } else { if ($group[2] == 'extension user') { $group[2] = _tr('extension user'); } } } $arrTmp[0] = " <a href='?menu=grouplist&action=view&id=" . $group[0] . "'>" . $group[1] . "</a>"; //id_group name $arrTmp[1] = $group[2]; //description $arrData[] = $arrTmp; } $arrGrid = array("title" => _tr("Group List"), "icon" => "/modules/{$module_name}/images/system_groups.png", "columns" => array(0 => array("name" => _tr("Group"), "property1" => ""), 1 => array("name" => _tr("Description"), "property1" => ""))); $oGrid->addNew("submit_create_group", _tr("Create New Group")); $contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData); } } } } } return $contenidoModulo; }
function view_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk, $update = FALSE) { $arrFormadress_book = createFieldForm($arrLang); $pACL = new paloACL($pDB_2); $id_user = $pACL->getIdUser($_SESSION["elastix_user"]); $padress_book = new paloAdressBook($pDB); $oForm = new paloForm($smarty, $arrFormadress_book); $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : ""); if (isset($_POST["edit"]) || $update == TRUE) { $oForm->setEditMode(); if ($padress_book->isEditablePublicContact($id, $id_user)) { $smarty->assign("Commit", 1); $smarty->assign("SAVE", $arrLang["Save"]); } else { $smarty->assign("Commit", 0); $smarty->assign("SAVE", $arrLang["Save"]); } } else { $oForm->setViewMode(); $smarty->assign("Edit", 1); if ($padress_book->isEditablePublicContact($id, $id_user)) { $smarty->assign("Edit", 1); $smarty->assign("EditW", 0); } else { $smarty->assign("Edit", 0); $smarty->assign("EditW", 0); } } $smarty->assign("EDIT", $arrLang["Edit"]); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("title", $arrLang["Address Book"]); $smarty->assign("FirstName", $arrLang["First Name"]); $smarty->assign("LastName", $arrLang["Last Name"]); $smarty->assign("PhoneNumber", $arrLang["Phone Number"]); $smarty->assign("Email", $arrLang["Email"]); $smarty->assign("address", $arrLang["Address"]); $smarty->assign("company", $arrLang["Company"]); $smarty->assign("notes", $arrLang["Notes"]); $smarty->assign("picture", $arrLang["picture"]); $smarty->assign("private_contact", $arrLang["Private Contact"]); $smarty->assign("public_contact", $arrLang["Public Contact"]); if (isset($_POST['address_book_options']) && $_POST['address_book_options'] == 'address_from_csv') { $smarty->assign("check_csv", "checked"); } else { $smarty->assign("check_new_contact", "checked"); } $smarty->assign("SAVE", $arrLang["Save"]); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $smarty->assign("label_file", $arrLang["File"]); $smarty->assign("DOWNLOAD", $arrLang["Download Address Book"]); $smarty->assign("HeaderFile", $arrLang["Header File Address Book"]); $smarty->assign("AboutContacts", $arrLang["About Address Book"]); $smarty->assign("style_address_options", "style='display:none'"); $smarty->assign("idPhoto", $id); $contactData = $padress_book->contactData($id, $id_user); if ($contactData) { $smarty->assign("ID", $id); } else { $smarty->assign("mb_title", $arrLang["Validation Error"]); $smarty->assign("mb_message", $arrLang["Not_allowed_contact"]); return report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk); } if ($contactData['status'] == 'isPrivate') { $smarty->assign("check_isPrivate", "checked"); } else { if ($contactData['status'] == 'isPublic') { $smarty->assign("check_isPublic", "checked"); } else { $smarty->assign("check_isPrivate", "checked"); } } $arrData['name'] = isset($_POST['name']) ? $_POST['name'] : $contactData['name']; $arrData['last_name'] = isset($_POST['last_name']) ? $_POST['last_name'] : $contactData['last_name']; $arrData['telefono'] = isset($_POST['telefono']) ? $_POST['telefono'] : $contactData['telefono']; $arrData['email'] = isset($_POST['email']) ? $_POST['email'] : $contactData['email']; $arrData['address'] = isset($_POST['address']) ? $_POST['address'] : $contactData['address']; $arrData['company'] = isset($_POST['company']) ? $_POST['company'] : $contactData['company']; $arrData['notes'] = isset($_POST['notes']) ? $_POST['notes'] : $contactData['notes']; $arrData['picture'] = isset($_POST['picture']) ? $_POST['picture'] : $contactData['picture']; $arrData['status'] = isset($_POST['status']) ? $_POST['status'] : $contactData['status']; $smarty->assign("ShowImg", 1); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new_adress_book.tpl", $arrLang["Address Book"], $arrData); $contenidoModulo = "<form method='POST' enctype='multipart/form-data' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $contenidoModulo; }
function view_conference($smarty, $module_name, $local_templates_dir, $pDB, $arrLang, $arrConfig, $dsnAsterisk) { $arrFormConference = createFieldForm($arrLang); $oForm = new paloForm($smarty, $arrFormConference); $smarty->assign("Show", 0); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("announce", $arrLang["Announce"]); $smarty->assign("record", $arrLang["Record"]); $smarty->assign("listen_only", $arrLang["Listen Only"]); $smarty->assign("wait_for_leader", $arrLang["Wait for Leader"]); $pConference = new paloSantoConference($pDB); $conferenceId = isset($_GET['conferenceId']) ? $_GET['conferenceId'] : ""; $conferenceData = $pConference->ObtainConferenceData($conferenceId); $arrData['conference_number'] = $conferenceData['roomNo']; $arrData['conference_owner'] = $conferenceData['confOwner']; $arrData['conference_name'] = $conferenceData['confDesc']; $arrData['moderator_pin'] = $conferenceData['silPass']; $arrData['user_pin'] = $conferenceData['roomPass']; $arrData['start_time'] = $conferenceData['startTime']; $arrData['max_participants'] = $conferenceData['maxUser']; if (strpos($conferenceData['aFlags'], 'i', 4)) { $arrData['moderator_options_1'] = 'on'; } if (strpos($conferenceData['aFlags'], 'r', 4)) { $arrData['moderator_options_2'] = 'on'; } if (strpos($conferenceData['uFlags'], 'i', 1)) { $arrData['user_options_1'] = 'on'; } if (strpos($conferenceData['uFlags'], 'm', 1)) { $arrData['user_options_2'] = 'on'; } if (strpos($conferenceData['uFlags'], 'w', 1)) { $arrData['user_options_3'] = 'on'; } $fecha_ini = strtotime($conferenceData['startTime']); $fecha_fin = strtotime($conferenceData['endTime']); $duracion = $fecha_fin - $fecha_ini; $arrData['duration'] = number_format($duracion / 3600, 0, ",", ""); $arrData['duration_min'] = $duracion % 3600 / 60; $oForm->setViewMode(); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new_conference.tpl", $arrLang["Conference"], $arrData); $contenidoModulo = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $contenidoModulo; }
function view_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk, $update = FALSE) { $arrFormadress_book = createFieldForm($pDB); $padress_book = new paloAdressBook($pDB); $oForm = new paloForm($smarty, $arrFormadress_book); $id = getParameter('id'); if (isset($_POST["edit"]) || $update == TRUE) { $oForm->setEditMode(); $smarty->assign("Commit", 1); $smarty->assign("SAVE", "Sửa"); } else { $oForm->setViewMode(); $smarty->assign("Edit", 1); } $smarty->assign("icon", "modules/{$module_name}/images/address_book.png"); $smarty->assign("EDIT", "Sửa"); $smarty->assign("title", "Thông tin khách hàng"); $smarty->assign("SAVE", "Lưu"); $smarty->assign("CANCEL", "Đóng"); $smarty->assign("REQUIRED_FIELD", "Bắt buộc"); $contactData = $padress_book->contactData($id); if ($contactData) { $smarty->assign("ID", $id); } else { $smarty->assign("mb_title", "Lỗi"); $smarty->assign("mb_message", 'Không cho phép xem'); return report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk); } if ($contactData['type'] == '0') { $smarty->assign("check_0", "checked"); } elseif ($contactData['type'] == '1') { $smarty->assign("check_1", "checked"); } elseif ($contactData['type'] == '2') { $smarty->assign("check_2", "checked"); } else { $smarty->assign("check_3", "checked"); } // get contact list to show in smarty $smarty->assign("CONTACT", $contactData['contact']); // get phone list foreach ($contactData['number'] as $v) { $arr_phone .= $v . "\n"; } $arrData['firstname'] = $contactData['firstname']; $arrData['lastname'] = $contactData['lastname']; $arrData['company'] = $contactData['company']; $arrData['email'] = $contactData['email']; $arrData['cmnd'] = $contactData['cmnd']; $arrData['passport'] = $contactData['passport']; $arrData['birthday'] = date("d-m-Y", strtotime($contactData['birthday'])); $arrData['birthplace'] = $contactData['birthplace']; $arrData['address'] = $contactData['address']; $arrData['membership'] = $contactData['membership']; $arrData['sale'] = $contactData['sale']; $arrData['booker'] = $contactData['agent_id']; $arrData['accountant'] = $contactData['accountant']; $arrData['payment_type'] = $contactData['payment_type']; $arrData['customer_code'] = $contactData['customer_code']; // for company customer $arrData['company_name'] = $contactData['firstname']; $arrData['company_booker'] = $contactData['agent_id']; $arrData['company_code'] = $contactData['customer_code']; $arrData['company_pay_type'] = $contactData['payment_type']; $arrData['company_sale'] = $contactData['sale']; $arrData['company_accountant'] = $contactData['accountant']; $arrData['company_address'] = $contactData['address']; $arrData['company_membership'] = $contactData['membership']; $arrData['phone'] = $arr_phone; $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new_adress_book.tpl", "Thông tin khách hàng", $arrData); $contenidoModulo = "<form method='POST' enctype='multipart/form-data' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $contenidoModulo; }
function viewFormInbound($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $arrInbound = array(); $action = getParameter("action"); $idInbound = getParameter("id_inbound"); if ($action == "view" || getParameter("edit") || getParameter("save_edit")) { if (!isset($idInbound)) { $error = _tr("Invalid Inbound Route"); } $domain = getParameter('organization'); if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pInbound = new paloSantoInbound($pDB, $domain); $arrInbound = $pInbound->getInboundById($idInbound); if ($error == "") { if ($arrInbound === false) { $error = $pInbound->errMsg; } else { if (count($arrInbound) == 0) { $error = _tr("Inbound doesn't exist"); } else { if (getParameter("save_edit")) { $arrInbound = $_POST; } $smarty->assign("fax_detect_act", $arrInbound["fax_detect"]); $smarty->assign("privacy_act", $arrInbound["primanager"]); } } } if ($error != "") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $error); return reportInbound($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } else { if ($credentials['userlevel'] == 'superadmin') { if (getParameter("create_inbound")) { $domain = getParameter('organization_add'); //este parametro solo es selecionable cuando es el superadmin quien crea la ruta } else { $domain = getParameter('organization'); } } else { $domain = $credentials['domain']; } $pInbound = new paloSantoInbound($pDB, $domain); $domain = $pInbound->getDomain(); if (empty($domain)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Organization")); return reportInbound($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } if (getParameter("create_inbound")) { $arrInbound["primanager"] = "no"; $arrInbound["fax_detect"] = "no"; $arrInbound["fax_time"] = "4"; $arrInbound["fax_type"] = "fax"; $arrInbound["min_length"] = "3"; $arrInbound["max_attempt"] = "5"; $arrInbound["goto"] = ""; } else { $arrInbound = $_POST; } } $goto = $pInbound->getCategoryDefault($domain); if ($goto === false) { $goto = array(); } $res = $pInbound->getDefaultDestination($domain, $arrInbound["goto"]); $destiny = $res == false ? array() : $res; $arrForm = createFieldForm($goto, $destiny, $pInbound->getFaxExtesion(), $pInbound->getDetectFax(), $pInbound->getMoHClass($domain)); $oForm = new paloForm($smarty, $arrForm); if ($action == "view") { $oForm->setViewMode(); } else { if ($action == "view_edit" || getParameter("edit") || getParameter("save_edit")) { $oForm->setEditMode(); } } $smarty->assign("EDIT_ROUTE", in_array('edit', $arrPermission)); $smarty->assign("CREATE_ROUTE", in_array('create', $arrPermission)); $smarty->assign("DELETE_ROUTE", in_array('delete', $arrPermission)); //$smarty->assign("ERROREXT",_tr($pTrunk->errMsg)); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("OPTIONS", _tr("Options")); $smarty->assign("APPLY_CHANGES", _tr("Apply changes")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("EDIT", _tr("Edit")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?")); $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("id_inbound", $idInbound); $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("ORGANIZATION_LABEL", _tr("Organization Domain")); $smarty->assign("ORGANIZATION", $domain); $smarty->assign("CALLERID", _tr("Caller Id")); $smarty->assign("SEQUENCE", _tr("TRUNKS SEQUENCE")); $smarty->assign("SETTINGS", _tr("Settings")); $smarty->assign("PEERDETAIL", _tr("PEER Details")); $smarty->assign("USERDETAIL", _tr("USER Details")); $smarty->assign("OVEREXTEN", _tr("Override Extension")); $smarty->assign("CIDPRIORITY", _tr("Cid Priority Route")); $smarty->assign("PRIVACY", _tr("Privacy")); $smarty->assign("PRIVACYMANAGER", _tr("Privacy Manager")); $smarty->assign("SIGNALRING", _tr("Signal Ringing")); $smarty->assign("CIDSOURCE", _tr("CID Lookup Source")); $smarty->assign("FAXDETECT", _tr("Fax Detect")); $smarty->assign("DETECTFAX", _tr("Detect Fax ")); $smarty->assign("LANGUAGE", _tr("Language")); $smarty->assign("SETDESTINATION", _tr("Set Destination")); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Inbound Route"), $arrInbound); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function viewFormEmaillist($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $pORGZ = new paloSantoOrganization($pDB); $pEmailList = new paloSantoEmailList($pDB); //no se puede editar una lista una vez que ha sido creada //la unica accion que existe es observar la configuracion de la lista $idList = getParameter("id"); $action = getParameter("action"); $arrDominios = array(); if ($action == 'view_list') { //comprabamos que la lista exista if (empty($idList)) { $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Invalid Email List")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if ($credentials['userlevel'] == 'superadmin') { $emailList = $pEmailList->getEmailList($idList); } else { $emailList = $pEmailList->getEmailList($idList, $credentials['domain']); } if ($emailList == false) { $smarty->assign("mb_title", _tr("Error")); $error = $emailList === false ? _tr("Couldn't be retrieved Email List data") : _tr("Email List does not exist"); $smarty->assign("mb_message", $error); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { $smarty->assign("DOMAIN", $emailList['organization_domain']); $smarty->assign("LIST_NAME", htmlentities($emailList['listname'], ENT_QUOTES, "UTF-8")); $smarty->assign("LIST_ADMIN_USER", $emailList['mailadmin']); } } } else { //queremos crear una nueva lista if ($credentials['userlevel'] == 'superadmin') { foreach ($pORGZ->getOrganization(array()) as $value) { $arrDominios[$value["domain"]] = $value["domain"]; } } //se comprueba que el mailman haya sido configurado por primera vez $MailmanListCreated = $pEmailList->isMailmanListCreated(); if (is_null($MailmanListCreated)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $pEmailList->getError()); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } elseif (!$MailmanListCreated) { $smarty->assign("StatusNew", 1); $smarty->assign("Mailman_Setting", _tr("Mailman Admin Settings")); if ($credentials['userlevel'] != 'superadmin') { //solo el superadmin puede hacer esta accion $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("A new List can be added because some configurations are missed. Please contact with Elastix Admisnistrator")); return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } } $arrFormEmaillist = createFieldForm($arrDominios); $oForm = new paloForm($smarty, $arrFormEmaillist); if ($action == 'view_list') { $oForm->setViewMode(); } if (in_array('delete_list', $arrPermission)) { $smarty->assign("DELETE_LIST", true); } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("DELETE", _tr("Delete")); $smarty->assign("List_Setting", _tr("New List Settings")); $smarty->assign("icon", "web/apps/{$module_name}/images/email.png"); $smarty->assign("idList", $idList); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("New Email List"), $_POST); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
function newDomain($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang) { $pEmail = new paloEmail($pDB); $arrFormElements = createFieldForm($arrLang); $oForm = new paloForm($smarty, $arrFormElements); $_DATA = $_POST; $action = getParameter("action"); $id = getParameter("id"); if ($action == "view" && !getParameter("submit_create_domain")) { $oForm->setViewMode(); } else { $action = "new"; } //else if($action=="view_edit" || getParameter("save_edit")) //$oForm->setEditMode(); $formValues['domain_name'] = ''; if ($action == "view" || $action == "view_edit") { // the action is to view or view_edit. $arrDomain = $pEmail->getDomains($id); // Conversion de formato $arrTmp['domain_name'] = $arrDomain[0][1]; $arrTmp['id_domain'] = $arrDomain[0][0]; $formValues = $arrTmp; } $smarty->assign("SAVE", $arrLang["Save"]); $smarty->assign("CANCEL", $arrLang["Cancel"]); $smarty->assign("DELETE", $arrLang["Delete"]); $smarty->assign("CONFIRM_CONTINUE", $arrLang["Are you sure you wish to continue?"]); $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]); $content = $oForm->fetchForm("{$local_templates_dir}/form_domain.tpl", $arrLang["New Domain"], $formValues); return $content; }