summaryrefslogtreecommitdiff
path: root/utils/events.php
diff options
context:
space:
mode:
authordeva <deva>2008-10-24 10:20:04 +0000
committerdeva <deva>2008-10-24 10:20:04 +0000
commit96b8bc5ff5882f33114137d6b07db32e17b8ad87 (patch)
tree24ee6be2390627fc005b0e2ec12829c0fc5aef47 /utils/events.php
parent9bca27c9342bd4f34bed77dd3eb8c51dd686cdf1 (diff)
Did a lot of work on the page and module systems.
Diffstat (limited to 'utils/events.php')
-rw-r--r--utils/events.php45
1 files changed, 33 insertions, 12 deletions
diff --git a/utils/events.php b/utils/events.php
index 27ec873..2257e33 100644
--- a/utils/events.php
+++ b/utils/events.php
@@ -10,16 +10,17 @@ class Event {
public function show()
{
- echo "<div class=\"event\">\n";
- echo " <div class=\"event_title\">" .
+ $str = "<div class=\"event\">\n";
+ $str .= " <div class=\"event_title\">" .
htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n";
- echo " <div class=\"event_time\">" . date("D M jS Y", $this->time) . "</div>\n";
- echo " <div class=\"event_description\">" .
+ $str .= " <div class=\"event_time\">" . date("D M jS Y", $this->time) . "</div>\n";
+ $str .= " <div class=\"event_description\">" .
htmlspecialchars_decode($this->description, ENT_QUOTES) . "</div>\n";
if($this->flyer) {
- echo " <img class=\"event_flyer\" alt=\"flyer\" src=\"gfx/flyers/" . $this->flyer . "\"/>\n";
+ $str .= " <img class=\"event_flyer\" alt=\"flyer\" src=\"gfx/flyers/" . $this->flyer . "\"/>\n";
}
- echo "</div>\n";
+ $str .= "</div>\n";
+ return $str;
}
public function Event($title, $time, $description, $flyer = "")
@@ -36,8 +37,24 @@ class Events {
private $file;
private $events = array();
+ public function run($module)
+ {
+ switch($module) {
+ case "events_coming":
+ return $this->showcoming(-1);
+ break;
+
+ case "events_old":
+ default:
+ return $this->showold(-1);
+ break;
+ }
+ }
+
public function showcoming($number)
{
+ $str = "";
+
$foundany = false;
// Key sort
@@ -49,17 +66,20 @@ class Events {
foreach($this->events as $event) {
if($event->time >= time()) {
$foundany = true;
- $event->show();
+ $str .= $event->show();
$number--;
}
- if(!$number) return;
+ if(!$number) return $str;
}
- if($foundany == false) echo "No shows available at the moment.";
+ if($foundany == false) return "No shows available at the moment.";
+ return $str;
}
public function showold($number)
{
+ $str = "";
+
// Key sort
krsort($this->events);
@@ -68,11 +88,12 @@ class Events {
foreach($this->events as $event) {
if($event->time <= time()) {
- $event->show();
+ $str .= $event->show();
$number--;
}
- if(!$number) return;
+ if(!$number) return $str;
}
+ return $str;
}
public function add($event) {
@@ -122,7 +143,7 @@ class Events {
public function Events($file)
{
$this->file = $file;
- $this->read();
+ if(file_exists($file)) $this->read();
}
}