Example #1
0
function createFieldForm($pDB)
{
    $pCrearCampaign = new paloSantoCrearcampaña($pDB);
    /*
        $arrTmp = $pCrearCampaign->getForms();
        if(count($arrTmp)>0){
    	foreach($arrTmp as $form){
    	    $arrFormOptions[$form['id']] = $form['nombre'];
    	}
        }else{
    	return "No existen formularios.";
        }
    */
    /*
    if(getParameter("action")!="view_edit"){      
    	$arrTmp = $pCrearCampaign->getBases();
    	if(count($arrTmp)>0){
    	    foreach($arrTmp as $base){
    		$arrBaseOptions[$base['id']] = $base['nombre'];
    		}
    	    }else{
    		return "No existen bases de clientes.";
    	    }
    
    	$pDB = new paloDB("sqlite3:////var/www/db/acl.db"); // me cambio temporalmente a Sqlite
    	$pCrearCampaign = new paloSantoCrearcampaña($pDB);
    	$arrTmp = $pCrearCampaign->getUsuarios("Agente"); // pido los usuarios del rol Agente
    	
    	if(count($arrTmp)>0){
    	    foreach($arrTmp as $base){
    		$arrAgentesNoElegidos[$base['name']] = $base['description'] . " - Ext: " . $base['extension'];
    	    }
    	}else{
    	    return "No existen agentes.";
    	}
    }else
    */
    if (getParameter("action") == "view_edit") {
        // Bases
        $arrTmp = $pCrearCampaign->getBasesCampania(getParameter('id'));
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $base) {
                $arrBasesElegidas[$base['id']] = $base['nombre'];
            }
        }
        if (sizeof($arrBasesElegidas) > 0) {
            $arrTmp = $pCrearCampaign->getOtrasBases($arrBasesElegidas);
        } else {
            $arrTmp = $pCrearCampaign->getBases();
        }
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $base) {
                $arrBaseOptions[$base['id']] = $base['nombre'];
            }
        }
        //Calltypes
        $arrTmp = $pCrearCampaign->getCalltypes(getParameter('id'), getParameter('clase_calltype'));
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $calltype) {
                $arrCalltypes[$calltype['id']] = $calltype['descripcion'];
            }
        } else {
            return "No existen calltypes.";
        }
        // Agentes
        $arrTmp = $pCrearCampaign->getAgentesCampania(getParameter('id'));
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $agente) {
                $arrAgentesElegidos[$agente['id_agente']] = $agente['id_agente'];
            }
        }
        $pDB = new paloDB("sqlite3:////var/www/db/acl.db");
        // me cambio temporalmente a Sqlite
        $pCrearCampaign = new paloSantoCrearcampaña($pDB);
        $arrTmp = $pCrearCampaign->getUsuariosElegidos("Agente", $arrAgentesElegidos);
        // pido los usuarios del rol Agente que estén en arreglo $rrAgentesElegidos
        unset($arrAgentesElegidos);
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $agente) {
                $arrAgentesElegidos[$agente['name']] = $agente['description'] . " - Ext: " . $agente['extension'];
            }
        }
        if (sizeof($arrAgentesElegidos) > 0) {
            $arrTmp = $pCrearCampaign->getUsuariosElegidos("Agente", $arrAgentesElegidos, "not");
            // pido los usuarios del rol Agente que estén en arreglo $rrAgentesElegidos
        } else {
            $arrTmp = $pCrearCampaign->getUsuarios("Agente");
        }
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $agente) {
                $arrAgentesNoElegidos[$agente['name']] = $agente['description'] . " - Ext: " . $agente['extension'];
            }
        }
    }
    // por default $arrSelect está vacío, debe tener algo cuando la campaña está siendo editada
    $arrSelected = array();
    $arrFields = array("nombre" => array("LABEL" => _tr("Nombre"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "base" => array("LABEL" => _tr("Base"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrBaseOptions, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "10"), "bases_elegidas" => array("LABEL" => _tr("Base"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrBasesElegidas, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "10"), "agente" => array("LABEL" => _tr("Agente"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrAgentesNoElegidos, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "5"), "agentes_elegidos" => array("LABEL" => _tr("Agente"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrAgentesElegidos, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "5"), "calltypes" => array("LABEL" => _tr("Call types"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrCalltypes, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "5"), "calltypes_elegidos" => array("LABEL" => _tr("Call types"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrSelected, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "5"));
    return $arrFields;
}
Example #2
0
function createFieldForm($pDB)
{
    $pCrearCampaign = new paloSantoCrearcampaña($pDB);
    $arrTmp = $pCrearCampaign->getForms();
    if (count($arrTmp) > 0) {
        foreach ($arrTmp as $form) {
            $arrFormOptions[$form['id']] = $form['nombre'];
        }
    } else {
        return "No existen formularios.";
    }
    if ($_GET['action'] != "view_edit") {
        $arrTmp = $pCrearCampaign->getBases();
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $base) {
                $arrBaseOptions[$base['id']] = $base['nombre'];
            }
        } else {
            return "No existen bases de clientes.";
        }
        $pDB = new paloDB("sqlite3:////var/www/db/acl.db");
        // me cambio temporalmente a Sqlite
        $pCrearCampaign = new paloSantoCrearcampaña($pDB);
        $arrTmp = $pCrearCampaign->getUsuarios("Agente");
        // pido los usuarios del rol Agente
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $base) {
                $arrAgentesNoElegidos[$base['name']] = $base['description'] . " - Ext: " . $base['extension'];
            }
        } else {
            return "No existen agentes.";
        }
    } elseif ($_GET['action'] == "view_edit") {
        // Bases
        $arrTmp = $pCrearCampaign->getBasesCampania($_GET['id']);
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $base) {
                $arrBasesElegidas[$base['id']] = $base['nombre'];
            }
        }
        if (sizeof($arrBasesElegidas) > 0) {
            $arrTmp = $pCrearCampaign->getOtrasBases($arrBasesElegidas);
        } else {
            $arrTmp = $pCrearCampaign->getBases();
        }
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $base) {
                $arrBaseOptions[$base['id']] = $base['nombre'];
            }
        }
        // Agentes
        $arrTmp = $pCrearCampaign->getAgentesCampania($_GET['id']);
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $agente) {
                $arrAgentesElegidos[$agente['id_agente']] = $agente['id_agente'];
            }
        }
        $pDB = new paloDB("sqlite3:////var/www/db/acl.db");
        // me cambio temporalmente a Sqlite
        $pCrearCampaign = new paloSantoCrearcampaña($pDB);
        $arrTmp = $pCrearCampaign->getUsuariosElegidos("Agente", $arrAgentesElegidos);
        // pido los usuarios del rol Agente que estén en arreglo $rrAgentesElegidos
        unset($arrAgentesElegidos);
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $agente) {
                $arrAgentesElegidos[$agente['name']] = $agente['description'] . " - Ext: " . $agente['extension'];
            }
        }
        if (sizeof($arrAgentesElegidos) > 0) {
            $arrTmp = $pCrearCampaign->getUsuariosElegidos("Agente", $arrAgentesElegidos, "not");
            // pido los usuarios del rol Agente que estén en arreglo $rrAgentesElegidos
        } else {
            $arrTmp = $pCrearCampaign->getUsuarios("Agente");
        }
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $agente) {
                $arrAgentesNoElegidos[$agente['name']] = $agente['description'] . " - Ext: " . $agente['extension'];
            }
        }
    }
    // por default $arrSelect está vacío, debe tener algo cuando la campaña está siendo editada
    $arrSelected = array();
    $arrFields = array("nombre" => array("LABEL" => _tr("Nombre"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "id_form" => array("LABEL" => _tr("Form"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrFormOptions, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si"), "base" => array("LABEL" => _tr("Base"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrBaseOptions, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "10"), "bases_elegidas" => array("LABEL" => _tr("Base"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrBasesElegidas, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "10"), "agente" => array("LABEL" => _tr("Agente"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrAgentesNoElegidos, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "5"), "agentes_elegidos" => array("LABEL" => _tr("Agente"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrAgentesElegidos, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si", "MULTIPLE" => true, "SIZE" => "5"), "fecha_inicio" => array("LABEL" => _tr("Fecha Inicio"), "REQUIRED" => "yes", "INPUT_TYPE" => "DATE", "INPUT_EXTRA_PARAM" => array("TIME" => false, "FORMAT" => "%Y-%m-%d"), "VALIDATION_TYPE" => 'text'), "fecha_fin" => array("LABEL" => _tr("Fecha Fin"), "REQUIRED" => "no", "REQUIRED" => "yes", "INPUT_TYPE" => "DATE", "INPUT_EXTRA_PARAM" => array("TIME" => false, "FORMAT" => "%Y-%m-%d"), "VALIDATION_TYPE" => 'text'), "script" => array("LABEL" => _tr("Script"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "EDITABLE" => "si", "COLS" => "50", "ROWS" => "20", "VALIDATION_EXTRA_PARAM" => ""));
    return $arrFields;
}