-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmenu_block.php
More file actions
219 lines (204 loc) · 7.53 KB
/
Copy pathmenu_block.php
File metadata and controls
219 lines (204 loc) · 7.53 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
/**
* Include any constants used for internationalizing templates.
*
* @package XoopsModules\Pedigree
* @copyright 2004 James Cotton
* @copyright {@link https://xoops.org/ XOOPS Project}
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
* @author James Cotton {@link http://www.dobermannvereniging.nl James Cotton}
* @author XOOPS Module Dev Team
*/
use XoopsModules\Pedigree\{
Helper,
Utility
};
/** @var Helper $helper */
$moduleDirName = basename(__DIR__);
$helper = Helper::getInstance();
$helper->loadLanguage('main');
// Include any common code for this module.
require_once $helper->path('include/common.php');
/**
* @return XoopsTpl
*/
function menu_block()
{
$helper = Helper::getInstance();
[$actlink, $even, $odd, $text, $hovlink, $head, $body, $title] = Utility::getColourScheme();
/*
$actlink = $colors[0];
$even = $colors[1];
$odd = $colors[2];
$text = $colors[3];
$hovlink = $colors[4];
$head = $colors[5];
$body = $colors[6];
$title = $colors[7];
*/
//inline-css
echo '<style>';
//text-colour
echo 'body {margin: 0;padding: 0;background: ' . $body . ';color: ' . $text . ";font-size: 100%; /* <-- Resets 1em to 10px */font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; text-align: left;}";
//link-colour
echo 'a, h2 a:hover, h3 a:hover { color: ' . $actlink . '; text-decoration: none; }';
//link hover colour
echo 'a:hover { color: ' . $hovlink . '; text-decoration: underline; }';
//th
echo 'th {padding: 2px;color: #ffffff;background: ' . $title . ';font-family: Verdana, Arial, Helvetica, sans-serif;vertical-align: middle;}';
echo 'td#centercolumn th { color: #fff; background: ' . $title . '; vertical-align: middle; }';
//head
echo '.head {background-color: ' . $head . '; padding: 3px; font-weight: normal;}';
//even
echo '.even {background-color: ' . $even . '; padding: 3px;}';
echo 'tr.even td {background-color: ' . $even . '; padding: 3px;}';
//odd
echo '.odd {background-color: ' . $odd . '; padding: 3px;}';
echo 'tr.odd td {background-color: ' . $odd . '; padding: 3px;}';
echo '</style>';
//is current user a module admin ?
if (!empty($GLOBALS['xoopsUser']) && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)
&& $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) {
$isAdmin = true;
} else {
$isAdmin = false;
}
$counter = 1;
$menuwidth = 4;
$x = $_SERVER['SCRIPT_NAME'];
$lastpos = Utility::myStrRpos($x, '/');
$len = mb_strlen($x);
$curpage = mb_substr($x, $lastpos, $len);
if ('1' == $helper->getConfig('showwelcome')) {
if ('/welcome.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_WELCOME . '</b>';
} else {
$title = _MA_PEDIGREE_WELCOME;
}
$menuarray[] = ['title' => $title, 'link' => 'welcome.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
}
if ('/index.php' === $curpage || '/result.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_VIEWSEARCH . $helper->getConfig('animalTypes') . '</b>';
} else {
$title = '_MA_PEDIGREE_VIEWSEARCH ' . $helper->getConfig('animalTypes');
}
$menuarray[] = ['title' => $title, 'link' => 'result.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
if ('/index.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_ADD_A . $helper->getConfig('animalType') . '</b>';
} else {
$title = 'PED_ADD_A ' . $helper->getConfig('animalType');
}
$menuarray[] = ['title' => $title, 'link' => 'add_dog.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
if ('1' == $helper->getConfig('uselitter')) {
if ('/index.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_ADD_LITTER . $helper->getConfig('litter') . '</b>';
} else {
$title = '_MA_PEDIGREE_ADD_LITTER ' . $helper->getConfig('litter');
}
$menuarray[] = ['title' => $title, 'link' => 'add_litter.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
}
if ('1' == $helper->getConfig('ownerbreeder')) {
if ('/index.php' === $curpage || '/owner.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_VIEW_OWNBREED . '</b>';
} else {
$title = '_MA_PEDIGREE_VIEW_OWNBREED';
}
$menuarray[] = ['title' => $title, 'link' => 'breeder.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
if ('/index.php' === $curpage || '/add_breeder.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_ADD_OWNBREED . '</b>';
} else {
$title = '_MA_PEDIGREE_ADD_OWNBREED';
}
$menuarray[] = ['title' => $title, 'link' => 'add_breeder.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
}
if ('/index.php' === $curpage || '/advanced.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_ADVANCE_INFO . '</b>';
} else {
$title = '_MA_PEDIGREE_ADVANCE_INFO';
}
$menuarray[] = ['title' => $title, 'link' => 'advanced.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
if ('1' == $helper->getConfig('proversion')) {
if ('/index.php' === $curpage || '/virtual.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_VIRUTALTIT . '</b>';
} else {
$title = '_MA_PEDIGREE_VIRUTALTIT';
}
$menuarray[] = ['title' => $title, 'link' => 'virtual.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
}
if ('/index.php' === $curpage || '/latest.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_LATEST_ADD . '</b>';
} else {
$title = '_MA_PEDIGREE_LATEST_ADD';
}
$menuarray[] = ['title' => $title, 'link' => 'latest.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
if ($isAdmin) {
if ('/index.php' === $curpage || '/tools.php' === $curpage) {
$title = '<b>' . _MA_PEDIGREE_WEB_TOOLS . '</b>';
} else {
$title = '_MA_PEDIGREE_WEB_TOOLS';
}
$menuarray[] = ['title' => $title, 'link' => 'tools.php?op=index', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
$title = _MA_PEDIGREE_USER_LOGOUT;
$menuarray[] = ['title' => $title, 'link' => '../../user.php?op=logout', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
} else {
if ('/user.php' === $curpage) {
$title = '._MA_PEDIGREE_USER_LOGIN.';
} else {
$title = _MA_PEDIGREE_USER_LOGIN;
}
$menuarray[] = ['title' => $title, 'link' => '../../user.php', 'counter' => $counter];
++$counter;
if ($counter == $menuwidth) {
$counter = 1;
}
}
//create path taken
//showpath();
$GLOBALS['xoopsTpl']->assign('menuarray', $menuarray);
//return the template contents
return $GLOBALS['xoopsTpl'];
}