From f7072cad414ffdcff4bde04b5f44093f0a5295cd Mon Sep 17 00:00:00 2001
From: Tim Repke <timmothey@gmx.de>
Date: Sat, 15 Oct 2016 18:40:05 +0200
Subject: [PATCH] default template now handles like an abstract class

---
 registration-system/view/default_index.php | 121 ++++++++++++---------
 registration-system/view/style.css         |   2 +
 2 files changed, 73 insertions(+), 50 deletions(-)

diff --git a/registration-system/view/default_index.php b/registration-system/view/default_index.php
index 804f215..ec398e6 100644
--- a/registration-system/view/default_index.php
+++ b/registration-system/view/default_index.php
@@ -1,54 +1,75 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-<head>
-
-    <!-- ------------------------------------------------------- -->
-    <!--               Programmiert von                          -->
-    <!--                                                         -->
-    <!--               ~ Manu Herrmann ~                         -->
-    <!--                     und                                 -->
-    <!--                ~ Tim Repke ~                            -->
-    <!--                                                         -->
-    <!-- Erste Version in 2014.                                  -->
-    <!-- Beide haben 2015 noch einmal eine Schippe draufgesetzt! -->
-    <!-- ------------------------------------------------------- -->
-
-    <!--
-         Die Entwickler sind der Meinung, dass im Quelltext rumschnüffeln unethisch ist.
-         Da wir sehr schlau sind, haben wir deinen Rechner infiziert. Eine Anmeldung zur
-         Fachschaftsfahrt ist daher nicht mehr möglich.
-         Selbst schuld!
-
-         PS: Solltest du es doch geschafft haben, gib' uns bitte Bescheid, damit wir dich wieder löschen.
-    -->
-
-    <title>Fachschaftsfahrt</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <?php
+<?php
+
+require_once __DIR__.'/../frameworks/Environment.php';
+
+abstract class DefaultIndex {
+
+    protected $environment;
+
+    protected function __construct() {
+        $this->environment = Environment::getEnv();
+    }
+
+    abstract protected function echoHeaders();
+    abstract protected function echoContent();
 
-    echo_headers();
-
-    ?>
-</head>
-<body>
-<div class="shadowbox">
-    <div id="headerbox">
-        <div class="headerboxshade"><h1>Fachschaftsfahrt</h1></div>
-        <div class="headerboxshade"><h2>Informatik</h2></div>
-        <p></p>
-    </div>
-    <div id="menubox">
-
-        <?php
-        show_content();
+    protected function resolvePath($resource) {
+        return $this->environment->sysconf['baseURL'] . 'view/' . $resource;
+    }
+
+    protected function mysql2german($date) {
+        return date('d.m.Y', strtotime($date));
+    }
+
+    public function render() {
         ?>
+        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+        <head>
+
+            <!-- ------------------------------------------------------- -->
+            <!--               Programmiert von                          -->
+            <!--                                                         -->
+            <!--               ~ Manu Herrmann ~                         -->
+            <!--                     und                                 -->
+            <!--                ~ Tim Repke ~                            -->
+            <!--                                                         -->
+            <!-- Erste Version in 2014.                                  -->
+            <!-- Beide haben 2015 noch einmal eine Schippe draufgesetzt! -->
+            <!-- Irgendwie 2016 noch einmal!                             -->
+            <!-- ------------------------------------------------------- -->
 
-    </div>
-    <div id="footerbox">&copy;<?php echo date("Y"); ?> Fachschaftsinitiative Informatik der Humboldt Universität zu
-        Berlin.
-    </div>
-    <img id="nyan" alt="O" src="view/graphics/studityp_5.gif" style="position: fixed;bottom: 5px;left:0px"/>
+            <!--
+                 Die Entwickler sind der Meinung, dass im Quelltext rumschnüffeln unethisch ist.
+                 Da wir sehr schlau sind, haben wir deinen Rechner infiziert. Eine Anmeldung zur
+                 Fachschaftsfahrt ist daher nicht mehr möglich.
+                 Selbst schuld!
 
-</div>
-</body>
-</html>
+                 PS: Solltest du es doch geschafft haben, gib' uns bitte Bescheid, damit wir dich wieder löschen.
+            -->
+
+            <title>Fachschaftsfahrt</title>
+            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+            <?php $this->echoHeaders(); ?>
+        </head>
+        <body>
+            <div class="shadowbox">
+                <div id="headerbox">
+                    <div class="headerboxshade"><h1>Fachschaftsfahrt</h1></div>
+                    <div class="headerboxshade"><h2>Informatik</h2></div>
+                    <p></p>
+                </div>
+                <div id="menubox">
+                    <?php $this->echoContent(); ?>
+                </div>
+                <div id="footerbox">&copy;<?php echo date("Y"); ?>
+                    Fachschaftsinitiative Informatik der Humboldt Universität zu Berlin.
+                </div>
+                <img id="nyan" alt="O" src="<?php echo $this->resolvePath('graphics/studityp_5.gif') ?>"
+                     style="position: fixed;bottom: 5px;left:0"/>
+            </div>
+        </body>
+        </html>
+    <?php
+    }
+}
diff --git a/registration-system/view/style.css b/registration-system/view/style.css
index 6e1ccfc..f6c7fb0 100644
--- a/registration-system/view/style.css
+++ b/registration-system/view/style.css
@@ -302,6 +302,8 @@ a.editenum { display: block; height: 20px; line-height: 20px; width: 20px; font-
 
 .fahrttable {
     display: table;
+    margin-bottom: 1em;
+    margin-top: 1em;
 }
 
 .fahrttable div {
-- 
GitLab