summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/message.inc.php25
-rw-r--r--modules/main.inc.php9
-rw-r--r--templates/main-menu.html2
-rw-r--r--templates/messagebox-info.html1
-rw-r--r--templates/messagebox-success.html1
-rw-r--r--templates/messagebox-warning.html1
-rw-r--r--templates/page-main-guest.html5
-rw-r--r--templates/page-main.html1
8 files changed, 42 insertions, 3 deletions
diff --git a/inc/message.inc.php b/inc/message.inc.php
index 9409db95..238ed939 100644
--- a/inc/message.inc.php
+++ b/inc/message.inc.php
@@ -18,8 +18,33 @@ class Message
);
}
+ public static function addWarning($id)
+ {
+ self::$list[] = array(
+ 'type' => 'warning',
+ 'id' => $id
+ );
+ }
+
+ public static function addInfo($id)
+ {
+ self::$list[] = array(
+ 'type' => 'info',
+ 'id' => $id
+ );
+ }
+
+ public static function addSuccess($id)
+ {
+ self::$list[] = array(
+ 'type' => 'success',
+ 'id' => $id
+ );
+ }
+
public static function renderList()
{
+ global $error_text;
foreach (self::$list as $item) {
Render::addTemplate('messagebox-' . $item['type'], array('message' => $error_text[$item['id']]));
}
diff --git a/modules/main.inc.php b/modules/main.inc.php
index fc6a9fac..007fb296 100644
--- a/modules/main.inc.php
+++ b/modules/main.inc.php
@@ -4,11 +4,16 @@ User::load();
function render_module()
{
- Render::setTitle('Wurstgesicht');
+ // Render::setTitle('abc');
Render::openTag('h1', array('class' => 'wurst kacke'));
Render::closeTag('h1');
- Render::addTemplate('helloworld', array('wurst' => 'käse & bier'));
+ if (!User::isLoggedIn()) {
+ Render::addTemplate('page-main-guest');
+ return;
+ }
+ // Logged in here
+ Render::addTemplate('page-main', array('user' => User::getName()));
}
diff --git a/templates/main-menu.html b/templates/main-menu.html
index 7e9c3bdc..0b2cdd7f 100644
--- a/templates/main-menu.html
+++ b/templates/main-menu.html
@@ -11,7 +11,7 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
- <li class="active"><a href="#">Home</a></li>
+ <li class="active"><a href="?do=main">Startseite</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
diff --git a/templates/messagebox-info.html b/templates/messagebox-info.html
new file mode 100644
index 00000000..b4464094
--- /dev/null
+++ b/templates/messagebox-info.html
@@ -0,0 +1 @@
+<div class="alert alert-info">{{message}}</div>
diff --git a/templates/messagebox-success.html b/templates/messagebox-success.html
new file mode 100644
index 00000000..180a0466
--- /dev/null
+++ b/templates/messagebox-success.html
@@ -0,0 +1 @@
+<div class="alert alert-success">{{message}}</div>
diff --git a/templates/messagebox-warning.html b/templates/messagebox-warning.html
new file mode 100644
index 00000000..1ce2c0e4
--- /dev/null
+++ b/templates/messagebox-warning.html
@@ -0,0 +1 @@
+<div class="alert alert-warning">{{message}}</div>
diff --git a/templates/page-main-guest.html b/templates/page-main-guest.html
new file mode 100644
index 00000000..f580e9f5
--- /dev/null
+++ b/templates/page-main-guest.html
@@ -0,0 +1,5 @@
+<div class="jumbotron">
+ <h1>Willkommen</h1>
+ <p>Dies ist das Administrations-Interface der lokalen bwLehrpool-Installation. Bitte authentifizieren Sie sich, um Einstellungen vorzunehmen.</p>
+ <p><a href="?do=session&amp;action=login" class="btn btn-primary btn-lg">Anmelden &raquo;</a></p>
+</div>
diff --git a/templates/page-main.html b/templates/page-main.html
new file mode 100644
index 00000000..3cb64449
--- /dev/null
+++ b/templates/page-main.html
@@ -0,0 +1 @@
+<h1>Willkommen, {{user}}</h1>