3define(
"NOCSRFCHECK", 1);
4if (!defined(
'NOSESSION')) {
5 define(
'NOSESSION',
'1');
8require_once
'../../main.inc.php';
9require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
11if ($dolibarr_main_prod) {
12 accessforbidden(
'Access forbidden when $dolibarr_main_prod is set to 1');
19header(
"Content-type: text/html; charset=UTF8");
22header(
"X-Content-Type-Options: nosniff");
23header(
"X-Frame-Options: SAMEORIGIN");
29 <meta charset=
"utf-8">
30 <meta
name=
"viewport" content=
"width=device-width, initial-scale=1, shrink-to-fit=no">
31 <meta
name=
"description" content=
"Documentation and examples for theme.">
33 <link href=
"<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php" rel=
"stylesheet">
35 <body
class=
"docpage" style=
"padding: 20px;">
38 <h1
class=
"bd-title" id=
"content">Badges</h1>
39 <p
class=
"bd-lead">Documentation and examples
for badges, our small count and labeling component.</p>
41 <h2
id=
"example">Example</h2>
43 <p>Badges scale to match the size of the immediate parent element by
using relative font sizing and em units.</p>
45 <div
class=
"bd-example">
46 <h1>Example heading <span
class=
"badge badge-secondary">New</span></h1>
47 <h2>Example heading <span
class=
"badge badge-secondary">New</span></h2>
48 <h3>Example heading <span
class=
"badge badge-secondary">New</span></h3>
49 <h4>Example heading <span
class=
"badge badge-secondary">New</span></h4>
50 <h5>Example heading <span
class=
"badge badge-secondary">New</span></h5>
51 <h6>Example heading <span
class=
"badge badge-secondary">New</span></h6>
54 <figure
class=
"highlight">
57<h1>Example heading <span
class="badge badge-secondary">New</span></h1>
58<h2>Example heading <span
class="badge badge-secondary">New</span></h2>
59<h3>Example heading <span
class="badge badge-secondary">New</span></h3>
60<h4>Example heading <span
class="badge badge-secondary">New</span></h4>
61<h5>Example heading <span
class="badge badge-secondary">New</span></h5>
62<h6>Example heading <span
class="badge badge-secondary">New</span></h6>
67 <p>Badges can be used as part of links or buttons to provide a counter.</p>
69 <div
class=
"bd-example">
71 Notifications <span
class=
"badge badge-primary">4</span>
75 <figure
class=
"highlight"><pre>
77 Notifications <span
class="badge badge-primary">4</span>
82 <p>Note that depending on how they are used, badges may be confusing
for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or
button.</p>
84 <p>Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.</p>
86 <p><strong>Remember to use aria-label attribute
for accessibility in Dolibarr.
Don't forget to use aria-hidden on icons included in badges</strong></p>
89 <div class="bd-example">
90 <button type="button" class="button">
91 Profile <span class="badge badge-primary" aria-label="9 unread messages" >9</span>
92 <span class="sr-only">unread messages</span>
96 <figure class="highlight">
100<button type="button" class="btn btn-primary">
101 Profile <span class="badge badge-light" aria-label="9 unread messages" >9</span>
102 <span class="sr-only">unread messages</span>
109 <h2 id="contextual-variations">Contextual variations</h2>
111 <p>Add any of the below mentioned modifier classes to change the appearance of a badge.</p>
113 <div class="bd-example">
115 <span class="badge badge-primary">Primary</span>
116 <span class="badge badge-secondary">Secondary</span>
117 <span class="badge badge-success">Success</span>
118 <span class="badge badge-danger">Danger</span>
119 <span class="badge badge-warning">Warning</span>
120 <span class="badge badge-info">Info</span>
121 <span class="badge badge-light">Light</span>
122 <span class="badge badge-dark">Dark</span>
125 <figure class="highlight">
128<span class="badge badge-primary">Primary</span>
129<span class="badge badge-secondary">Secondary</span>
130<span class="badge badge-success">Success</span>
131<span class="badge badge-danger">Danger</span>
132<span class="badge badge-warning">Warning</span>
133<span class="badge badge-info">Info</span>
134<span class="badge badge-light">Light</span>
135<span class="badge badge-dark">Dark</span>
140 <div class="warning">
141 <h5 id="conveying-meaning-to-assistive-technologies">Conveying meaning to assistive technologies</h5>
143 <p>Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.</p>
148 <h2 id="contextual-variations">Default status</h2>
150 <p>Add any of the below mentioned modifier classes to change the appearance of a badge to be linked to a default status.</p>
152 <div class="bd-example">
153 <?php for ($i = 0; $i <= 9; $i++) : ?>
154 <span class="badge badge-status<?php print $i; ?>" >status-<?php print $i; ?></span>
158 <figure class="highlight"><pre><pre>
159<?php for ($i = 0; $i <= 9; $i++) : ?>
160<span class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
165 <h2 id="pill-badges">Pill badges</h2>
167 <p>Use the .badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding).</p>
169 <div class="bd-example">
171 <span class="badge badge-pill badge-primary">Primary</span>
172 <span class="badge badge-pill badge-secondary">Secondary</span>
173 <span class="badge badge-pill badge-success">Success</span>
174 <span class="badge badge-pill badge-danger">Danger</span>
175 <span class="badge badge-pill badge-warning">Warning</span>
176 <span class="badge badge-pill badge-info">Info</span>
177 <span class="badge badge-pill badge-light">Light</span>
178 <span class="badge badge-pill badge-dark">Dark</span>
180 <?php for ($i = 0; $i <= 9; $i++) : ?>
181 <span class="badge badge-pill badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
186 <figure class="highlight">
189<span class="badge badge-pill badge-primary">Primary</span>
190<span class="badge badge-pill badge-secondary">Secondary</span>
191<span class="badge badge-pill badge-success">Success</span>
192<span class="badge badge-pill badge-danger">Danger</span>
193<span class="badge badge-pill badge-warning">Warning</span>
194<span class="badge badge-pill badge-info">Info</span>
195<span class="badge badge-pill badge-light">Light</span>
196<span class="badge badge-pill badge-dark">Dark</span>
197<?php for ($i = 0; $i <= 9; $i++) : ?>
198<span class="badge badge-pill badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
204 <h2 id="dot-badges">Dot badges</h2>
206 <p>.dot-pill modifier class to make badges circle.</p>
208 <div class="bd-example">
210 <span class="badge badge-dot badge-primary"></span>
211 <span class="badge badge-dot badge-secondary"></span>
212 <span class="badge badge-dot badge-success"></span>
213 <span class="badge badge-dot badge-danger"></span>
214 <span class="badge badge-dot badge-warning"></span>
215 <span class="badge badge-dot badge-info"></span>
216 <span class="badge badge-dot badge-light"></span>
217 <span class="badge badge-dot badge-dark"></span>
219 <?php for ($i = 0; $i <= 9; $i++) : ?>
220 <span class="badge badge-dot badge-status<?php print $i; ?>" ></span>
225 <figure class="highlight">
228<span class="badge badge-dot badge-primary"></span>
229<span class="badge badge-dot badge-secondary"></span>
230<span class="badge badge-dot badge-success"></span>
231<span class="badge badge-dot badge-danger"></span>
232<span class="badge badge-dot badge-warning"></span>
233<span class="badge badge-dot badge-info"></span>
234<span class="badge badge-dot badge-light"></span>
235<span class="badge badge-dot badge-dark"></span>
236<?php for ($i = 0; $i <= 9; $i++) : ?>
237<span class="badge badge-dot badge-status<?php print $i; ?>" ></span>
243 <p>Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.</p>
245 <p>Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.</p>
247 <p><strong>Remember to use aria-label attribute for accessibility in Dolibarr. Don't forget to use aria-hidden on icons included in badges</strong></p>
251 <h2
id=
"links">Links</h2>
253 <p>Using the contextual .badge-* classes on an <a> element quickly provide <em>actionable</em> badges with hover and focus states.</p>
255 <div
class=
"bd-example">
257 <a href=
"#" class=
"badge badge-primary">Primary</a>
258 <a href=
"#" class=
"badge badge-secondary">Secondary</a>
259 <a href=
"#" class=
"badge badge-success">Success</a>
260 <a href=
"#" class=
"badge badge-danger">Danger</a>
261 <a href=
"#" class=
"badge badge-warning">Warning</a>
262 <a href=
"#" class=
"badge badge-info">Info</a>
263 <a href=
"#" class=
"badge badge-light">Light</a>
264 <a href=
"#" class=
"badge badge-dark">Dark</a>
265 <?php
for ($i = 0; $i <= 9; $i++) : ?>
266 <a href=
"#" class=
"badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a>
271 <figure
class=
"highlight"><pre>
272<a href="#"
class="badge badge-primary">Primary</a>
273<a href="#"
class="badge badge-secondary">Secondary</a>
274<a href="#"
class="badge badge-success">Success</a>
275<a href="#"
class="badge badge-danger">Danger</a>
276<a href="#"
class="badge badge-warning">Warning</a>
277<a href="#"
class="badge badge-info">Info</a>
278<a href="#"
class="badge badge-light">Light</a>
279<a href="#"
class="badge badge-dark">Dark</a>
280<?php
for ($i = 0; $i <= 9; $i++) : ?>
281<a href="#"
class=
"badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a>
286 <h2
id=
"helper">Use badge helper
function</h2>
287 <p>Using the dolGetBadge
function provide in core/lib/functions.lib.php. This
function is recommended
for code uniformisation and easy maintain</p>
288 <?php print dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'primary') ?>
289 <?php print dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'danger',
'pill') ?>
290 <?php print dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'warning',
'dot') ?>
292 <figure
class=
"highlight"><pre>
293<?php print dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'danger',
'pill') ?>
294<?php print dolGetBadge(
'your label for accessibility',
'your label <u>with</u> <em>html</em>',
'warning',
'dot') ?>
297 <h2
id=
"helper">Use status helper
function</h2>
298 <p>Using the dolGetStatus
function provide in core/lib/functions.lib.php. This
function is recommended
for code uniformisation and easy maintain</p>
300 $saveGlobalConf = $conf->global->MAIN_STATUS_USES_CSS;
301 $conf->global->MAIN_STATUS_USES_CSS = 1;
303 <h4>Using hidden global
conf MAIN_STATUS_USES_CSS=1</h4>
304 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4') ?></p>
305 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 1) ?></p>
306 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 2) ?></p>
307 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 3) ?></p>
308 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 4) ?></p>
309 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 5) ?></p>
310 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 6) ?></p>
312 <?php $conf->global->MAIN_STATUS_USES_CSS = 0; ?>
313 <h4>Disabled hidden global
conf : MAIN_STATUS_USES_CSS=0</h4>
314 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 1) ?></p>
315 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 2) ?></p>
316 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 3) ?></p>
317 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 4) ?></p>
318 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 5) ?></p>
319 <p><?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4', 6) ?></p>
321 <?php $conf->global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?>
324 <figure
class=
"highlight"><pre>
325<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4') ?>
326<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4',1) ?>
327<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4',2) ?>
328<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4',3) ?>
329<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4',4) ?>
330<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4',5) ?>
331<?php print dolGetStatus(
'your label for accessibility',
'your label',
'your label <u>with</u> <em>html</em>',
'status4',6) ?>
Class to manage donations.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.