/** esta funcion solo es llamada al momento de crear una nueva organizacion dentro del sisitema */ function insertDBGlobals($country) { if ($this->validateGlobalsPBX() == false) { return false; } $query = "INSERT INTO globals values (?,?,?)"; $arrLngPBX = getLanguagePBX(); $arrTZPBX = $this->getToneZonePBX(); //de acuerdo al pais al que pertenece la organizacion se seleccion el //pais y el TONEZONE del mismo, en caso de no existir entre los que se //encuantrarn configurados en el servidor asterisk, se escogen los valoras por //default $language = $tonezone = ""; $arrSettings = getCountrySettings($country); if ($arrSettings != false) { if ($arrSettings["language"] != "") { if (array_key_exists($arrSettings["language"], $arrLngPBX)) { $language = $arrSettings["language"]; } } if ($arrSettings["tonezone"] != "") { if (array_key_exists($arrSettings["tonezone"], $arrTZPBX)) { $tonezone = $arrSettings["tonezone"]; } } } //acabamos de crear la organizacion y llenamos con los valores //default de las globales $arrProp = $this->getAllGlobalSettings(); if ($arrProp === false) { return false; } else { foreach ($arrProp as $property) { switch ($property["variable"]) { case "LANGUAGE": $value = empty($language) ? $property["value"] : $language; break; case "TONEZONE": $value = empty($tonezone) ? $property["value"] : $tonezone; break; case "MIXMON_DIR": $value = empty($property["value"]) ? "" : $property["value"] . $this->domain . "/"; break; case "VMX_CONTEXT": $value = empty($property["value"]) ? "" : $this->code . "-" . $property["value"]; break; case "VMX_TIMEDEST_CONTEXT": $value = empty($property["value"]) ? "" : $this->code . "-" . $property["value"]; break; case "VMX_LOOPDEST_CONTEXT": $value = empty($property["value"]) ? "" : $this->code . "-" . $property["value"]; break; case "TRANSFER_CONTEXT": $value = empty($property["value"]) ? "" : $this->code . "-" . $property["value"]; break; default: $value = isset($property["value"]) ? $property["value"] : ""; break; } $insert = $this->_DB->genQuery($query, array($this->domain, $property["variable"], $value)); if ($insert == false) { $this->errMsg = _tr("Problem setting globals variables") . $this->_DB->errMsg; break; } } return $insert; } }
function get_country_code() { $jsonObject = new PaloSantoJSON(); $country = getParameter("country"); $arrSettings = getCountrySettings($country); if ($arrSettings == false) { $jsonObject->set_message(""); } else { $jsonObject->set_message($arrSettings["code"]); } return $jsonObject->createJSON(); }