|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/** |
|
3
|
|
|
* classGenerator |
|
4
|
|
|
* walls_watermarks. |
|
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
|
|
|
* This program is distributed in the hope that it will be useful, |
|
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
12
|
|
|
* |
|
13
|
|
|
* |
|
14
|
|
|
* |
|
15
|
|
|
* L'utilisation de ce formulaire d'adminitration suppose |
|
16
|
|
|
* que la classe correspondante de la table a été générées avec classGenerator |
|
17
|
|
|
**/ |
|
18
|
|
|
define('_EXTCAL_FORMAT_AGENDA_KEYD', 'Y-m-d'); |
|
19
|
|
|
define('_EXTCAL_FORMAT_AGENDA_KEYT', 'H:i'); |
|
20
|
|
|
|
|
21
|
|
|
require_once __DIR__ . '/constantes.php'; |
|
22
|
|
|
require_once __DIR__ . '/../class/utility.php'; |
|
23
|
|
|
|
|
24
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
|
25
|
|
|
xoops_loadLanguage('main', $moduleDirName); |
|
26
|
|
|
|
|
27
|
|
|
/******************************************************************* |
|
28
|
|
|
* |
|
29
|
|
|
****************************************************************** |
|
30
|
|
|
* @param $ts |
|
31
|
|
|
* @param $hStart |
|
32
|
|
|
* @param $hEnd |
|
33
|
|
|
* @param int $mPlage |
|
34
|
|
|
* @param int $nbJours |
|
35
|
|
|
* @param $formatDate |
|
36
|
|
|
* @param string $formatJour |
|
37
|
|
|
* |
|
38
|
|
|
* @return array |
|
39
|
|
|
*/ |
|
40
|
|
|
|
|
41
|
|
|
function agenda_getCanevas($ts, $hStart, $hEnd, $mPlage = 15, $nbJours = 1, $formatDate, $formatJour = 'H:i') |
|
42
|
|
|
{ |
|
43
|
|
|
global $xoopsModuleConfig; |
|
|
|
|
|
|
44
|
|
|
$jour = date('d', $ts); |
|
45
|
|
|
$mois = date('m', $ts); |
|
46
|
|
|
$an = date('Y', $ts); |
|
47
|
|
|
if (!isset($formatDate)) { |
|
48
|
|
|
$formatDate = $xoopsModuleConfig['event_date_week']; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
//echo "agenda_getCanevas : {$jour}-{$mois}-{$an}-{$ts}<br>"; |
|
52
|
|
|
//$tsStart = mktime($heure, $minute, $seconde, $mois, $jour, $an); |
|
|
|
|
|
|
53
|
|
|
$jName = array( |
|
54
|
|
|
_MD_EXTCAL_DAY_SUNDAY, |
|
55
|
|
|
_MD_EXTCAL_DAY_MONDAY, |
|
56
|
|
|
_MD_EXTCAL_DAY_TUESDAY, |
|
57
|
|
|
_MD_EXTCAL_DAY_WEDNESDAY, |
|
58
|
|
|
_MD_EXTCAL_DAY_THURSDAY, |
|
59
|
|
|
_MD_EXTCAL_DAY_FRIDAY, |
|
60
|
|
|
_MD_EXTCAL_DAY_SATURDAY |
|
61
|
|
|
); |
|
62
|
|
|
|
|
63
|
|
|
$tj = array(); |
|
64
|
|
|
for ($j = 0; $j < $nbJours; ++$j) { |
|
65
|
|
|
$tsj = mktime(0, 0, 0, $mois, $jour + $j, $an); |
|
66
|
|
|
$kj = date(_EXTCAL_FORMAT_AGENDA_KEYD, $tsj); |
|
67
|
|
|
$tj[$kj]['caption'] = date($formatDate, $tsj); |
|
68
|
|
|
|
|
69
|
|
|
$tj[$kj]['events'] = array(); |
|
70
|
|
|
|
|
71
|
|
|
$tj[$kj]['dayWeek'] = date('w', $tsj); |
|
72
|
|
|
$tj[$kj]['jour'] = $jName[$tj[$kj]['dayWeek']]; //date('l', $tsj); |
|
|
|
|
|
|
73
|
|
|
if ($tj[$kj]['dayWeek'] == 0) { |
|
74
|
|
|
$tj[$kj]['bg'] = "background='" . XOOPS_URL . "/modules/extcal/assets/images/trame.png'"; |
|
75
|
|
|
} else { |
|
76
|
|
|
$tj[$kj]['bg'] = ''; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
//echo "{$hStart}-{$hEnd}-{$mPlage}<br>"; |
|
81
|
|
|
$sPlage = $mPlage * _EXTCAL_TS_MINUTE; // en secondes |
|
82
|
|
|
$tsStart = mktime($hStart, 0, 0, 1, 1, 2000); |
|
83
|
|
|
$tsEnd = mktime($hEnd + 1, 0, 0, 1, 1, 2000); |
|
84
|
|
|
|
|
85
|
|
|
$ta = array(); |
|
86
|
|
View Code Duplication |
if ($hStart > 0) { |
|
|
|
|
|
|
87
|
|
|
$tsCurent = mktime(0, 0, 0, 1, 1, 2000); |
|
88
|
|
|
$k = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent); |
|
89
|
|
|
$ta[$k]['caption'] = date($formatJour, $tsCurent); |
|
90
|
|
|
$ta[$k]['jours'] = $tj; |
|
91
|
|
|
$ta[$k]['class'] = 'head'; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
$tsCurent = $tsStart; |
|
95
|
|
|
$h = 0; |
|
96
|
|
|
while ($tsCurent < $tsEnd) { |
|
97
|
|
|
$k = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent); |
|
98
|
|
|
//echo "{$k}-$tsCurent-"; |
|
99
|
|
|
$ta[$k]['caption'] = date($formatJour, $tsCurent); |
|
100
|
|
|
$ta[$k]['jours'] = $tj; |
|
101
|
|
|
$ta[$k]['class'] = ((($h % 2) == 0) ? 'odd' : 'even'); |
|
102
|
|
|
|
|
103
|
|
|
//---------------------------------------------- |
|
104
|
|
|
++$h; |
|
105
|
|
|
$tsCurent += $sPlage; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
View Code Duplication |
if ($hEnd < 23) { |
|
|
|
|
|
|
109
|
|
|
$tsCurent = mktime($hEnd + 1, 0, 0, 1, 1, 2000); |
|
110
|
|
|
$k = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent); |
|
111
|
|
|
$ta[$k]['caption'] = date($formatJour, $tsCurent); |
|
112
|
|
|
$ta[$k]['jours'] = $tj; |
|
113
|
|
|
$ta[$k]['class'] = 'foot'; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
return $ta; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/******************************************************************* |
|
120
|
|
|
* |
|
121
|
|
|
****************************************************************** |
|
122
|
|
|
* @param $eventsArray |
|
123
|
|
|
* @param $ts |
|
124
|
|
|
* @param $hStart |
|
125
|
|
|
* @param $hEnd |
|
126
|
|
|
* @param int $mPlage |
|
127
|
|
|
* @param int $nbJours |
|
128
|
|
|
* @param string $formatDate |
|
129
|
|
|
* @param string $formatJour |
|
130
|
|
|
* @return array |
|
131
|
|
|
*/ |
|
132
|
|
|
function agenda_getEvents( |
|
133
|
|
|
$eventsArray, |
|
134
|
|
|
$ts, |
|
135
|
|
|
$hStart, |
|
136
|
|
|
$hEnd, |
|
137
|
|
|
$mPlage = 15, |
|
138
|
|
|
$nbJours = 1, |
|
139
|
|
|
$formatDate = 'd-m-Y', |
|
140
|
|
|
$formatJour = 'H:i' |
|
141
|
|
|
) { |
|
142
|
|
|
|
|
143
|
|
|
// $tAgenda = agenda_getCanevas($ts, 8, 20, $mPlage, $nbJours); |
|
|
|
|
|
|
144
|
|
|
$tAgenda = agenda_getCanevas($ts, $hStart, $hEnd - 1, $mPlage, $nbJours, $formatDate, $formatJour); |
|
145
|
|
|
$tk = array_keys($tAgenda); |
|
146
|
|
|
$tk0 = $tk[0]; |
|
147
|
|
|
$tk1 = $tk[count($tk) - 1]; |
|
148
|
|
|
|
|
149
|
|
|
foreach ($eventsArray as $e) { |
|
150
|
|
|
$ts = $e['event_start']; |
|
151
|
|
|
$kd = date(_EXTCAL_FORMAT_AGENDA_KEYD, $ts); |
|
152
|
|
|
$hour = date('H', $ts); |
|
153
|
|
|
$minute = date('i', $ts); |
|
154
|
|
|
$m = (int)($minute / $mPlage) * $mPlage; |
|
155
|
|
|
// echo "--->{$minute} / {$mPlage} = {$m}<br>"; |
|
156
|
|
|
$sMinute = (($m < 10) ? '0' . $m : $m); |
|
157
|
|
|
//$kt = date(_EXTCAL_FORMAT_AGENDA_KEYT, $ts); |
|
|
|
|
|
|
158
|
|
|
if ($hour < $hStart) { |
|
159
|
|
|
$kt = $tk0; |
|
160
|
|
|
} elseif ($hour >= ($hEnd + 1)) { |
|
161
|
|
|
$kt = $tk1; |
|
162
|
|
|
} else { |
|
163
|
|
|
$kt = $hour . ':' . $sMinute; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
$tAgenda[$kt]['jours'][$kd]['events'][] = $e; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
return $tAgenda; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/******************************************************************* |
|
173
|
|
|
* |
|
174
|
|
|
*******************************************************************/ |
|
175
|
|
|
function test_getAgenda() |
|
176
|
|
|
{ |
|
177
|
|
|
$tsD1 = mktime(0, 0, 0, 01, 25, 1954); |
|
178
|
|
|
$t = getAgenda($tsD1, 8, 21, 30, 7); |
|
179
|
|
|
|
|
180
|
|
|
$t['10:30']['jours']['1954-01-25']['events'][1]['lib'] = 'Jean'; |
|
181
|
|
|
$t['10:30']['jours']['1954-01-25']['events'][1]['dsc'] = 'bobo'; |
|
182
|
|
|
|
|
183
|
|
|
$t['10:30']['jours']['1954-01-25']['events'][7]['lib'] = 'polo'; |
|
184
|
|
|
$t['10:30']['jours']['1954-01-25']['events'][7]['dsc'] = 'haribo'; |
|
185
|
|
|
|
|
186
|
|
|
$t['11:30']['jours']['1954-01-28']['events'][5]['lib'] = 'Jean'; |
|
187
|
|
|
$t['11:30']['jours']['1954-01-28']['events'][5]['dsc'] = 'bibi'; |
|
188
|
|
|
|
|
189
|
|
|
$exp = print_r($t, true); |
|
190
|
|
|
echo "<pre>{$exp}</pre>"; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/******************************************************************* |
|
194
|
|
|
* |
|
195
|
|
|
****************************************************************** |
|
196
|
|
|
* @param $event1 |
|
197
|
|
|
* @param $event2 |
|
198
|
|
|
* @return int |
|
199
|
|
|
*/ |
|
200
|
|
|
function orderEvents($event1, $event2) |
|
|
|
|
|
|
201
|
|
|
{ |
|
202
|
|
|
if ($event1['event_start'] == $event2['event_start']) { |
|
203
|
|
|
return 0; |
|
204
|
|
|
} |
|
205
|
|
|
if ($GLOBALS['xoopsModuleConfig']['sort_order'] === 'ASC') { |
|
206
|
|
|
$opt1 = -1; |
|
207
|
|
|
$opt2 = 1; |
|
208
|
|
|
} else { |
|
209
|
|
|
$opt1 = 1; |
|
210
|
|
|
$opt2 = -1; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
return ($event1['event_start'] < $event2['event_start']) ? $opt1 : $opt2; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
/******************************************************************* |
|
217
|
|
|
* |
|
218
|
|
|
****************************************************************** |
|
219
|
|
|
* @param $year |
|
220
|
|
|
* @param int $nbYearsBefore |
|
221
|
|
|
* @param int $nbYearsAfter |
|
222
|
|
|
* @param bool $addNone |
|
223
|
|
|
* @param string $name |
|
224
|
|
|
* @return \XoopsFormSelect |
|
225
|
|
|
*/ |
|
226
|
|
|
function getListYears($year, $nbYearsBefore = 0, $nbYearsAfter = 5, $addNone = false, $name = 'year') |
|
227
|
|
|
{ |
|
228
|
|
|
// Year selectbox |
|
229
|
|
|
$select = new XoopsFormSelect('', $name, $year); |
|
230
|
|
|
if ($addNone) { |
|
231
|
|
|
$select->addOption(0, ' '); |
|
232
|
|
|
} |
|
233
|
|
|
if ($year == 0) { |
|
234
|
|
|
$year = date('Y'); |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
for ($i = $year - $nbYearsBefore; $i < ($year + $nbYearsAfter); ++$i) { |
|
238
|
|
|
$select->addOption($i); |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
return $select; |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
/******************************************************************* |
|
245
|
|
|
* |
|
246
|
|
|
****************************************************************** |
|
247
|
|
|
* @param $month |
|
248
|
|
|
* @param bool $addNone |
|
249
|
|
|
* @param string $name |
|
250
|
|
|
* @return \XoopsFormSelect |
|
251
|
|
|
*/ |
|
252
|
|
|
function getListMonths($month, $addNone = false, $name = 'month') |
|
253
|
|
|
{ |
|
254
|
|
|
// Month selectbox |
|
255
|
|
|
$extcalTimeHandler = ExtcalTime::getHandler(); |
|
256
|
|
|
|
|
257
|
|
|
$select = new XoopsFormSelect('', $name, $month); |
|
258
|
|
|
if ($addNone) { |
|
259
|
|
|
$select->addOption(0, ' '); |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
for ($i = 1; $i < 13; ++$i) { |
|
263
|
|
|
$select->addOption($i, $extcalTimeHandler->getMonthName($i)); |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
return $select; |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
/******************************************************************* |
|
270
|
|
|
* |
|
271
|
|
|
****************************************************************** |
|
272
|
|
|
* @param $day |
|
273
|
|
|
* @param bool $addNone |
|
274
|
|
|
* @return \XoopsFormSelect |
|
275
|
|
|
*/ |
|
276
|
|
|
function getListDays($day, $addNone = false) |
|
277
|
|
|
{ |
|
278
|
|
|
// Day selectbox |
|
279
|
|
|
$select = new XoopsFormSelect('', 'day', $day); |
|
280
|
|
|
if ($addNone) { |
|
281
|
|
|
$select->addOption(0, ' '); |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
for ($i = 1; $i < 32; ++$i) { |
|
285
|
|
|
$select->addOption($i); |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
return $select; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/******************************************************************* |
|
292
|
|
|
* |
|
293
|
|
|
****************************************************************** |
|
294
|
|
|
* @param $name |
|
295
|
|
|
* @return bool |
|
|
|
|
|
|
296
|
|
|
*/ |
|
297
|
|
|
function ext_loadLanguage($name) |
|
298
|
|
|
{ |
|
299
|
|
|
global $xoopsConfig; |
|
|
|
|
|
|
300
|
|
|
$prefix = substr($name, 4); |
|
301
|
|
|
switch ($prefix) { |
|
302
|
|
|
case '_MI_': |
|
303
|
|
|
$f = ''; |
|
304
|
|
|
break; |
|
305
|
|
|
case '_MD_': |
|
306
|
|
|
$f = ''; |
|
307
|
|
|
break; |
|
308
|
|
|
default: |
|
309
|
|
|
return false; |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
$file = XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/' . $f; |
|
313
|
|
|
$prefix = (defined($name) ? '_MI' : '_MD'); |
|
|
|
|
|
|
314
|
|
|
require_once $file; |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
/******************************************************************* |
|
318
|
|
|
* |
|
319
|
|
|
****************************************************************** |
|
320
|
|
|
* @param string $currentTab |
|
321
|
|
|
* @return array |
|
322
|
|
|
*/ |
|
323
|
|
|
|
|
324
|
|
|
function getNavBarTabs($currentTab = '') |
|
|
|
|
|
|
325
|
|
|
{ |
|
326
|
|
|
global $xoopsModuleConfig; |
|
|
|
|
|
|
327
|
|
|
|
|
328
|
|
|
ext_loadLanguage('_MD_'); |
|
329
|
|
|
|
|
330
|
|
|
$visibleTabs = $xoopsModuleConfig['visible_tabs']; |
|
331
|
|
|
$tNavBar = $ordre = array(); |
|
332
|
|
|
|
|
333
|
|
|
$sep = '='; |
|
334
|
|
|
$tabs = str_replace("\n", $sep, $xoopsModuleConfig['weight_tabs']); |
|
335
|
|
|
$tabs = str_replace("\r", '', $tabs); |
|
336
|
|
|
$tabs = str_replace(' ', '', $tabs); |
|
337
|
|
|
$t = explode($sep, $tabs); |
|
338
|
|
|
$tWeight = array_flip($t); |
|
339
|
|
|
|
|
340
|
|
|
//----------------------------------------------------------------- |
|
341
|
|
|
$view = _EXTCAL_NAV_CALMONTH; |
|
342
|
|
|
// echo "{$view} - {$currentTab}<br>"; |
|
343
|
|
|
// echoArray($visibleTabs,true); |
|
|
|
|
|
|
344
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
345
|
|
|
$tNavBar[$view] = array( |
|
346
|
|
|
'href' => _EXTCAL_FILE_CALMONTH, |
|
347
|
|
|
'name' => _MD_EXTCAL_NAV_CALMONTH, |
|
348
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
349
|
|
|
'weight' => 110 |
|
350
|
|
|
); |
|
351
|
|
|
} |
|
352
|
|
|
|
|
353
|
|
|
$view = _EXTCAL_NAV_CALWEEK; |
|
354
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
355
|
|
|
$tNavBar[$view] = array( |
|
356
|
|
|
'href' => _EXTCAL_FILE_CALWEEK, |
|
357
|
|
|
'name' => _MD_EXTCAL_NAV_CALWEEK, |
|
358
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
359
|
|
|
'weight' => 120 |
|
360
|
|
|
); |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
$view = _EXTCAL_NAV_YEAR; |
|
364
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
365
|
|
|
$tNavBar[$view] = array( |
|
366
|
|
|
'href' => _EXTCAL_FILE_YEAR, |
|
367
|
|
|
'name' => _MD_EXTCAL_NAV_YEAR, |
|
368
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
369
|
|
|
'weight' => 130 |
|
370
|
|
|
); |
|
371
|
|
|
} |
|
372
|
|
|
|
|
373
|
|
|
$view = _EXTCAL_NAV_MONTH; |
|
374
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
375
|
|
|
$tNavBar[$view] = array( |
|
376
|
|
|
'href' => _EXTCAL_FILE_MONTH, |
|
377
|
|
|
'name' => _MD_EXTCAL_NAV_MONTH, |
|
378
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
379
|
|
|
'weight' => 140 |
|
380
|
|
|
); |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
$view = _EXTCAL_NAV_WEEK; |
|
384
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
385
|
|
|
$tNavBar[$view] = array( |
|
386
|
|
|
'href' => _EXTCAL_FILE_WEEK, |
|
387
|
|
|
'name' => _MD_EXTCAL_NAV_WEEK, |
|
388
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
389
|
|
|
'weight' => 150 |
|
390
|
|
|
); |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
$view = _EXTCAL_NAV_DAY; |
|
394
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
395
|
|
|
$tNavBar[$view] = array( |
|
396
|
|
|
'href' => _EXTCAL_FILE_DAY, |
|
397
|
|
|
'name' => _MD_EXTCAL_NAV_DAY, |
|
398
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
399
|
|
|
'weight' => 160 |
|
400
|
|
|
); |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
$view = _EXTCAL_NAV_AGENDA_WEEK; |
|
404
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
405
|
|
|
$tNavBar[$view] = array( |
|
406
|
|
|
'href' => _EXTCAL_FILE_AGENDA_WEEK, |
|
407
|
|
|
'name' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
|
408
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
409
|
|
|
'weight' => 170 |
|
410
|
|
|
); |
|
411
|
|
|
} |
|
412
|
|
|
|
|
413
|
|
|
$view = _EXTCAL_NAV_AGENDA_DAY; |
|
414
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
415
|
|
|
$tNavBar[$view] = array( |
|
416
|
|
|
'href' => _EXTCAL_FILE_AGENDA_DAY, |
|
417
|
|
|
'name' => _MD_EXTCAL_NAV_AGENDA_DAY, |
|
418
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
419
|
|
|
'weight' => 180 |
|
420
|
|
|
); |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
$view = _EXTCAL_NAV_SEARCH; |
|
424
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
425
|
|
|
$tNavBar[$view] = array( |
|
426
|
|
|
'href' => _EXTCAL_FILE_SEARCH, |
|
427
|
|
|
'name' => _MD_EXTCAL_NAV_SEARCH, |
|
428
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
429
|
|
|
'weight' => 200 |
|
430
|
|
|
); |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
$user = isset($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser'] : null; |
|
434
|
|
|
/** @var ExtcalCatHandler $catHandler */ |
|
435
|
|
|
$catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
|
436
|
|
|
if ($catHandler->haveSubmitRight($user)) { |
|
437
|
|
|
$view = _EXTCAL_NAV_NEW_EVENT; |
|
438
|
|
View Code Duplication |
if (in_array($view, $visibleTabs)) { |
|
|
|
|
|
|
439
|
|
|
$tNavBar[$view] = array( |
|
440
|
|
|
'href' => _EXTCAL_FILE_NEW_EVENT, |
|
441
|
|
|
'name' => _MD_EXTCAL_NAV_NEW_EVENT, |
|
442
|
|
|
'current' => ($view == $currentTab) ? 1 : 0, |
|
443
|
|
|
'weight' => 100 |
|
444
|
|
|
); |
|
445
|
|
|
} |
|
446
|
|
|
} |
|
447
|
|
|
//---------------------------------------------------------------- |
|
448
|
|
|
// $ordre = array(); |
|
|
|
|
|
|
449
|
|
|
// while (list($k, $v) = each($tNavBar)) { |
|
|
|
|
|
|
450
|
|
|
foreach ($tNavBar as $k => $v) { |
|
451
|
|
|
if (isset($tWeight[$k])) { |
|
452
|
|
|
$ordre[] = (int)$tWeight[$k]; //ordre defini dans les option du module |
|
453
|
|
|
} else { |
|
454
|
|
|
$ordre[] = $v['weight']; // ordre par defaut ddefini dans le tableau $tNavBar |
|
455
|
|
|
} |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
array_multisort($tNavBar, SORT_ASC, SORT_NUMERIC, $ordre, SORT_ASC, SORT_NUMERIC); |
|
459
|
|
|
|
|
460
|
|
|
// ext_echoArray($tNavBar); |
|
|
|
|
|
|
461
|
|
|
// ext_echoArray($ordre); |
|
|
|
|
|
|
462
|
|
|
return $tNavBar; |
|
463
|
|
|
} |
|
464
|
|
|
|
|
465
|
|
|
/*----------------------------------------------------------------------*/ |
|
466
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.