dolibarr 19.0.4
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 *
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 */
17
31{
32 global $db, $langs, $conf;
33
34 $langs->load("recruitment");
35
36 $h = 0;
37 $head = array();
38
39 $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_card.php", 1).'?id='.$object->id;
40 $head[$h][1] = $langs->trans("RecruitmentCandidature");
41 $head[$h][2] = 'card';
42 $h++;
43
44 // if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
45 // $head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id;
46 // $head[$h][1] = $langs->trans("Rating");
47 // $head[$h][2] = 'rating';
48 // $h++;
49 // }
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_buildpath('/recruitment/recruitmentcandidature_note.php', 1).'?id='.$object->id;
60 $head[$h][1] = $langs->trans('Notes');
61 if ($nbNote > 0) {
62 $head[$h][1] .= '<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->recruitment->dir_output."/recruitmentcandidature/".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_buildpath("/recruitment/recruitmentcandidature_document.php", 1).'?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_buildpath("/recruitment/recruitmentcandidature_agenda.php", 1).'?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:@recruitment:/recruitment/mypage.php?id=__ID__'
90 //); // to add new tab
91 //$this->tabs = array(
92 // 'entity:-tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
93 //); // to remove a tab
94 complete_head_from_modules($conf, $langs, $object, $head, $h, 'recruitmentcandidature');
95
96 complete_head_from_modules($conf, $langs, $object, $head, $h, 'recruitmentcandidature', 'remove');
97
98 return $head;
99}
dol_dir_list($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:62
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.