dolibarr 24.0.0-beta
bookcal_availabilities.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2022 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 $db, $langs, $conf;
35
36 $langs->load("agenda");
37
38 $h = 0;
39 $head = array();
40
41 $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_card.php?id=' . $object->id;
42 $head[$h][1] = $langs->trans("Card");
43 $head[$h][2] = 'card';
44 $h++;
45
46 // $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_contact.php?id=' . $object->id;
47 // $head[$h][1] = $langs->trans("Contacts");
48 // $head[$h][2] = 'contact';
49 // $h++;
50
51 if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
52 $nbNote = 0;
53 if (!empty($object->note_private)) {
54 $nbNote++;
55 }
56 if (!empty($object->note_public)) {
57 $nbNote++;
58 }
59 $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_note.php?id=' . $object->id;
60 $head[$h][1] = $langs->trans('Notes');
61 if ($nbNote > 0) {
62 $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' : '');
63 }
64 $head[$h][2] = 'note';
65 $h++;
66 }
67
68 // require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
69 // require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
70 // $upload_dir = $conf->bookcal->dir_output . "/availabilities/" . dol_sanitizeFileName($object->ref);
71 // $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
72 // $nbLinks = Link::count($db, $object->element, $object->id);
73 // $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_document.php?id=' . $object->id;
74 // $head[$h][1] = $langs->trans('Documents');
75 // if (($nbFiles + $nbLinks) > 0) {
76 // $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
77 // }
78 // $head[$h][2] = 'document';
79 // $h++;
80
81 // $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_agenda.php?id=' . $object->id;
82 // $head[$h][1] = $langs->trans("Events");
83 // $head[$h][2] = 'agenda';
84 // $h++;
85
86 // Show more tabs from modules
87 // Entries must be declared in modules descriptor with line
88 //$this->tabs = array(
89 // 'entity:+tabname:Title:@bookcal:/bookcal/mypage.php?id=__ID__'
90 //); // to add new tab
91 //$this->tabs = array(
92 // 'entity:-tabname:Title:@bookcal:/bookcal/mypage.php?id=__ID__'
93 //); // to remove a tab
94 complete_head_from_modules($conf, $langs, $object, $head, $h, 'availabilities@bookcal');
95
96 complete_head_from_modules($conf, $langs, $object, $head, $h, 'availabilities@bookcal', 'remove');
97
98 return $head;
99}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
availabilitiesPrepareHead($object)
Prepare array of tabs for Availabilities.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.