source: trunk/www/dch/dates.php@ 19598

Last change on this file since 19598 was 15456, checked in by Daniela Dorner, 12 years ago
fixed tonight-button
File size: 2.3 KB
Line 
1<script type="text/javascript">
2function change (wert)
3{
4 document.formular.date.value=wert;
5}
6</script>
7<?php
8
9function GetDates($date, $name)
10{
11 if (!empty($_GET["date"]))
12 $date=date("Y-m-d", strtotime($_GET["date"]));
13 else
14 $date=date("Y-m-d");
15
16 $plusoneday=date("Y-m-d", strtotime($date." +1 day"));
17 $minusoneday=date("Y-m-d", strtotime($date." -1 day"));
18 $plusoneweek=date("Y-m-d", strtotime($date." +1 week"));
19 $minusoneweek=date("Y-m-d", strtotime($date." -1 week"));
20 $plustwoweeks=date("Y-m-d", strtotime($date." +2 week"));
21 $minustwoweeks=date("Y-m-d", strtotime($date." -2 week"));
22 $plusonemonth=date("Y-m-d", strtotime($date." +1 month"));
23 $minusonemonth=date("Y-m-d", strtotime($date." -1 month"));
24 $plusoneyear=date("Y-m-d", strtotime($date." +1 year"));
25 $minusoneyear=date("Y-m-d", strtotime($date." -1 year"));
26 if (date("H")>18)
27 $today=date("Y-m-d", mktime(0,0,0,date("m"), date("d"), date("Y")));
28 else
29 $today=date("Y-m-d",strtotime(date("Y-m-d", mktime(0,0,0,date("m"), date("d"), date("Y")))." -1 day"));
30
31 printf("<input name='date' type='text' size='10' maxlength='10' value='%s'>\n", $date);
32 echo "<input type='submit' value='Show'>\n";
33 printf("<input type='button' value='Tonight' onClick='change(\"%s\");submit()'>\n", $today);
34 printf("<input type='button' value='+1Day' onClick='change(\"%s\");submit()'>\n", $plusoneday);
35 printf("<input type='button' value='-1Day' onClick='change(\"%s\");submit()'>\n", $minusoneday);
36 printf("<input type='button' value='+1Week' onClick='change(\"%s\");submit()'>\n", $plusoneweek);
37 printf("<input type='button' value='-1Week' onClick='change(\"%s\");submit()'>\n", $minusoneweek);
38 printf("<input type='button' value='+2Weeks' onClick='change(\"%s\");submit()'>\n", $plustwoweeks);
39 printf("<input type='button' value='-2Weeks' onClick='change(\"%s\");submit()'>\n", $minustwoweeks);
40 printf("<input type='button' value='+1Month' onClick='change(\"%s\");submit()'>\n", $plusonemonth);
41 printf("<input type='button' value='-1Month' onClick='change(\"%s\");submit()'>\n", $minusonemonth);
42 printf("<input type='button' value='+1Year' onClick='change(\"%s\");submit()'>\n", $plusoneyear);
43 printf("<input type='button' value='-1Year' onClick='change(\"%s\");submit()'>\n", $minusoneyear);
44
45 return $date;
46}
47
48?>
Note: See TracBrowser for help on using the repository browser.