55 |
|
// Plot a positive sequence of integers $y in function of a sequence $x |
56 |
|
// (whatever it is) in a box of size [$width * $height] in pixels |
57 |
|
function bbc_plot($x, $y, $width, $height) { |
58 |
< |
global $BBC_IMAGES_PATH, $translation; |
58 |
> |
global $BBC_IMAGES_PATH, $BBC_TIME_OFFSET, $translation; |
59 |
|
|
60 |
|
// Various sizes |
61 |
|
$nb_x = count($x); |
97 |
|
|
98 |
|
$bbc_column_color = "column"; // default column color |
99 |
|
if ($nb > 27 || $nb == 7) { // make sure it's a month and not a week, hour, etc. |
100 |
< |
$bbc_weekend = mktime(0, 0, 0, date("m"), date("d") - ($nb - $k - 1), date("Y")); |
100 |
> |
$bbc_weekend = mktime(date("G"), date("i"), 0, date("m"), date("d") - ($nb - $k - 1), date("Y")); |
101 |
> |
// Correct for time offset |
102 |
> |
$bbc_weekend = $bbc_weekend + ($BBC_TIME_OFFSET * 60); |
103 |
|
if (date("w", $bbc_weekend) == 0 || date("w", $bbc_weekend) == 6) { // 0 is Sunday and 6 is Saturday |
104 |
|
$bbc_column_color = "weekend-column"; // column color for weekends |
105 |
|
} |
106 |
|
} else if ($nb == 24) { |
107 |
< |
$bbc_weekend = mktime(date("G") - ($nb - $k - 1), 0, 0, date("m"), date("d"), date("Y")); |
107 |
> |
$bbc_weekend = mktime(date("G") - ($nb - $k - 1), date("i"), 0, date("m"), date("d"), date("Y")); |
108 |
> |
// Correct for time offset |
109 |
> |
$bbc_weekend = $bbc_weekend + ($BBC_TIME_OFFSET * 60); |
110 |
|
} else { |
111 |
< |
$bbc_weekend = mktime(0, 0, 0, date("m") - ($nb - $k - 1), date("d"), date("Y")); |
111 |
> |
$bbc_weekend = mktime(date("G"), date("i"), 0, date("m") - ($nb - $k - 1), date("d"), date("Y")); |
112 |
> |
// Correct for time offset |
113 |
> |
$bbc_weekend = $bbc_weekend + ($BBC_TIME_OFFSET * 60); |
114 |
|
} |
115 |
|
|
116 |
|
$str .= "<td class=\"sky\" height=\"".($height - $bar_height)."\" " |