dolibarr 21.0.0-beta
progress-bars.php
1<?php
2/*
3 * Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
4 *
5 * This program and files/directory inner it is free software: you can
6 * redistribute it and/or modify it under the terms of the
7 * GNU Affero General Public License (AGPL) 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 AGPL for more details.
15 *
16 * You should have received a copy of the GNU AGPL
17 * along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
18 */
19
20$res=0;
21if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
22endif;
23if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
24endif;
25if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
26endif;
27
28// Protection if external user
29if ($user->socid > 0) : accessforbidden();
30endif;
31
32// Includes
33dol_include_once('admin/tools/ui/class/documentation.class.php');
34
35// Load documentation translations
36$langs->load('uxdocumentation');
37
38//
39$documentation = new Documentation($db);
40
41// Output html head + body - Param is Title
42$documentation->docHeader('Progress-bars');
43
44// Set view for menu and breadcrumb
45// Menu must be set in constructor of documentation class
46$documentation->view = array('Components','Progress');
47
48// Output sidebar
49$documentation->showSidebar(); ?>
50
51<div class="doc-wrapper">
52
53 <?php $documentation->showBreadCrumb(); ?>
54
55 <div class="doc-content-wrapper">
56
57 <h1 class="documentation-title"><?php echo $langs->trans('DocProgressBarsTitle'); ?></h1>
58 <p class="documentation-text"><?php echo $langs->trans('DocProgressBarsMainDescription'); ?></p>
59
60 <!-- Summary -->
61 <?php $documentation->showSummary(); ?>
62
63 <!-- Basic usage -->
64 <div class="documentation-section" id="progresse-section-basic-usage">
65 <h2 class="documentation-title"><?php echo $langs->trans('DocBasicUsage'); ?></h2>
66 <p class="documentation-text"><?php echo $langs->trans('DocProgressBarsDescription'); ?></p>
67 <div class="documentation-example">
68
69 <?php echo 'Xss'; ?>
70 <div class="progress xxs spaced" title="10%">
71 <div class="progress-bar" role="progressbar" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
72 </div>
73
74 <?php echo 'Xs'; ?>
75 <div class="progress xs spaced" title="20%">
76 <div class="progress-bar" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
77 </div>
78
79 <?php echo 'Sm'; ?>
80 <div class="progress sm spaced" title="40%">
81 <div class="progress-bar" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
82 </div>
83
84 <?php echo $langs->trans('Default'); ?>
85 <div class="progress" title="80%">
86 <div class="progress-bar" role="progressbar" style="width: 80%" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"></div>
87 </div>
88 </div>
89
90 <?php
91 $lines = array(
92 '<div class="progress xxs" title="10%">',
93 ' <div class="progress-bar" role="progressbar" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>',
94 '</div>',
95 '',
96 '<div class="progress xs" title="20%">',
97 ' <div class="progress-bar" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>',
98 '</div>',
99 '',
100 '<div class="progress sm" title="40%">',
101 ' <div class="progress-bar" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
102 '</div>',
103 '',
104 '<div class="progress" title="80%">',
105 ' <div class="progress-bar" role="progressbar" style="width: 80%" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"></div>',
106 '</div>',
107 );
108 echo $documentation->showCode($lines); ?>
109
110 <p class="documentation-text"><?php echo $langs->trans('DocProgressCanBeSpaced'); ?></p>
111 <div class="documentation-example">
112 <div class="progress spaced" title="40%">
113 <div class="progress-bar" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
114 </div>
115 </div>
116
117 <?php
118 $lines = array(
119 '<div class="progress spaced" title="40%">',
120 ' <div class="progress-bar" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
121 '</div>',
122 );
123 echo $documentation->showCode($lines); ?>
124
125 </div>
126
127
128 <!-- Colors usage -->
129 <div class="documentation-section" id="progress-section-color">
130 <h2 class="documentation-title"><?php echo $langs->trans('DocColorVariants'); ?></h2>
131 <p class="documentation-text"><?php echo $langs->trans('DocColorVariantsDesc'); ?></p>
132 <div class="documentation-example">
133 <div class="progress spaced" title="40%">
134 <div class="progress-bar progress-bar-success" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
135 </div>
136 <div class="progress spaced" title="40%">
137 <div class="progress-bar progress-bar-warning" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
138 </div>
139 <div class="progress spaced" title="40%">
140 <div class="progress-bar progress-bar-info" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
141 </div>
142 <div class="progress spaced" title="40%">
143 <div class="progress-bar progress-bar-danger" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
144 </div>
145 </div>
146
147 <?php
148 $lines = array(
149 '<div class="progress" title="40%">',
150 ' <div class="progress-bar progress-bar-success" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
151 '</div>',
152 '',
153 '<div class="progress" title="40%">',
154 ' <div class="progress-bar progress-bar-warning" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
155 '</div>',
156 '',
157 '<div class="progress" title="40%">',
158 ' <div class="progress-bar progress-bar-info" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
159 '</div>',
160 '',
161 '<div class="progress" title="40%">',
162 ' <div class="progress-bar progress-bar-danger" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
163 '</div>',
164 '',
165
166 );
167 echo $documentation->showCode($lines); ?>
168 </div>
169
170
171 <!-- Striped usage -->
172 <div class="documentation-section" id="progresse-section-stripped">
173 <h2 class="documentation-title"><?php echo $langs->trans('DocStripedVariants'); ?></h2>
174 <p class="documentation-text"><?php echo $langs->trans('DocStripedVariantsDesc'); ?></p>
175
176 <div class="documentation-example">
177 <div class="progress spaced progress-striped" title="40%">
178 <div class="progress-bar progress-bar-success" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
179 </div>
180 <div class="progress spaced progress-striped" title="40%">
181 <div class="progress-bar progress-bar-warning" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
182 </div>
183 <div class="progress spaced progress-striped" title="40%">
184 <div class="progress-bar progress-bar-info" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
185 </div>
186 <div class="progress spaced progress-striped" title="40%">
187 <div class="progress-bar progress-bar-danger" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
188 </div>
189 </div>
190
191 <?php
192 $lines = array(
193 '<div class="progress progress-striped" title="40%">',
194 ' <div class="progress-bar progress-bar-success" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
195 '</div>',
196 '',
197 '<div class="progress progress-striped" title="40%">',
198 ' <div class="progress-bar progress-bar-warning" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
199 '</div>',
200 '',
201 '<div class="progress progress-striped" title="40%">',
202 ' <div class="progress-bar progress-bar-info" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
203 '</div>',
204 '',
205 '<div class="progress progress-striped" title="40%">',
206 ' <div class="progress-bar progress-bar-danger" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
207 '</div>',
208 '',
209
210 );
211 echo $documentation->showCode($lines); ?>
212 </div>
213 <!-- -->
214
215
216 <!-- other usage -->
217 <div class="documentation-section" id="progresse-section-stripped">
218 <h2 class="documentation-title"><?php echo $langs->trans('DocOtherVariants'); ?></h2>
219 <p class="documentation-text"><?php echo $langs->trans('DocOtherVariantsDesc'); ?></p>
220
221 <div class="documentation-example">
222 .progress-bar-consumed
223 <div class="progress spaced progress-bar-consumed" title="40%">
224 <div class="progress-bar" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
225 </div>
226 .progress-bar-consumed-late
227 <div class="progress spaced progress-bar-consumed" title="40%">
228 <div class="progress-bar" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
229 </div>
230 </div>
231
232 <?php
233 $lines = array(
234 '<div class="progress progress-striped" title="40%">',
235 ' <div class="progress-bar progress-bar-success" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
236 '</div>',
237 '',
238 '<div class="progress progress-striped" title="40%">',
239 ' <div class="progress-bar progress-bar-warning" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
240 '</div>',
241 '',
242 '<div class="progress progress-striped" title="40%">',
243 ' <div class="progress-bar progress-bar-info" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
244 '</div>',
245 '',
246 '<div class="progress progress-striped" title="40%">',
247 ' <div class="progress-bar progress-bar-danger" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>',
248 '</div>',
249 '',
250
251 );
252 echo $documentation->showCode($lines); ?>
253 </div>
254 <!-- -->
255
256
257 </div>
258
259 </div>
260
261<?php
262// Output close body + html
263$documentation->docFooter();
264?>
Class to manage UI documentation.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
usage($program, $header)
Print the usage when executing scripts from install/.
Definition inc.php:94
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.