示例#1
0
function createFieldForm($pDB)
{
    $arrOptions = array('val1' => 'Value 1', 'val2' => 'Value 2', 'val3' => 'Value 3');
    $arrTmp = null;
    $pIngresodeBasedeClientes = new paloSantoIngresodeBasedeClientes($pDB);
    $arrTmp = $pIngresodeBasedeClientes->getCampanias();
    if (!empty($arrTmp)) {
        if (count($arrTmp) > 0) {
            foreach ($arrTmp as $form) {
                $arrCampOptions[$form['id']] = $form['nombre'];
            }
        } else {
            return "No existen campañas recargables.";
        }
    } else {
        return "No existen campañas recargables.";
    }
    $arrFields = array("nombre_base" => array("LABEL" => _tr("Nombre de la BD"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "archivo_de_clientes" => array("LABEL" => _tr("Archivo de clientes"), "REQUIRED" => "yes", "INPUT_TYPE" => "FILE", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "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'), "campania" => array("LABEL" => _tr("Campaña Recargable"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrCampOptions, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "EDITABLE" => "si"));
    //Editar base
    $edit_base = getParameter("edit_base");
    $id_base = getParameter("id_base");
    $id_campania = getParameter("id_campania");
    if ($edit_base == "si") {
        $base = $pIngresodeBasedeClientes->getDatosBase($id_base, $id_campania);
    }
    return $arrFields;
}
示例#2
0
function saveNewIngresodeBasedeClientes($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
    $pIngresodeBasedeClientes = new paloSantoIngresodeBasedeClientes($pDB);
    $arrFormIngresodeBasedeClientes = createFieldForm();
    $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 {
        if (isset($_FILES)) {
            $arrResult = $pIngresodeBasedeClientes->guardarActualizar($_POST, $_FILES);
        }
        $content = $pIngresodeBasedeClientes->resultadoTemplate($arrResult, $_FILES);
    }
    return $content;
}