コード例 #1
0
ファイル: index.php プロジェクト: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    require_once "modules/{$module_name}/configs/default.conf.php";
    require_once "modules/{$module_name}/libs/paloSantoDataFormList.class.php";
    load_language_module($module_name);
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConfig['theme'];
    // Definición del formulario de nueva formulario
    $smarty->assign("MODULE_NAME", $module_name);
    $script = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"libs/js/jscalendar/calendar-win2k-2.css\" />\n    <script type=\"text/javascript\" src=\"libs/js/jscalendar/calendar.js\"></script>\n    <script type=\"text/javascript\" src=\"libs/js/jscalendar/lang/calendar-en.js\"></script>\n    <script type=\"text/javascript\" src=\"libs/js/jscalendar/calendar-setup.js\"></script>";
    $smarty->assign("HEADER", $script);
    //Definicion de campos
    $formCampos = array('form_nombre' => array("LABEL" => _tr("Form Name"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "40"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), 'form_description' => array("LABEL" => _tr("Form Description"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "33", "ROWS" => "2"));
    $smarty->assign("type", _tr('Type'));
    $smarty->assign("select_type", "type");
    $smarty->assign("option_type", array("VALUE" => array("LABEL", "TEXT", "LIST", "DATE", "TEXTAREA"), "NAME" => array(_tr("Type Label"), _tr("Type Text"), _tr("Type List"), _tr("Type Date"), _tr("Type Text Area")), "SELECTED" => "Text"));
    $smarty->assign("item_list", _tr('List Item'));
    $oForm = new paloForm($smarty, $formCampos);
    $pDB = new paloDB($arrConfig['cadena_dsn']);
    if (!is_object($pDB->conn) || $pDB->errMsg != "") {
        $smarty->assign("mb_message", _tr("Error when connecting to database") . " " . $pDB->errMsg);
    }
    if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "preview") {
        $contenidoModulo = preview_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
    } else {
        $contenidoModulo = listadoForm($pDB, $smarty, $module_name, $local_templates_dir);
    }
    return $contenidoModulo;
}
コード例 #2
0
ファイル: index3.php プロジェクト: veraveramanolo/cpc2c_uio
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoInterfazdeAgente.class.php";
    require_once "modules/{$module_name}/libs/paloSantoDataFormList.class.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'];
    $script = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"libs/js/jscalendar/calendar-win2k-2.css\" />\n    <script type=\"text/javascript\" src=\"libs/js/jscalendar/calendar.js\"></script>\n    <script type=\"text/javascript\" src=\"libs/js/jscalendar/lang/calendar-en.js\"></script>\n    <script type=\"text/javascript\" src=\"libs/js/jscalendar/calendar-setup.js\"></script>";
    $smarty->assign("HEADER", $script);
    //conexion resource
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    //actions
    $action = getAction();
    $content = "";
    if ($action == 'sacarpausa') {
        sacarPausa($_SESSION['elastix_user'], $pDB);
        $action = 'info_cliente';
    }
    /** 
     * CORRECTO:Primero valido si el usuario tiene campañas disponibles.
     */
    if (!validarUsuario($_SESSION['elastix_user'], $pDB)) {
        $action = "deny";
    }
    if (usuarioEnPausa($_SESSION['elastix_user'], $pDB)) {
        $action = "pausado";
    }
    // si siguiente es si, procedo con el siguiente cliente
    // Al hacer unset, buscará otro cliente asociado a campaña.
    if (isset($_GET['siguiente']) && $_GET['siguiente'] == "si") {
        unset($_SESSION['id_campania_cliente']);
    }
    switch ($action) {
        case 'pausar':
            pausar($_POST['id_break'], $_SESSION['elastix_user'], $pDB);
        case 'pausado':
            $content = "El usuario <b>{$_SESSION['elastix_user']}</b> se encuentra en pausa, para regresar haga click <a href=index.php?menu=hispana_interfaz_agente&action=sacarpausa>aqui</a>.";
            break;
        case 'gestionar':
            $_SESSION['id_campania_cliente'] = $_GET['id_campania_cliente'];
            $content = viewFormInterfazdeAgente($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case 'deny':
            $content = "El usuario <b>{$_SESSION['elastix_user']}</b> no tiene campañas asignadas para hoy.";
            break;
        case "llamar":
            $_SESSION['action'] = 'llamar';
            // Ver si se puede mejorar el IF a continuación
            if (isset($_SESSION['ci']) && isset($_GET['id_campania']) && isset($_GET['id_campania_cliente']) && isset($_GET['telefono'])) {
                $_SESSION['id_campania'] = $_GET['id_campania'];
                $_SESSION['id_campania_cliente'] = $_GET['id_campania_cliente'];
                $_SESSION['telefono'] = $_GET['telefono'];
            }
            if (isset($_SESSION['id_campania_cliente']) && !empty($_SESSION['id_campania_cliente_recargable'])) {
                $arrValoresGestionAnterior = verificarGestionAnterior($_SESSION['id_campania_cliente'], $pDB);
            }
            /** Verificar si esto es útil. */
            $formCampos = array('form_nombre' => array("LABEL" => _tr("Form Name"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "40"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), 'form_description' => array("LABEL" => _tr("Form Description"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "33", "ROWS" => "2"));
            $smarty->assign("type", _tr('Type'));
            $smarty->assign("select_type", "type");
            $smarty->assign("option_type", array("VALUE" => array("LABEL", "TEXT", "LIST", "DATE", "TEXTAREA"), "NAME" => array(_tr("Type Label"), _tr("Type Text"), _tr("Type List"), _tr("Type Date"), _tr("Type Text Area")), "SELECTED" => "Text"));
            $smarty->assign("item_list", _tr('List Item'));
            $oForm = new paloForm($smarty, $formCampos);
            $content = preview_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm, $arrConf, $arrValoresGestionAnterior);
            break;
        case 'guardar':
            if (isset($_POST) && $_POST['calltype'] != 0) {
                // Aqui mismo se guarda y agenda la gestión.
                guardarGestion($_POST, $pDB);
                // Se llama asi mismo.
                // Header("Location: index.php?menu=hispana_interfaz_agente");
                unset($_SESSION["id_campania_cliente_recargable"]);
            } else {
                $smarty->assign("mb_title", _tr("Error"));
                $smarty->assign("mb_message", _tr("Se ha intentado guardar gestión sin Call Type."));
            }
            /** No se pone break, porque despues de guardar debe mostrarse la info del cliente. */
        /** No se pone break, porque despues de guardar debe mostrarse la info del cliente. */
        case 'info_cliente':
            // Obtiene y muestra información de un cliente (igual que el default)
            /** No se pone break */
        // Obtiene y muestra información de un cliente (igual que el default)
        /** No se pone break */
        default:
            $_SESSION['action'] = 'info_cliente';
            $content = viewFormInterfazdeAgente($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
    }
    /*
    echo "\$action:<br>";
    _pre($action);
    
    echo "\$_SESSION:<br>";
    _pre($_SESSION);
    */
    return $content;
}