21require
'../../../../main.inc.php';
31if ($user->socid > 0) {
36require_once DOL_DOCUMENT_ROOT .
'/admin/tools/ui/class/documentation.class.php';
39$langs->load(
'uxdocumentation');
45 '/includes/ace/src/ace.js',
46 '/includes/ace/src/ext-statusbar.js',
47 '/includes/ace/src/ext-language_tools.js',
50$documentation->docHeader(
'Contributing', $morejs);
54$documentation->view = array(
'Resources',
'Contributing');
57$documentation->showSidebar(); ?>
59<div
class=
"doc-wrapper">
61 <?php $documentation->showBreadCrumb(); ?>
63 <div
class=
"doc-content-wrapper">
65 <h1
class=
"documentation-title"><?php echo $langs->trans(
'DocHowContribute'); ?></h1>
66 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocHowContributeDescription'); ?></p>
69 <?php $documentation->showSummary(); ?>
72 <div
class=
"documentation-section" id=
"contributesection-step1">
73 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocContributeStep1'); ?></h2>
74 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocContributeStep1Description'); ?></p>
80 ' * Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>',
81 ' * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>',
83 ' * This program is free software; you can redistribute it and/or modify',
84 ' * it under the terms of the GNU General Public License as published by',
85 ' * the Free Software Foundation; either version 3 of the License, or',
86 ' * (at your option) any later version.',
88 ' * This program is distributed in the hope that it will be useful,',
89 ' * but WITHOUT ANY WARRANTY; without even the implied warranty of',
90 ' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the',
91 ' * GNU General Public License for more details.',
93 ' * You should have received a copy of the GNU General Public License',
94 ' * along with this program. If not, see <https://www.gnu.org/licenses/>.',
97 '// Load Dolibarr environment',
98 'require \'../../../../main.inc.php\';',
107 '// Protection if external user',
108 'if ($user->socid > 0) {',
109 ' accessforbidden();',
113 'require_once DOL_DOCUMENT_ROOT . \'/admin/tools/ui/class/documentation.class.php\';',
115 '// Load documentation translations',
116 '$langs->load(\'uxdocumentation\');',
119 '$hookmanager->initHooks(array(\'uidocumentation\'));',
122 '$documentation = new Documentation($db);',
126 ' \'/includes/ace/src/ace.js\',',
127 ' \'/includes/ace/src/ext-statusbar.js\',',
128 ' \'/includes/ace/src/ext-language_tools.js\',',
130 '// Output html head + body - First param is title',
131 '$documentation->docHeader(\'DocMyPageTitle\', $morejs);',
133 '// Set view for menu and breadcrumb',
134 '// Menu must be set in constructor of documentation class',
135 '$documentation->view = array(\'MyPageKey1\', \'MyPageKey2\');',
138 '$documentation->showSidebar(); ?>',
140 '<div class="doc-wrapper">',
142 ' <?php $documentation->showBreadCrumb(); ?>',
143 ' <div class="doc-content-wrapper">',
145 ' <h1 class="documentation-title"><?php print $langs->trans(\'DocMyPageTitle\'); ?></h1>',
146 ' <p class="documentation-text"><?php print $langs->trans(\'DocMyPageDescription\'); ?></p>',
149 ' <?php $documentation->showSummary(); ?>',
151 ' <!-- Section 1 -->',
152 ' <div class="documentation-section" id="my-section-name">',
154 ' <h2 class="documentation-title"><?php print $langs->trans(\'DocMySectionTitle\'); ?></h2>',
155 ' <p class="documentation-text"><?php print $langs->trans(\'DocMySectionText\'); ?></p>',
157 ' <div class="documentation-example">',
158 ' <div class="div-table-responsive">',
159 ' <p><?php print $langs->trans(\'DocMySectionExample\'); ?></p>',
164 ' \'<div class="div-table-responsive">\',',
165 ' \' <p>Here you can put an example of your component</p>\',',
168 ' print $documentation->showCode($lines, \'html\'); ?>',
170 ' <p class="documentation-text"><?php print $langs->trans(\'DocMySectionText2\'); ?></p>',
173 ' <!-- Section 2-->',
174 ' <div class="documentation-section" id="my-section2-name">',
176 ' <h2 class="documentation-title"><?php print $langs->trans(\'DocMySectionTitle\'); ?></h2>',
177 ' <p class="documentation-text"><?php print $langs->trans(\'DocMySectionText\'); ?></p>',
179 ' <!-- Display messages -->',
180 ' <div class="warning"><?php print $langs->trans(\'DocExampleWarning\'); ?></div>',
181 ' <div class="info"><?php print $langs->trans(\'DocExampleInfo\'); ?></div>',
182 ' <div class="error"><?php print $langs->trans(\'DocExampleError\'); ?></div>',
183 ' <div class="green"><?php print $langs->trans(\'DocExampleGreen\'); ?></div>',
190 '// Output close body + html',
191 '$documentation->docFooter();',
194 $documentation->showCode($lines,
'php'); ?>
198 <div
class=
"documentation-section" id=
"contributesection-step2">
200 <h2
class=
"documentation-title"><?php print $langs->trans(
'DocContributeStep2'); ?></h2>
201 <p
class=
"documentation-text"><?php print $langs->trans(
'DocContributeStep2Description'); ?></p>
202 <p
class=
"documentation-text"><?php print $langs->trans(
'DocContributeAddMenuEntry'); ?></p>
207 '// in SetMenu() function, search "Components" and fill submenu',
210 '$this->menu[\'Components\'] = array(',
213 ' \'submenu\' => array(',
215 ' // Others menu entries ...',
217 ' // My new menu entry',
218 ' \'MyComponent\' => array(',
219 ' // Url to my documentation page',
220 ' \'url\' => dol_buildpath($this->baseUrl.\'/components/mycomponenturl.php\', 1),',
221 ' // My component icon, use fontawesome class',
222 ' \'icon\' => \'fas fa-mouse\', // use fontawesome class here',
223 ' // You can add another submenu into this array',
224 ' \'submenu\' => array(),',
225 ' // Here is for build summary (LangKeySection => nameOfYourDiv)',
226 ' \'summary\' => array(',
227 ' \'MyLangKey1\' => \'#my-component-section1-div\',',
228 ' \'MyLangKey2\' => \'#my-component-section2-div\',',
234 $documentation->showCode($lines,
'php'); ?>
238 <div
class=
"documentation-section" id=
"contributesection-step3">
240 <h2
class=
"documentation-title"><?php print $langs->trans(
'DocContributeStep3'); ?></h2>
241 <p
class=
"documentation-text"><?php print $langs->trans(
'DocContributeStep3Description'); ?></p>
247 '// Set view for menu and breadcrumb',
248 '$documentation->view = array(\'Components\', \'MyComponent\');',
250 $documentation->showCode($lines,
'php'); ?>
259$documentation->docFooter();
Class to manage UI documentation.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.