dolibarr 24.0.0-beta
bookcal_calendar.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Alice Adminson <aadminson@example.com>
3 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
33{
34 global $langs, $conf;
35
36 $langs->load("agenda");
37
38 $h = 0;
39 $head = array();
40
41 $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_card.php?id=' . $object->id;
42 $head[$h][1] = $langs->trans("Calendar");
43 $head[$h][2] = 'card';
44 $h++;
45
46 //if ($object->status == Calendar::STATUS_VALIDATED) {
47 $head[$h][0] = DOL_URL_ROOT . '/bookcal/booking_list.php?id=' . $object->id;
48 $head[$h][1] = $langs->trans("Bookings");
49 $head[$h][2] = 'booking';
50 $h++;
51 //}
52
53 // $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_contact.php?id=' . $object->id;
54 // $head[$h][1] = $langs->trans("Contacts");
55 // $head[$h][2] = 'contact';
56 // $h++;
57
58 if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
59 $nbNote = 0;
60 if (!empty($object->note_private)) {
61 $nbNote++;
62 }
63 if (!empty($object->note_public)) {
64 $nbNote++;
65 }
66 $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_note.php?id=' . $object->id;
67 $head[$h][1] = $langs->trans('Notes');
68 if ($nbNote > 0) {
69 $head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' : '');
70 }
71 $head[$h][2] = 'note';
72 $h++;
73 }
74
75 // require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
76 // require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
77 // $upload_dir = $conf->bookcal->dir_output . "/calendar/" . dol_sanitizeFileName($object->ref);
78 // $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
79 // $nbLinks = Link::count($db, $object->element, $object->id);
80 // $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_document.php?id=' . $object->id;
81 // $head[$h][1] = $langs->trans('Documents');
82 // if (($nbFiles + $nbLinks) > 0) {
83 // $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
84 // }
85 // $head[$h][2] = 'document';
86 // $h++;
87
88 $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_agenda.php?id=' . $object->id;
89 $head[$h][1] = $langs->trans("Events");
90 $head[$h][2] = 'agenda';
91 $h++;
92
93 // Show more tabs from modules
94 // Entries must be declared in modules descriptor with line
95 //$this->tabs = array(
96 // 'entity:+tabname:Title:@bookcal:/bookcal/mypage.php?id=__ID__'
97 //); // to add new tab
98 //$this->tabs = array(
99 // 'entity:-tabname:Title:@bookcal:/bookcal/mypage.php?id=__ID__'
100 //); // to remove a tab
101 complete_head_from_modules($conf, $langs, $object, $head, $h, 'calendar@bookcal');
102
103 complete_head_from_modules($conf, $langs, $object, $head, $h, 'calendar@bookcal', 'remove');
104
105 return $head;
106}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
calendarPrepareHead($object)
Prepare array of tabs for Calendar.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).