dolibarr 23.0.3
documentation_page.php
1<?php
2/*
3 * Copyright (C) 2024 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';
37
38// Load documentation translations
39$langs->load('uxdocumentation');
40
41// Hooks
42$hookmanager->initHooks(array('uidocumentation'));
43
44//
45$documentation = new Documentation($db);
46
47// Add more js
48$morejs = [
49 '/includes/ace/src/ace.js',
50 '/includes/ace/src/ext-statusbar.js',
51 '/includes/ace/src/ext-language_tools.js',
52];
53// Output html head + body - First param is title
54$documentation->docHeader('DocMyPageTitle', $morejs);
55
56// Set view for menu and breadcrumb
57// Menu must be set in constructor of documentation class
58$documentation->view = array('MyPageKey1', 'MyPageKey2');
59
60// Output sidebar
61$documentation->showSidebar(); ?>
62
63<div class="doc-wrapper">
64
65 <?php $documentation->showBreadCrumb(); ?>
66
67 <div class="doc-content-wrapper">
68
69 <h1 class="documentation-title"><?php print $langs->trans('DocMyPageTitle'); ?></h1>
70 <p class="documentation-text"><?php print $langs->trans('DocMyPageDescription'); ?></p>
71
72 <!-- Summary -->
73 <?php $documentation->showSummary(); ?>
74
75 <!-- Section 1 -->
76 <div class="documentation-section" id="my-section-name">
77
78 <h2 class="documentation-title"><?php print $langs->trans('DocMySectionTitle'); ?></h2>
79 <p class="documentation-text"><?php print $langs->trans('DocMySectionText'); ?></p>
80
81 <div class="documentation-example">
82 <div class="div-table-responsive">
83 <p><?php print $langs->trans('DocMySectionExample'); ?></p>
84 </div>
85 </div>
86 <?php
87 $lines = array(
88 '<div class="div-table-responsive">',
89 ' <p>Here you can put an example of your component</p>',
90 '</div>',
91 );
92 print $documentation->showCode($lines, 'html'); ?>
93
94 <p class="documentation-text"><?php print $langs->trans('DocMySectionText2'); ?></p>
95 </div>
96
97 <!-- Section 2-->
98 <div class="documentation-section" id="my-section2-name">
99
100 <h2 class="documentation-title"><?php print $langs->trans('DocMySectionTitle'); ?></h2>
101 <p class="documentation-text"><?php print $langs->trans('DocMySectionText'); ?></p>
102
103 <!-- Display messages -->
104 <div class="warning"><?php print $langs->trans('DocExampleWarning'); ?></div>
105 <div class="info"><?php print $langs->trans('DocExampleInfo'); ?></div>
106 <div class="error"><?php print $langs->trans('DocExampleError'); ?></div>
107 <div class="green"><?php print $langs->trans('DocExampleGreen'); ?></div>
108 </div>
109
110 </div>
111</div>
112
113<?php
114// Output close body + html
115$documentation->docFooter();
116?>
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.