summaryrefslogtreecommitdiffstats
path: root/modules-available/news
diff options
context:
space:
mode:
authorChristian Klinger2016-07-05 11:20:53 +0200
committerChristian Klinger2016-07-05 11:20:53 +0200
commit3b7e02631c89641d94534c13bebf646385c518a8 (patch)
treecf0fefd63963178d0b644ae6bb8dea131dd55fdf /modules-available/news
parenti18n for bootstrap_datepicker. (diff)
downloadslx-admin-3b7e02631c89641d94534c13bebf646385c518a8.tar.gz
slx-admin-3b7e02631c89641d94534c13bebf646385c518a8.tar.xz
slx-admin-3b7e02631c89641d94534c13bebf646385c518a8.zip
fixed bug.
Diffstat (limited to 'modules-available/news')
-rw-r--r--modules-available/news/page.inc.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/modules-available/news/page.inc.php b/modules-available/news/page.inc.php
index f77f1881..50e07458 100644
--- a/modules-available/news/page.inc.php
+++ b/modules-available/news/page.inc.php
@@ -48,8 +48,9 @@ class Page_News extends Page
$this->newsContent = false;
$this->newsDate = false;
} elseif ($action === 'show') {
- /* load latest help */
- $this->loadLatestHelp(Request::any('newsid'));
+ /* load latest things */
+ $this->loadLatest('help');
+ $this->loadLatest('news');
/* and also the news (or help) with the given id */
if (!$this->loadNews(Request::any('newsid'))) {
@@ -158,6 +159,7 @@ class Page_News extends Page
$this->newsTitle = $row['title'];
$this->newsContent = $row['content'];
$this->newsDate = $row['dateline'];
+ $this->editHelp = false;
} else {
$this->editHelp = true;
$this->helpContent = $row['content'];
@@ -167,11 +169,18 @@ class Page_News extends Page
return $row !== false;
}
- private function loadLatestHelp()
+ private function loadLatest($type)
{
- $row = Database::queryFirst("SELECT newsid, content, dateline, type FROM vmchooser_pages WHERE type='help' ORDER BY dateline DESC LIMIT 1", []);
+ $row = Database::queryFirst("SELECT newsid, title, content, dateline, type FROM vmchooser_pages WHERE type=:type ORDER BY dateline DESC LIMIT 1", ['type' => $type]);
if ($row !== false) {
- $this->helpContent = $row['content'];
+ if ($row['type'] == 'news') {
+ $this->newsId = $row['newsid'];
+ $this->newsTitle = $row['title'];
+ $this->newsContent = $row['content'];
+ $this->newsDate = $row['dateline'];
+ } else {
+ $this->helpContent = $row['content'];
+ }
}
}