From 3cb7a7f16be016f2d563762379222fdea5767986 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 28 Apr 2009 07:36:01 +0000 Subject: Added icon module, and made the news module use it. Also made the ImageComboBox use it if supplied as the values parameter. --- utils/modules/news.php | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'utils/modules/news.php') 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 = "
\n"; $str .= "
" . htmlspecialchars_decode($this->title, ENT_QUOTES) . "
\n"; $str .= "
" . date("D M jS Y G:i", $this->time) . "
\n"; $str .= "
By: " . $users->findUser($this->userid)->userid . "
\n"; $str .= "
\n"; - if($this->icon) $str .= " \"icon\"icon . "\"/>\n"; + if($this->icon) $str .= " \"icon\"prefix.$icon->file . "\"/>\n"; $str .= " ".htmlspecialchars_decode($this->description, ENT_QUOTES) . "\n"; $str .= "
\n"; $str .= "
\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; -- cgit v1.2.3