dolibarr 20.0.0
recruitment_recruitmentcandidature.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) ---Put here your own copyright and developer email---
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.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 */
18
32{
33 global $db, $langs, $conf;
34
35 $langs->load("recruitment");
36
37 $h = 0;
38 $head = array();
39
40 $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_card.php?id=' . $object->id;
41 $head[$h][1] = $langs->trans("RecruitmentCandidature");
42 $head[$h][2] = 'card';
43 $h++;
44
45 // if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
46 // $head[$h][0] = DOL_URL_ROOT.'/recruitment/recruitmentrating_card.php?id='.$object->id;
47 // $head[$h][1] = $langs->trans("Rating");
48 // $head[$h][2] = 'rating';
49 // $h++;
50 // }
51
52 if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
53 $nbNote = 0;
54 if (!empty($object->note_private)) {
55 $nbNote++;
56 }
57 if (!empty($object->note_public)) {
58 $nbNote++;
59 }
60 $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_note.php?id=' . $object->id;
61 $head[$h][1] = $langs->trans('Notes');
62 if ($nbNote > 0) {
63 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
64 }
65 $head[$h][2] = 'note';
66 $h++;
67 }
68
69 require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
70 require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
71 $upload_dir = $conf->recruitment->dir_output . "/recruitmentcandidature/" . dol_sanitizeFileName($object->ref);
72 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
73 $nbLinks = Link::count($db, $object->element, $object->id);
74 $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_document.php?id=' . $object->id;
75 $head[$h][1] = $langs->trans('Documents');
76 if (($nbFiles + $nbLinks) > 0) {
77 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
78 }
79 $head[$h][2] = 'document';
80 $h++;
81
82 $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_agenda.php?id=' . $object->id;
83 $head[$h][1] = $langs->trans("Events");
84 $head[$h][2] = 'agenda';
85 $h++;
86
87 // Show more tabs from modules
88 // Entries must be declared in modules descriptor with line
89 //$this->tabs = array(
90 // 'entity:+tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
91 //); // to add new tab
92 //$this->tabs = array(
93 // 'entity:-tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
94 //); // to remove a tab
95 complete_head_from_modules($conf, $langs, $object, $head, $h, 'recruitmentcandidature');
96
97 complete_head_from_modules($conf, $langs, $object, $head, $h, 'recruitmentcandidature', 'remove');
98
99 return $head;
100}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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).
recruitmentCandidaturePrepareHead($object)
Prepare array of tabs for RecruitmentCandidature.