Conditions | 5 |
Paths | 12 |
Total Lines | 47 |
Code Lines | 30 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | function prepareFlightTabs(Bbcvols $flight) |
||
11 | { |
||
12 | global $user, $langs, $conf; |
||
13 | |||
14 | dol_include_once('/flightLog/class/card/Tab.php'); |
||
15 | dol_include_once('/flightLog/class/card/TabCollection.php'); |
||
16 | |||
17 | $tabUrls = [ |
||
18 | DOL_URL_ROOT . '/flightLog/card.php?id=' . $flight->idBBC_vols, |
||
19 | ($user->rights->flightLog->vol->financial || $user->id != $flight->fk_pilot) ? DOL_URL_ROOT . '/flightLog/card_tab_financial.php?id=' . $flight->idBBC_vols : '', |
||
20 | DOL_URL_ROOT . '/flightLog/card_tab_comments.php?id=' . $flight->idBBC_vols, |
||
21 | DOL_URL_ROOT . '/flightLog/card_tab_follow.php?id=' . $flight->idBBC_vols, |
||
22 | ]; |
||
23 | |||
24 | $tabNames = [ |
||
25 | 'general', |
||
26 | 'financial', |
||
27 | 'comments', |
||
28 | 'follow', |
||
29 | ]; |
||
30 | |||
31 | $tabTitle = [ |
||
32 | 'Vol', |
||
33 | 'Finances', |
||
34 | 'Remarques', |
||
35 | 'Suivis', |
||
36 | ]; |
||
37 | |||
38 | $tabCollection = new TabCollection(); |
||
39 | |||
40 | $countUrls = count($tabUrls); |
||
41 | for ($i = 0; $i < $countUrls; $i++) { |
||
42 | if (empty($tabUrls[$i])) { |
||
43 | continue; |
||
44 | } |
||
45 | |||
46 | $tab = new Tab($tabTitle[$i], $tabNames[$i], $tabUrls[$i]); |
||
47 | $tabCollection->addTab($tab); |
||
48 | } |
||
49 | |||
50 | $head = $tabCollection->toArray(); |
||
51 | $tabCount = count($tabCollection); |
||
52 | |||
53 | complete_head_from_modules($conf, $langs, $flight, $head, $tabCount, 'bbcFlight'); |
||
54 | |||
55 | return $head; |
||
56 | } |