/
index.php
executable file
·110 lines (95 loc) · 3.77 KB
/
index.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
$is_public = true;
require_once('utility_lgmis_lib.php');
require_once($link_to_utility_authorization);
$header = '';
$content = '';
$footer = '';
$size = 0;
$from = -1;
$to = -1;
$pages = -1;
$cur_page = -1;
$need_pagination = true;
$head_addition = '';
//----D I S P L A Y----
//----A R T I C L E S----
if ((!isset($_GET['content_type'])) || ($_GET['content_type'] == $content_types_short['articles'])) {
$size = Article::FetchCountOf();
if ($size) {
$head_addition = MakeScript('window_bottom_callbacks.push(Article.WindowBottomCallback);');
$need_pagination = false;
require($link_to_pagination_init_template);
$limit = $to - $from + 1;
$articles = Article::FetchBy(['limit' => $limit, 'offset' => $from, 'order_by' => 'id DESC']);
$content .= '<div onscroll="scrolled(this);" id="articles_list">';
for ($i = 0; $i < $limit; ++$i) {
$atricle = $articles[$i];
$content .= '<div class="pbl_article">'.($atricle->ToHTMLAutoShortForTable(GetUserPrivileges())).'</div>';
if ($i != $to) $content .= '<hr><div style="background-color: #eeeeee;"><br></div><hr>';
}
$content .= '</div>';
} else {
$content .= ToPageHeader(Language::Word('no news'), "h3", "black");
}
$header .= Language::PublicMenu('articles');
} else if (isset($_GET['content_type'])) {
//----D I R E C T I O N S----
if ($_GET['content_type'] == $content_types_short['directions']) {
$directions = Direction::FetchAll();
$size = count($directions);
if ($size) {
require($link_to_pagination_init_template);
for ($i = $from; $i <= $to; ++$i) {
$direction = $directions[$i];
$content .= $direction->ToHTMLAutoShortForTable(GetUserPrivileges());
if ($i != $to) $content .= '<hr><div style="background-color: #eeeeee;"><br></div><hr>';
}
} else {
$content .= ToPageHeader(Language::Word('no directions'), 'h3', 'black');
}
$header .= Language::PublicMenu('directions');
}
//----P R O J E C T S----
else if ($_GET['content_type'] == $content_types_short['projects']) {
$directions = Direction::FetchAll();
$projects = array();
for ($i = 0, $size = count($directions); $i < $size; ++$i) {
$tmp = Project::FetchByDirectionID($directions[$i]->id);
if ($tmp !== NULL) {
$projects = array_merge($projects, $tmp);
}
}
$size = count($projects);
if ($size) {
require($link_to_pagination_init_template);
for ($i = $from; $i <= $to; ++$i) {
$project = $projects[$i];
if (($i === $from) || ($i > $from) && ($projects[$i - 1]->direction_id != $project->direction_id)) {
if ($i != $from) $content .= '<hr>';
$content .= '<div align="left" style="padding: 15px; background-color: #eeeeee;">';
$content .= Language::Word('direction').': '.Direction::FetchByID($project->direction_id)->LinkToThis();
$content .= '</div><hr>';
}
$content .= ($project->ToHTMLAutoShortForTable(GetUserPrivileges()));
}
} else {
$content .= ToPageHeader(Language::Word('no projects'), 'h3', 'black');
}
$header .= Language::PublicMenu('projects');
}
} else {
//Manage articles
$content .= MenuButton(Language::PublicMenu('articles'), $_SERVER['PHP_SELF'].'?content_type='.$content_types_short['articles']);
//Manage directions
$content .= MenuButton(Language::PublicMenu('directions'), $_SERVER['PHP_SELF'].'?content_type='.$content_types_short['directions']);
//Manage projects
$content .= MenuButton(Language::PublicMenu('projects'), $_SERVER['PHP_SELF'].'?content_type='.$content_types_short['projects']);
}
$pagination = '';
if ($size) {
require($link_to_pagination_show_template);
$content .= $pagination;
}
include($link_to_public_template);
?>