-
Notifications
You must be signed in to change notification settings - Fork 170
/
trend_navigation.php
62 lines (53 loc) · 2.06 KB
/
trend_navigation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
$months_ahead = array(0,1,2,3,6,9,12,18,24);
$months_back = array(12,9,6,3,2,1);
if ( !isset($_REQUEST['trendrange']) or !is_numeric($_REQUEST['trendrange']) )
$_REQUEST['trendrange'] = 6;
if ( !isset($_REQUEST['trendhistory']) or !is_numeric($_REQUEST['trendhistory']) )
$_REQUEST['trendhistory'] = 6;
$drop_args = array("trendrange", "trendhistory");
foreach ( $_REQUEST as $key => $value ) {
if ( ! in_array($key, $drop_args) )
$graph_args[] = rawurlencode($key) . "=" . rawurlencode( str_replace("_/graph_php?", "", $value) );
}
$query_string = preg_replace("/(&trendrange=)(\d+)/", "", $_SERVER['QUERY_STRING'] );
$query_string = preg_replace("/(&trendhistory=)(\d+)/", "", htmlspecialchars($query_string, ENT_QUOTES) );
?>
<center>
<div id="trend_range_menu">
<form id="trend_range_form">
Use data from last
<?php
foreach ( $months_back as $index => $month ) {
if ( $_REQUEST['trendhistory'] == $month )
$checked = 'checked="checked"';
else
$checked = "";
?>
<input OnChange='drawTrendGraph("<?php print $query_string ?>" + "&" + $("#trend_range_form").serialize()); return false;' type="radio" id="trendhistory-<?php print $month; ?>" name="trendhistory" value="<?php print $month; ?>" <?php print $checked; ?>/>
<label for="trendhistory-<?php print $month; ?>"><?php print $month; ?></label>
<?php
}
?>
months | Extend trend line
<?php
if ( !isset($_REQUEST['trendrange']) )
$_REQUEST['trendrange'] = 6;
foreach ( $months_ahead as $index => $month ) {
if ( $_REQUEST['trendrange'] == $month )
$checked = 'checked="checked"';
else
$checked = "";
?>
<input OnChange='drawTrendGraph("<?php print $query_string ?>" + "&" + $("#trend_range_form").serialize()); return false;' type="radio" id="range-<?php print $month; ?>" name="trendrange" value="<?php print $month; ?>" <?php print $checked; ?>/>
<label for="range-<?php print $month; ?>"><?php print $month; ?></label>
<?php
}
?>
months ahead</form></div>
</center>
<script type="text/javascript">
$(function () {
$("#trend_range_menu").buttonset();
});
</script>