From 3f1dda1e19e1f77e908df1d49d028d0932d0f1a1 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 23 Apr 2009 07:41:28 +0000 Subject: A completely new forms class, to replace the old function based method. Also some work on a new config module, evenmtuelly to replace the old hardcoded values. --- utils/modules/events.php | 49 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'utils/modules/events.php') 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; } -- cgit v1.2.3