Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / themes / sprites.css.php
blob2c12589a416d109a462cc7f6f8df405ae5b228e8
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * This file generates the CSS code for the sprites of a theme
6 * @package PhpMyAdmin-theme
7 */
9 // unplanned execution path
10 if (! defined('PMA_MINIMUM_COMMON')) {
11 exit();
14 $bg = $_SESSION['PMA_Theme']->getImgPath() . 'sprites.png';
15 /* Check if there is a valid data file for sprites */
16 if (is_readable($_SESSION['PMA_Theme']->getPath() . '/sprites.lib.php')) {
19 /* Icon sprites */
20 .icon {
21 margin: 0 .3em;
22 padding: 0 !important;
23 width: 16px;
24 height: 16px;
25 background-image: url('<?php echo $bg; ?>') !important;
26 background-repeat: no-repeat !important;
27 background-position: top left !important;
29 <?php
31 include_once $_SESSION['PMA_Theme']->getPath() . '/sprites.lib.php';
32 $sprites = array();
33 if (function_exists('PMA_sprites')) {
34 $sprites = PMA_sprites();
36 $template = ".ic_%s { background-position: 0 -%upx !important;%s%s }\n";
37 foreach ($sprites as $name => $data) {
38 // generate the CSS code for each icon
39 $width = '';
40 $height = '';
41 // if either the height or width of an icon is 16px,
42 // then it's pointless to set this as a parameter,
43 //since it will be inherited from the "icon" class
44 if ($data['width'] != 16) {
45 $width = " width: " . $data['width'] . "px;";
47 if ($data['height'] != 16) {
48 $height = " height: " . $data['height'] . "px;";
50 printf(
51 $template,
52 $name,
53 ($data['position'] * 16),
54 $width,
55 $height
58 // Here we map some of the classes that we
59 // defined above to other CSS selectors.
60 // The indexes of the array correspond to
61 // already defined classes and the values
62 // are the selectors that we want to map to.
63 $elements = array(
64 's_sortable' => 'img.sortableIcon',
65 's_asc' => 'th.headerSortUp img.sortableIcon',
66 's_desc' => 'th.headerSortDown img.sortableIcon'
68 $template = "%s { background-position: 0 -%upx; "
69 . "height: %upx; width: %upx; }\n";
70 foreach ($elements as $key => $value) {
71 if (isset($sprites[$key])) { // If the CSS class has been defined
72 printf(
73 $template,
74 $value,
75 ($sprites[$key]['position'] * 16),
76 $sprites[$key]['height'],
77 $sprites[$key]['width']