32 global $db, $langs, $conf;
34 $langs->load(
"mymodule@mymodule");
39 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_card.php", 1).
'?id='.$object->id;
40 $head[$h][1] = $langs->trans(
"Card");
41 $head[$h][2] =
'card';
44 if (isset($object->fields[
'note_public']) || isset($object->fields[
'note_private']))
47 if (!empty($object->note_private)) $nbNote++;
48 if (!empty($object->note_public)) $nbNote++;
49 $head[$h][0] =
dol_buildpath(
'/mymodule/myobject_note.php', 1).
'?id='.$object->id;
50 $head[$h][1] = $langs->trans(
'Notes');
51 if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>' :
'');
52 $head[$h][2] =
'note';
56 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
59 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
60 $nbLinks =
Link::count($db, $object->element, $object->id);
61 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_document.php", 1).
'?id='.$object->id;
62 $head[$h][1] = $langs->trans(
'Documents');
63 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
64 $head[$h][2] =
'document';
67 $head[$h][0] =
dol_buildpath(
"/mymodule/myobject_agenda.php", 1).
'?id='.$object->id;
68 $head[$h][1] = $langs->trans(
"Events");
69 $head[$h][2] =
'agenda';
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
myobjectPrepareHead($object)
Prepare array of tabs for MyObject.
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.
static count($db, $objecttype, $objectid)
Return nb of links.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).