Пример #1
0
<?php

include_once 'biblioteca/conexionBd.php';
$recursoDeConexion = conectar('postgresql');
//Realizar Select
$query = "select marca_id,nombre\n              from marca\n              ;";
$resultSetMarca = ejecutarQueryPostgreSql($recursoDeConexion, $query);
$valoresMarca = array('marca_id', 'nombre', 'marca');
$selectMarca = crearSelect($resultSetMarca, $marcaId, $valoresMarca);
//Realizar Select
$query = "select tipo_id,nombre\n              from tipo\n              ;";
$resultSetTipo = ejecutarQueryPostgreSql($recursoDeConexion, $query);
$valoresTipo = array('tipo_id', 'nombre', 'tipo');
$selectTipo = crearSelect($resultSetTipo, $tipoId, $valoresTipo);
desconectarPostgreSql($recursoDeConexion);
$formulario = <<<INICIO
<html>
<head>
<title>Editar Tabla</title>
</head>
<form action="" method="post">
\t<table>
\t\t<tr>
\t\t  <td>Nombre del Producto</td>
\t\t  <td><input type="text" value="{$nombreProducto}" name='nombreproducto'/></td>
\t\t</tr>
\t\t<tr>
\t\t  <td>Descripcion</td>
\t\t  <td><input type="text" value="{$descripcion}" name="descripcion"/></td>
\t\t</tr>
\t\t<tr>
Пример #2
0
function viewFeatures($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials, $action = "")
{
    global $arrPermission;
    $error = "";
    $pORGZ = new paloSantoOrganization($pDB);
    if ($credentials['userlevel'] == 'superadmin') {
        $domain = getParameter(_tr('organization'));
        $tmpORG = $pORGZ->getOrganization(array());
        $arrOrgz = array();
        foreach ($tmpORG as $value) {
            $arrOrgz[$value["domain"]] = $value["name"];
        }
        if (count($arrOrgz) > 0) {
            if (!isset($arrOrgz[$domain])) {
                $domain = $tmpORG[0]["domain"];
            }
        } else {
            $smarty->assign("mb_title", _tr("ERROR"));
            $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module"));
            return '';
        }
    } else {
        $domain = $credentials['domain'];
    }
    $arrForm = createFieldForm();
    $oForm = new paloForm($smarty, $arrForm);
    $pFC = new paloFeatureCodePBX($pDB, $domain);
    $arrFC = $pFC->getAllFeaturesCode($domain);
    if ($arrFC === false) {
        $smarty->assign("mb_title", _tr("ERROR"));
        $smarty->assign("mb_message", _tr($pFC->errMsg));
    } else {
        foreach ($arrFC as $feature) {
            $name = $feature["name"];
            $disabled_sel = "disabled";
            if ($action == "edit") {
                $data[$name] = $_POST[$name];
                if (isset($_POST[$name . "_stat"])) {
                    $estado = $_POST[$name . "_stat"];
                }
            } else {
                if ($feature["estado"] != "enabled") {
                    $estado = "disabled";
                } else {
                    if (!is_null($feature["code"]) && $feature["code"] != "") {
                        $code = $feature["code"];
                        $estado = "ena_custom";
                    } else {
                        $code = $feature["default_code"];
                        $estado = "ena_default";
                    }
                }
                $data[$feature["name"]] = $code;
            }
            if ($name != "pickup" && $name != "blind_transfer" && $name != "attended_transfer" && $name != "one_touch_monitor" && $name != "disconnect_call") {
                if (getParameter("edit") || $action == "edit") {
                    $disabled_sel = "";
                }
                $smarty->assign($feature["name"] . "_stat", crearSelect($feature["name"], $estado, $disabled_sel));
            }
        }
    }
    if ($credentials['userlevel'] == 'superadmin') {
        $HTML = '<select name="organization" id="organization" onchange="javascript:submit();">';
        foreach ($arrOrgz as $key => $value) {
            $seleted = '';
            if ($key == $domain) {
                $seleted = 'selected="selected"';
            }
            $value = htmlentities($value, ENT_QUOTES, "UTF-8");
            $key = htmlentities($key, ENT_QUOTES, "UTF-8");
            $HTML .= '<option label="' . $value . '" value="' . $key . '" ' . $seleted . '>' . $value . '</option>';
        }
        $HTML .= '</select>';
        $HTML .= '<input type="button" name="select_org" value="Organization" class="neo-table-action">';
        $smarty->assign("SELECT_ORG", $HTML);
    }
    $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("BLACKLIST", _tr("BLACKLIST"));
    $smarty->assign("CALLFORWARD", _tr("CALLFORWARD"));
    $smarty->assign("CALLWAITING", _tr("CALLWAITING"));
    $smarty->assign("CORE", _tr("CORE"));
    $smarty->assign("DICTATION", _tr("DICTATION"));
    $smarty->assign("DND", _tr("DND"));
    $smarty->assign("INFO", _tr("INFO"));
    $smarty->assign("RECORDING", _tr("RECORDING"));
    $smarty->assign("SPEEDDIAL", _tr("SPEEDDIAL"));
    $smarty->assign("VOICEMAIL", _tr("VOICEMAIL"));
    $smarty->assign("FOLLOWME", _tr("FOLLOWME"));
    $smarty->assign("QUEUE", _tr("QUEUE"));
    $smarty->assign("USERLEVEL", $credentials['userlevel']);
    if (getParameter("edit") || $action == "edit") {
        $oForm->setEditMode();
    } else {
        $oForm->setViewMode();
    }
    //permission
    $smarty->assign("EDIT_FC", in_array("edit", $arrPermission));
    $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Features Code"), $data);
    $mensaje = showMessageReload($module_name, $pDB, $credentials);
    $content = "<form  method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $mensaje . $htmlForm . "</form>";
    return $content;
}