本文整理汇总了PHP中createFieldForm函数的典型用法代码示例。如果您正苦于以下问题:PHP createFieldForm函数的具体用法?PHP createFieldForm怎么用?PHP createFieldForm使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createFieldForm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
//global variables
global $arrConf;
global $arrConfModule;
$arrConf = array_merge($arrConf, $arrConfModule);
//folder path for custom templates
$local_templates_dir = getWebDirModule($module_name);
$arrFormDHCP = createFieldForm();
$oForm = new paloForm($smarty, $arrFormDHCP);
$smarty->assign("REQUIRED_FIELD", _tr("Required field"));
$smarty->assign("CONFIGURATION_UPDATE", _tr("Update"));
$smarty->assign("SERVICE_START", _tr("Service Start"));
$smarty->assign("SERVICE_STOP", _tr("Service Stop"));
$smarty->assign("STATUS", _tr("Status"));
$smarty->assign("START_RANGE_OF_IPS", _tr("Start range of IPs"));
$smarty->assign("END_RANGE_OF_IPS", _tr("End range of IPs"));
$smarty->assign("DNS_1", _tr("DNS 1"));
$smarty->assign("DNS_2", _tr("DNS 2"));
$smarty->assign("WINS", _tr("WINS"));
$smarty->assign("GATEWAY", _tr("Gateway"));
$smarty->assign("OPTIONAL", _tr("Optional"));
$smarty->assign("icon", "web/apps/{$module_name}/images/system_network_dhcp_server.png");
$smarty->assign("OF_1_TO_50000_SECONDS", _tr("Of 1 to 50000 Seconds"));
if (isset($_POST["in_iniciar"])) {
$accion = "service_start";
} else {
if (isset($_POST["in_finalizar"])) {
$accion = "service_stop";
} else {
if (isset($_POST["in_actualizar_conf_red"])) {
$accion = "service_update";
} else {
$accion = "service_show";
}
}
}
$content = "";
switch ($accion) {
case "service_start":
$content = serviceStartDHCP($smarty, $module_name, $local_templates_dir, $oForm);
break;
case "service_stop":
$content = serviceStopDHCP($smarty, $module_name, $local_templates_dir, $oForm);
break;
case "service_update":
$content = serviceUpdateDHCP($smarty, $module_name, $local_templates_dir, $oForm);
break;
default:
//service_show
$content = serviceShowDHCP($smarty, $module_name, $local_templates_dir, $oForm);
break;
}
return $content;
}
示例2: formLanguage
function formLanguage($smarty, $module_name, $local_templates_dir, $arrConf, $pACL, $uid)
{
global $arrPermission;
$lang = get_language();
$error_msg = '';
$archivos = array();
$langElastix = array();
$contenido = '';
$msgError = '';
$arrDefaultRate = array();
$conexionDB = FALSE;
include "configs/languages.conf.php";
//este archivo crea el arreglo language que contine los idiomas soportados
//por elastix
leer_directorio("/usr/share/elastix/lang", $error_msg, $archivos);
if (count($archivos) > 0) {
foreach ($languages as $lang => $lang_name) {
if (in_array("{$lang}.lang", $archivos)) {
$langElastix[$lang] = $lang_name;
}
}
}
if (count($langElastix) > 0) {
$arrFormLanguage = createFieldForm($langElastix);
$oForm = new paloForm($smarty, $arrFormLanguage);
if (empty($pACL->errMsg)) {
$conexionDB = TRUE;
} else {
$msgError = _tr("You can't change language") . '.-' . _tr("ERROR") . ":" . $pACL->errMsg;
}
// $arrDefaultRate['language']="es";
$smarty->assign("CAMBIAR", _tr("Save"));
$smarty->assign("MSG_ERROR", $msgError);
$smarty->assign("conectiondb", $conexionDB);
$smarty->assign("icon", "web/apps/{$module_name}/images/system_preferencies_language.png");
if (in_array('edit', $arrPermission)) {
$smarty->assign('EDIT_LANG', true);
}
//obtener el valor del lenguage por defecto
$defLang = $pACL->getUserProp($uid, 'language');
if (empty($defLang) || $defLang === false) {
$defLang = "en";
}
$arrDefault['language'] = $defLang;
$htmlForm = $oForm->fetchForm("{$local_templates_dir}/language.tpl", _tr("Language"), $arrDefault);
$contenido = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>";
}
return $contenido;
}
示例3: viewFormFestival
function viewFormFestival($smarty, $module_name, $local_templates_dir, $arrConf)
{
$pFestival = new paloSantoFestival();
$arrFormFestival = createFieldForm();
$oForm = new paloForm($smarty, $arrFormFestival);
$_DATA = $_POST;
if ($pFestival->isFestivalActivated()) {
$_DATA["status"] = "on";
} else {
$_DATA["status"] = "off";
}
$smarty->assign("SAVE", _tr("Save"));
$smarty->assign("icon", "web/apps/{$module_name}/images/pbx_tools_festival.png");
$htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Festival"), $_DATA);
$content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>";
return $content;
}
示例4: formCurrency
function formCurrency($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang)
{
$pCurrency = new paloSantoCurrency($pDB);
$arrFormCurrency = createFieldForm($arrLang);
$oForm = new paloForm($smarty, $arrFormCurrency);
//CARGAR CURRENCY GUARDADO
$curr = loadCurrentCurrency($pDB);
if ($curr == false) {
$curr = "\$";
}
$smarty->assign("SAVE", $arrLang["Save"]);
$smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]);
$smarty->assign("icon", "modules/{$module_name}/images/system_preferences_currency.png");
$_POST['currency'] = $curr;
$htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", $arrLang["Currency"], $_POST);
$contenidoModulo = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>";
return $contenidoModulo;
}
示例5: formCurrency
function formCurrency($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
global $arrPermission;
$arrFormCurrency = createFieldForm();
$oForm = new paloForm($smarty, $arrFormCurrency);
//CARGAR CURRENCY GUARDADO
$curr = loadCurrentCurrency($pDB);
if ($curr == false) {
$curr = "\$";
}
$smarty->assign("SAVE", _tr("Save"));
$smarty->assign("REQUIRED_FIELD", _tr("Required field"));
$smarty->assign("icon", "web/apps/{$module_name}/images/system_preferences_currency.png");
$_POST['currency'] = $curr;
if (in_array('edit', $arrPermission)) {
$smarty->assign('EDIT_CURR', true);
}
$htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Currency"), $_POST);
$contenidoModulo = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>";
return $contenidoModulo;
}
示例6: saveNewKey
function saveNewKey($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrAST, $arrAMP)
{
$arrFormNew = createFieldForm($pDB);
$arrValues['id'] = getParameter("Extension");
$arrValues['key'] = getParameter("Current_Secret");
$arrValues['new_key'] = getParameter("New_Secret");
$confirmation = getParameter("Confirm_New_Secret");
$pDB2 = new paloDB($arrConf['elastix_dsn']['acl']);
$pACL = new paloACL($pDB2);
$oForm = new paloForm($smarty, $arrFormNew);
if (!$oForm->validateForm($_POST)) {
// Falla la validación básica del formulario
$strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br/>";
$arrErrores = $oForm->arrErroresValidacion;
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k}: [{$v['mensaje']}] <br /> ";
}
}
$smarty->assign("mb_title", _tr("Validation Error"));
$smarty->assign("mb_message", $strErrorMsg);
return editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrValues['id']);
}
$pWeakKeys = new paloSantoWeakKeys($pDB);
$device = $pWeakKeys->getWeakKeyById($arrValues['id']);
if (!$pACL->isUserAdministratorGroup($_SESSION['elastix_user'])) {
if ($arrValues['key'] != $device['data']) {
$smarty->assign("mb_title", _tr("Error"));
$smarty->assign("mb_message", _tr("The Current Secret is invalid"));
return editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrValues['id']);
}
}
if ($arrValues['new_key'] != $confirmation) {
$smarty->assign("mb_title", _tr("Error"));
$smarty->assign("mb_message", _tr("The New Secret does not match with the Confirmation Secret"));
return editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrValues['id']);
}
$mensaje = getMensaje($arrValues['id'], $arrValues['new_key']);
if ($mensaje != "OK") {
$smarty->assign("mb_title", _tr("Error"));
$smarty->assign("mb_message", $mensaje);
return editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrValues['id']);
}
if (!$pWeakKeys->saveNewKey($arrValues, $device['tech'])) {
$smarty->assign("mb_title", _tr("Error"));
$smarty->assign("mb_message", $pWeakKeys->errMsg);
return editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrValues['id']);
}
$data_connection = array('host' => $arrConf['AMI_HOST'], 'user' => $arrConf['AMI_USER'], 'password' => $arrConf['AMI_PASS']);
$pLoadExtension = new paloSantoLoadExtension($pDB);
if (!$pLoadExtension->do_reloadAll($data_connection, $arrAST, $arrAMP)) {
$smarty->assign("mb_title", _tr("Error"));
$smarty->assign("mb_message", $pLoadExtension->errMsg);
return editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrValues['id']);
}
$smarty->assign("mb_title", _tr("Message"));
$smarty->assign("mb_message", _tr("Successful Secret Update"));
return reportWeakKeys($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
}
示例7: createFieldForm
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;
}
示例8: saveNewAnnouncement
function saveNewAnnouncement($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
$error = "";
$continue = true;
$success = false;
$domain = getParameter('organization');
//este parametro solo es selecionable cuando es el superadmin quien hace la accion
if ($credentials['userlevel'] != 'superadmin') {
$domain = $credentials['domain'];
}
$pAnnouncement = new paloSantoAnnouncement($pDB, $domain);
$arrFormOrgz = createFieldForm(array(), array(), $pDB, $domain);
$oForm = new paloForm($smarty, $arrFormOrgz);
$description = trim(getParameter('description'));
if (!$oForm->validateForm($_POST)) {
// Validation basic, not empty and VALIDATION_TYPE
$smarty->assign("mb_title", _tr("Validation Error"));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr("The following fields contain errors") . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k} [{$v['mensaje']}], ";
}
}
$smarty->assign("mb_message", $strErrorMsg);
return viewFormAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} elseif (count(explode("\n", $description)) > 1) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("Invalid description text"));
return viewFormAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
if ($pAnnouncement->validateDestine($domain, getParameter("destination")) == false) {
$error = _tr("You must select a default destination.");
$continue = false;
}
if ($continue) {
//seteamos un arreglo con los parametros configurados
$arrProp = array();
$arrProp["description"] = $description;
$arrProp["recording_id"] = getParameter("recording_id");
$arrProp["allow_skip"] = getParameter("allow_skip");
$arrProp["return_ivr"] = getParameter("return_ivr");
$arrProp["noanswer"] = getParameter("noanswer");
$arrProp["repeat_msg"] = getParameter("repeat_msg");
$arrProp["goto"] = getParameter("goto");
$arrProp['destination'] = getParameter("destination");
}
if ($continue) {
$pDB->beginTransaction();
$success = $pAnnouncement->createNewAnnouncement($arrProp);
if ($success) {
$pDB->commit();
} else {
$pDB->rollBack();
}
$error .= $pAnnouncement->errMsg;
}
}
if ($success) {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("Announcement has been created successfully"));
//mostramos el mensaje para crear los archivos de ocnfiguracion
$pAstConf = new paloSantoASteriskConfig($pDB);
$pAstConf->setReloadDialplan($domain, true);
$content = reportAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $error);
$content = viewFormAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
return $content;
}
示例9: saveRules
function saveRules($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$arrValues = array();
$str_error = "";
$arrFormNew = createFieldForm($pDB);
$oForm = new paloForm($smarty, $arrFormNew);
$id = getParameter("id");
$arrValues['id'] = $id;
if ($id == "") {
$state = "new";
} else {
$state = "edit";
}
//************************************************************************************************************
//** TRAFFIC **
//************************************************************************************************************
$arrValues['traffic'] = getParameter("id_traffic");
if ($arrValues['traffic'] == "INPUT") {
$arrValues['interface_in'] = getParameter("interface_in");
if (strlen($arrValues['interface_in']) == 0) {
$str_error .= strlen($str_error) == 0 ? "interface_in" : ", interface_in";
}
$arrValues['interface_out'] = null;
} else {
if ($arrValues['traffic'] == "OUTPUT") {
$arrValues['interface_out'] = getParameter("interface_out");
if (strlen($arrValues['interface_out']) == 0) {
$str_error .= strlen($str_error) == 0 ? "interface_out" : ", interface_out";
}
$arrValues['interface_in'] = null;
} else {
if ($arrValues['traffic'] == "FORWARD") {
$arrValues['interface_in'] = getParameter("interface_in");
if (strlen($arrValues['interface_in']) == 0) {
$str_error .= strlen($str_error) == 0 ? "interface_in" : ", interface_in";
}
$arrValues['interface_out'] = getParameter("interface_out");
if (strlen($arrValues['interface_out']) == 0) {
$str_error .= strlen($str_error) == 0 ? "interface_out" : ", interface_out";
}
}
}
}
//************************************************************************************************************
//** SOURCE **
//************************************************************************************************************
$arrValues['ip_source'] = getParameter("ip_source");
$arrValues['mask_source'] = getParameter("mask_source");
$arrValues['ip_destin'] = getParameter("ip_destin");
$arrValues['mask_destin'] = getParameter("mask_destin");
//************************************************************************************************************
//** PROTOCOL **
//************************************************************************************************************
$arrValues['protocol'] = getParameter("id_protocol");
if ($arrValues['protocol'] == 'TCP' || $arrValues['protocol'] == 'UDP') {
$arrValues['port_in'] = getParameter("port_in");
if (strlen($arrValues['port_in']) == 0) {
$str_error .= strlen($str_error) == 0 ? "port_in" : ", port_in";
}
$arrValues['port_out'] = getParameter("port_out");
if (strlen($arrValues['port_out']) == 0) {
$str_error .= strlen($str_error) == 0 ? "port_out" : ", port_out";
}
$arrValues['type_icmp'] = null;
$arrValues['id_ip'] = null;
$arrValues['state'] = "";
} else {
if ($arrValues['protocol'] == 'ICMP') {
$arrValues['port_in'] = null;
$arrValues['port_out'] = null;
$arrValues['state'] = "";
$arrValues['type_icmp'] = getParameter("type_icmp");
if (strlen($arrValues['type_icmp']) == 0) {
$str_error .= strlen($str_error) == 0 ? "type" : ", type";
}
$arrValues['id_ip'] = null;
} else {
if ($arrValues['protocol'] == 'IP') {
$arrValues['port_in'] = null;
$arrValues['port_out'] = null;
$arrValues['type_icmp'] = null;
$arrValues['state'] = "";
$arrValues['id_ip'] = getParameter("id_ip");
if (strlen($arrValues['id_ip']) == 0) {
$str_error .= strlen($str_error) == 0 ? "id" : ", id";
}
} else {
if ($arrValues['protocol'] == 'STATE') {
$arrValues['port_in'] = null;
$arrValues['port_out'] = null;
$arrValues['type_icmp'] = null;
$arrValues['id_ip'] = null;
$established = getParameter("established");
$related = getParameter("related");
if ($established == "on") {
$arrValues['state'] = "Established";
if ($related == "on") {
$arrValues['state'] .= ",Related";
}
} else {
//.........这里部分代码省略.........
示例10: saveNewOtherDestinations
function saveNewOtherDestinations($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
$error = "";
$success = false;
$domain = getParameter('organization');
//este parametro solo es selecionable cuando es el superadmin quien hace la accion
if ($credentials['userlevel'] != 'superadmin') {
$domain = $credentials['domain'];
}
$pOtherDestinations = new paloSantoOtherDestinations($pDB, $domain);
$arrFormOrgz = createFieldForm();
$oForm = new paloForm($smarty, $arrFormOrgz);
if (!$oForm->validateForm($_POST)) {
// Validation basic, not empty and VALIDATION_TYPE
$smarty->assign("mb_title", _tr("Validation Error"));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr("The following fields contain errors") . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k} [{$v['mensaje']}], ";
}
}
$smarty->assign("mb_message", $strErrorMsg);
return viewFormOtherDestinations($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
//seteamos un arreglo con los parametros configurados
$arrProp = array();
$arrProp["description"] = getParameter("description");
$arrProp["destdial"] = getParameter("destdial");
$pDB->beginTransaction();
$success = $pOtherDestinations->createNewOtherDestinations($arrProp);
if ($success) {
$pDB->commit();
} else {
$pDB->rollBack();
}
$error .= $pOtherDestinations->errMsg;
}
if ($success) {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("Other Destination has been created successfully"));
//mostramos el mensaje para crear los archivos de ocnfiguracion
$pAstConf = new paloSantoASteriskConfig($pDB);
$pAstConf->setReloadDialplan($domain, true);
$content = reportOtherDestinations($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $error);
$content = viewFormOtherDestinations($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
return $content;
}
示例11: saveNewFTPBackup
function saveNewFTPBackup($smarty, $module_name, $local_templates_dir, &$pDB)
{
$pFTPBackup = new paloSantoFTPBackup($pDB);
$oForm = new paloForm($smarty, createFieldForm());
if (!$oForm->validateForm($_POST)) {
// Validation basic, not empty and VALIDATION_TYPE
$smarty->assign("mb_title", _tr('Validation Error'));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
$strErrorMsg .= implode(', ', array_keys($arrErrores));
}
$smarty->assign("mb_message", $strErrorMsg);
} else {
$server = getParameter("server");
$port = getParameter("port");
$user = getParameter("user");
$password = getParameter("password");
$path = getParameter("pathServer");
//deben estar llenos todos los campos
if ($server && $port && $user && $password && $path) {
$r = $pFTPBackup->asignarCredencialesFTP($server, $port, $user, $password, $path);
if (!$r) {
$smarty->assign("mb_message", $pFTPBackup->errMsg);
}
} else {
$smarty->assign("mb_message", _tr('Error to save'));
}
}
return viewFormFTPBackup($smarty, $module_name, $local_templates_dir, $pDB);
}
示例12: saveNewMoH
function saveNewMoH($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
$error = "";
$continue = true;
$success = false;
if ($credentials['userlevel'] == 'superadmin') {
$pMoH = new paloSantoMoH($pDB, "");
} else {
$domain = $credentials['domain'];
$pMoH = new paloSantoMoH($pDB, $domain);
}
$arrFormOrgz = createFieldForm(array(), $credentials['userlevel'] == 'superadmin');
$oForm = new paloForm($smarty, $arrFormOrgz);
if (!$oForm->validateForm($_POST)) {
// Validation basic, not empty and VALIDATION_TYPE
$smarty->assign("mb_title", _tr("Validation Error"));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr("The following fields contain errors") . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k} [{$v['mensaje']}], ";
}
}
$smarty->assign("mb_message", $strErrorMsg);
return viewFormMoH($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
$name = getParameter("name");
if ($name == "") {
$error = _tr("Field 'Name' can't be empty.");
$continue = false;
} elseif (getParameter("mode_moh") == 'custom' && $credentials['userlevel'] != 'superadmin') {
$error = _tr('Creation of custom MOH restricted to superadmin');
$continue = FALSE;
}
if ($continue) {
//seteamos un arreglo con los parametros configurados
$arrProp = array();
$arrProp["name"] = getParameter("name");
$arrProp["mode"] = getParameter("mode_moh");
$arrProp["application"] = getParameter("application");
$arrProp["sort"] = getParameter("sort");
$arrProp["format"] = getParameter("format");
}
if ($continue) {
$pDB->beginTransaction();
$success = $pMoH->createNewMoH($arrProp);
if ($success) {
$pDB->commit();
if ($arrProp["mode"] == "files") {
$pMoH->uploadFile($arrProp["name"]);
}
} else {
$pDB->rollBack();
}
$error .= $pMoH->errMsg;
}
}
if ($success) {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("New MoH Class has been created successfully") . " " . $error);
$content = reportMoH($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $error);
$content = viewFormMoH($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
return $content;
}
示例13: saveEditBaseDeClientes
function saveEditBaseDeClientes($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pIngresodeBasedeClientes = new paloSantoIngresodeBasedeClientes($pDB);
$arrFormIngresodeBasedeClientes = createFieldForm($pDB);
$oForm = new paloForm($smarty, $arrFormIngresodeBasedeClientes);
if (!$oForm->validateForm($_POST)) {
// Validation basic, not empty and VALIDATION_TYPE
$smarty->assign("mb_title", _tr("Validation Error"));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr("The following fields contain errors") . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k}, ";
}
}
$smarty->assign("mb_message", $strErrorMsg);
$content = viewFormIngresodeBasedeClientes($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
} else {
$arrResult = $pIngresodeBasedeClientes->actualizarCampaniaRecarga($_POST);
header("location: ?menu=hispana_listado_recarga");
}
return $content;
}
示例14: saveThemes
function saveThemes($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $uid)
{
$oThemes = new PaloSantoThemes($pDB);
$arr_themes = $oThemes->getThemes("/var/www/html/admin/web/themes/");
$formThemes = createFieldForm($arr_themes);
$oForm = new paloForm($smarty, $formThemes);
$exito = $oThemes->updateTheme($_POST['themes'], $uid);
if ($exito) {
if ($oThemes->smartyRefresh($_SERVER['DOCUMENT_ROOT'])) {
header("Location: index.php?menu=themes_system");
die;
} else {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("The smarty cache could not be deleted"));
}
} else {
$smarty->assign("mb_title", _tr("Validation Error"));
$smarty->assign("mb_message", $oThemes->errMsg);
}
return formThemes($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $uid);
}
示例15: saveEditQueue
function saveEditQueue($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
$error = "";
$exito = false;
$qname = getParameter("qname");
$domain = getParameter('organization');
//este parametro solo es selecionable cuando es el superadmin quien hace la accion
if ($credentials['userlevel'] != 'superadmin') {
$domain = $credentials['domain'];
}
if (!isset($qname)) {
$error = _tr("Queue doesn't exist");
} else {
$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 {
$arrForm = createFieldForm(array(), array(), array(), array(), array());
$oForm = new paloForm($smarty, $arrForm);
if (!$oForm->validateForm($_POST)) {
// Validation basic, not empty and VALIDATION_TYPE
$smarty->assign("mb_title", _tr("Validation Error"));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr("The following fields contain errors") . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k} [{$v['mensaje']}], ";
}
}
$smarty->assign("mb_message", $strErrorMsg);
return viewQueue($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
$password = getParameter("password_detail");
if (isset($password)) {
if (!preg_match("/^[0-9]*\$/", $password)) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("Password must only contain digits."));
return viewQueue($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
}
$arrMembers = array('dynamic_members' => getParameter("dynamic_members"), 'static_members' => getParameter("static_members"));
$pDB->beginTransaction();
$arrProp = queueParams();
$arrProp["name"] = $qname;
$exito = $pQueue->updateQueue($arrProp, $arrMembers);
if ($exito) {
$pDB->commit();
} else {
$pDB->rollBack();
}
$error .= $pQueue->errMsg;
}
}
}
if ($exito) {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("Queue has been edited successfully"));
//mostramos el mensaje para crear los archivos de ocnfiguracion
$pAstConf = new paloSantoASteriskConfig($pDB);
$pAstConf->setReloadDialplan($domain, true);
} else {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $error);
}
return reportQueue($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}