dolibarr 20.0.5
badges.inc.php
1<?php
2if (!defined('ISLOADEDBYSTEELSHEET')) {
3 die('Must be call by steelsheet');
4}
5?>
6/* Badge style is based on bootstrap framework */
7
8.badge {
9 display: inline-block;
10 padding: .1em .35em;
11 font-size: 80%;
12 font-weight: 700 !important;
13 line-height: 1;
14 text-align: center;
15 white-space: nowrap;
16 vertical-align: baseline;
17 border-radius: .25rem;
18 transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
19 border-width: 2px;
20 border-style: solid;
21 border-color: rgba(255,255,255,0);
22 box-sizing: border-box;
23}
24
25.badge-status {
26 font-size: 0.95em;
27 padding: .19em .35em; /* more than 0.19 generate a change into height of lines */
28}
29.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
30 font-size: 1.1em;
31 padding: .4em .4em;
32}
33/* Force values for small screen 767 */
34@media only screen and (max-width: 767px)
35{
36 .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
37 font-size: 0.95em;
38 padding: .3em .2em;
39 }
40}
41
42.tabs .badge {
43 padding-right: .5em;
44 padding-left: .5em;
45 border-radius: 0.25rem;
46}
47
48.badge-pill{
49 /* Use the .badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding). */
50 padding-right: .8em;
51 padding-left: 0.8em;
52 border-radius: 0.5rem;
53}
54
55.badge-dot {
56 padding: 0;
57 border-radius: 50%;
58 padding: 0.45em;
59 vertical-align: text-top;
60}
61
62a.badge:focus, a.badge:hover {
63 text-decoration: none;
64}
65
66.liste_titre .badge:not(.nochangebackground) {
67 background-color: <?php print $badgeSecondary; ?>;
68 color: #fff;
69}
70
71span.badgeneutral {
72 padding: 2px 7px 2px 7px;
73 background-color: #e4e4e4;
74 color: #666;
75 border-radius: 10px;
76 white-space: nowrap;
77}
78
79
80/* PRIMARY */
81.badge-primary{
82 color: #fff !important;
83 background-color: <?php print $badgePrimary; ?>;
84}
85a.badge-primary.focus, a.badge-primary:focus {
86 outline: 0;
87 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>;
88}
89a.badge-primary:focus, a.badge-primary:hover {
90 color: #fff !important;
91 background-color: <?php print colorDarker($badgePrimary, 10); ?>;
92}
93
94/* SECONDARY */
95.badge-secondary, .tabs .badge {
96 color: #fff !important;
97 background-color: <?php print $badgeSecondary; ?>;
98}
99a.badge-secondary.focus, a.badge-secondary:focus {
100 outline: 0;
101 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>;
102}
103a.badge-secondary:focus, a.badge-secondary:hover {
104 color: #fff !important;
105 background-color: <?php print colorDarker($badgeSecondary, 10); ?>;
106}
107
108/* SUCCESS */
109.badge-success {
110 color: #fff !important;
111 background-color: <?php print $badgeSuccess; ?>;
112}
113a.badge-success.focus, a.badge-success:focus {
114 outline: 0;
115 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>;
116}
117a.badge-success:focus, a.badge-success:hover {
118 color: #fff !important;
119 background-color: <?php print colorDarker($badgeSuccess, 10); ?>;
120}
121
122/* DANGER */
123.badge-danger {
124 color: #fff !important;
125 background-color: <?php print $badgeDanger; ?>;
126}
127a.badge-danger.focus, a.badge-danger:focus {
128 outline: 0;
129 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>;
130}
131a.badge-danger:focus, a.badge-danger:hover {
132 color: #fff !important;
133 background-color: <?php print colorDarker($badgeDanger, 10); ?>;
134}
135
136/* WARNING */
137.badge-warning {
138 color: #fff !important;
139 background-color: <?php print $badgeWarning; ?>;
140}
141a.badge-warning.focus, a.badge-warning:focus {
142 outline: 0;
143 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>;
144}
145a.badge-warning:focus, a.badge-warning:hover {
146 color: #212529 !important;
147 background-color: <?php print colorDarker($badgeWarning, 10); ?>;
148}
149
150/* WARNING colorblind */
151body[class*="colorblind-"] .badge-warning {
152 background-color: <?php print $colorblind_deuteranopes_badgeWarning; ?>;
153 }
154body[class*="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus {
155 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($colorblind_deuteranopes_badgeWarning, 0.5); ?>;
156}
157body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
158 background-color: <?php print colorDarker($colorblind_deuteranopes_badgeWarning, 10); ?>;
159}
160
161/* INFO */
162.badge-info {
163 color: #fff !important;
164 background-color: <?php print $badgeInfo; ?>;
165}
166a.badge-info.focus, a.badge-info:focus {
167 outline: 0;
168 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>;
169}
170a.badge-info:focus, a.badge-info:hover {
171 color: #fff !important;
172 background-color: <?php print colorDarker($badgeInfo, 10); ?>;
173}
174
175/* LIGHT */
176.badge-light {
177 color: #212529 !important;
178 background-color: <?php print $badgeLight; ?>;
179}
180a.badge-light.focus, a.badge-light:focus {
181 outline: 0;
182 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>;
183}
184a.badge-light:focus, a.badge-light:hover {
185 color: #212529 !important;
186 background-color: <?php print colorDarker($badgeLight, 10); ?>;
187}
188
189/* DARK */
190.badge-dark {
191 color: #fff !important;
192 background-color: <?php print $badgeDark; ?>;
193}
194a.badge-dark.focus, a.badge-dark:focus {
195 outline: 0;
196 box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>;
197}
198a.badge-dark:focus, a.badge-dark:hover {
199 color: #fff !important;
200 background-color: <?php print colorDarker($badgeDark, 10); ?>;
201}
202
203
204@media only screen and (max-width: 570px)
205{
206 span.badge.badge-status {
207 overflow: hidden;
208 max-width: 130px;
209 text-overflow: ellipsis;
210 }
211}
212
213
214/* STATUS BADGES */
215<?php
216for ($i = 0; $i <= 10; $i++) {
217 /* Default Status */
218 _createStatusBadgeCss($i, '', "STATUS".$i);
219
220 // create status for accessibility
221 _createStatusBadgeCss($i, 'colorblind_deuteranopes_', "COLORBLIND STATUS".$i, 'body[class*="colorblind-"] ');
222}
223
224_createStatusBadgeCss('1b', '', "STATUS1b");
225_createStatusBadgeCss('4b', '', "STATUS4b");
226
227
237function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentLabel = '', $cssPrefix = '')
238{
239 global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
240
241 if (!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) {
242 print "\n/* ".strtoupper($commentLabel)." */\n";
243
244 $thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix.'badgeStatus'.$statusName};
245
246 $TBadgeBorderOnly = array('0', '1b', '3', '4b', '5', '7', '10');
247 $thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix.'badgeStatus'.$statusName}) ? '#212529' : '#ffffff';
248
249 if (!empty(${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName})) {
250 $thisBadgeTextColor = ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
251 }
252
253 if (in_array((string) $statusName, $TBadgeBorderOnly)) {
254 $thisBadgeTextColor = '#212529';
255 $thisBadgeBackgroundColor = "";
256 }
257
258 if (in_array((string) $statusName, array('0', '5', '9'))) {
259 $thisBadgeTextColor = '#999999';
260 }
261 if (in_array((string) $statusName, array('6'))) {
262 $thisBadgeTextColor = '#777777';
263 }
264
265 // badge-statusX
266 print $cssPrefix.".badge-status".$statusName." {\n";
267 print " color: ".$thisBadgeTextColor." !important;\n";
268 if (in_array((string) $statusName, $TBadgeBorderOnly)) {
269 print " border-color: ".$thisBadgeBorderColor." !important;\n";
270 }
271 if ($thisBadgeBackgroundColor != '') {
272 print " background-color: ".$thisBadgeBackgroundColor." !important;\n";
273 }
274 print "}\n";
275
276 print $cssPrefix.".font-status".$statusName." {\n";
277 if ($thisBadgeBackgroundColor != '') {
278 print " color: ".$thisBadgeBackgroundColor." !important;\n";
279 }
280 print "}\n";
281
282 print $cssPrefix.".badge-status".$statusName.".focus, ".$cssPrefix.".badge-status".$statusName.":focus {\n";
283 print " outline: 0;\n";
284 print " box-shadow: 0 0 0 0.2rem ".colorHexToRgb($thisBadgeBackgroundColor, 0.5)." !important;\n";
285 print "}\n";
286
287 // badge-statusX:focus
288 print $cssPrefix.".badge-status".$statusName.":focus, ".$cssPrefix.".badge-status".$statusName.":hover {\n";
289 print " color: ".$thisBadgeTextColor." !important;\n";
290 //print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n";
291 if (in_array((string) $statusName, $TBadgeBorderOnly)) {
292 print " border-color: ".colorDarker($thisBadgeBorderColor, 10)." !important;\n";
293 }
294 print "}\n";
295 }
296}
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition security.php:637
colorHexToRgb($hex, $alpha=false, $returnArray=false)
colorDarker($hex, $percent)
colorIsLight($stringcolor)
Return true if the color is light.