dolibarr  17.0.4
salaries.lib.php
1 <?php
29 function salaries_prepare_head($object)
30 {
31  global $db, $langs, $conf;
32 
33  $h = 0;
34  $head = array();
35 
36  $head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id;
37  $head[$h][1] = $langs->trans("Salary");
38  $head[$h][2] = 'card';
39  $h++;
40 
41  // Show more tabs from modules
42  // Entries must be declared in modules descriptor with line
43  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
44  // $this->tabs = array('entity:-tabname); to remove a tab
45  complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'add', 'core');
46 
47  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
48  require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
49  $upload_dir = $conf->salaries->dir_output."/".dol_sanitizeFileName($object->ref);
50  $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
51  $nbLinks = Link::count($db, $object->element, $object->id);
52  $head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id;
53  $head[$h][1] = $langs->trans('Documents');
54  if (($nbFiles + $nbLinks) > 0) {
55  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
56  }
57  $head[$h][2] = 'documents';
58  $h++;
59 
60  $head[$h][0] = DOL_URL_ROOT.'/salaries/info.php?id='.$object->id;
61  $head[$h][1] = $langs->trans("Info");
62  $head[$h][2] = 'info';
63  $h++;
64 
65  complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'add', 'external');
66 
67  complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
68 
69  return $head;
70 }
71 
77 function salaries_admin_prepare_head()
78 {
79  global $langs, $conf, $user;
80 
81  $h = 0;
82  $head = array();
83 
84  $head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries.php';
85  $head[$h][1] = $langs->trans("Miscellaneous");
86  $head[$h][2] = 'general';
87  $h++;
88 
89  // Show more tabs from modules
90  // Entries must be declared in modules descriptor with line
91  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
92  // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
93  complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin');
94 
95  $head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php';
96  $head[$h][1] = $langs->trans("ExtraFieldsSalaries");
97  $head[$h][2] = 'attributes';
98  $h++;
99 
100  complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin', 'remove');
101 
102  return $head;
103 }
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:61
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).