Browse files

- Module classed are now suffixed with _Module to avoid name collisi…

…ons with controller classes

- EK_Parser now uses a separate view-data array for partials
- Event details page added
- Image color-profiles fixed
  • Loading branch information...
1 parent 9657af8 commit 079970d74c9dad9439f9d8c3f5f5d333b02aa577 Maximilian Arnicke committed Apr 27, 2011
View
1 application/config/routes.php
@@ -41,6 +41,7 @@
$route['default_controller'] = "welcome";
$route['404_override'] = '';
+$route['event/(:num)-(:any)'] = 'events/show/$1';
/* End of file routes.php */
/* Location: ./application/config/routes.php */
View
32 application/controllers/events.php
@@ -0,0 +1,32 @@
+<?php
+
+class Events extends Ext_Controller
+{
+ function __construct()
+ {
+ parent::__construct();
+ $this->load->model('calendar');
+ }
+
+ public function index()
+ {
+
+ }
+
+ public function show($event_id)
+ {
+ $event = $this->calendar->get_event_by_id($event_id);
+
+ $event->description = trim($event->description);
+
+ if(empty($event->description))
+ {
+ $event->description = 'Keine Beschreibung vorhanden.';
+ }
+
+ $this->set_title('Event: '.$event->title);
+
+ $this->data['event'] = $event;
+ $this->display('events/show');
+ }
+}
View
19 application/core/ek_Controller.php
@@ -90,23 +90,26 @@ protected function set_title($title)
protected function display($content_partial, $return = FALSE)
{
// use name of class as title, if title not specified
+ $partials = array();
+
if(empty($this->title))
{
- $this->data['title'] = get_class($this);
+ $partials['title'] = get_class($this);
}
else
{
- $this->data['title'] = $this->title;
+ $partials['title'] = $this->title;
}
$this->load->library('parser');
- $this->data['head:head'] = $this->load->view('partials/head', $this->data, TRUE);
- $this->data['header:header'] = $this->load->view('partials/header', $this->data, TRUE);
- $this->data['serverstatus:serverstatus'] = $this->load->view('partials/serverstatus', $this->data, TRUE);
- $this->data['content:content'] = $this->load->view('controller/'. $content_partial, $this->data, TRUE);
- $this->data['footer:footer'] = $this->load->view('partials/footer', $this->data, TRUE);
- return $this->parser->parse('layout/'.$this->layout, $this->data, $return);
+ $partials['head:head'] = $this->load->view('partials/head', array_merge(array('title' => $partials['title']), $this->data), TRUE);
+ $partials['header:header'] = $this->load->view('partials/header', $this->data, TRUE);
+ $partials['serverstatus:serverstatus'] = $this->load->view('partials/serverstatus', $this->data, TRUE);
+ $partials['content:content'] = $this->load->view('controller/'. $content_partial, $this->data, TRUE);
+ $partials['footer:footer'] = $this->load->view('partials/footer', $this->data, TRUE);
+
+ return $this->parser->parse('layout/'.$this->layout, $partials, $return);
}
/**
View
2 application/libraries/EK_Parser.php
@@ -38,7 +38,7 @@ private function invoke_module($name)
{
include_once APPPATH.'modules/'.$name.'.php';
- $classname = ucfirst($name);
+ $classname = ucfirst($name).'_Module';
$module = new $classname;
ob_start();
View
11 application/models/calendar.php
@@ -24,4 +24,15 @@ public function get_month_events($userlevel)
->get()
->result();
}
+
+ /**
+ * Return single detailed event by ID
+ *
+ * @param int $id Event-ID
+ * @return object
+ */
+ public function get_event_by_id($event_id)
+ {
+ return $this->db->from('ek_calendar')->select('*')->where('id', $event_id)->get()->row();
+ }
}
View
4 application/modules/events.php
@@ -1,6 +1,6 @@
<?php
-class Events extends EK_Module
+class Events_Module extends EK_Module
{
function __construct()
{
@@ -28,7 +28,7 @@ function index()
foreach($events as $event)
{
- $content[date('j', $event->date)] = '<div style="display:none" id="event-title-'.date('j', $event->date).'">'.$event->title.'</div><a href="'.site_url('events/'.$event->id).'">'.date('j', $event->date).'</a>';
+ $content[date('j', $event->date)] = '<div style="display:none" id="event-title-'.date('j', $event->date).'">'.$event->title.'</div><a href="'.site_url('event/'.$event->id.'-'.url_title($event->title)).'">'.date('j', $event->date).'</a>';
}
$config = array();
View
2 application/modules/forum_activity.php
@@ -1,6 +1,6 @@
<?php
-class Forum_activity extends EK_Module
+class Forum_activity_Module extends EK_Module
{
function __construct()
{
View
2 application/modules/serverinfo.php
@@ -1,6 +1,6 @@
<?php
-class Serverinfo extends EK_Module
+class Serverinfo_Module extends EK_Module
{
function __construct()
{
View
5 application/views/controller/events/show.php
@@ -0,0 +1,5 @@
+<p><strong>Zeitpunkt:</strong> <?=strftime('%A, %e. %B %G um %R Uhr', $event->date)?></p>
+<br />
+<p>
+ <?=$event->description?>
+</p>
View
3 application/views/modules/events.php
@@ -1,5 +1,4 @@
-<?=$calendar?><br />
-<div style="text-align:right"><a href="<?=site_url('events')?>" class="button">Mehr</a></div>
+<?=$calendar?>
<script type="text/javascript">
$(document).ready(function()
View
2 application/views/partials/head.php
@@ -1,5 +1,5 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title><?php echo $title;?> | Eternal-Knights</title>
+ <title><?=$title?> | Eternal-Knights</title>
<link rel="stylesheet" href="<?=base_url()?>assets/css/style.css" type="text/css" />
<!--[if IE]>
View
5 assets/css/style.css
@@ -5,7 +5,7 @@
}
body {
- background: #000911 url(../images/content-bg.png) center 290px no-repeat;
+ background: #000912 url(../images/content-bg.png) center 290px no-repeat;
color: white;
font-family: Arial, sans-serif;
line-height: 16px;
@@ -122,6 +122,7 @@ img {
font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
font-size: 12px;
color: white;
+ z-index: 15;
}
#header ul li.dropdown > div div {
@@ -570,7 +571,7 @@ a.button {
a.button:hover {
background: none #141b23;
text-shadow: 1px 1px 0 #0c1318;
- color: #93B4C9;
+ color: white;
}
*::-moz-selection {
View
BIN assets/images/accordion-bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/accordion-news-title-hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/accordion-news-title.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/accordion-title-hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/back.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/box-bottom.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/box-title.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/button-bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/content-bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/content-foot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/content-title.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/images/footer-bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 079970d

Please sign in to comment.