-
Notifications
You must be signed in to change notification settings - Fork 1
/
freeInput.php
executable file
·117 lines (98 loc) · 4.24 KB
/
freeInput.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Weather</title>
<link rel="stylesheet" href="woffice.css">
</head>
<body bgcolor="#d6e5ca" marginheight="25" marginwidth="20" topmargin="25" leftmargin="0">
<?PHP
////////////////////////////////////////////////////
//
// WeatherOffice
//
// http://www.sourceforge.net/projects/weatheroffice
//
// Copyright (C) 04/2007 Mathias Zuckermann &
// Bernhard Heibler
//
// See COPYING for license info
//
////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// getFreeInput
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getFreeInput($beginDay, $beginMonth, $beginYear, $endDay, $endMonth, $endYear, $showVal, $text)
{
global $database;
// Header
$begin = convertTimestamp($beginDay, $beginMonth, $beginYear, 0, 0, 0);
$end = convertTimestamp($endDay, $endMonth, $endYear, 23, 59, 59);
echo "<a name=\"top\"></a>";
$result = $database->getWeatherFromPeriod($begin, $end, false);
$num = $database->getRowsCount();
if ($num == 0)
{
getStartYearAndMonth($firstYear, $firstMonth, $firstDay);
getStopYearAndMonth($lastYear, $lastMonth, $lastDay);
printf($text['messages']['no_data_found_d'], "$beginDay.$beginMonth.$beginYear", "$firstDay.$firstMonth.$firstYear", "$lastDay.$lastMonth.$lastYear");
return $num;
}
// Statistics
$stat=statArray($num, $beginDay, $begin, $end);
echo "<h2>{$text['statistics']} {$text['of']} $beginDay.$beginMonth.$beginYear {$text['to']} $endDay.$endMonth.$endYear.</h2><p>";
links($showVal, $text);
// Graphs
graphs("free", "{$text['graphs']} {$text['for_the_range_from']} $beginDay.$beginMonth.$beginYear {$text['to']} $endDay.$endMonth.$endYear.", $begin, $end, $text);
// Average Table Header
echo "<a name=\"avg\"></a>";
echo "<h3>{$text['avg_values']} {$text['for_the_range_from']} $beginDay.$beginMonth.$beginYear {$text['to']} $endDay.$endMonth.$endYear.</h3><p>";
valueTable($stat, "avg", "--", "--", "--", $text);
// min values Table Header
echo "<a name=\"minimal\"></a>";
echo "<hr><h3>{$text['min_values']} {$text['for_the_range_from']} $beginDay.$beginMonth.$beginYear {$text['to']} $endDay.$endMonth.$endYear.</h3><p>";
valueTimeDateTable($stat, "min", "minTime", "minDate", $text);
// max values Table Header
echo "<a name=\"maximal\"></a>";
echo "<hr><h3>{$text['max_values']} {$text['for_the_range_from']} $beginDay.$beginMonth.$beginYear {$text['to']} $endDay.$endMonth.$endYear.</h3><p>";
valueTimeDateTable($stat, "max", "maxTime", "maxDate", $text);
echo "<a name=\"all\"></a>";
if($showVal == "true")
{
// All Values Table Header
echo "<hr><h3>{$text['all_values']} {$text['for_the_range_from']} $beginDay.$beginMonth.$beginYear {$text['to']} $endDay.$endMonth.$endYear.</h3><p>";
tableHeader($text);
// All Values Table
printTableRows($database);
tableFooter($text);
}
else
{
echo "<hr><a href=\"freeInput.php?showVal=true&beginDay=$beginDay&beginMonth=$beginMonth&beginYear=$beginYear&endDay=$endDay&endMonth=$endMonth&endYear=$endYear#all\">{$text['show_all_values']}</a>";
}
$database->free();
$database->close();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// MAIN
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
// Data in weather (as stored by mysql2300)
//
// timestamp: uniqe bigint(14) in format YYYYMMDDhhmmss
//
//////////////////////////////////////////////////////////////////////
include("weatherInclude.php");
$beginDay = $_REQUEST["beginDay"];
$beginMonth = $_REQUEST["beginMonth"];
$beginYear = $_REQUEST["beginYear"];
$endDay = $_REQUEST["endDay"];
$endMonth = $_REQUEST["endMonth"];
$endYear = $_REQUEST["endYear"];
$showVal = $_REQUEST["showVal"];
getFreeInput($beginDay, $beginMonth, $beginYear, $endDay, $endMonth, $endYear, $showVal, $text);
?>