dolibarr 24.0.0-beta
titles.php
1<?php
2/*
3 * Copyright (C) 2024-2025 Anthony Damhet <a.damhet@progiseize.fr>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20// Load Dolibarr environment
21require '../../../../main.inc.php';
22
30// Protection if external user
31if ($user->socid > 0) {
33}
34
35// Includes
36require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
37require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
38
39// Load documentation translations
40$langs->load('uxdocumentation');
41
42// Hooks
43$hookmanager->initHooks(array('uidocumentation'));
44
45//
46$documentation = new Documentation($db);
47$form = new Form($db);
48
49$morejs = [
50 '/includes/ace/src/ace.js',
51 '/includes/ace/src/ext-statusbar.js',
52 '/includes/ace/src/ext-language_tools.js',
53];
54// Output html head + body - Param is Title
55$documentation->docHeader('Titles', $morejs);
56
57// Set view for menu and breadcrumb
58// Menu must be set in constructor of documentation class
59$documentation->view = array('Content','Titles');
60
61// Output sidebar
62$documentation->showSidebar(); ?>
63
64<div class="doc-wrapper">
65
66 <?php $documentation->showBreadCrumb(); ?>
67
68 <div class="doc-content-wrapper">
69
70 <h1 class="documentation-title"><?php echo $langs->trans('DocTitleTitle'); ?></h1>
71 <p class="documentation-text"><?php echo $langs->trans('DocTitleMainDescription'); ?></p>
72
73 <!-- Summary -->
74 <?php $documentation->showSummary(); ?>
75
76 <!-- Basic usage -->
77 <div class="documentation-section" id="titlesection-basicusage">
78
79 <h2 class="documentation-title"><?php echo $langs->trans('DocBasicUsage'); ?></h2>
80
81 <p class="documentation-text"><?php echo $langs->transnoentities('DocTitleBasicDescription'); ?></p>
82 <ul>
83 <li><?php echo $langs->trans('DocTitleIconUsageMethod1', dol_buildpath('/admin/tools/ui/components/icons.php#img-picto-section-list', 1)); ?></li>
84 <li><?php echo $langs->trans('DocTitleIconUsageMethod2', dol_buildpath('/admin/tools/ui/components/icons.php#icon-section-list', 1)); ?></li>
85 <li><?php echo $langs->trans('DocTitleIconUsageMethod3'); ?></li>
86 </ul>
87 <div class="documentation-example">
88 <?php print load_fiche_titre($langs->trans('DocMyPageTitle'), '', 'info'); ?>
89 </div>
90 <?php
91 $lines = array(
92 '<?php',
93 '',
94 '// Title with icon, see list of icons in components/icons section',
95 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", "", "info");',
96 '',
97 '// Title with fontawesome icon, see list of icons in components/icons section',
98 '// use like this: ICONCLASS_FAMILYCLASS_COLOR',
99 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", "", "fa-rocket_fas_#b0bb39");',
100 '',
101 '// Title with custom image icon, 4th parameter must be 1',
102 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", "", "IMAGE_URL", 1);',
103 );
104 $documentation->showCode($lines, 'php'); ?>
105
106 <p class="documentation-text"><?php echo $langs->trans('DocTitleMoreContentDescription'); ?></p>
107 <div class="documentation-example">
108 <?php print load_fiche_titre($langs->trans('DocMyPageTitle'), '<a href="#">'.img_picto('', 'add', '', 0, 0, 0, '', 'valignmiddle btnTitle-icon').'</a>', 'fa-rocket_fas_#b0bb39'); ?>
109 </div>
110 <?php
111 $lines = array(
112 '<?php',
113 '',
114 '// Title with picto link',
115 '$moreHtmlRight = \'<a href="#">\'.img_picto("", "add").\'</a>\';',
116 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", $moreHtmlRight, "fa-rocket_fas_#b0bb39");',
117 '',
118 '// Title with badge',
119 '$moreHtmlRight = \'<span class="badge badge-pill badge-secondary">Secondary</span>\';',
120 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", $moreHtmlRight, "fa-rocket_fas_#b0bb39");',
121
122 '',
123 '// Title with form',
124 '$moreHtmlRight = \'<form>...</form>\';',
125 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", $moreHtmlRight, "fa-rocket_fas_#b0bb39");',
126 '',
127 '// Set ID for table and css class',
128 '$tableID = \'tableid\';',
129 '$moreclass = \'class1 class2\';',
130 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", $moreHtmlRight, "fa-rocket_fas_#b0bb39", 0, $tableID, $moreclass);',
131 '',
132 '// Add html between title and right content',
133 '$moreContent = \'MyHTMLContent\';',
134 'print load_fiche_titre("'.$langs->trans('DocMyPageTitle').'", $moreHtmlRight, "fa-rocket_fas_#b0bb39", 0, $tableID, $moreclass, $moreContent);',
135 );
136 $documentation->showCode($lines, 'php'); ?>
137 </div>
138
139 <!-- Table with filters -->
140 <div class="documentation-section" id="titlesection-withfilters">
141
142 <h2 class="documentation-title"><?php echo $langs->trans('DocTitleWithFilters'); ?></h2>
143
144 <p class="documentation-text"><?php echo $langs->trans('DocTitleWithFiltersDescription', dol_buildpath('admin/tools/ui/components/inputs.php', 1)); ?></p>
145 <div class="documentation-example">
146 <?php
147 $title = $langs->trans('DocMyPageTitle');
148 $page = 1;
149 $file = '#';
150 $options = '';
151 $sortfield = '';
152 $sortorder = '';
153 $morehtmlcenter = '';
154 $num = 21;
155 $totalnboflines = 56;
156 $picto = 'facture';
157 $pictoisfullpath = 0;
158 $morehtmlright = dolGetButtonTitle($langs->trans('ViewList'), '', 'fas fa-bars', '#', '', 1);
159 $morehtmlright .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fas fa-grip-horizontal', '#', '', 1);
160 $morehtmlright .= '<span class="button-title-separator"></span>';
161 $morehtmlright .= '<a href="#">'.img_picto('', 'add', '', 0, 0, 0, '', 'valignmiddle btnTitle-icon').'</a>';
162 $morecss = '';
163 $limit = 20;
164 $selectlimitsuffix = 0;
165 $hidenavigation = 0;
166 $pagenavastextinput = 1;
167 $morehtmlrightbeforearrow = '';
168 print_barre_liste($title, $page, $file, $options, $sortfield, $sortorder, $morehtmlcenter, $num, $totalnboflines, $picto, $pictoisfullpath, $morehtmlright, $morecss, $limit, $selectlimitsuffix, $hidenavigation, $pagenavastextinput, $morehtmlrightbeforearrow); ?>
169 </div>
170 <?php
171 $lines = array(
172 '<?php',
173 '',
174 '
196',
197 'print_barre_liste($title, $page, $file, $options, $sortfield, $sortorder, $morehtmlcenter, $num, $totalnboflines, $picto, $pictoisfullpath, $morehtmlright, $morecss, $limit, $selectlimitsuffix, $hidenavigation, $pagenavastextinput, $morehtmlrightbeforearrow);',
198 );
199 $documentation->showCode($lines, 'php'); ?>
200 </div>
201
202 </div>
203
204 </div>
205
206<?php
207// Output close body + html
208$documentation->docFooter();
209?>
Class to manage UI documentation.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.