Passed
Push — master ( d2520f...3f8ec2 )
by Michael
02:50
created

agenda_fnc.php ➔ getNavBarTabs()   F

Complexity

Conditions 25
Paths > 20000

Size

Total Lines 140
Code Lines 91

Duplication

Lines 80
Ratio 57.14 %

Importance

Changes 0
Metric Value
cc 25
eloc 91
nc 354294
nop 1
dl 80
loc 140
rs 2
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 21 and the first side effect is on line 24.

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.

Loading history...
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
19
use XoopsModules\Extcal;
20
21
define('_EXTCAL_FORMAT_AGENDA_KEYD', 'Y-m-d');
22
define('_EXTCAL_FORMAT_AGENDA_KEYT', 'H:i');
23
24
require_once __DIR__ . '/constantes.php';
25
// require_once __DIR__ . '/../class/Utility.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
26
27
$moduleDirName = basename(dirname(__DIR__));
28
Extcal\Helper::getInstance()->loadLanguage('main');
29
30
/*******************************************************************
31
 *
32
 ******************************************************************
33
 * @param        $ts
34
 * @param        $hStart
35
 * @param        $hEnd
36
 * @param int    $mPlage
37
 * @param int    $nbJours
38
 * @param        $formatDate
39
 * @param string $formatJour
40
 *
41
 * @return array
42
 */
43
44
function agenda_getCanevas($ts, $hStart, $hEnd, $mPlage = 15, $nbJours = 1, $formatDate, $formatJour = 'H:i')
45
{
46
    global $xoopsModuleConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
47
    $jour = date('d', $ts);
48
    $mois = date('m', $ts);
49
    $an   = date('Y', $ts);
50
    if (!isset($formatDate)) {
51
        $formatDate = $xoopsModuleConfig['event_date_week'];
52
    }
53
54
    //echo "agenda_getCanevas : {$jour}-{$mois}-{$an}-{$ts}<br>";
55
    //$tsStart = mktime($heure, $minute, $seconde, $mois, $jour, $an);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
56
    $jName = [
57
        _MD_EXTCAL_DAY_SUNDAY,
58
        _MD_EXTCAL_DAY_MONDAY,
59
        _MD_EXTCAL_DAY_TUESDAY,
60
        _MD_EXTCAL_DAY_WEDNESDAY,
61
        _MD_EXTCAL_DAY_THURSDAY,
62
        _MD_EXTCAL_DAY_FRIDAY,
63
        _MD_EXTCAL_DAY_SATURDAY
64
    ];
65
66
    $tj = [];
67
    for ($j = 0; $j < $nbJours; ++$j) {
68
        $tsj                = mktime(0, 0, 0, $mois, $jour + $j, $an);
0 ignored issues
show
Bug introduced by
$an of type string is incompatible with the type integer expected by parameter $year of mktime(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

68
        $tsj                = mktime(0, 0, 0, $mois, $jour + $j, /** @scrutinizer ignore-type */ $an);
Loading history...
Bug introduced by
$mois of type string is incompatible with the type integer expected by parameter $month of mktime(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

68
        $tsj                = mktime(0, 0, 0, /** @scrutinizer ignore-type */ $mois, $jour + $j, $an);
Loading history...
69
        $kj                 = date(_EXTCAL_FORMAT_AGENDA_KEYD, $tsj);
70
        $tj[$kj]['caption'] = date($formatDate, $tsj);
71
72
        $tj[$kj]['events'] = [];
73
74
        $tj[$kj]['dayWeek'] = date('w', $tsj);
75
        $tj[$kj]['jour']    = $jName[$tj[$kj]['dayWeek']]; //date('l', $tsj);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
76
        if (0 == $tj[$kj]['dayWeek']) {
77
            $tj[$kj]['bg'] = "background='" . XOOPS_URL . "/modules/extcal/assets/images/trame.png'";
0 ignored issues
show
Bug introduced by
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
78
        } else {
79
            $tj[$kj]['bg'] = '';
80
        }
81
    }
82
83
    //echo "{$hStart}-{$hEnd}-{$mPlage}<br>";
84
    $sPlage  = $mPlage * _EXTCAL_TS_MINUTE; // en secondes
85
    $tsStart = mktime($hStart, 0, 0, 1, 1, 2000);
86
    $tsEnd   = mktime($hEnd + 1, 0, 0, 1, 1, 2000);
87
88
    $ta = [];
89
    if ($hStart > 0) {
90
        $tsCurent          = mktime(0, 0, 0, 1, 1, 2000);
91
        $k                 = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent);
92
        $ta[$k]['caption'] = date($formatJour, $tsCurent);
93
        $ta[$k]['jours']   = $tj;
94
        $ta[$k]['class']   = 'head';
95
    }
96
97
    $tsCurent = $tsStart;
98
    $h        = 0;
99
    while ($tsCurent < $tsEnd) {
100
        $k = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent);
101
        //echo "{$k}-$tsCurent-";
102
        $ta[$k]['caption'] = date($formatJour, $tsCurent);
103
        $ta[$k]['jours']   = $tj;
104
        $ta[$k]['class']   = ((0 == ($h % 2)) ? 'odd' : 'even');
105
106
        //----------------------------------------------
107
        ++$h;
108
        $tsCurent += $sPlage;
109
    }
110
111
    if ($hEnd < 23) {
112
        $tsCurent          = mktime($hEnd + 1, 0, 0, 1, 1, 2000);
113
        $k                 = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent);
114
        $ta[$k]['caption'] = date($formatJour, $tsCurent);
115
        $ta[$k]['jours']   = $tj;
116
        $ta[$k]['class']   = 'foot';
117
    }
118
119
    return $ta;
120
}
121
122
/*******************************************************************
123
 *
124
 ******************************************************************
125
 * @param        $eventsArray
126
 * @param        $ts
127
 * @param        $hStart
128
 * @param        $hEnd
129
 * @param int    $mPlage
130
 * @param int    $nbJours
131
 * @param string $formatDate
132
 * @param string $formatJour
133
 * @return array
134
 */
135
function agenda_getEvents(
136
    $eventsArray,
137
    $ts,
138
    $hStart,
139
    $hEnd,
140
    $mPlage = 15,
141
    $nbJours = 1,
142
    $formatDate = 'd-m-Y',
143
    $formatJour = 'H:i')
144
{
145
146
    //    $tAgenda = agenda_getCanevas($ts, 8, 20, $mPlage, $nbJours);
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
147
    $tAgenda = agenda_getCanevas($ts, $hStart, $hEnd - 1, $mPlage, $nbJours, $formatDate, $formatJour);
148
    $tk      = array_keys($tAgenda);
149
    $tk0     = $tk[0];
150
    $tk1     = $tk[count($tk) - 1];
151
152
    foreach ($eventsArray as $e) {
153
        $ts     = $e['event_start'];
154
        $kd     = date(_EXTCAL_FORMAT_AGENDA_KEYD, $ts);
155
        $hour   = date('H', $ts);
156
        $minute = date('i', $ts);
157
        $m      = (int)($minute / $mPlage) * $mPlage;
158
        //      echo "--->{$minute} / {$mPlage} = {$m}<br>";
159
        $sMinute = (($m < 10) ? '0' . $m : $m);
160
        //$kt = date(_EXTCAL_FORMAT_AGENDA_KEYT, $ts);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
161
        if ($hour < $hStart) {
162
            $kt = $tk0;
163
        } elseif ($hour >= ($hEnd + 1)) {
164
            $kt = $tk1;
165
        } else {
166
            $kt = $hour . ':' . $sMinute;
167
        }
168
169
        $tAgenda[$kt]['jours'][$kd]['events'][] = $e;
170
    }
171
172
    return $tAgenda;
173
}
174
175
/*******************************************************************
176
 *
177
 *******************************************************************/
178
function test_getAgenda()
179
{
180
    $tsD1 = mktime(0, 0, 0, 01, 25, 1954);
181
    $t    = getAgenda($tsD1, 8, 21, 30, 7);
0 ignored issues
show
Bug introduced by
The function getAgenda was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

181
    $t    = /** @scrutinizer ignore-call */ getAgenda($tsD1, 8, 21, 30, 7);
Loading history...
182
183
    $t['10:30']['jours']['1954-01-25']['events'][1]['lib'] = 'Jean';
184
    $t['10:30']['jours']['1954-01-25']['events'][1]['dsc'] = 'bobo';
185
186
    $t['10:30']['jours']['1954-01-25']['events'][7]['lib'] = 'polo';
187
    $t['10:30']['jours']['1954-01-25']['events'][7]['dsc'] = 'haribo';
188
189
    $t['11:30']['jours']['1954-01-28']['events'][5]['lib'] = 'Jean';
190
    $t['11:30']['jours']['1954-01-28']['events'][5]['dsc'] = 'bibi';
191
192
    $exp = print_r($t, true);
193
    echo "<pre>{$exp}</pre>";
194
}
195
196
/*******************************************************************
197
 *
198
 ******************************************************************
199
 * @param $event1
200
 * @param $event2
201
 * @return int
202
 */
203
function orderEvents($event1, $event2)
204
{
205
    if ($event1['event_start'] == $event2['event_start']) {
206
        return 0;
207
    }
208
    if ('ASC' === $GLOBALS['xoopsModuleConfig']['sort_order']) {
209
        $opt1 = -1;
210
        $opt2 = 1;
211
    } else {
212
        $opt1 = 1;
213
        $opt2 = -1;
214
    }
215
216
    return ($event1['event_start'] < $event2['event_start']) ? $opt1 : $opt2;
217
}
218
219
/*******************************************************************
220
 *
221
 ******************************************************************
222
 * @param        $year
223
 * @param int    $nbYearsBefore
224
 * @param int    $nbYearsAfter
225
 * @param bool   $addNone
226
 * @param string $name
227
 * @return \XoopsFormSelect
228
 */
229
function getListYears($year, $nbYearsBefore = 0, $nbYearsAfter = 5, $addNone = false, $name = 'year')
230
{
231
    // Year selectbox
232
    $select = new \XoopsFormSelect('', $name, $year);
0 ignored issues
show
Bug introduced by
The type XoopsFormSelect was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
233
    if ($addNone) {
234
        $select->addOption(0, ' ');
235
    }
236
    if (0 == $year) {
237
        $year = date('Y');
238
    }
239
240
    for ($i = $year - $nbYearsBefore; $i < ($year + $nbYearsAfter); ++$i) {
241
        $select->addOption($i);
242
    }
243
244
    return $select;
245
}
246
247
/*******************************************************************
248
 *
249
 ******************************************************************
250
 * @param        $month
251
 * @param bool   $addNone
252
 * @param string $name
253
 * @return \XoopsFormSelect
254
 */
255
function getListMonths($month, $addNone = false, $name = 'month')
256
{
257
    // Month selectbox
258
    $timeHandler = Extcal\Time::getHandler();
259
260
    $select = new \XoopsFormSelect('', $name, $month);
261
    if ($addNone) {
262
        $select->addOption(0, ' ');
263
    }
264
265
    for ($i = 1; $i < 13; ++$i) {
266
        $select->addOption($i, $timeHandler->getMonthName($i));
267
    }
268
269
    return $select;
270
}
271
272
/*******************************************************************
273
 *
274
 ******************************************************************
275
 * @param      $day
276
 * @param bool $addNone
277
 * @return \XoopsFormSelect
278
 */
279
function getListDays($day, $addNone = false)
280
{
281
    // Day selectbox
282
    $select = new \XoopsFormSelect('', 'day', $day);
283
    if ($addNone) {
284
        $select->addOption(0, ' ');
285
    }
286
287
    for ($i = 1; $i < 32; ++$i) {
288
        $select->addOption($i);
289
    }
290
291
    return $select;
292
}
293
294
/*******************************************************************
295
 *
296
 ******************************************************************
297
 * @param $name
298
 * @return bool
299
 */
300
function ext_loadLanguage($name)
301
{
302
    global $xoopsConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
303
    $prefix = substr($name, 4);
304
    switch ($prefix) {
305
        case '_MI_':
306
            $f = '';
307
            break;
308
        case '_MD_':
309
            $f = '';
310
            break;
311
        default:
312
            return false;
313
    }
314
315
    $file   = XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/' . $f;
0 ignored issues
show
Bug introduced by
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
316
    $prefix = (defined($name) ? '_MI' : '_MD');
0 ignored issues
show
Unused Code introduced by
The assignment to $prefix is dead and can be removed.
Loading history...
317
    require_once $file;
318
}
319
320
/*******************************************************************
321
 *
322
 ******************************************************************
323
 * @param string $currentTab
324
 * @return array
325
 */
326
327
function getNavBarTabs($currentTab = '')
328
{
329
    global $xoopsModuleConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
330
331
    ext_loadLanguage('_MD_');
332
333
    $visibleTabs = $xoopsModuleConfig['visible_tabs'];
334
    $tNavBar     = $ordre = [];
335
336
    $sep     = '=';
337
    $tabs    = str_replace("\n", $sep, $xoopsModuleConfig['weight_tabs']);
338
    $tabs    = str_replace("\r", '', $tabs);
339
    $tabs    = str_replace(' ', '', $tabs);
340
    $t       = explode($sep, $tabs);
341
    $tWeight = array_flip($t);
342
343
    //-----------------------------------------------------------------
344
    $view = _EXTCAL_NAV_CALMONTH;
345
    //   echo "{$view} - {$currentTab}<br>";
346
    //   echoArray($visibleTabs,true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
347
    if (in_array($view, $visibleTabs)) {
348
        $tNavBar[$view] = [
349
            'href'    => _EXTCAL_FILE_CALMONTH,
350
            'name'    => _MD_EXTCAL_NAV_CALMONTH,
351
            'current' => ($view == $currentTab) ? 1 : 0,
352
            'weight'  => 110
353
        ];
354
    }
355
356
    $view = _EXTCAL_NAV_CALWEEK;
357
    if (in_array($view, $visibleTabs)) {
358
        $tNavBar[$view] = [
359
            'href'    => _EXTCAL_FILE_CALWEEK,
360
            'name'    => _MD_EXTCAL_NAV_CALWEEK,
361
            'current' => ($view == $currentTab) ? 1 : 0,
362
            'weight'  => 120
363
        ];
364
    }
365
366
    $view = _EXTCAL_NAV_YEAR;
367
    if (in_array($view, $visibleTabs)) {
368
        $tNavBar[$view] = [
369
            'href'    => _EXTCAL_FILE_YEAR,
370
            'name'    => _MD_EXTCAL_NAV_YEAR,
371
            'current' => ($view == $currentTab) ? 1 : 0,
372
            'weight'  => 130
373
        ];
374
    }
375
376
    $view = _EXTCAL_NAV_MONTH;
377
    if (in_array($view, $visibleTabs)) {
378
        $tNavBar[$view] = [
379
            'href'    => _EXTCAL_FILE_MONTH,
380
            'name'    => _MD_EXTCAL_NAV_MONTH,
381
            'current' => ($view == $currentTab) ? 1 : 0,
382
            'weight'  => 140
383
        ];
384
    }
385
386
    $view = _EXTCAL_NAV_WEEK;
387
    if (in_array($view, $visibleTabs)) {
388
        $tNavBar[$view] = [
389
            'href'    => _EXTCAL_FILE_WEEK,
390
            'name'    => _MD_EXTCAL_NAV_WEEK,
391
            'current' => ($view == $currentTab) ? 1 : 0,
392
            'weight'  => 150
393
        ];
394
    }
395
396
    $view = _EXTCAL_NAV_DAY;
397
    if (in_array($view, $visibleTabs)) {
398
        $tNavBar[$view] = [
399
            'href'    => _EXTCAL_FILE_DAY,
400
            'name'    => _MD_EXTCAL_NAV_DAY,
401
            'current' => ($view == $currentTab) ? 1 : 0,
402
            'weight'  => 160
403
        ];
404
    }
405
406
    $view = _EXTCAL_NAV_AGENDA_WEEK;
407
    if (in_array($view, $visibleTabs)) {
408
        $tNavBar[$view] = [
409
            'href'    => _EXTCAL_FILE_AGENDA_WEEK,
410
            'name'    => _MD_EXTCAL_NAV_AGENDA_WEEK,
411
            'current' => ($view == $currentTab) ? 1 : 0,
412
            'weight'  => 170
413
        ];
414
    }
415
416
    $view = _EXTCAL_NAV_AGENDA_DAY;
417
    if (in_array($view, $visibleTabs)) {
418
        $tNavBar[$view] = [
419
            'href'    => _EXTCAL_FILE_AGENDA_DAY,
420
            'name'    => _MD_EXTCAL_NAV_AGENDA_DAY,
421
            'current' => ($view == $currentTab) ? 1 : 0,
422
            'weight'  => 180
423
        ];
424
    }
425
426
    $view = _EXTCAL_NAV_SEARCH;
427
    if (in_array($view, $visibleTabs)) {
428
        $tNavBar[$view] = [
429
            'href'    => _EXTCAL_FILE_SEARCH,
430
            'name'    => _MD_EXTCAL_NAV_SEARCH,
431
            'current' => ($view == $currentTab) ? 1 : 0,
432
            'weight'  => 200
433
        ];
434
    }
435
436
    $user = isset($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser'] : null;
437
    /** @var Extcal\CategoryHandler $catHandler */
438
    $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
439
    if ($catHandler->haveSubmitRight($user)) {
440
        $view = _EXTCAL_NAV_NEW_EVENT;
441
        if (in_array($view, $visibleTabs)) {
442
            $tNavBar[$view] = [
443
                'href'    => _EXTCAL_FILE_NEW_EVENT,
444
                'name'    => _MD_EXTCAL_NAV_NEW_EVENT,
445
                'current' => ($view == $currentTab) ? 1 : 0,
446
                'weight'  => 100
447
            ];
448
        }
449
    }
450
    //----------------------------------------------------------------
451
    //    $ordre = array();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
452
    //    while (list($k, $v) = each($tNavBar)) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
453
    foreach ($tNavBar as $k => $v) {
454
        if (isset($tWeight[$k])) {
455
            $ordre[] = (int)$tWeight[$k]; //ordre defini dans les option du module
456
        } else {
457
            $ordre[] = $v['weight']; // ordre par defaut ddefini dans le tableau $tNavBar
458
        }
459
    }
460
461
    array_multisort($tNavBar, SORT_ASC, SORT_NUMERIC, $ordre, SORT_ASC, SORT_NUMERIC);
462
463
    //    Extcal\Utility::echoArray($tNavBar);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
464
    //    Extcal\Utility::echoArray($ordre);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
465
    return $tNavBar;
466
}
467
468
/*----------------------------------------------------------------------*/
469