dolibarr  13.0.2
salaries.lib.php
1 <?php
28 function salaries_prepare_head($object)
29 {
30  global $db, $langs, $conf;
31 
32  $h = 0;
33  $head = array();
34 
35  $head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id;
36  $head[$h][1] = $langs->trans("SalaryPayment");
37  $head[$h][2] = 'card';
38  $h++;
39 
40  // Show more tabs from modules
41  // Entries must be declared in modules descriptor with line
42  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
43  // $this->tabs = array('entity:-tabname); to remove a tab
44  complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
45 
46  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
47  require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
48  $upload_dir = $conf->salaries->dir_output."/".dol_sanitizeFileName($object->ref);
49  $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
50  $nbLinks = Link::count($db, $object->element, $object->id);
51  $head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id;
52  $head[$h][1] = $langs->trans('Documents');
53  if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
54  $head[$h][2] = 'documents';
55  $h++;
56 
57  $head[$h][0] = DOL_URL_ROOT.'/salaries/info.php?id='.$object->id;
58  $head[$h][1] = $langs->trans("Info");
59  $head[$h][2] = 'info';
60  $h++;
61 
62  complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
63 
64  return $head;
65 }
66 
72 function salaries_admin_prepare_head()
73 {
74  global $langs, $conf, $user;
75 
76  $h = 0;
77  $head = array();
78 
79  $head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries.php';
80  $head[$h][1] = $langs->trans("Miscellaneous");
81  $head[$h][2] = 'general';
82  $h++;
83 
84  // Show more tabs from modules
85  // Entries must be declared in modules descriptor with line
86  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
87  // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
88  complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin');
89 
90  $head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php';
91  $head[$h][1] = $langs->trans("ExtraFieldsSalaries");
92  $head[$h][2] = 'attributes';
93  $h++;
94 
95  complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin', 'remove');
96 
97  return $head;
98 }
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:60
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).