diff --git a/registration-system/admin/index.php b/registration-system/admin/index.php index 46abc5939fecb0fe8370388db155b5402c880e28..e21e371a46315466b77c69e1e1cb35b9abff8a58 100644 --- a/registration-system/admin/index.php +++ b/registration-system/admin/index.php @@ -7,6 +7,15 @@ */ session_start(); + +mb_internal_encoding('UTF-8'); +mb_http_output('UTF-8'); +mb_http_input('UTF-8'); +mb_language('uni'); +mb_regex_encoding('UTF-8'); +ob_start('mb_output_handler'); +date_default_timezone_set("Europe/Berlin"); + require_once("commons_admin.php"); require_once("pages.php"); require_once("../config.inc.php"); @@ -47,10 +56,10 @@ if (isLoggedIn()) page_stuff(); break; case "list": page_list(); break; - //case "cost": - //page_cost(); break; - //case "mail": - //page_mail(); break; + case "cost": + page_cost(); break; + case "mail": + page_mail(); break; case "notes": page_notes(); break; default: diff --git a/registration-system/admin/pages.php b/registration-system/admin/pages.php index 1aad11d39ae564d0dda47244342cd05ea1ca66e6..0c8c44febba394b80d9da3739afee89b4fdfcd63 100644 --- a/registration-system/admin/pages.php +++ b/registration-system/admin/pages.php @@ -57,7 +57,23 @@ function page_404($pag) } function page_notes(){ - require_once "pages_notes.php"; + require_page("pages_notes.php"); +} + +function page_mail(){ + require_page("pages_mail.php"); +} + +function page_cost(){ + require_page("pages_cost.php"); +} + +function require_page($page){ + if(!@file_exists($page) ) { + page_404($page); + } else { + require_once $page; + } } ?> \ No newline at end of file diff --git a/registration-system/admin/pages_mail.php b/registration-system/admin/pages_mail.php new file mode 100644 index 0000000000000000000000000000000000000000..16db96c3d6ca95486df104ba1b961927a2508277 --- /dev/null +++ b/registration-system/admin/pages_mail.php @@ -0,0 +1,187 @@ +<?php +/** + * Created by PhpStorm. + * User: tim + * Date: 8/17/14 + * Time: 11:05 PM + */ + +global $config_studitypen, $config_reisearten, $config_essen, $admin_db, $config_current_fahrt_id, $config_verbose_level; + +echo ' +<form method="POST"> + <table> + <tr> + <td>Studityp</td> + <td>Anreise</td> + <td>Abreise</td> + <td>Nächte</td> + <td>Essen</td> + <td>Gezahlt</td> + <td>Rückgezahlt</td> + <td>18+</td> + <td>Zurückgetreten</td> + </tr> + <tr> + <td><input type="checkbox" name="check_studityp" /></td> + <td><input type="checkbox" name="check_antyp" /></td> + <td><input type="checkbox" name="check_abtyp" /></td> + <td><input type="checkbox" name="check_nights" /></td> + <td><input type="checkbox" name="check_essen" /></td> + <td><input type="checkbox" name="check_paid" /></td> + <td><input type="checkbox" name="check_repaid" /></td> + <td><input type="checkbox" name="check_virgin" /></td> + <td><input type="checkbox" name="check_backstepped" /></td> + </tr> + <tr> + <td> + <select multiple name="val_studityp[]">'; + foreach($config_studitypen as $typ) + echo'<option value="'.$typ.'">'.$typ.'</option>'; + echo' + </select> + </td> + <td> + <select multiple name="val_antyp[]">'; + foreach($config_reisearten as $typ) + echo'<option value="'.$typ.'">'.$typ.'</option>'; + echo' + </select> + </td> + <td> + <select multiple name="val_abtyp[]">'; + foreach($config_reisearten as $typ) + echo'<option value="'.$typ.'">'.$typ.'</option>'; + echo' + </select> + </td> + <td> + <select multiple name="val_nights[]">'; + $tage = $admin_db->query("SELECT DATEDIFF(bis, von) AS diff FROM fahrten WHERE fahrt_id=".$config_current_fahrt_id)->fetch(0); + for($cnt = $tage['diff']; $cnt>=0; $cnt--) + echo '<option value="'.$cnt.'">'.$cnt.'</option>'; + echo' + </select> + </td> + <td> + <select multiple name="val_essen[]">'; + foreach($config_essen as $typ) + echo'<option value="'.$typ.'">'.$typ.'</option>'; + echo' + </select> + </td> + <td> + <select name="val_paid"> + <option value="1">Ja</option> + <option value="0">Nein</option> + </select> + </td> + <td> + <select name="val_repaid"> + <option value="1">Ja</option> + <option value="0">Nein</option> + </select> + </td> + <td> + <select name="val_virgin"> + <option value="1">Ja</option> + <option value="0">Nein</option> + </select> + </td> + <td> + <select name="val_backstepped"> + <option value="1">Ja</option> + <option value="0">Nein</option> + </select> + </td> + </tr> + </table> + <input type="submit" name="submit"> +</form>'; + +$query = "SELECT mehl, forname, sirname FROM bachelor"; +$where = array(); + +if(!isset($_REQUEST['submit'])){ + // not submitted +} else { + if(isset($_REQUEST['check_studityp'])){ + $tmp = ""; + foreach($_REQUEST['val_studityp'] as $st){ + $tmp.= "studityp = \"".$st."\" OR "; + } + array_push($where,substr($tmp,0,-3)); + } + if(isset($_REQUEST['check_antyp'])){ + $tmp = ""; + foreach($_REQUEST['val_antyp'] AS $st){ + $tmp.= "antyp = ".$st." OR "; + } + array_push($where,substr($tmp,0,-3)); + } + if(isset($_REQUEST['check_abtyp'])){ + $tmp = ""; + foreach($_REQUEST['val_abtyp'] AS $st){ + $tmp.= "abtyp = ".$st." OR "; + } + array_push($where,substr($tmp,0,-3)); + } + if(isset($_REQUEST['check_nights'])){ + // TODO + } + if(isset($_REQUEST['check_essen'])){ + $tmp = ""; + foreach($_REQUEST['val_essen'] AS $st){ + $tmp.= "essen = ".$st." OR "; + } + array_push($where,substr($tmp,0,-3)); + } + if(isset($_REQUEST['check_paid'])){ + if($_REQUEST['val_paid'] == 1) + array_push($where,"paid IS NOT NULL"); + else + array_push($where,"paid IS NULL"); + } + if(isset($_REQUEST['check_repaid'])){ + if($_REQUEST['val_repaid'] == 1) + array_push($where,"repaid IS NOT NULL"); + else + array_push($where,"repaid IS NULL"); + } + if(isset($_REQUEST['check_virgin'])){ + array_push($where,"virgin = ".$_REQUEST['val_virgin']); + } + if(isset($_REQUEST['check_backstepped'])){ + if($_REQUEST['val_backstepped'] == 1) + array_push($where,"backstepped IS NOT NULL"); + else + array_push($where,"backstepped IS NULL"); + } + + + + if(count($where)>0){ + $query .= " WHERE "; + + foreach($where AS $w) + $query .= "(".$w.") AND "; + + $query = substr($query,0,-4); // cut last AND + } +} + +$config_verbose_level = 4; +$tmp = $admin_db->query($query.";"); +if($tmp) + $mails = $tmp->fetchAll(PDO::FETCH_ASSOC); +else + $mails = array(); + +echo '<textarea style="height:300px; width:800px">'; +foreach($mails as $mehl) + echo "<".$mehl['forname']." ".$mehl['sirname']."> ".$mehl['mehl']."; "; +echo '</textarea>'; + + +echo"<pre>";print_r($_REQUEST);echo"</pre>"; +?> \ No newline at end of file diff --git a/registration-system/config.inc.php b/registration-system/config.inc.php index c0cf9292c350728e3cdaf2868e8f554448349824..0403a86c60b1aa1ed5df8ad498a277efd87e089d 100644 --- a/registration-system/config.inc.php +++ b/registration-system/config.inc.php @@ -2,7 +2,7 @@ // https://repke.eu:8443 // passwort manu:kuzerPenis666! -$config_verbose_level = 3; // 0 = nothing, 1 = important, 2 = somewhat important, 3 = detailed verbose +$config_verbose_level = 3; // 0 = nothing, 1 = important, 2 = somewhat important, 3 = detailed verbose, 4 = with sql $config_admin_verbose_level = 3; $config_db = array( diff --git a/registration-system/frameworks/medoo.php b/registration-system/frameworks/medoo.php index 439433b8bc914f55aeabd95633682ce7be391821..198552379d15af08a42ddb81f70d0fad16982187 100644 --- a/registration-system/frameworks/medoo.php +++ b/registration-system/frameworks/medoo.php @@ -129,14 +129,14 @@ class medoo public function query($query) { $this->queryString = $query; - comm_verbose(3,$query); + comm_verbose(4,$query); return $this->pdo->query($query); } public function exec($query) { $this->queryString = $query; - comm_verbose(3,$query); + comm_verbose(4,$query); return $this->pdo->exec($query); } diff --git a/registration-system/view/admin_template.html b/registration-system/view/admin_template.html index ce43ed094c8e7741faf20e4f6ba03295729ec4fd..abce2e7f7af623d712e46f9dca310253dc860538 100644 --- a/registration-system/view/admin_template.html +++ b/registration-system/view/admin_template.html @@ -53,6 +53,10 @@ color:#f5f5f5; border:0 !important; } + form table tr td{ + border-left: 1px dotted #d3d3d3; + padding: 0 5px; + } </style> </head> <body>