1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Wgevents; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* You may not change or alter any portion of this comment or credits |
7
|
|
|
* of supporting developers from this source code or any supporting source code |
8
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
* |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @copyright XOOPS Project https://xoops.org/ |
17
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
18
|
|
|
* @author Goffy - XOOPS Development Team |
19
|
|
|
*/ |
20
|
|
|
//\defined('\XOOPS_ROOT_PATH') || die('Restricted access'); |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class Modulemenu |
24
|
|
|
*/ |
25
|
|
|
class Modulemenu |
26
|
|
|
{ |
27
|
|
|
|
28
|
|
|
/** function to create an array for XOOPS main menu |
29
|
|
|
* |
30
|
|
|
* @return array |
31
|
|
|
*/ |
32
|
|
|
public function getMenuitemsDefault() |
33
|
|
|
{ |
34
|
|
|
|
35
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
36
|
|
|
$pathname = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'; |
37
|
|
|
|
38
|
|
|
require_once $pathname . 'include/common.php'; |
39
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
40
|
|
|
//load necessary language files from this module |
41
|
|
|
$helper->loadLanguage('modinfo'); |
42
|
|
|
|
43
|
|
|
$items = []; |
44
|
|
|
$currdirname = isset($GLOBALS['xoopsModule']) && \is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system'; |
45
|
|
|
if ($currdirname == $moduleDirName) { |
46
|
|
|
require_once \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php'; |
47
|
|
|
$helper = Helper::getInstance(); |
48
|
|
|
$permissionsHandler = $helper->getHandler('Permission'); |
49
|
|
|
|
50
|
|
|
$items = []; |
51
|
|
|
$items[] = [ |
52
|
|
|
'name' => \_MI_WGEVENTS_SMNAME1, |
53
|
|
|
'url' => 'index.php', |
54
|
|
|
]; |
55
|
|
|
// Sub events |
56
|
|
|
$items[] = [ |
57
|
|
|
'name' => \_MI_WGEVENTS_SMNAME2, |
58
|
|
|
'url' => 'event.php', |
59
|
|
|
]; |
60
|
|
|
if ($permissionsHandler->getPermEventsSubmit()) { |
61
|
|
|
// Sub Submit |
62
|
|
|
$items[] = [ |
63
|
|
|
'name' => \_MI_WGEVENTS_SMNAME10, |
64
|
|
|
'url' => 'event.php?op=list&filter=me', |
65
|
|
|
]; |
66
|
|
|
} |
67
|
|
|
if ($permissionsHandler->getPermEventsSubmit()) { |
68
|
|
|
// Sub Submit |
69
|
|
|
$items[] = [ |
70
|
|
|
'name' => \_MI_WGEVENTS_SMNAME3, |
71
|
|
|
'url' => 'event.php?op=new', |
72
|
|
|
]; |
73
|
|
|
} |
74
|
|
|
if ($permissionsHandler->getPermEventsSubmit()) { |
75
|
|
|
// Sub Submit |
76
|
|
|
$items[] = [ |
77
|
|
|
'name' => \_MI_WGEVENTS_SMNAME8, |
78
|
|
|
'url' => 'textblock.php?op=list', |
79
|
|
|
]; |
80
|
|
|
} |
81
|
|
|
if ($permissionsHandler->getPermRegistrationsSubmit()) { |
82
|
|
|
$items[] = [ |
83
|
|
|
'name' => \_MI_WGEVENTS_SMNAME5, |
84
|
|
|
'url' => 'registration.php?op=listmy', |
85
|
|
|
]; |
86
|
|
|
} |
87
|
|
|
if ($helper->getConfig('cal_page')) { |
88
|
|
|
// calendar |
89
|
|
|
$items[] = [ |
90
|
|
|
'name' => \_MI_WGEVENTS_SMNAME6, |
91
|
|
|
'url' => 'calendar.php', |
92
|
|
|
]; |
93
|
|
|
} |
94
|
|
|
// export |
95
|
|
|
$items[] = [ |
96
|
|
|
'name' => \_MI_WGEVENTS_SMNAME11, |
97
|
|
|
'url' => 'export.php?op=list&new=1', |
98
|
|
|
]; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
return $items; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
|
105
|
|
|
/** function to create a list of sublinks |
106
|
|
|
* |
107
|
|
|
* @return array |
108
|
|
|
*/ |
109
|
|
|
public function getMenuitemsSbadmin5() |
110
|
|
|
{ |
111
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
112
|
|
|
$pathname = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'; |
113
|
|
|
$urlModule = \XOOPS_URL . '/modules/' . $moduleDirName . '/'; |
114
|
|
|
|
115
|
|
|
require_once $pathname . 'include/common.php'; |
116
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
117
|
|
|
|
118
|
|
|
//load necessary language files from this module |
119
|
|
|
/* $helper->loadLanguage('common'); |
120
|
|
|
$helper->loadLanguage('main');*/ |
121
|
|
|
$helper->loadLanguage('modinfo'); |
122
|
|
|
|
123
|
|
|
// start creation of link list as array |
124
|
|
|
$permissionsHandler = $helper->getHandler('Permission'); |
125
|
|
|
|
126
|
|
|
$requestUri = $_SERVER['REQUEST_URI']; |
127
|
|
|
/*read navbar items related to perms of current user*/ |
128
|
|
|
$nav_items1 = []; |
129
|
|
|
$nav_items1[] = [ |
130
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . '/index.php') > 0, |
131
|
|
|
'url' => $urlModule . 'index.php', |
132
|
|
|
'icon' => '<i class="fa fa-tachometer fa-fw fa-lg"></i>', |
133
|
|
|
'name' => \_MI_WGEVENTS_SMNAME1, |
134
|
|
|
'sublinks' => [] |
135
|
|
|
]; |
136
|
|
|
// Sub events |
137
|
|
|
$nav_items1[] = [ |
138
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . '/event.php') > 0, |
139
|
|
|
'url' => $urlModule . 'event.php', |
140
|
|
|
'icon' => '<i class="fa fa-file fa-fw fa-lg"></i>', |
141
|
|
|
'name' => \_MI_WGEVENTS_SMNAME2, |
142
|
|
|
'sublinks' => [] |
143
|
|
|
]; |
144
|
|
|
if ($permissionsHandler->getPermEventsSubmit()) { |
145
|
|
|
// Sub Submit |
146
|
|
|
$nav_items1[] = [ |
147
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . '/event.php?op=list&filter=me') > 0, |
148
|
|
|
'url' => $urlModule . 'event.php?op=list&filter=me', |
149
|
|
|
'icon' => '<i class="fa fa-user fa-fw fa-lg"></i>', |
150
|
|
|
'name' => \_MI_WGEVENTS_SMNAME10, |
151
|
|
|
'sublinks' => [] |
152
|
|
|
]; |
153
|
|
|
} |
154
|
|
|
if ($permissionsHandler->getPermEventsSubmit()) { |
155
|
|
|
// Sub Submit |
156
|
|
|
$nav_items1[] = [ |
157
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . '/event.php?op=new') > 0, |
158
|
|
|
'url' => $urlModule . 'event.php?op=new', |
159
|
|
|
'icon' => '<i class="fa fa-file-circle-plus fa-fw fa-lg"></i>', |
160
|
|
|
'name' => \_MI_WGEVENTS_SMNAME3, |
161
|
|
|
'sublinks' => [] |
162
|
|
|
]; |
163
|
|
|
} |
164
|
|
|
if ($permissionsHandler->getPermEventsSubmit()) { |
165
|
|
|
// Sub Submit |
166
|
|
|
$nav_items1[] = [ |
167
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . 'textblock.php') > 0, |
168
|
|
|
'url' => $urlModule . 'textblock.php?op=list', |
169
|
|
|
'icon' => '<i class="fa fa-file-lines fa-fw fa-lg"></i>', |
170
|
|
|
'name' => \_MI_WGEVENTS_SMNAME8, |
171
|
|
|
'sublinks' => [] |
172
|
|
|
]; |
173
|
|
|
} |
174
|
|
|
if ($permissionsHandler->getPermRegistrationsSubmit()) { |
175
|
|
|
$nav_items1[] = [ |
176
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . 'registration.php') > 0, |
177
|
|
|
'url' => $urlModule . 'registration.php?op=listmy', |
178
|
|
|
'icon' => '<i class="fa fa-user fa-fw fa-lg"></i>', |
179
|
|
|
'name' => \_MI_WGEVENTS_SMNAME5, |
180
|
|
|
'sublinks' => [] |
181
|
|
|
]; |
182
|
|
|
} |
183
|
|
|
if ($helper->getConfig('cal_page')) { |
184
|
|
|
// calendar |
185
|
|
|
$nav_items1[] = [ |
186
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . 'calendar.php') > 0, |
187
|
|
|
'url' => $urlModule . 'calendar.php', |
188
|
|
|
'icon' => '<i class="fa fa-calendar fa-fw fa-lg"></i>', |
189
|
|
|
'name' => \_MI_WGEVENTS_SMNAME6, |
190
|
|
|
'sublinks' => [] |
191
|
|
|
]; |
192
|
|
|
} |
193
|
|
|
// export |
194
|
|
|
$nav_items1[] = [ |
195
|
|
|
'highlight' => \strpos($requestUri, $moduleDirName . 'export.php') > 0, |
196
|
|
|
'url' => $urlModule . 'export.php?op=list&new=1', |
197
|
|
|
'icon' => '<i class="fa fa-download fa-fw fa-lg"></i>', |
198
|
|
|
'name' => \_MI_WGEVENTS_SMNAME11, |
199
|
|
|
'sublinks' => [] |
200
|
|
|
]; |
201
|
|
|
|
202
|
|
|
return $nav_items1; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
|
206
|
|
|
} |
207
|
|
|
|