badges.inc.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <?php
  2. if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet');
  3. ?>
  4. /* Badge style is based on boostrap framework */
  5. .badge-status {
  6. font-size: 0.95em;
  7. padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */
  8. }
  9. .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
  10. font-size: 1.1em;
  11. padding: .4em .4em;
  12. }
  13. /* Force values for small screen 767 */
  14. @media only screen and (max-width: 767px)
  15. {
  16. .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
  17. font-size: 0.95em;
  18. padding: .3em .2em;
  19. }
  20. }
  21. .badge-pill, .tabs .badge {
  22. padding-right: .5em;
  23. padding-left: .5em;
  24. border-radius: 0.25rem;
  25. }
  26. .badge-dot {
  27. padding: 0;
  28. border-radius: 50%;
  29. padding: 0.45em;
  30. vertical-align: text-top;
  31. }
  32. a.badge:focus, a.badge:hover {
  33. text-decoration: none;
  34. }
  35. .liste_titre .badge:not(.nochangebackground) {
  36. background-color: <?php print $badgeSecondary; ?>;
  37. color: #fff;
  38. }
  39. span.badgeneutral {
  40. padding: 2px 7px 2px 7px;
  41. background-color: #e4e4e4;
  42. color: #666;
  43. border-radius: 10px;
  44. }
  45. /* PRIMARY */
  46. .badge-primary{
  47. color: #fff !important;
  48. background-color: <?php print $badgePrimary; ?>;
  49. }
  50. a.badge-primary.focus, a.badge-primary:focus {
  51. outline: 0;
  52. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>;
  53. }
  54. a.badge-primary:focus, a.badge-primary:hover {
  55. color: #fff !important;
  56. background-color: <?php print colorDarker($badgePrimary, 10); ?>;
  57. }
  58. /* SECONDARY */
  59. .badge-secondary, .tabs .badge {
  60. color: #fff !important;
  61. background-color: <?php print $badgeSecondary; ?>;
  62. }
  63. a.badge-secondary.focus, a.badge-secondary:focus {
  64. outline: 0;
  65. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>;
  66. }
  67. a.badge-secondary:focus, a.badge-secondary:hover {
  68. color: #fff !important;
  69. background-color: <?php print colorDarker($badgeSecondary, 10); ?>;
  70. }
  71. /* SUCCESS */
  72. .badge-success {
  73. color: #fff !important;
  74. background-color: <?php print $badgeSuccess; ?>;
  75. }
  76. a.badge-success.focus, a.badge-success:focus {
  77. outline: 0;
  78. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>;
  79. }
  80. a.badge-success:focus, a.badge-success:hover {
  81. color: #fff !important;
  82. background-color: <?php print colorDarker($badgeSuccess, 10); ?>;
  83. }
  84. /* DANGER */
  85. .badge-danger {
  86. color: #fff !important;
  87. background-color: <?php print $badgeDanger; ?>;
  88. }
  89. a.badge-danger.focus, a.badge-danger:focus {
  90. outline: 0;
  91. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>;
  92. }
  93. a.badge-danger:focus, a.badge-danger:hover {
  94. color: #fff !important;
  95. background-color: <?php print colorDarker($badgeDanger, 10); ?>;
  96. }
  97. /* WARNING */
  98. .badge-warning {
  99. color: #fff !important;
  100. background-color: <?php print $badgeWarning; ?>;
  101. }
  102. a.badge-warning.focus, a.badge-warning:focus {
  103. outline: 0;
  104. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>;
  105. }
  106. a.badge-warning:focus, a.badge-warning:hover {
  107. color: #212529 !important;
  108. background-color: <?php print colorDarker($badgeWarning, 10); ?>;
  109. }
  110. /* WARNING colorblind */
  111. body[class*="colorblind-"] .badge-warning {
  112. background-color: <?php print $colorblind_deuteranopes_badgeWarning; ?>;
  113. }
  114. body[class*="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus {
  115. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($colorblind_deuteranopes_badgeWarning, 0.5); ?>;
  116. }
  117. body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
  118. background-color: <?php print colorDarker($colorblind_deuteranopes_badgeWarning, 10); ?>;
  119. }
  120. /* INFO */
  121. .badge-info {
  122. color: #fff !important;
  123. background-color: <?php print $badgeInfo; ?>;
  124. }
  125. a.badge-info.focus, a.badge-info:focus {
  126. outline: 0;
  127. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>;
  128. }
  129. a.badge-info:focus, a.badge-info:hover {
  130. color: #fff !important;
  131. background-color: <?php print colorDarker($badgeInfo, 10); ?>;
  132. }
  133. /* LIGHT */
  134. .badge-light {
  135. color: #212529 !important;
  136. background-color: <?php print $badgeLight; ?>;
  137. }
  138. a.badge-light.focus, a.badge-light:focus {
  139. outline: 0;
  140. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>;
  141. }
  142. a.badge-light:focus, a.badge-light:hover {
  143. color: #212529 !important;
  144. background-color: <?php print colorDarker($badgeLight, 10); ?>;
  145. }
  146. /* DARK */
  147. .badge-dark {
  148. color: #fff !important;
  149. background-color: <?php print $badgeDark; ?>;
  150. }
  151. a.badge-dark.focus, a.badge-dark:focus {
  152. outline: 0;
  153. box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>;
  154. }
  155. a.badge-dark:focus, a.badge-dark:hover {
  156. color: #fff !important;
  157. background-color: <?php print colorDarker($badgeDark, 10); ?>;
  158. }
  159. @media only screen and (max-width: 570px)
  160. {
  161. span.badge.badge-status {
  162. overflow: hidden;
  163. max-width: 130px;
  164. text-overflow: ellipsis;
  165. }
  166. }
  167. /* STATUS BADGES */
  168. <?php
  169. for ($i = 0; $i <= 9; $i++) {
  170. /* Default Status */
  171. _createStatusBadgeCss($i, '', "STATUS".$i);
  172. // create status for accessibility
  173. _createStatusBadgeCss($i, 'colorblind_deuteranopes_', "COLORBLIND STATUS".$i, 'body[class*="colorblind-"] ');
  174. }
  175. _createStatusBadgeCss('1b', '', "STATUS1b");
  176. _createStatusBadgeCss('4b', '', "STATUS4b");
  177. /**
  178. * Create status badge
  179. *
  180. * @param string $statusName name of status
  181. * @param string $statusVarNamePrefix a prefix for var ${$statusVarNamePrefix.'badgeStatus'.$statusName}
  182. * @param string $commentLabel a comment label
  183. * @param string $cssPrefix a css prefix
  184. * @return void
  185. */
  186. function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentLabel = '', $cssPrefix = '')
  187. {
  188. global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
  189. if (!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) {
  190. print "\n/* ".strtoupper($commentLabel)." */\n";
  191. $thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix.'badgeStatus'.$statusName};
  192. $TBadgeBorderOnly = array('0', '1b', '3', '4b', '5', '7');
  193. $thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix.'badgeStatus'.$statusName}) ? '#212529' : '#ffffff';
  194. if (!empty(${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName})) {
  195. $thisBadgeTextColor = ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
  196. }
  197. if (in_array((string) $statusName, $TBadgeBorderOnly)) {
  198. $thisBadgeTextColor = '#212529';
  199. $thisBadgeBackgroundColor = "#fff";
  200. }
  201. if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999';
  202. if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777';
  203. print $cssPrefix.".badge-status".$statusName." {\n";
  204. print " color: ".$thisBadgeTextColor." !important;\n";
  205. if (in_array((string) $statusName, $TBadgeBorderOnly)) {
  206. print " border-color: ".$thisBadgeBorderColor.";\n";
  207. }
  208. print " background-color: ".$thisBadgeBackgroundColor.";\n";
  209. print "}\n";
  210. print $cssPrefix.".font-status".$statusName." {\n";
  211. print " color: ".$thisBadgeBackgroundColor." !important;\n";
  212. print "}\n";
  213. print $cssPrefix.".badge-status".$statusName.".focus, ".$cssPrefix.".badge-status".$statusName.":focus {\n";
  214. print " outline: 0;\n";
  215. print " box-shadow: 0 0 0 0.2rem ".colorHexToRgb($thisBadgeBackgroundColor, 0.5).";\n";
  216. print "}\n";
  217. print $cssPrefix.".badge-status".$statusName.":focus, ".$cssPrefix.".badge-status".$statusName.":hover {\n";
  218. print " color: ".$thisBadgeTextColor." !important;\n";
  219. //print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n";
  220. if (in_array((string) $statusName, $TBadgeBorderOnly)) {
  221. print " border-color: ".colorDarker($thisBadgeBorderColor, 10).";\n";
  222. }
  223. print "}\n";
  224. }
  225. }