From e2402482727f07cff634ea228d8dcbe70c618bc3 Mon Sep 17 00:00:00 2001
From: bucherda <bucherda@informatik.hu-berlin.de>
Date: Sat, 28 Apr 2018 19:06:18 +0200
Subject: [PATCH] added: list size in the menu, added: seperate col for
 pseudonym, fixed: 'anmelde-ID can not made invisible any more, added: Comment
 and Pseudo are default invisible, changed: new Code Orgacode was setted'

---
 registration-system/admin/index.php         | 29 +++++++++++++++++++++
 registration-system/admin/pages_jumpOf.php  | 12 ++++-----
 registration-system/admin/pages_list.php    | 25 +++++++++++-------
 registration-system/frameworks/Bachelor.php |  2 +-
 4 files changed, 51 insertions(+), 17 deletions(-)

diff --git a/registration-system/admin/index.php b/registration-system/admin/index.php
index cbdf461..9168e52 100644
--- a/registration-system/admin/index.php
+++ b/registration-system/admin/index.php
@@ -1,6 +1,10 @@
 <?php
 session_start();
 
+ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);
+
 require_once __DIR__ . '/../view/default_admin.php';
 
 class AdminBase extends DefaultAdmin {
@@ -43,9 +47,34 @@ class AdminBase extends DefaultAdmin {
         $this->isSudo = $this->environment->isSuperAdmin();
 
         $this->requerestedPage = isset($_GET['page']) ? $_GET['page'] : AdminBase::$DEFAULT_PAGE;
+        $this->getBachelorstats();
         $this->page = $this->getRequestedPage();
     }
 
+    private function getBachelorstats() {
+        $this->fahrt = $this->environment->getTrip(true);
+        $people = $this->fahrt->getBachelors([]);
+        $wl = 0;
+        $wl_al = 0;
+        $list = 0;
+        $jumpOf = 0;
+        foreach($people as $b) {
+            if(!$b['on_waitlist'] || $b['on_waitlist'] && $b['transferred']) {
+                $list++;
+            }else if($b['backstepped'] && !$b['on_waitlist']) {
+                $jumpOf++;
+            }else if($b['on_waitlist'] && !$b['transferred'] && $b['studityp'] == "ALUMN") {
+                $wl_al++;
+            }else if($b['on_waitlist'] && !$b['transferred'] && $b['studityp'] != "ALUMN") {
+                $wl++;
+            }
+        }
+        AdminBase::$PAGES['list'] = 'Meldeliste('.$list.')';
+        AdminBase::$PAGES['jumpOf'] = 'Abspringer('.$jumpOf.')';
+        AdminBase::$PAGES['wl'] = 'Warteliste('.$wl.')';
+        AdminBase::$PAGES['wl_al'] = 'Warteliste (Alumnis)('.$wl_al.')';
+    }
+
     private function isLoggedIn() {
         return $this->isAdmin or $this->isSudo;
     }
diff --git a/registration-system/admin/pages_jumpOf.php b/registration-system/admin/pages_jumpOf.php
index ca38770..a5cd876 100644
--- a/registration-system/admin/pages_jumpOf.php
+++ b/registration-system/admin/pages_jumpOf.php
@@ -118,8 +118,8 @@ class AdminJumpOfPage extends AdminPage {
 
     public function getText() {
         $cols = ['Anmelde-ID','Anmeldung','Name','Anreisetyp','Abreisetyp', 'Anreisetag','Abreisetag',
-            'Kommentar','Studityp','Essen', '18+', 'Orga', 'Mörderspiel', 'PaidReBack'];
-        $buttoncol = count($cols)-1;
+            'Kommentar','Studityp','Essen', '18+', 'Orga', 'Mörderspiel', 'PaidReBack', 'BackAt','toWaitlist'];
+        $buttoncol = count($cols)-3;
 
         $thead = '';
         $toggle = 'Toggle Column:';
@@ -127,8 +127,6 @@ class AdminJumpOfPage extends AdminPage {
             $thead .= '<th>'.$col.'</th>';
             $toggle .= '<a class="toggle-vis" data-column="' . $tcnt . '">' . $col . '</a> - ';
         }
-        $thead .= '<th>toWaitlist</th>';
-        $toggle .= '<a class="toggle-vis" data-column=\'12\'>toWaitlist</a> - ';
 
         $people = $this->fahrt->getBachelors(['waiting'=>false]);
         $tbody = '';
@@ -152,6 +150,7 @@ class AdminJumpOfPage extends AdminPage {
                     <td>'.($b['isOrga']==1 ? 'Ja' : 'Nein').'</td>
                     <td>'.($b['mGame']==1 ? 'Ja' : 'Nein').'</td>
                     <td>'.($b['paid'] ? $b['paid'] : '0') . ',' . ($b['repaid'] ? $b['repaid'] : '0') . ',' . ($b['backstepped'] ? $b['backstepped'] : '0').'</td>
+                    <td>'.date('d.m.Y - G:i.s', $b['backstepped']).'</td>
                     <td><a href="#" class="moveToWaitlist">&#8614; Warteliste</a></td>
                     <td>'.($b['backstepped'] ? 1 : '0').'</td>
                 </tr>';
@@ -223,14 +222,13 @@ class AdminJumpOfPage extends AdminPage {
                         { type: "dedate", targets: [1,5,6]},
                         { type: "link", targets: [0, 2] },
                         { type: "prb", targets: ' . $buttoncol . ' },
-                        { targets: 0, visible: false, searchable: true },
                         { targets: 7, visible: false, searchable: true },
-                        { targets: 15, visible: false, searchable: false }
+                        { targets: 16, visible: false, searchable: false }
                     ],
 
                     "order": [[ 2, "asc" ]],
                     "paging": false,
-                    "orderFixed": [ 15, "asc" ]
+                    "orderFixed": [ 14, "asc" ]
                     
                 });
 
diff --git a/registration-system/admin/pages_list.php b/registration-system/admin/pages_list.php
index a78b0ba..2b6cf20 100644
--- a/registration-system/admin/pages_list.php
+++ b/registration-system/admin/pages_list.php
@@ -117,8 +117,8 @@ class AdminListPage extends AdminPage {
     }
 
     public function getText() {
-        $cols = ['Anmelde-ID','Anmeldung','Name','Anreisetyp','Abreisetyp', 'Anreisetag','Abreisetag',
-            'Kommentar','Studityp','Essen', '18+', 'Orga', 'Mörderspiel', 'PaidReBack'];
+        $cols = ['Anmelde-ID','Anmeldung', 'Name', 'Pseudo', 'Anreisetyp', 'Abreisetyp', 'Anreisetag','Abreisetag',
+            'Kommentar','Studityp','Essen', '18+', 'Orga', 'M.spiel', 'PaidReBack'];
         $buttoncol = count($cols)-1;
 
         $thead = '';
@@ -137,7 +137,8 @@ class AdminListPage extends AdminPage {
                 <tr>
                     <td><a href="#" class="edit_bachelor">'.$b['bachelor_id'].'</a></td>
                     <td>'.$this->mysql2german($b['anm_time']).'</td>
-                    <td><a href="mailto:'.$b['mehl'].'?subject=FS-Fahrt">' . $b['forname'] . ' ' . $b['sirname'] . ' (' . $b['pseudo'] . ')</a></td>
+                    <td><a href="mailto:'.$b['mehl'].'?subject=FS-Fahrt">' . $b['forname'] . ' ' . $b['sirname'] .'</a></td>
+                    <td>'.$b['pseudo'].'</td>
                     <td>'.$b['antyp'].'</td>
                     <td>'.$b['abtyp'].'</td>
                     <td>'.$this->mysql2german($b['anday']).'</td>
@@ -221,22 +222,24 @@ class AdminListPage extends AdminPage {
                         { type: "link", targets: [0, 2] },
                         { type: "prb", targets: ' . $buttoncol . ' },
                         { targets: 7, visible: false, searchable: true },
-                        { targets: 15, visible: false, searchable: false }
+                        { targets: 16, visible: false, searchable: false }
                     ],
 
                     "order": [[ 2, "asc" ]],
                     "paging": false,
-                    "orderFixed": [ 15, "asc" ]
+                    "orderFixed": [ 16, "asc" ]
                     
                 });
                 $("a.toggle-vis").click( function (e) {
                     e.preventDefault();
 
-                    // Get the column API object
-                    var column = ltab.column( $(this).attr("data-column") );
+                    if($(this).attr("data-column")!=0) {
+                        // Get the column API object
+                        var column = ltab.column( $(this).attr("data-column") );
 
-                    // Toggle the visibility
-                    column.visible( ! column.visible() );
+                        // Toggle the visibility
+                        column.visible( ! column.visible() );
+                    }
                 });
                 $(".moveToWaitlist").click( function(){
                     var bid = $(this).closest("tr").find("td:eq(0)").text();
@@ -254,6 +257,10 @@ class AdminListPage extends AdminPage {
                 $("#editFormTopbar > p").click( function(){
                     $(this).parent().parent().hide();
                 });
+                var column = ltab.column(3);
+                column.visible(false);
+                var column = ltab.column(8);
+                column.visible(false);
             });
 
             function btnclick(that, type, hash, state){
diff --git a/registration-system/frameworks/Bachelor.php b/registration-system/frameworks/Bachelor.php
index bb12b6d..84d98cd 100644
--- a/registration-system/frameworks/Bachelor.php
+++ b/registration-system/frameworks/Bachelor.php
@@ -460,7 +460,7 @@ class Bachelor {
                         $this->set([$index => 0]);
                     else
                         if (isset($_REQUEST['captcha']))
-                            $this->set([$index => ($tmp == 'test2017') ? 1 : 0]);
+                            $this->set([$index => ($tmp == 'sommerfahrt2018') ? 1 : 0]);
                         else
                             $this->set([$index => (strtoupper($tmp) == 'JA') ? 1 : 0]);
                 }
-- 
GitLab