diff --git a/registration-system/admin/pages.php b/registration-system/admin/pages.php index 6aaf132717a1df11615f3df5518d441cf32c524b..0be9cda1d87670b79cee4799178d1d645b1ef555 100644 --- a/registration-system/admin/pages.php +++ b/registration-system/admin/pages.php @@ -9,83 +9,8 @@ function page_stuff() $text .= "Übersichtsseite"; } -function page_list() -{ - global $text, $headers, $admin_db; - $headers =<<<END - <link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" /> - <script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script> - <script type="text/javascript" src="../view/js/jquery.dataTables.min.js"></script> -END; - $text .= "Meldeliste"; - - $columns = array( - "bachelor_id", - "fahrt_id", - "forname", - "sirname", - "mehl", - "pseudo", - "antyp", - "abtyp", - "anday", - "abday", - "comment", - "studityp", - "paid", - "repaid", - "backstepped" - ); - - $columnFunctions = array( - "Anmelde-ID" => function($person) { return $person["bachelor_id"]; }, - "FahrtID" => function($person) { return $person["fahrt_id"]; }, - "Name" => function($person) { return "<a href='mailto:".$person["mehl"]."?subject=FS-Fahrt'>".$person["forname"]." ".$person["sirname"]." (".$person["pseudo"].")</a>"; }, - "Anreisetyp" => function($person) { return $person["antyp"]; }, - "Abreisetyp" => function($person) { return $person["abtyp"]; }, - "Anreisetag" => function($person) { return $person["anday"]; }, - "Abreisetag" => function($person) { return $person["abday"]; }, - "Kommentar" => function($person) { return $person["comment"]; }, - "StudiTyp" => function($person) { return $person["studityp"]; }, - "PaidReBack" => function($person) { return ($person["paid"] ? "1" : "0") . ($person["repaid"] ? "1" : "0") . ($person["backstepped"] ? "1" : "0"); } - ); - - $text .=<<<END - <table id="mlist"> - <thead> - <tr> -END; - foreach($columnFunctions as $key => $value) - { - $text .= "<th>".$key."</th>"; - } - $text .=<<<END - </tr> - </thead> - <tbody> -END; - // TODO: generate table content - - $people = $admin_db->select('bachelor',$columns); - foreach($people as $person) { - $text .= "<tr>"; - foreach($columnFunctions as $key => $value) - { - $text .= "<td>".$value($person)."</td>"; - } - $text .= "</tr>"; - } - - $text .=<<<END - </tbody> - </table> - <script type='text/javascript'> - $(document).ready(function(){ - $('#mlist').dataTable({}); - }); - </script> -END; - +function page_list(){ + require_page("pages_list.php"); } function page_404($pag) diff --git a/registration-system/admin/pages_list.php b/registration-system/admin/pages_list.php new file mode 100644 index 0000000000000000000000000000000000000000..5d657b5515d3665953a6f3597efbda03b9224f0a --- /dev/null +++ b/registration-system/admin/pages_list.php @@ -0,0 +1,93 @@ +<?php +/** + * Created by PhpStorm. + * User: tim + * Date: 9/3/14 + * Time: 7:09 PM + */ + +global $text, $headers, $admin_db, $config_current_fahrt_id; +$headers =<<<END + <link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" /> + <script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script> + <script type="text/javascript" src="../view/js/jquery.dataTables.min.js"></script> +END; +$text .= "Meldeliste"; + +$columns = array( + "bachelor_id", + "fahrt_id", + "anm_time", + "forname", + "sirname", + "mehl", + "pseudo", + "antyp", + "abtyp", + "anday", + "abday", + "comment", + "studityp", + "paid", + "repaid", + "backstepped" +); + +$columnFunctions = array( + "Anmelde-ID" => function($person) { return $person["bachelor_id"]; } + //,"FahrtID" => function($person) { return $person["fahrt_id"]; } +,"Anmeldung" => function($person) { return date("m.d.Y", $person['anm_time']); }, + "Name" => function($person) { return "<a href='mailto:".$person["mehl"]."?subject=FS-Fahrt'>".$person["forname"]." ".$person["sirname"]." (".$person["pseudo"].")</a>"; }, + "Anreisetyp" => function($person) { return $person["antyp"]; }, + "Abreisetyp" => function($person) { return $person["abtyp"]; }, + "Anreisetag" => function($person) { return date("m.d.Y", $person["anday"]); }, + "Abreisetag" => function($person) { return date("m.d.Y", $person["abday"]); }, + "Kommentar" => function($person) { return $person["comment"]; }, + "StudiTyp" => function($person) { return $person["studityp"]; }, + "PaidReBack" => function($person) { return ($person["paid"] ? "1" : "0") . ($person["repaid"] ? "1" : "0") . ($person["backstepped"] ? "1" : "0"); } +); + +$text .=<<<END + <table id="mlist"> + <thead> + <tr> +END; +foreach($columnFunctions as $key => $value) +{ + $text .= "<th>".$key."</th>"; +} +$text .=<<<END + </tr> + </thead> + <tbody> +END; + +$people = $admin_db->select('bachelor',$columns, array("fahrt_id"=>$config_current_fahrt_id)); +foreach($people as $person) { + $text .= "<tr>"; + foreach($columnFunctions as $key => $value) + { + $text .= "<td class='".$key."'>".$value($person)."</td>"; + } + $text .= "</tr>"; +} + +$text .=<<<END + </tbody> + </table> + <script type='text/javascript'> + $(document).ready(function(){ + $('#mlist').dataTable({}); + + $('.PaidReBack').each(function(){ + $(this).text(function(){ + var btns = ""; + for(var i = 0, txt = $(this).text(); i < txt.length; i++){ + btns += txt[i]+","; + } + return btns; + }); + }); + }); + </script> +END; diff --git a/registration-system/frameworks/commons.php b/registration-system/frameworks/commons.php index bc64b2f999002bb29967fa8e8a01ea99d0ecc4bd..535a9dcea30281817c2521e2e7109a959fb89a5b 100644 --- a/registration-system/frameworks/commons.php +++ b/registration-system/frameworks/commons.php @@ -26,7 +26,7 @@ function comm_format_date($date){ } function comm_get_possible_dates($fid){ - return array("12.03.2014","13.03.2014","14.03.2014"); + return array("12.03.2014","13.03.2014","14.03.2014"); // FIXME dynamisch machen! } function comm_isopen_fid($db_handle, $fid){ diff --git a/registration-system/index.php b/registration-system/index.php index 0e6debc3b592ad0d00db403c495d8b4904e70025..9d71858f686ffdd5d4583fa81434e6bf5a09597e 100644 --- a/registration-system/index.php +++ b/registration-system/index.php @@ -77,6 +77,9 @@ function index_form_to_db($data){ global $index_db, $config_baseurl, $lang_regmail, $config_current_fahrt_id; $data['version'] = 1; $data['bachelor_id'] = comm_generate_key($index_db, "bachelor", "bachelor_id", array('fahrt_id'=>$data['fahrt_id'])); + $data['anm_time'] = time(); + $data['anday'] = DateTime::createFromFormat('d.m.Y',$data['anday'])->getTimestamp(); + $data['abday'] = DateTime::createFromFormat('d.m.Y',$data['abday'])->getTimestamp(); $index_db->insert("bachelor", $data); $from = $index_db->get("fahrten", array("kontakt","leiter"), array("fahrt_id"=>$config_current_fahrt_id)); $mail = comm_get_lang("lang_regmail", array( "{{url}}" => $config_baseurl."status.php?hash=".$data['bachelor_id'], @@ -351,7 +354,7 @@ function index_show_signupTable($fid){ <table class="signups"> <thead> <tr> - <th></th> + <!--th></th--> <th>Anzeigename</th> <th>Anreisetag</th> <th>Anreiseart</th> @@ -362,11 +365,11 @@ function index_show_signupTable($fid){ </thead>'; foreach($data as $d){ echo '<tr> - <td>'.$d["studityp"].'</td> + <!--td>'.$d["studityp"].'</td--> <td>'.$d["pseudo"].'</td> - <td>'.$d["anday"].'</td> + <td>'.date('d.m.Y', $d["anday"]).'</td> <td>'.$d["antyp"].'</td> - <td>'.$d["abday"].'</td> + <td>'.date('d.m.Y', $d["abday"]).'</td> <td>'.$d["abtyp"].'</td> <td>'.$d["comment"].'</td> </tr>'; diff --git a/registration-system/status.php b/registration-system/status.php index c631be707c69dff52ba9a3908111c93739e062d0..35425ff0cec97af74f9ec7ea882f77e4a65f5fab 100644 --- a/registration-system/status.php +++ b/registration-system/status.php @@ -36,10 +36,11 @@ function show_content(){ $infolist = Array( 'Anmelde ID' => $data['bachelor_id'], + 'Anmeldetag' => date('d.m.Y', $data['anm_time']), 'Vor-/Nachname' => $data['forname'].' '.$data['sirname'].(strlen($data['pseudo']) > 0 ? ' ('.$data['pseudo'].')' : ""), 'eMail-Adresse' => $data['mehl'], - 'Anreisetag & Art' => $data["anday"].' ('.$data["antyp"].')', - 'Abreisetag & Art' => $data["abday"].' ('.$data["abtyp"].')', + 'Anreisetag & Art' => date('d.m.Y', $data["anday"]).' ('.$data["antyp"].')', + 'Abreisetag & Art' => date('d.m.Y', $data["abday"]).' ('.$data["abtyp"].')', 'Essenswunsch' => $data["essen"], 'Zahlung erhalten' => ((is_null($data["paid"])) ? "nein" : date('d.m.Y',$data["paid"])), 'Rückzahlung gesendet' => ((is_null($data["repaid"])) ? "nein" : date('d.m.Y',$data["repaid"])),