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(
'Badges', $morejs);
54$documentation->view = array(
'Components',
'Badges');
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(
'DocBadgeTitle'); ?></h1>
66 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeMainDescription'); ?></p>
69 <?php $documentation->showSummary(); ?>
72 <div
class=
"documentation-section" id=
"badgesection-basicusage">
73 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBasicUsage'); ?></h2>
74 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeScaleDescription'); ?></p>
75 <div
class=
"documentation-example">
76 <h1>Example heading <span
class=
"badge badge-secondary">New</span></h1>
77 <h2>Example heading <span
class=
"badge badge-secondary">New</span></h2>
78 <h3>Example heading <span
class=
"badge badge-secondary">New</span></h3>
79 <h4>Example heading <span
class=
"badge badge-secondary">New</span></h4>
80 <h5>Example heading <span
class=
"badge badge-secondary">New</span></h5>
81 <h6>Example heading <span
class=
"badge badge-secondary">New</span></h6>
86 '<h1>Example heading <span class="badge badge-secondary">New</span></h1>',
87 '<h2>Example heading <span class="badge badge-secondary">New</span></h2>',
88 '<h3>Example heading <span class="badge badge-secondary">New</span></h3>',
89 '<h4>Example heading <span class="badge badge-secondary">New</span></h4>',
90 '<h5>Example heading <span class="badge badge-secondary">New</span></h5>',
91 '<h6>Example heading <span class="badge badge-secondary">New</span></h6>'
93 echo $documentation->showCode($lines); ?>
95 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeUseOnLinksOrButtons'); ?></p>
96 <div
class=
"documentation-example">
98 <?php echo $langs->trans(
'Notifications'); ?> <span
class=
"badge badge-primary">4</span>
104 '<button type="button" class="button">',
105 ' Notifications <span class="badge badge-primary">4</span>',
108 echo $documentation->showCode($lines); ?>
110 <div
class=
"warning">
111 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeWarningAriaHidden1'); ?></p>
112 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeWarningAriaHidden2'); ?></p>
113 <p
class=
"documentation-text"><strong><?php echo $langs->trans(
'DocBadgeWarningAriaHidden3'); ?></strong></p>
116 <div
class=
"documentation-example">
118 Profile <span
class=
"badge badge-primary" aria-label=
"9 unread messages" >9</span>
119 <span
class=
"sr-only">unread messages</span>
125 '<button type="button" class="button">',
126 ' Profile <span class="badge badge-primary" aria-label="9 unread messages" >9</span>',
127 ' <span class="sr-only">unread messages</span>',
130 echo $documentation->showCode($lines); ?>
133 <!-- Contextual variations -->
134 <div
class=
"documentation-section" id=
"badgesection-contextvariations">
135 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBadgeContextualVariations'); ?></h2>
136 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeContextualVariationsDescription'); ?></p>
137 <div
class=
"documentation-example">
138 <span
class=
"badge badge-primary">Primary</span>
139 <span
class=
"badge badge-secondary">Secondary</span>
140 <span
class=
"badge badge-success">Success</span>
141 <span
class=
"badge badge-danger">Danger</span>
142 <span
class=
"badge badge-warning">Warning</span>
143 <span
class=
"badge badge-info">Info</span>
144 <span
class=
"badge badge-light">Light</span>
145 <span
class=
"badge badge-dark">Dark</span>
149 '<span class="badge badge-primary">Primary</span>',
150 '<span class="badge badge-secondary">Secondary</span>',
151 '<span class="badge badge-success">Success</span>',
152 '<span class="badge badge-danger">Danger</span>',
153 '<span class="badge badge-warning">Warning</span>',
154 '<span class="badge badge-info">Info</span>',
155 '<span class="badge badge-light">Light</span>',
156 '<span class="badge badge-dark">Dark</span>',
158 echo $documentation->showCode($lines); ?>
159 <div
class=
"warning">
160 <p
class=
"documentation-text"><strong><?php echo $langs->trans(
'DocBadgeContextualVariationsWarning1'); ?></strong></p>
161 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeContextualVariationsWarning2'); ?></p>
166 <div
class=
"documentation-section" id=
"badgesection-defaultstatus">
167 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBadgeDefaultStatus'); ?></h2>
168 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeDefaultStatusDescription'); ?></p>
169 <div
class=
"documentation-example">
170 <?php
for ($i = 0; $i <= 9; $i++) : ?>
171 <span
class=
"badge badge-status<?php print $i; ?>" >
status-<?php print $i; ?></span>
176 for ($i = 0; $i <= 9; $i++) :
177 $lines[] =
'<span class="badge badge-status'.$i.
'">status-'.$i.
'</span>';
179 echo $documentation->showCode($lines); ?>
183 <div
class=
"documentation-section" id=
"badgesection-pill">
184 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBadgePillBadges'); ?></h2>
185 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgePillBadgesDescription'); ?></p>
186 <div
class=
"documentation-example">
187 <span
class=
"badge badge-pill badge-primary">Primary</span>
188 <span
class=
"badge badge-pill badge-secondary">Secondary</span>
189 <span
class=
"badge badge-pill badge-success">Success</span>
190 <span
class=
"badge badge-pill badge-danger">Danger</span>
191 <span
class=
"badge badge-pill badge-warning">Warning</span>
192 <span
class=
"badge badge-pill badge-info">Info</span>
193 <span
class=
"badge badge-pill badge-light">Light</span>
194 <span
class=
"badge badge-pill badge-dark">Dark</span>
195 <?php
for ($i = 0; $i <= 9; $i++) : ?>
201 '<span class="badge badge-pill badge-primary">Primary</span>',
202 '<span class="badge badge-pill badge-secondary">Secondary</span>',
203 '<span class="badge badge-pill badge-success">Success</span>',
204 '<span class="badge badge-pill badge-danger">Danger</span>',
205 '<span class="badge badge-pill badge-warning">Warning</span>',
206 '<span class="badge badge-pill badge-info">Info</span>',
207 '<span class="badge badge-pill badge-light">Light</span>',
208 '<span class="badge badge-pill badge-dark">Dark</span>',
210 for ($i = 0; $i <= 9; $i++) :
211 $lines[] =
'<span class="badge badge-pill badge-status'.$i.
'">status-'.$i.
'</span>';
213 echo $documentation->showCode($lines); ?>
217 <div
class=
"documentation-section" id=
"badgesection-dot">
218 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBadgeDotBadges'); ?></h2>
219 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeDotBadgesDescription'); ?></p>
220 <div
class=
"documentation-example">
221 <span
class=
"badge badge-dot badge-primary"></span>
222 <span
class=
"badge badge-dot badge-secondary"></span>
223 <span
class=
"badge badge-dot badge-success"></span>
224 <span
class=
"badge badge-dot badge-danger"></span>
225 <span
class=
"badge badge-dot badge-warning"></span>
226 <span
class=
"badge badge-dot badge-info"></span>
227 <span
class=
"badge badge-dot badge-light"></span>
228 <span
class=
"badge badge-dot badge-dark"></span>
229 <?php
for ($i = 0; $i <= 9; $i++) : ?>
230 <span
class=
"badge badge-dot badge-status<?php print $i; ?>"></span>
235 '<span class="badge badge-dot badge-primary"></span>',
236 '<span class="badge badge-dot badge-secondary"></span>',
237 '<span class="badge badge-dot badge-success"></span>',
238 '<span class="badge badge-dot badge-danger"></span>',
239 '<span class="badge badge-dot badge-warning"></span>',
240 '<span class="badge badge-dot badge-info"></span>',
241 '<span class="badge badge-dot badge-light"></span>',
242 '<span class="badge badge-dot badge-dark"></span>',
244 for ($i = 0; $i <= 9; $i++) :
245 $lines[] =
'<span class="badge badge-dot badge-status'.$i.
'"></span>';
247 echo $documentation->showCode($lines); ?>
251 <div
class=
"documentation-section" id=
"badgesection-links">
252 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBadgeLinks'); ?></h2>
253 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeLinksDescription'); ?></p>
254 <div
class=
"documentation-example">
255 <a href=
"#" class=
"badge badge-primary">Primary</a>
256 <a href=
"#" class=
"badge badge-secondary">Secondary</a>
257 <a href=
"#" class=
"badge badge-success">Success</a>
258 <a href=
"#" class=
"badge badge-danger">Danger</a>
259 <a href=
"#" class=
"badge badge-warning">Warning</a>
260 <a href=
"#" class=
"badge badge-info">Info</a>
261 <a href=
"#" class=
"badge badge-light">Light</a>
262 <a href=
"#" class=
"badge badge-dark">Dark</a>
263 <?php
for ($i = 0; $i <= 9; $i++) : ?>
269 '<a href="#" class="badge badge-primary">Primary</a>',
270 '<a href="#" class="badge badge-secondary">Secondary</a>',
271 '<a href="#" class="badge badge-success">Success</a>',
272 '<a href="#" class="badge badge-danger">Danger</a>',
273 '<a href="#" class="badge badge-warning">Warning</a>',
274 '<a href="#" class="badge badge-info">Info</a>',
275 '<a href="#" class="badge badge-light">Light</a>',
276 '<a href="#" class="badge badge-dark">Dark</a>',
278 for ($i = 0; $i <= 9; $i++) :
279 $lines[] =
'<a href="#" class="badge badge-status'.$i.
'" >status'.$i.
'</a>';
281 echo $documentation->showCode($lines); ?>
284 <!-- Use badge helper
function -->
285 <div
class=
"documentation-section" id=
"badgesection-dolgetbadge">
286 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBadgeHelper'); ?></h2>
287 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocBadgeHelperDescription'); ?></p>
288 <div
class=
"documentation-example">
289 <?php print
dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'primary'); ?>
290 <?php print
dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'danger',
'pill'); ?>
291 <?php print
dolGetBadge(
'your label for accessibility',
'your label',
'warning',
'dot'); ?>
296 " * Function dolGetBadge",
298 " * @param string \$label label of badge no html : use in alt attribute for accessibility",
299 " * @param string \$html optional : label of badge with html",
300 " * @param string \$type type of badge : Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9",
301 " * @param string \$mode Default '' , 'pill', 'dot'",
302 " * @param string \$url the url for link",
303 " * ... See more: core/lib/functions.lib.php ",
305 "<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'primary'); ?>",
306 "<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'danger', 'pill'); ?>",
307 "<?php print dolGetBadge('your label for accessibility', 'your label', 'warning', 'dot'); ?>",
309 echo $documentation->showCode($lines); ?>
320$documentation->docFooter();
Class to manage UI documentation.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dolGetBadge($label, $html='', $type='primary', $mode='', $url='', $params=array())
Function dolGetBadge.
ui state ui widget content ui state ui widget header ui state a ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
usage($program, $header)
Print the usage when executing scripts from install/.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.