示例#1
0
文件: index.php 项目: hardikk/HNH
function preview_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm)
{
    $smarty->assign('FRAMEWORK_TIENE_TITULO_MODULO', existeSoporteTituloFramework());
    $oForm->setViewMode();
    // Esto es para activar el modo "preview"
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        return false;
    }
    $oDataForm = new paloSantoDataForm($pDB);
    $arrDataForm = $oDataForm->getFormularios($_GET['id']);
    $arrFieldForm = $oDataForm->obtener_campos_formulario($_GET['id']);
    // Conversion de formato
    $arrTmp['form_nombre'] = $arrDataForm[0]['nombre'];
    $arrTmp['form_description'] = $arrDataForm[0]['descripcion'];
    $smarty->assign("title", _tr('Form'));
    $smarty->assign("form_name_lbl", _tr('Form Name'));
    $smarty->assign("form_description_lbl", _tr('Form Description'));
    $smarty->assign("form_name_val", $arrTmp['form_nombre']);
    $smarty->assign("form_description_val", $arrTmp['form_description']);
    $smarty->assign("id_formulario_actual", $_GET['id']);
    $smarty->assign("style_field", "style='display:none;'");
    $smarty->assign("formulario", $arrFieldForm);
    $smarty->assign('icon', 'images/kfaxview.png');
    $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/preview.tpl", _tr('Form'), $arrTmp);
    // hay que pasar el arreglo
    return $contenidoModulo;
}
示例#2
0
function preview_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm, $arrConf, $arrValoresGestionAnterior)
{
    require_once "/var/lib/asterisk/agi-bin/phpagi-asmanager.php";
    $oForm->setViewMode();
    // Esto es para activar el modo "preview"
    $pInterfazdeAgente = new paloSantoInterfazdeAgente($pDB);
    $iNumForm = $pInterfazdeAgente->getForm($_SESSION['id_campania']);
    $pDBsqlite = new paloDB("sqlite3:////var/www/db/acl.db");
    $pInterfazdeAgenteSqlite = new paloSantoInterfazdeAgente($pDBsqlite);
    $extensionAgente = $pInterfazdeAgenteSqlite->getExtensionAgente($_SESSION['elastix_user']);
    if (isset($_GET['telefono'])) {
        // si el telefono viene en la barra de direccion
        $destinatario = $_GET['telefono'];
    }
    if (!isset($iNumForm) || !is_numeric($iNumForm)) {
        return false;
    }
    $oDataForm = new paloSantoDataForm($pDB);
    $arrDataForm = $oDataForm->getFormularios($iNumForm);
    if (is_array($arrValoresGestionAnterior)) {
        $arrFieldForm = $oDataForm->obtener_campos_formulario($iNumForm, NULL, $_SESSION['telefono'], $_SESSION, $arrValoresGestionAnterior);
        // envío arreglo $_GET
    } else {
        $arrFieldForm = $oDataForm->obtener_campos_formulario($iNumForm, NULL, $_SESSION['telefono'], $_SESSION);
    }
    $smarty->assign("id_formulario_actual", $iNumForm);
    $smarty->assign("style_field", "style='display:none;'");
    $smarty->assign("formulario", $arrFieldForm);
    if (isset($destinatario) && $destinatario != "") {
        // si hay telefono seteado llamar al numero
        $astman = new AGI_AsteriskManager();
        if (!$astman->connect($arrConf['asterisk_host'], $arrConf['asterisk_user'], $arrConf['asterisk_pass'])) {
            $smarty->assign("mb_title", _tr("Error"));
            $smarty->assign("mb_message", _tr("No es posible conectarse a la PBX."));
        } else {
            $result = $astman->Originate("Local/{$extensionAgente}@from-internal", $extensionAgente, "hispana-callcenter", 1, null, null, null, null, "DEST={$destinatario}", null);
        }
    }
    $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/preview.tpl", _tr('Gestión de clientes'));
    // hay que pasar el arreglo
    return $contenidoModulo;
}
function update_campo_formulario($id_formulario, $nombre_formulario, $descripcion_formulario, $id_campo, $etiqueta_campo, $value_campo, $tipo_campo, $orden_campo)
{
    global $arrConf;
    $respuesta = new xajaxResponse();
    $validar = validar_campos($id_formulario, $nombre_formulario, $descripcion_formulario, $etiqueta_campo, $value_campo, $tipo_campo, $orden_campo, true);
    if ($validar == 'true') {
        $oDataForm = new paloSantoDataForm($arrConf["cadena_dsn"]);
        if ($oDataForm->existe_formulario($id_formulario) == 0) {
            //si no existe lo creo
            $se_creo = $oDataForm->crear_formulario($id_formulario, $nombre_formulario, $descripcion_formulario);
        } else {
            $se_creo = $oDataForm->actualizar_formulario($id_formulario, $nombre_formulario, $descripcion_formulario);
        }
        //ya existe
        if ($se_creo) {
            if ($oDataForm->actualizar_campo_formulario($id_campo, $etiqueta_campo, $value_campo, $tipo_campo, $orden_campo)) {
                $arr_campos = $oDataForm->obtener_campos_formulario($id_formulario);
                //actualiza la tabla dnd se muestran los campos
                $html_campos = html_campos_formulario($arr_campos);
                $respuesta->addAssign("tabla_campos_agregados", "innerHTML", $html_campos);
                $script = "\n visibilidad_botones_campo(2); \n";
                $script .= "limpiar_campos(); \n";
                $respuesta->addScript($script);
                $respuesta->addAssign("id_estado_field", "innerHTML", _tr('Add Field'));
                $respuesta->addAssign("mb_title", "innerHTML", "");
                $respuesta->addAssign("mb_message", "innerHTML", "");
                $respuesta->addAssign("mb_msg_ok", "innerHTML", _tr("Update Field Successfully") . ":  <b>{$etiqueta_campo}</b>");
            } else {
                $respuesta->addAssign("mb_title", "innerHTML", _tr("Validation Error"));
                $respuesta->addAssign("mb_message", "innerHTML", _tr('Field could not be updated in the Form'));
            }
        } else {
            $respuesta->addAssign("mb_title", "innerHTML", _tr("Validation Error"));
            $respuesta->addAssign("mb_message", "innerHTML", _tr('Form could not be updated'));
        }
    } else {
        $respuesta->addAssign("mb_title", "innerHTML", _tr("Validation Error"));
        $respuesta->addAssign("mb_message", "innerHTML", $validar);
    }
    return $respuesta;
}
示例#4
0
function edit_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm)
{
    $smarty->assign('FRAMEWORK_TIENE_TITULO_MODULO', existeSoporteTituloFramework());
    // Tengo que recuperar los datos del formulario
    $oDataForm = new paloSantoDataForm($pDB);
    $arrDataForm = $oDataForm->getFormularios($_GET['id']);
    $arrFieldForm = $oDataForm->obtener_campos_formulario($_GET['id']);
    $arrTmp['form_nombre'] = $arrDataForm[0]['nombre'];
    $arrTmp['form_description'] = $arrDataForm[0]['descripcion'];
    $oForm = new paloForm($smarty, $formCampos);
    $oForm->setEditMode();
    $smarty->assign("id_formulario_actual", $_GET['id']);
    $html_campos = html_campos_formulario($arrFieldForm);
    $smarty->assign("solo_contenido_en_vista", $html_campos);
    $smarty->assign('icon', 'images/kfaxview.png');
    $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr('Edit Form') . " \"" . $arrTmp['form_nombre'] . "\"", $arrTmp);
    return $contenidoModulo;
}