コード例 #1
0
ファイル: index.php プロジェクト: veraveramanolo/cpc2c_uio
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    global $arrConf;
    $arrConf['cadena_dsn'] = "mysql://*****:*****@localhost/hispana";
    // _pre($arrConf);
    // _pre($_SESSION);
    /*
        global $arrLang;
    
        #incluir el archivo de idioma de acuerdo al que este seleccionado
        #si el archivo de idioma no existe incluir el idioma por defecto
        $lang=get_language();
    
        $script_dir=dirname($_SERVER['SCRIPT_FILENAME']);
    
        // Include language file for EN, then for local, and merge the two.
        include_once("modules/$module_name/lang/en.lang");
        $lang_file="modules/$module_name/lang/$lang.lang";
        if (file_exists("$script_dir/$lang_file")) {
            $arrLangModuleEN = $arrLangModule;
            include_once($lang_file);
            $arrLangModule = array_merge($arrLangModuleEN, $arrLangModule);
        }
    */
    load_language_module($module_name);
    require_once "modules/{$module_name}/libs/paloSantoDataForm.class.php";
    //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 . '/' . $arrConf['theme'];
    // Definición del formulario de nueva formulario
    $smarty->assign("MODULE_NAME", $module_name);
    $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("DESCATIVATE", _tr('Desactivate'));
    $smarty->assign("DELETE", _tr('Delete'));
    $smarty->assign("CONFIRM_CONTINUE", _tr('Are you sure you wish to continue?'));
    $smarty->assign("new_field", _tr('New Field'));
    $smarty->assign("add_field", _tr('Add Field'));
    $smarty->assign("update_field", _tr('Update Field'));
    $smarty->assign("CONFIRM_DELETE", _tr('Are you sure you wish to delete form?'));
    //Definicion de campos
    $formCampos = array('form_nombre' => array("LABEL" => _tr('Form Name'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "60"), "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"), 'field_nombre' => array("LABEL" => _tr('Field Name'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "50", "ROWS" => "2"), "order" => array("LABEL" => _tr('Order'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "3"), "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""));
    $smarty->assign("type", _tr('Type'));
    $smarty->assign("select_type", "type");
    $arr_type = array("VALUE" => array("TEXT", "LIST", "DATE", "TEXTAREA", "LABEL"), "NAME" => array(_tr('Type Text'), _tr('Type List'), _tr('Type Date'), _tr('Type Text Area'), _tr('Type Label')), "SELECTED" => "TEXT");
    $smarty->assign("option_type", $arr_type);
    $smarty->assign("item_list", _tr('List Item'));
    $smarty->assign("agregar", _tr('Add Item'));
    $smarty->assign("quitar", _tr('Remove Item'));
    $oForm = new paloForm($smarty, $formCampos);
    // print_r($_SESSION['ayuda']);
    $xajax = new xajax();
    $xajax->registerFunction("agregar_campos_formulario");
    $xajax->registerFunction("cancelar_formulario_ingreso");
    $xajax->registerFunction("guardar_formulario");
    $xajax->registerFunction("eliminar_campos_formulario");
    $xajax->registerFunction("editar_campo_formulario");
    $xajax->registerFunction("update_campo_formulario");
    $xajax->registerFunction("cancel_campo_formulario");
    $xajax->registerFunction("desactivar_formulario");
    $xajax->processRequests();
    $smarty->assign("xajax_javascript", $xajax->printJavascript("libs/xajax/"));
    $pDB = new paloDB($arrConf['cadena_dsn']);
    if (!is_object($pDB->conn) || $pDB->errMsg != "") {
        $smarty->assign("mb_message", _tr('Error when connecting to database') . " " . $pDB->errMsg);
    }
    if (isset($_POST['submit_create_form'])) {
        $contenidoModulo = new_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
    } else {
        if (isset($_POST['edit'])) {
            $contenidoModulo = edit_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
        } else {
            if (isset($_POST['delete'])) {
                $contenidoModulo = delete_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
            } else {
                if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "view") {
                    $contenidoModulo = view_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
                } else {
                    if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "activar") {
                        $contenidoModulo = activar_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
                    } else {
                        if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "editarCampo") {
                            $contenidoModulo = editar_campo_status($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
                        } else {
                            $contenidoModulo = listadoForm($pDB, $smarty, $module_name, $local_templates_dir);
                        }
                    }
                }
            }
        }
    }
    return $contenidoModulo;
}
コード例 #2
0
ファイル: new.php プロジェクト: puchon/php4-book
    header("Location: {$URL['login']}?url={$URL['new']}");
    exit;
}
if ($m == 'register') {
    /* Query 생성 */
    $query = "insert into poll_data " . "(question,sdate,status,answer_no," . "answer1,answer2,answer3,answer4,answer5," . "answer6,answer7,answer8,answer9,answer10) values " . "('{$question}',now(),'1',{$answer_no}," . "'{$answer1}','{$answer2}','{$answer3}','{$answer4}','{$answer5}'," . "'{$answer6}','{$answer7}','{$answer8}','{$answer9}','{$answer10}')";
    $dbh = dbconnect();
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        $msg = "에러가 발생하였습니다.<br><br>\n" . mysql_error();
        print_message($msg);
    } else {
        print_alert("등록이 완료되었습니다.   ", "url|{$URL['list']}");
    }
} else {
    new_form();
}
exit;
function new_form()
{
    global $URL;
    print_header();
    ?>

<script language="JavaScript">
<!--
function checkForm(form)
{
	var msg="";
	if(form.question.value==""){
		msg+="- 설문 내용을 입력하세요.\n\n";
コード例 #3
0
function new_multi_input($input_data = array(), $method = 'get')
{
    $new_form = '';
    if (!empty_array($input_data)) {
        $new_form = new_form($method, '', 'collect_form', 'navbar-form');
        $multiple_input = get_input_multiple($input_data);
        append_form($multiple_input, $new_form);
        append_form(get_input_submit('submit'), $new_form);
    }
    return $new_form;
}