diff options
author | deva <deva> | 2009-04-23 07:41:28 +0000 |
---|---|---|
committer | deva <deva> | 2009-04-23 07:41:28 +0000 |
commit | 3f1dda1e19e1f77e908df1d49d028d0932d0f1a1 (patch) | |
tree | d44586018a0594aa53cfbe172d7a576bbe5f593c /utils/modules/events.php | |
parent | 9fc8170f4492c3e5900156610061e59c84aa9d83 (diff) |
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.
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; } |