diff options
Diffstat (limited to 'utils/modules/events.php')
-rw-r--r-- | utils/modules/events.php | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/utils/modules/events.php b/utils/modules/events.php index efba697..bdbe43e 100644 --- a/utils/modules/events.php +++ b/utils/modules/events.php @@ -39,8 +39,8 @@ class Events { // Admin config public $admin_title = "Events"; public $admin_submodules = array("New Event" => "new", - "Edit Event" => "edit", - "Delete Event" => "delete"); + "Edit Event" => "edit", + "Delete Event" => "delete"); public function admin($sub, $action, $vars) { @@ -62,17 +62,44 @@ class Events { foreach($params as $param) { switch($param) { case "coming": - return $this->showcoming(-1); - break; + return $this->showcoming(-1); + break; + + case "all": + return $this->showall(-1); + break; case "old": default: - return $this->showold(-1); - break; + return $this->showold(-1); + break; } } } + public function showall($number) + { + $str = ""; + + $foundany = false; + + // Key sort + ksort($this->events); + + // If number is -1 show all shows. + if($number == -1) $number = 100000; + + foreach($this->events as $event) { + $foundany = true; + $str .= $event->show(); + $number--; + if(!$number) return $str; + } + + if($foundany == false) return "No shows available at the moment."; + return $str; + } + public function showcoming($number) { $str = ""; @@ -87,9 +114,9 @@ class Events { foreach($this->events as $event) { if($event->time >= time()) { - $foundany = true; - $str .= $event->show(); - $number--; + $foundany = true; + $str .= $event->show(); + $number--; } if(!$number) return $str; } @@ -110,8 +137,8 @@ class Events { foreach($this->events as $event) { if($event->time <= time()) { - $str .= $event->show(); - $number--; + $str .= $event->show(); + $number--; } if(!$number) return $str; } |