dolibarr 21.0.0-alpha
holiday.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 * or see https://www.gnu.org/
18 */
19
32{
33 global $db, $langs, $conf, $user;
34
35 $h = 0;
36 $head = array();
37
38 $head[$h][0] = DOL_URL_ROOT.'/holiday/card.php?id='.$object->id;
39 $head[$h][1] = $langs->trans("Leave");
40 $head[$h][2] = 'card';
41 $h++;
42
43 // Attachments
44 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
45 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
46 $upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
47 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
48 $nbLinks = Link::count($db, $object->element, $object->id);
49 $head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
50 $head[$h][1] = $langs->trans('Documents');
51 if (($nbFiles + $nbLinks) > 0) {
52 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
53 }
54 $head[$h][2] = 'documents';
55 $h++;
56
57 complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'core');
58
59 $head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id;
60 $head[$h][1] = $langs->trans("Info");
61 $head[$h][2] = 'info';
62 $h++;
63
64 // Show more tabs from modules
65 // Entries must be declared in modules descriptor with line
66 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
67 // $this->tabs = array('entity:-tabname); to remove a tab
68 complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'external');
69
70 complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove');
71
72 return $head;
73}
74
75
82{
83 global $db, $langs, $conf, $user;
84
85 $extrafields = new ExtraFields($db);
86 $extrafields->fetch_name_optionals_label('holiday');
87
88 $h = 0;
89 $head = array();
90
91 $head[$h][0] = DOL_URL_ROOT.'/admin/holiday.php';
92 $head[$h][1] = $langs->trans("Setup");
93 $head[$h][2] = 'holiday';
94 $h++;
95
96 // Show more tabs from modules
97 // Entries must be declared in modules descriptor with line
98 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
99 // $this->tabs = array('entity:-tabname); to remove a tab
100 complete_head_from_modules($conf, $langs, null, $head, $h, 'holiday_admin');
101
102 $head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php';
103 $head[$h][1] = $langs->trans("ExtraFields");
104 $nbExtrafields = $extrafields->attributes['holiday']['count'];
105 if ($nbExtrafields > 0) {
106 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
107 }
108 $head[$h][2] = 'attributes';
109 $h++;
110
111 complete_head_from_modules($conf, $langs, null, $head, $h, 'holiday_admin', 'remove');
112
113 return $head;
114}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to manage standard extra fields.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:63
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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).
holiday_prepare_head($object)
Return array head with list of tabs to view object information.
holiday_admin_prepare_head()
Return array head with list of tabs to view object information.