32 global $db, $langs, $conf;
34 $langs->load(
"mymodule@mymodule");
36 $showtabofpagecontact = 1;
37 $showtabofpagenote = 1;
38 $showtabofpagedocument = 1;
39 $showtabofpageagenda = 1;
44 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_card.php", 1).
'?id='.$object->id;
45 $head[$h][1] = $langs->trans(
"Card");
46 $head[$h][2] =
'card';
49 if ($showtabofpagecontact) {
50 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_contact.php", 1).
'?id='.$object->id;
51 $head[$h][1] = $langs->trans(
"Contacts");
52 $head[$h][2] =
'contact';
56 if ($showtabofpagenote) {
57 if (isset($object->fields[
'note_public']) || isset($object->fields[
'note_private'])) {
59 if (!empty($object->note_private)) {
62 if (!empty($object->note_public)) {
65 $head[$h][0] =
dol_buildpath(
'/mymodule/myobject_note.php', 1).
'?id='.$object->id;
66 $head[$h][1] = $langs->trans(
'Notes');
68 $head[$h][1] .= (!
getDolGlobalInt(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>' :
'');
70 $head[$h][2] =
'note';
75 if ($showtabofpagedocument) {
76 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
77 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
79 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
80 $nbLinks =
Link::count($db, $object->element, $object->id);
81 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_document.php", 1).
'?id='.$object->id;
82 $head[$h][1] = $langs->trans(
'Documents');
83 if (($nbFiles + $nbLinks) > 0) {
84 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
86 $head[$h][2] =
'document';
90 if ($showtabofpageagenda) {
91 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_agenda.php", 1).
'?id='.$object->id;
92 $head[$h][1] = $langs->trans(
"Events");
93 $head[$h][2] =
'agenda';
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.
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).