dolibarr  17.0.4
hrm.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2020 jean-pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
3  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
4  * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
5  * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
6  * Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
7  * Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
35 {
36  global $langs, $conf, $db;
37 
38  $langs->load("hrm");
39 
40  $extrafields = new ExtraFields($db);
41  $extrafields->fetch_name_optionals_label('hrm_evaluation');
42  $extrafields->fetch_name_optionals_label('hrm_job');
43  $extrafields->fetch_name_optionals_label('hrm_skill');
44 
45  $h = 0;
46  $head = array();
47  $head[$h][0] = DOL_URL_ROOT . "/admin/hrm.php";
48  $head[$h][1] = $langs->trans("Settings");
49  $head[$h][2] = 'settings';
50  $h++;
51 
52  $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
53  $head[$h][1] = $langs->trans("Establishments");
54  $head[$h][2] = 'establishments';
55  $h++;
56 
57  $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php';
58  $head[$h][1] = $langs->trans("SkillsExtraFields");
59  $nbExtrafields = $extrafields->attributes['hrm_skill']['count'];
60  if ($nbExtrafields > 0) {
61  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
62  }
63  $head[$h][2] = 'skillsAttributes';
64  $h++;
65 
66  $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php';
67  $head[$h][1] = $langs->trans("JobsExtraFields");
68  $nbExtrafields = $extrafields->attributes['hrm_job']['count'];
69  if ($nbExtrafields > 0) {
70  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
71  }
72  $head[$h][2] = 'jobsAttributes';
73  $h++;
74 
75  $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php';
76  $head[$h][1] = $langs->trans("EvaluationsExtraFields");
77  $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count'];
78  if ($nbExtrafields > 0) {
79  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
80  }
81  $head[$h][2] = 'evaluationsAttributes';
82  $h++;
83 
84  // Show more tabs from modules
85  // Entries must be declared in modules descriptor with line
86  //$this->tabs = array(
87  // 'entity:+tabname:Title:@workstation:/workstation/mypage.php?id=__ID__'
88  //); // to add new tab
89  //$this->tabs = array(
90  // 'entity:-tabname:Title:@workstation:/workstation/mypage.php?id=__ID__'
91  //); // to remove a tab
92  complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin');
93 
94  complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove');
95 
96  return $head;
97 }
Class to manage standard extra fields.
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).
hrmAdminPrepareHead()
Prepare admin pages header.
Definition: hrm.lib.php:34