diff options
author | deva <deva> | 2010-01-28 16:18:33 +0000 |
---|---|---|
committer | deva <deva> | 2010-01-28 16:18:33 +0000 |
commit | 74fd2508e253967dbff5e368dd19ae6f6e16fcbf (patch) | |
tree | 0e1f77d1adf60019483f533890cace175ec77928 /utils/modules | |
parent | 521796a29642d27de7b998a8e3442085044a1fa5 (diff) |
Initial implementation of cross-linking.
Diffstat (limited to 'utils/modules')
-rw-r--r-- | utils/modules/events.php | 62 | ||||
-rw-r--r-- | utils/modules/news.php | 9 |
2 files changed, 46 insertions, 25 deletions
diff --git a/utils/modules/events.php b/utils/modules/events.php index 63fb080..45ee061 100644 --- a/utils/modules/events.php +++ b/utils/modules/events.php @@ -26,15 +26,17 @@ class Event { public function show() { - global $ICONS_DIR; + global $ICONS_DIR, $EVENT_PAGE; $icons = new Icons($ICONS_DIR."/"); $icon = $icons->icons[$this->flyer]; $content = Markdown(htmlspecialchars_decode($this->description)); $str = "<div class=\"event\">\n"; - $str .= " <div class=\"event_title\">" . - htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n"; + $str .= " <div class=\"event_title\">\n"; + $str .= " <a href=\"?page=".$EVENT_PAGE."&eventid=".$this->time."\">". + htmlspecialchars_decode($this->title, ENT_QUOTES) . "</a>\n"; + $str .= "</div>\n"; $str .= " <div class=\"event_time\">" . date("D M jS Y", $this->time) . "</div>\n"; $str .= " <div class=\"event_description\">" . $content . "</div>\n"; if($this->flyer) { @@ -238,28 +240,44 @@ class Events { public function run($params) { - foreach($params as $param => $value) { - switch($param) { - case "show": - switch($value) { - case "coming": - return $this->showcoming(-1); + global $eventid; + + $str = ""; + + $str .= "<div class=\"events\">\n"; + + if($eventid && $this->events[$eventid]) { + $str .= $this->events[$eventid]->show(); + } else { + foreach($params as $param => $value) { + switch($param) { + case "show": + switch($value) { + case "coming": + $str .= $this->showcoming(-1); + break; + + case "old": + $str .= $this->showold(-1); + break; + + case "all": + default: + $str .= $this->showall(-1); + break; + } + + default: + // $str .= $this->showall(-1); break; + } + } + } - case "old": - return $this->showold(-1); - break; + $str .= "</div>\n"; - case "all": - default: - return $this->showall(-1); - } - - default: - return $this->showall(-1); - } - } - } + return $str; + } public function showall($number) { diff --git a/utils/modules/news.php b/utils/modules/news.php index 8c693c3..4fe8b44 100644 --- a/utils/modules/news.php +++ b/utils/modules/news.php @@ -20,7 +20,8 @@ class NewsEntry { public function show() { - global $users, $DATA_DIR, $ICONS_DIR; + global $users, $DATA_DIR, $ICONS_DIR, $NEWS_PAGE; + if(!isset($users)) $users = new Users($DATA_DIR . "/users.xml"); $content = Markdown(htmlspecialchars_decode($this->description)); @@ -29,8 +30,10 @@ class NewsEntry { $icon = $icons->icons[$this->icon]; $str = "<div class=\"news_entry\">\n"; - $str .= " <div class=\"news_title\">" . - htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n"; + $str .= " <div class=\"news_title\">\n"; + $str .= " <a href=\"?page=".$NEWS_PAGE."&newsid=".$this->time."\">" . + htmlspecialchars_decode($this->title, ENT_QUOTES) . "</a>\n"; + $str .= " </div>\n"; $str .= " <div class=\"news_time\">" . date("D M jS Y G:i", $this->time) . "</div>\n"; $str .= " <div class=\"news_user\">By: " . |