diff --git a/registration-system/admin/pages_list.php b/registration-system/admin/pages_list.php index 32c2bfcdd6df9a43d25dd8e3b5a6b2c9dcd85eb4..f8b0c0e38ead6756bdb0d22034544d14f5713f0e 100644 --- a/registration-system/admin/pages_list.php +++ b/registration-system/admin/pages_list.php @@ -9,6 +9,27 @@ global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax, $config_studitypen, $config_essen, $config_reisearten; +$ecols = [ + "forname" => function($d){ return $d; }, + "sirname" => function($d){ return $d; }, + "mehl" => function($d){ return $d; }, + "pseudo" => function($d){ return $d; }, + "antyp" => function($d){ return $d; }, + "abtyp" => function($d){ return $d; }, + "anday" => function($d){ return date('Y-m-d', DateTime::createFromFormat('d.m.Y',$d)->getTimestamp()); }, + "abday" => function($d){ return date('Y-m-d', DateTime::createFromFormat('d.m.Y',$d)->getTimestamp()); }, + "comment" => function($d){ return $d; }, + "studityp"=> function($d){ return $d; }, + "virgin" => function($d){ return (($d=="Nein") ? 1 : 0); } +]; + +if(isset($_REQUEST['change'])){ + $update = []; + foreach($ecols as $e){ + + } +} + if(isset($_REQUEST['ajax'])){ if(isset($_REQUEST['update']) && isset($_REQUEST['hash']) && isset($_REQUEST['nstate'])){ @@ -22,18 +43,7 @@ if(isset($_REQUEST['ajax'])){ elseif(isset($_REQUEST['form'])){ $bid = $_REQUEST['hash']; - $ecols = [ - "forname", - "sirname", - "mehl", - "pseudo", - "antyp", - "abtyp", - "anday", - "abday", - "comment", - "studityp" - ]; + $rcols = [ "bachelor_id" => ["Hash", function( $b ){ return $b; }], "fahrt_id" => ["Fahrt", function( $b ){ return "ID ".$b; }], @@ -53,7 +63,7 @@ if(isset($_REQUEST['ajax'])){ $ajax .= '<br /> <div id="stylized" class="myform"> - <form id="form" name="form" method="post" action="">'; + <form id="form" name="form" method="post" action="?list&change='.$bid.'">'; $ajax .= admin_show_formular_helper_input("Vorname", "forname", $bachelor["forname"], ""); $ajax .= admin_show_formular_helper_input("Nachname","sirname",$bachelor["sirname"],""); @@ -175,7 +185,8 @@ $columns = array( "studityp", "paid", "repaid", - "backstepped" + "backstepped", + "virgin" ); $columnFunctions = array( @@ -189,6 +200,7 @@ $columnFunctions = array( "Abreisetag" => function($person) { return comm_from_mysqlDate( $person["abday"]); }, "Kommentar" => function($person) { return $person["comment"]; }, "StudiTyp" => function($person) { return $person["studityp"]; }, + "18+" => function($person) { return (($person["virgin"]==0) ? "Ja" : "Nein"); }, "PaidReBack" => function($person) { return ($person["paid"] ? $person["paid"] : "0") .",". ($person["repaid"] ? $person["repaid"] : "0") .",". ($person["backstepped"] ? $person["backstepped"] : "0"); } ); @@ -252,18 +264,18 @@ $text .=<<<END "columnDefs": [ { type: 'link', targets: 2 }, { type: 'link', targets: 0 }, - { type: 'prb', targets: 9 } + { type: 'prb', targets: 10 } ], "aoColumnDefs": [ { - "aTargets": [ 9 ], + "aTargets": [ 10 ], "mDataProp": function ( data, type, row ) { if (type === 'set') { - data[9] = row; + data[10] = row; var btns = ""; var classes = ["paid", "repaid", "backstepped"]; - var txt = data[9].split(","); + var txt = data[10].split(","); for(var i = 0; i < txt.length; i++){ var tmp = (txt[i]==0) ? 0 : 1; btns += "<div onclick=\"btnclick(this, '"+classes[i]+"','"+data[0].match(/<a [^>]+>([^<]+)<\/a>/)[1]+"',"+tmp+");\" class='btn btn-"+classes[i]+"-"+tmp+"'> </div>"; @@ -277,7 +289,7 @@ $text .=<<<END return data.date_rendered; } // 'sort' and 'type' both just use the raw data - return data[9]; + return data[10]; } } ], diff --git a/registration-system/index.php b/registration-system/index.php index 56d846ae6e22505badf8351bbd160dab798f07c4..5df38816e717fd8330feb1859bbe6908757f6f6c 100644 --- a/registration-system/index.php +++ b/registration-system/index.php @@ -245,7 +245,12 @@ function index_check_field($index, $check, &$datarr, &$errarr, $errmess){ //$tmp = ""; } } - $datarr[$index] = $tmp; + if($index == "virgin"){ + if($_REQUEST[$index]=="Ja") $datarr[$index] = 0; // NOTE: for consistency: virgin = 0 means > 18 + else $datarr[$index] = 1; + } else { + $datarr[$index] = $tmp; + } } } @@ -284,7 +289,7 @@ function index_show_formular($fid, $bid = NULL, $bachelor = NULL){ index_show_formular_helper_input("Anzeigename","pseudo",$bachelor["pseudo"],""); index_show_formular_helper_input("E-Mail-Adresse","mehl",$bachelor["mehl"],"regelmäßig lesen!"); index_show_formular_helper_sel("Du bist","studityp",$config_studitypen, $bachelor["studityp"],""); - index_show_formular_helper_sel("Alter 18+?","virgin",array("", "Nein", "Ja"), $bachelor["virgin"], "Bist du älter als 18 Jahre?"); + index_show_formular_helper_sel("Alter 18+?","virgin",array("", "Nein", "Ja"), ($bachelor["virgin"]==0) ? "Ja" : "Nein", "Bist du älter als 18 Jahre?"); index_show_formular_helper_sel("Essenswunsch","essen",$config_essen, $bachelor["essen"],"Info für den Koch."); index_show_formular_helper_sel2("Anreise","anday", array_slice($possible_dates,0, -1), $bachelor["anday"] ,"antyp",$config_reisearten, $bachelor["antyp"],"");