From eeb0107ade748fe4eda26be7194ddb9bb9f9945b Mon Sep 17 00:00:00 2001
From: Tim Repke <repketim@informatik.hu-berlin.de>
Date: Sat, 20 Sep 2014 22:52:24 +0100
Subject: [PATCH] randomise individual travel types in signup table list

---
 registration-system/config.inc.php |  6 ++++++
 registration-system/index.php      | 11 +++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/registration-system/config.inc.php b/registration-system/config.inc.php
index b332ff2..f15dec5 100644
--- a/registration-system/config.inc.php
+++ b/registration-system/config.inc.php
@@ -39,6 +39,12 @@ $config_reisearten = array(
     //,"mit Kamel"
 );
 
+$config_reisearten_destroyed = array(
+    "mit Kamel",
+    "mit Esel",
+    "mit Schlauchboot"
+);
+
 $config_admins = array(
     // username => password
     "george" => "peter",
diff --git a/registration-system/index.php b/registration-system/index.php
index 74af71e..338043c 100644
--- a/registration-system/index.php
+++ b/registration-system/index.php
@@ -381,12 +381,19 @@ echo '<h2>Angemeldet</h2>';
                 <!--td>'.$d["studityp"].'</td-->
                 <td>'.$d["pseudo"].'</td>
                 <td>'.date('d.m.Y', $d["anday"]).'</td>
-                <td>'.$d["antyp"].'</td>
+                <td>'.index_show_signupTable_destroyTypes($d["antyp"]).'</td>
                 <td>'.date('d.m.Y', $d["abday"]).'</td>
-                <td>'.$d["abtyp"].'</td>
+                <td>'.index_show_signupTable_destroyTypes($d["abtyp"]).'</td>
                 <td>'.$d["comment"].'</td>
             </tr>';
         }
         echo '</table>';
     }
 }
+
+function index_show_signupTable_destroyTypes($anabtyp){
+    global $config_reisearten, $config_reisearten_destroyed;
+    if(array_search($anabtyp, $config_reisearten)>=2)
+        return $config_reisearten_destroyed[array_rand($config_reisearten_destroyed)];
+    return $anabtyp;
+}
\ No newline at end of file
-- 
GitLab