dolibarr 24.0.0-beta
mymodule.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) ---Replace with your own copyright and developer email---
3 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
31{
32 global $langs, $conf;
33
34 // global $db;
35 // $extrafields = new ExtraFields($db);
36 // $extrafields->fetch_name_optionals_label('myobject');
37
38 $langs->load("mymodule@mymodule");
39
40 $h = 0;
41 $head = array();
42
43 $head[$h][0] = dolBuildUrl(dol_buildpath("/mymodule/admin/setup.php", 1));
44 $head[$h][1] = $langs->trans("Settings");
45 $head[$h][2] = 'settings';
46 $h++;
47
48 /*
49 $head[$h][0] = dolBuildUrl(dol_buildpath("/mymodule/admin/myobject_extrafields.php", 1));
50 $head[$h][1] = $langs->trans("ExtraFields");
51 $nbExtrafields = (isset($extrafields->attributes['myobject']['label']) && is_countable($extrafields->attributes['myobject']['label'])) ? count($extrafields->attributes['myobject']['label']) : 0;
52 if ($nbExtrafields > 0) {
53 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
54 }
55 $head[$h][2] = 'myobject_extrafields';
56 $h++;
57
58 $head[$h][0] = dolBuildUrl(dol_buildpath("/mymodule/admin/myobjectline_extrafields.php", 1));
59 $head[$h][1] = $langs->trans("ExtraFieldsLines");
60 $nbExtrafields = (isset($extrafields->attributes['myobjectline']['label']) && is_countable($extrafields->attributes['myobjectline']['label'])) ? count($extrafields->attributes['myobject']['label']) : 0;
61 if ($nbExtrafields > 0) {
62 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
63 }
64 $head[$h][2] = 'myobject_extrafieldsline';
65 $h++;
66 */
67
68 $head[$h][0] = dolBuildUrl(dol_buildpath("/mymodule/admin/about.php", 1));
69 $head[$h][1] = $langs->trans("About");
70 $head[$h][2] = 'about';
71 $h++;
72
73 // Show more tabs from modules
74 // Entries must be declared in modules descriptor with line
75 //$this->tabs = array(
76 // 'entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
77 //); // to add new tab
78 //$this->tabs = array(
79 // 'entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
80 //); // to remove a tab
81 complete_head_from_modules($conf, $langs, null, $head, $h, 'mymodule@mymodule');
82
83 complete_head_from_modules($conf, $langs, null, $head, $h, 'mymodule@mymodule', 'remove');
84
85 return $head;
86}
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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).
mymoduleAdminPrepareHead()
Prepare admin pages header.