diff --git a/registration-system/config_current_fahrt_id b/registration-system/config_current_fahrt_id index d8263ee9860594d2806b0dfd1bfd17528b0ba2a4..62f9457511f879886bb7728c986fe10b0ece6bcb 100644 --- a/registration-system/config_current_fahrt_id +++ b/registration-system/config_current_fahrt_id @@ -1 +1 @@ -2 \ No newline at end of file +6 \ No newline at end of file diff --git a/registration-system/index.php b/registration-system/index.php index 1d8ef429d14ddc2990e37138508e2c8c7fe58be9..e463d91c5564a8d2d0fb2559819d9412b20dfeae 100644 --- a/registration-system/index.php +++ b/registration-system/index.php @@ -16,9 +16,9 @@ function echo_headers() { } function index_get_css_includes() { - $basefolder = 'view/'; + $basefolder = 'view/'; - $base_styles = ['style.css']; + $base_styles = ['style.css']; $additional_styles = index_get_dependencies_helper('getCSSDependencies'); $styles = array_merge($base_styles, $additional_styles); @@ -31,7 +31,7 @@ function index_get_css_includes() { } function index_get_js_includes() { - $basefolder = 'view/'; + $basefolder = 'view/'; $base_js = [ 'js/jquery-1.11.1.min.js', @@ -55,10 +55,10 @@ function index_get_dependencies_helper($dependency_function_name) { $signup_method = SignupMethods::getInstance(); - if($signup_method->signupMethodExists()){ + if ($signup_method->signupMethodExists()) { $method_folder = $signup_method->getActiveMethodId(); - return array_map(function($d) use ($methods_basefolder, $method_folder) { + return array_map(function ($d) use ($methods_basefolder, $method_folder) { return $methods_basefolder . $method_folder . '/' . $d; }, $signup_method->getActiveMethod()->$dependency_function_name()); } @@ -67,51 +67,54 @@ function index_get_dependencies_helper($dependency_function_name) { function index_get_additional_headers() { $signup_method = SignupMethods::getInstance(); - if($signup_method->signupMethodExists()){ + if ($signup_method->signupMethodExists()) { return $signup_method->getActiveMethod()->getAdditionalHeader(); } return ''; } - - - - - // ===================================================================================================================== // CONTENT function show_content() { $environment = Environment::getEnv(); - if(!$environment->isSelectedTripIdValid()) { + if (!$environment->isSelectedTripIdValid()) { index_show_alleFahrten(); } else { $fid = $environment->getSelectedTripId(); + try { + $opentime = $environment->database->select('fahrten', ['opentime'], ['fahrt_id' => $fid])[0]['opentime']; + } catch (Exception $ex) { + $opentime = 0; + } + // --- Fahrtinfos index_show_fahrtHeader($fid); index_show_fahrtHeader_js($fid); - // --- Anmeldebox - index_show_signup(); + if ($opentime < time()) { + // --- Anmeldebox + index_show_signup(); + + // --- Liste der Anmeldungen + index_show_signupTable($fid); + } else index_show_countdown($opentime); - // --- Liste der Anmeldungen - index_show_signupTable($fid); } } - // --------------------------------------------------------------------------------------------------------------------- // SIGNUP AREA function index_show_signup() { - $environment = Environment::getEnv(); + $environment = Environment::getEnv(); $signup_method = SignupMethods::getInstance(); - $fid = $environment->getSelectedTripId(); + $fid = $environment->getSelectedTripId(); $openstatus = $environment->getRegistrationState($fid); $waitlist_confirmed = $environment->isInWaitlistMode(); @@ -120,49 +123,42 @@ function index_show_signup() { echo '<h2>Anmeldung</h2>'; // Anmeldung erfolgreich - if(isset($_REQUEST['success'])) { + if (isset($_REQUEST['success'])) { echo '<div style="text-align:center; font-size: 20pt; font-weight: bold">Die Anmeldung war erfolgreich.</div>'; - } - - // Anmeldung fehlgeschlagen, weil voll + } // Anmeldung fehlgeschlagen, weil voll elseif (isset($_REQUEST['full'])) { echo '<div style="text-align:center; font-size: 20pt; font-weight: bold">Anmeldung leider fehlgeschlagen.</div>'; echo '<div style="text-align:center; font-size: 16pt; font-weight: bold">Die Anmeldegrenze wurde leider erreicht.</div>'; echo '<div style="text-align:center; font-size: 14pt; ">Es besteht die Möglichkeit sich auf der Warteliste einzutragen.<br /> - Wenn du das möchtest, klicke hier: <a class="normallink" href="?fid='.$fid.'&waitlist">⇶ Warteliste</a></div>'; - } - - // Formulardaten empfangen -> auswerten! - elseif($environment->formDataReceived()){ + Wenn du das möchtest, klicke hier: <a class="normallink" href="?fid=' . $fid . '&waitlist">⇶ Warteliste</a></div>'; + } // Formulardaten empfangen -> auswerten! + elseif ($environment->formDataReceived()) { comm_verbose(1, "Formular bekommen"); $sub = $signup_method->validateSubmission(); if ($sub['valid']) { if ($environment->sendBachelorToDB($sub['data'])) - header("Location: ?fid=".$fid."&success"); + header("Location: ?fid=" . $fid . "&success"); else - header("Location: ?fid=".$fid."&full"); + header("Location: ?fid=" . $fid . "&full"); die(); } else { index_show_errors($sub['errors']); $environment->setDanglingFormData($sub['data']); $signup_method->getFallbackMethod()->showInlineHTML(); } - } - - // Anmeldung anzeigen (Form or game) + } // Anmeldung anzeigen (Form or game) elseif ($signup_method->signupMethodExists() && - ($openstatus == 0 || ($waitlist_confirmed && $openstatus < 2 ))) { + ($openstatus == 0 || ($waitlist_confirmed && $openstatus < 2)) + ) { $signup_method->getActiveMethod()->showInlineHTML(); // future feature: option to show edit view (when $_GET['bid'] isset) - } - - // Anmeldeoptionen anzeigen + } // Anmeldeoptionen anzeigen else { - if($openstatus > 0 && !$waitlist_confirmed) { + if ($openstatus > 0 && !$waitlist_confirmed) { echo '<div style="text-align:center; font-size: 20pt; font-weight: bold">Die Anmeldung wurde geschlossen.</div>'; if ($openstatus != 2) { @@ -197,17 +193,15 @@ function index_show_signup() { * puts out a list of all errors * @param $errors */ -function index_show_errors($errors){ +function index_show_errors($errors) { echo '<div class="message error"><ul>'; - foreach($errors as $e){ - echo '<li>'.$e.'</li>'; + foreach ($errors as $e) { + echo '<li>' . $e . '</li>'; } - echo'</ul></div>'; + echo '</ul></div>'; } - - // --------------------------------------------------------------------------------------------------------------------- // TRIP LISTING @@ -218,19 +212,19 @@ function index_show_errors($errors){ function index_show_alleFahrten() { $environment = Environment::getEnv(); - comm_verbose(2,"Liste aller Fahrten (Jahr, Ziel, Zeitraum, Anz. Mitfahrer)"); + comm_verbose(2, "Liste aller Fahrten (Jahr, Ziel, Zeitraum, Anz. Mitfahrer)"); echo '<h2>Anmeldung zur Fachschaftsfahrt</h2>'; $foos = $environment->database->select("fahrten", - ['fahrt_id','titel','ziel','von','bis','beschreibung','leiter','kontakt', 'max_bachelor'], + ['fahrt_id', 'titel', 'ziel', 'von', 'bis', 'beschreibung', 'leiter', 'kontakt', 'max_bachelor'], "ORDER BY fahrt_id DESC"); - if(!$foos) { + if (!$foos) { echo 'Keine Fahrten im System gefunden'; return; } $fids = []; - foreach($foos as $foo){ + foreach ($foos as $foo) { index_show_fahrtHeader($foo); array_push($fids, $foo['fahrt_id']); } @@ -240,38 +234,38 @@ function index_show_alleFahrten() { /** * @param $fahrt wenn array, dann Datenbankrow; wenn zahl, dann wird das selektiert */ -function index_show_fahrtHeader($fahrt){ +function index_show_fahrtHeader($fahrt) { $environment = Environment::getEnv(); - if(!is_array($fahrt)){ + if (!is_array($fahrt)) { // select fahrt by ID $fahrt = $environment->database->select('fahrten', - ['fahrt_id','titel','ziel', 'von', 'bis', 'leiter', 'kontakt', 'beschreibung', 'max_bachelor'], - ['fahrt_id'=> $fahrt]); - if(!$fahrt) + ['fahrt_id', 'titel', 'ziel', 'von', 'bis', 'leiter', 'kontakt', 'beschreibung', 'max_bachelor'], + ['fahrt_id' => $fahrt]); + if (!$fahrt) return; // break here and show nothing! else $fahrt = $fahrt[0]; } - $cnt = $environment->database->count("bachelor", ["AND"=> + $cnt = $environment->database->count("bachelor", ["AND" => ["backstepped" => NULL, - "fahrt_id" => $fahrt['fahrt_id']]]); + "fahrt_id" => $fahrt['fahrt_id']]]); echo '<div class="fahrt"> <div class="fahrt-left"> - <a class="fahrthead" href="index.php?fid='.$fahrt['fahrt_id'].'">'.$fahrt['titel'].'</a>'; - echo 'Ziel: <i>'.$fahrt['ziel'].'</i><br />'; - echo 'Datum: <i>'.comm_from_mysqlDate($fahrt['von'])." - ".comm_from_mysqlDate($fahrt['bis']).'</i><br />'; - echo "Ansprechpartner: <i>".$fahrt['leiter']." (".comm_convert_mail($fahrt['kontakt']).")</i><br />"; - echo "Anmeldungen: <i>".$cnt." / ".$fahrt['max_bachelor']."</i>"; - echo '<p>'.$fahrt['beschreibung'].'</p></div> - <div class="map-canvas" id="map-canvas-'.$fahrt['fahrt_id'].'"></div> + <a class="fahrthead" href="index.php?fid=' . $fahrt['fahrt_id'] . '">' . $fahrt['titel'] . '</a>'; + echo 'Ziel: <i>' . $fahrt['ziel'] . '</i><br />'; + echo 'Datum: <i>' . comm_from_mysqlDate($fahrt['von']) . " - " . comm_from_mysqlDate($fahrt['bis']) . '</i><br />'; + echo "Ansprechpartner: <i>" . $fahrt['leiter'] . " (" . comm_convert_mail($fahrt['kontakt']) . ")</i><br />"; + echo "Anmeldungen: <i>" . $cnt . " / " . $fahrt['max_bachelor'] . "</i>"; + echo '<p>' . $fahrt['beschreibung'] . '</p></div> + <div class="map-canvas" id="map-canvas-' . $fahrt['fahrt_id'] . '"></div> <div style="clear:both"></div> </div>'; } -function index_show_fahrtHeader_js($fahrten){ +function index_show_fahrtHeader_js($fahrten) { $environment = Environment::getEnv(); $pins = $environment->database->select("fahrten", ["fahrt_id", "map_pin"], ["fahrt_id" => $fahrten]); @@ -294,9 +288,9 @@ function index_show_fahrtHeader_js($fahrten){ ); };'; - foreach($pins as $p){ + foreach ($pins as $p) { // if not valid GPS pos, fallback to Kheta! - if(!preg_match("/\\d+\\.\\d+ \\d+\\.\\d+/m", $p["map_pin"])) + if (!preg_match("/\\d+\\.\\d+ \\d+\\.\\d+/m", $p["map_pin"])) $p["map_pin"] = '71.555267 99.690962'; echo ' @@ -306,15 +300,15 @@ function index_show_fahrtHeader_js($fahrten){ '; } - echo' + echo ' function initialize() { '; - foreach($pins as $p){ - echo' - var mapOptions_'.$p['fahrt_id'].' = { + foreach ($pins as $p) { + echo ' + var mapOptions_' . $p['fahrt_id'] . ' = { zoom: 8, - center: ziel_'.$p['fahrt_id'].', + center: ziel_' . $p['fahrt_id'] . ', panControl: false, zoomControl: false, scaleControl: true, @@ -323,18 +317,18 @@ function index_show_fahrtHeader_js($fahrten){ overviewMapControl: false }; - map_'.$p['fahrt_id'].' = new google.maps.Map(document.getElementById(\'map-canvas-'.$p['fahrt_id'].'\'), mapOptions_'.$p['fahrt_id'].'); + map_' . $p['fahrt_id'] . ' = new google.maps.Map(document.getElementById(\'map-canvas-' . $p['fahrt_id'] . '\'), mapOptions_' . $p['fahrt_id'] . '); - marker_'.$p['fahrt_id'].' = new google.maps.Marker({ - map:map_'.$p['fahrt_id'].', + marker_' . $p['fahrt_id'] . ' = new google.maps.Marker({ + map:map_' . $p['fahrt_id'] . ', draggable:true, animation: google.maps.Animation.DROP, - position: ziel_'.$p['fahrt_id'].' + position: ziel_' . $p['fahrt_id'] . ' }); - marker_'.$p['fahrt_id'].'.setAnimation(google.maps.Animation.BOUNCE);'; + marker_' . $p['fahrt_id'] . '.setAnimation(google.maps.Animation.BOUNCE);'; } - echo' + echo ' } google.maps.event.addDomListener(window, \'load\', initialize); @@ -343,30 +337,26 @@ function index_show_fahrtHeader_js($fahrten){ } - - - - // --------------------------------------------------------------------------------------------------------------------- // PUBLIC REGISTRATIONS LISTING /** * show table of public registrations */ -function index_show_signupTable($fid){ +function index_show_signupTable($fid) { $environment = Environment::getEnv(); echo '<h2>Anmeldungen</h2>'; $data = $environment->database->select('bachelor', - ["pseudo","antyp","abtyp","anday","abday","comment","studityp"], + ["pseudo", "antyp", "abtyp", "anday", "abday", "comment", "studityp"], ["AND" => [ - 'fahrt_id' => (int) $fid, - 'public' => 1 + 'fahrt_id' => (int)$fid, + 'public' => 1 ]]); - if(!$data) echo'<div class="signups">Noch keine (sichtbaren) Anmeldungen!</div>'; + if (!$data) echo '<div class="signups">Noch keine (sichtbaren) Anmeldungen!</div>'; else { echo ' <table class="signups"> @@ -381,24 +371,72 @@ function index_show_signupTable($fid){ <th>Kommentar</th> </tr> </thead>'; - foreach($data as $d){ + foreach ($data as $d) { echo '<tr> - <!--td>'.$d["studityp"].'</td--> - <td>'.$d["pseudo"].'</td> - <td>'.comm_from_mysqlDate($d["anday"]).'</td> - <td>'.index_show_signupTable_destroyTypes($d["antyp"]).'</td> - <td>'.comm_from_mysqlDate($d["abday"]).'</td> - <td>'.index_show_signupTable_destroyTypes($d["abtyp"]).'</td> - <td>'.$d["comment"].'</td> + <!--td>' . $d["studityp"] . '</td--> + <td>' . $d["pseudo"] . '</td> + <td>' . comm_from_mysqlDate($d["anday"]) . '</td> + <td>' . index_show_signupTable_destroyTypes($d["antyp"]) . '</td> + <td>' . comm_from_mysqlDate($d["abday"]) . '</td> + <td>' . index_show_signupTable_destroyTypes($d["abtyp"]) . '</td> + <td>' . $d["comment"] . '</td> </tr>'; } echo '</table>'; } } -function index_show_signupTable_destroyTypes($anabtyp){ +function index_show_signupTable_destroyTypes($anabtyp) { global $config_reisearten, $config_reisearten_destroyed; - if(array_search($anabtyp, $config_reisearten)>=2) + if (array_search($anabtyp, $config_reisearten) >= 2) return $config_reisearten_destroyed[array_rand($config_reisearten_destroyed)]; return $anabtyp; +} + + +function index_show_countdown($opentime) { + echo " + <script> + var a = '0123456789abcdef'; + function randstr () { + var str = ''; + for(var i = 0; i < 6; ++i) + str += a[Math.floor(Math.random()*16)]; + return str; + } + var b = true; + function hurrdurr () { + $('#text, body').stop().animate({color:b?'#ffffff':'#000000'}, 1000); + + hurrrdurrr('#menubox'); + hurrrdurrr('body'); + + function hurrrdurrr(elem) { + $(elem).stop().animate({backgroundColor:'#'+randstr()}, 333, + function () { + $(elem).stop().animate({backgroundColor:'#'+randstr()}, 333, + function () { + $(elem).stop().animate({backgroundColor:'#'+randstr()}, 333); + }); + }); + } + + b = !b; + } + $(function () { + hurrdurr(); + setInterval(hurrdurr, 1000); + }); + </script>"; + + echo '<div id="text" style="font-weight:bold;text-align:center;font-size:40pt;font-family:Verdana, Geneva, sans-serif"> + ANMELDUNG IN KÃœRZE + </div>'; + + echo '<div style="width:100%"> + <div style="margin:0 auto; width:420px"> + <iframe width="420" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/109529816&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe> + </div> + </div>'; + } \ No newline at end of file