1<?php 2/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 3 of the License, or 7 * (at your option) any later version. 8 * 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. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 * or see https://www.gnu.org/ 17 */ 18 19/** 20 * \file htdocs/core/lib/holiday.lib.php 21 * \brief Ensemble de fonctions de base pour les adherents 22 */ 23 24/** 25 * Return array head with list of tabs to view object informations 26 * 27 * @param Object $object Holiday 28 * @return array head 29 */ 30function holiday_prepare_head($object) 31{ 32 global $db, $langs, $conf, $user; 33 34 $h = 0; 35 $head = array(); 36 37 $head[$h][0] = DOL_URL_ROOT.'/holiday/card.php?id='.$object->id; 38 $head[$h][1] = $langs->trans("Leave"); 39 $head[$h][2] = 'card'; 40 $h++; 41 42 // Attachments 43 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; 44 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; 45 $upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); 46 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); 47 $nbLinks = Link::count($db, $object->element, $object->id); 48 $head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id; 49 $head[$h][1] = $langs->trans('Documents'); 50 if (($nbFiles + $nbLinks) > 0) { 51 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; 52 } 53 $head[$h][2] = 'documents'; 54 $h++; 55 56 $head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id; 57 $head[$h][1] = $langs->trans("Info"); 58 $head[$h][2] = 'info'; 59 $h++; 60 61 // Show more tabs from modules 62 // Entries must be declared in modules descriptor with line 63 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab 64 // $this->tabs = array('entity:-tabname); to remove a tab 65 complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday'); 66 67 complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove'); 68 69 return $head; 70} 71 72 73/** 74 * Return array head with list of tabs to view object informations 75 * 76 * @return array head 77 */ 78function holiday_admin_prepare_head() 79{ 80 global $db, $langs, $conf, $user; 81 82 $h = 0; 83 $head = array(); 84 85 $head[$h][0] = DOL_URL_ROOT.'/admin/holiday.php'; 86 $head[$h][1] = $langs->trans("Setup"); 87 $head[$h][2] = 'holiday'; 88 $h++; 89 90 // Show more tabs from modules 91 // Entries must be declared in modules descriptor with line 92 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab 93 // $this->tabs = array('entity:-tabname); to remove a tab 94 complete_head_from_modules($conf, $langs, null, $head, $h, 'holiday_admin'); 95 96 $head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php'; 97 $head[$h][1] = $langs->trans("ExtraFields"); 98 $head[$h][2] = 'attributes'; 99 $h++; 100 101 complete_head_from_modules($conf, $langs, null, $head, $h, 'holiday_admin', 'remove'); 102 103 return $head; 104} 105