diff options
author | deva <deva> | 2009-04-28 07:36:01 +0000 |
---|---|---|
committer | deva <deva> | 2009-04-28 07:36:01 +0000 |
commit | 3cb7a7f16be016f2d563762379222fdea5767986 (patch) | |
tree | b53f875ae6c3f5b6eaa68c5e1623f32793e94732 /utils/modules/news.php | |
parent | 1a8817ea76efb61240a9baa1673b95438e8770d9 (diff) |
Added icon module, and made the news module use it. Also made the ImageComboBox use it if supplied as the values parameter.
Diffstat (limited to 'utils/modules/news.php')
-rw-r--r-- | utils/modules/news.php | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/utils/modules/news.php b/utils/modules/news.php index 9667e44..95cdda1 100644 --- a/utils/modules/news.php +++ b/utils/modules/news.php @@ -3,6 +3,7 @@ include_once($UTIL_DIR . "/convert.php"); include_once($UTIL_DIR . "/forms.php"); include_once($UTIL_DIR . "/user.php"); +include_once($MODULES_DIR . "/icons.php"); class NewsEntry { public $title; @@ -14,16 +15,19 @@ class NewsEntry { public function show() { - global $users, $DATA_DIR; + global $users, $DATA_DIR, $ICONS_DIR; if(!isset($users)) $users = new Users($DATA_DIR . "/users.xml"); + $icons = new Icons($ICONS_DIR."/"); + $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_time\">" . date("D M jS Y G:i", $this->time) . "</div>\n"; $str .= " <div class=\"news_user\">By: " . $users->findUser($this->userid)->userid . "</div>\n"; $str .= " <div class=\"news_description\">\n"; - if($this->icon) $str .= " <img alt=\"icon\" class=\"news_icon\" src=\"" . $this->icon . "\"/>\n"; + if($this->icon) $str .= " <img alt=\"icon\" class=\"news_icon\" src=\"" . $icon->prefix.$icon->file . "\"/>\n"; $str .= " ".htmlspecialchars_decode($this->description, ENT_QUOTES) . "\n"; $str .= " </div>\n"; $str .= "</div>\n"; @@ -72,7 +76,7 @@ class News { public function admin_add($action, $vars) { - global $UID; + global $UID, $ICONS_DIR; switch($action) { case "add": @@ -109,19 +113,12 @@ class News { $category = $vars["category"]; $description = $vars["description"]; default: - $icons = array("http://www.executionroom.com/gfx/logos/die_logo_black_thumb.png", - "http://www.executionroom.com/gfx/logos/die_logo_bloody_thumb.png", - "http://www.executionroom.com/gfx/logos/die_logo_red_thumb_.png", - "http://www.executionroom.com/gfx/logos/die_logo_white_thumb.png", - "http://www.executionroom.com/gfx/die_group_2008_thumb.jpg", - "http://www.executionroom.com/gfx/die_group_thumb.jpg"); - $form = new Form("preview"); $form->addWidget(new LineEdit("Title", "title", $title)); $form->addWidget(new DateTimeEdit("Time", "time", $time)); $form->addWidget(new ComboBox("Category", "category", $category, array("Main" => "main", "Site" => "site"))); $form->addWidget(new TextEdit("Description", "description", $description)); - $form->addWidget(new ImageComboBox("Icon", "icon", $icon, $icons)); + $form->addWidget(new ImageComboBox("Icon", "icon", $icon, new Icons($ICONS_DIR."/"))); $form->addWidget(new Button("Post news")); $form->render(); break; @@ -130,7 +127,7 @@ class News { public function admin_edit($action, $vars) { - global $UID; + global $UID, $ICONS_DIR; switch($action) { case "add": @@ -165,13 +162,6 @@ class News { case "edit": case "retry": - $icons = array("http://www.executionroom.com/gfx/logos/die_logo_black_thumb.png", - "http://www.executionroom.com/gfx/logos/die_logo_bloody_thumb.png", - "http://www.executionroom.com/gfx/logos/die_logo_red_thumb_.png", - "http://www.executionroom.com/gfx/logos/die_logo_white_thumb.png", - "http://www.executionroom.com/gfx/die_group_2008_thumb.jpg", - "http://www.executionroom.com/gfx/die_group_thumb.jpg"); - if(isset($vars["title"])) $title = $vars["title"]; else $title = $this->news[$vars["newsid"]]->title; if(isset($vars["time_year"])) $time = DateTimeEdit::toTimestamp($vars, "time"); @@ -190,7 +180,7 @@ class News { $form->addWidget(new ComboBox("Category", "category", $category, array("Main" => "main", "Site" => "site"))); $form->addWidget(new TextEdit("Description", "description", $description)); - $form->addWidget(new ImageComboBox("Icon", "icon", $icon, $icons)); + $form->addWidget(new ImageComboBox("Icon", "icon", $icon, new Icons($ICONS_DIR."/"))); $form->addWidget(new Button("Post news")); $form->render(); break; |