-
Notifications
You must be signed in to change notification settings - Fork 53
/
NewsPage.de.php
86 lines (75 loc) · 1.9 KB
/
NewsPage.de.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
require_once('Controller.php');
require_once('Models/NewsModel.php');
require_once('Models/ScreenshotsModel.php');
class NewsPage extends Controller {
private $_template;
/* Constructor. */
public function __construct() {
parent::__construct();
$this->_template = 'news.tpl';
}
/* Display the index page. */
public function index() {
$date = isset($_GET['d']) ? $_GET['d'] : null;
if ($date != null) {
if (strtolower($date) == 'archive' || $date == '') {
$date = null;
}
return $this->getNews($date);
}
return $this->getNewsIntro();
}
/* Display a specific news item, or all news items. */
public function getNews($date = null) {
if ($date == null) {
$news_items = NewsModel::getAllNews();
$date = 'archive';
} else {
if (strlen($date) == 8) {
$news_items = NewsModel::getAllByDate($date);
} else {
$news_items = array(NewsModel::getOneByDate($date));
}
}
$this->addCSSFiles('news.css');
return $this->renderPage(
array(
'title' => 'Home',
'content_title' => 'Latest Developments',
'show_intro' => false,
'news_items' => $news_items,
'news_archive_link' => false,
'date' => $date,
),
$this->_template
);
}
/* Display the main page with limited news items and intro text. */
public function getNewsIntro() {
$news_items = NewsModel::getLatestNews(NEWS_ITEMS);
$random_shot = ScreenshotsModel::getRandomScreenshot();
$this->addCSSFiles(array(
'intro.css',
'news.css',
'../javascripts/slimbox/css/slimbox2.css',
));
$this->addJSFiles(array(
'jquery-1.3.2.min.js',
'slimbox/js/slimbox2.js',
'introduction.js',
));
return $this->renderPage(
array(
'title' => 'Startseite',
'content_title' => 'Aktuelle Entwicklungen',
'show_intro' => true,
'news_items' => $news_items,
'news_archive_link' => true,
'random_shot' => $random_shot,
),
$this->_template
);
}
}
?>