dolibarr  7.0.0-beta
salaries.lib.php
1 <?php
27 function salaries_prepare_head($object) {
28 
29  global $db, $langs, $conf;
30 
31  $h = 0;
32  $head = array();
33 
34  $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id;
35  $head[$h][1] = $langs->trans("Card");
36  $head[$h][2] = 'card';
37  $h++;
38 
39  // Show more tabs from modules
40  // Entries must be declared in modules descriptor with line
41  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
42  // $this->tabs = array('entity:-tabname); to remove a tab
43  complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries');
44 
45  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
46  require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
47  $upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
48  $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
49  $nbLinks=Link::count($db, $object->element, $object->id);
50  $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id;
51  $head[$h][1] = $langs->trans('Documents');
52  if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
53  $head[$h][2] = 'documents';
54  $h++;
55 
56  $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
57  $head[$h][1] = $langs->trans("Info");
58  $head[$h][2] = 'info';
59  $h++;
60 
61  complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove');
62 
63  return $head;
64 }
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
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="")
Scan a directory and return a list of files/directories.
Definition: files.lib.php:58