charts in webfrontend improved
reports added to Webfrontend git-svn-id: file:///home/jan/tmp/wetterstation/trunk@116 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
ae1336bec3
commit
04e4bcd3a4
|
|
@ -1,2 +1,2 @@
|
|||
<h3 class="mod_headline">Statistik:</h3>
|
||||
<h3 class="chart_headline">Statistik:</h3>
|
||||
{content:insertChart:auto}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
{content:addChart:only}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{content:addReport:standard}
|
||||
|
|
@ -25,3 +25,19 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mod_subsec">
|
||||
<h4 class="mod_subhead">Statistik</h4>
|
||||
<table>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">10 Tage</td><td class="mod_line_stat">{content:addChartLink:hum_10}</td><td class="mod_line_chart">{content:addReportLink:hum_10}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">30 Tage</td><td class="mod_line_stat">{content:addChartLink:hum_30}</td><td class="mod_line_chart">{content:addReportLink:hum_30}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">1 Jahr</td><td class="mod_line_stat">{content:addChartLink:hum_365}</td><td class="mod_line_chart">{content:addReportLink:hum_365}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,3 +25,19 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mod_subsec">
|
||||
<h4 class="mod_subhead">Statistik</h4>
|
||||
<table>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">10 Tage</td><td class="mod_line_stat">{content:addChartLink:press_10}</td><td class="mod_line_chart">{content:addReportLink:press_10}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">30 Tage</td><td class="mod_line_stat">{content:addChartLink:press_30}</td><td class="mod_line_chart">{content:addReportLink:press_30}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">1 Jahr</td><td class="mod_line_stat">{content:addChartLink:press_365}</td><td class="mod_line_chart">{content:addReportLink:press_365}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -37,3 +37,19 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mod_subsec">
|
||||
<h4 class="mod_subhead">Statistik</h4>
|
||||
<table>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">10 Tage</td><td class="mod_line_stat">{content:addChartLink:rain_10}</td><td class="mod_line_chart">{content:addReportLink:rain_10}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">30 Tage</td><td class="mod_line_stat">{content:addChartLink:rain_30}</td><td class="mod_line_chart">{content:addReportLink:rain_30}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">1 Jahr</td><td class="mod_line_stat">{content:addChartLink:rain_365}</td><td class="mod_line_chart">{content:addReportLink:rain_365}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,13 @@
|
|||
<h4 class="mod_subhead">Statistik</h4>
|
||||
<table>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">10 Tage</td><td class="mod_line_stat">{content:addChartLink:temp_test}</td>
|
||||
<td class="mod_line_desc">10 Tage</td><td class="mod_line_chart">{content:addChartLink:temp_10}</td><td class="mod_line_chart">{content:addReportLink:temp_10}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">30 Tage</td><td class="mod_line_chart">{content:addChartLink:temp_30}</td><td class="mod_line_chart">{content:addReportLink:temp_30}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">1 Jahr</td><td class="mod_line_chart">{content:addChartLink:temp_365}</td><td class="mod_line_chart">{content:addReportLink:temp_365}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,3 +22,19 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mod_subsec">
|
||||
<h4 class="mod_subhead">Statistik</h4>
|
||||
<table>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">10 Tage</td><td class="mod_line_stat">{content:addChartLink:wind_10}</td><td class="mod_line_chart">{content:addReportLink:wind_10}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">30 Tage</td><td class="mod_line_stat">{content:addChartLink:wind_30}</td><td class="mod_line_chart">{content:addReportLink:wind_30}</td>
|
||||
</tr>
|
||||
<tr class="mod_temp_stat_row">
|
||||
<td class="mod_line_desc">1 Jahr</td><td class="mod_line_stat">{content:addChartLink:wind_365}</td><td class="mod_line_chart">{content:addReportLink:wind_365}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
{content:part:top}
|
||||
{content:addModule:auto}
|
||||
|
||||
<div class="report">
|
||||
<h3 class="report_head">Report:</h3>
|
||||
<div class="rpt_subsec">
|
||||
{content:part:end}
|
||||
...Hier die Tabelle...
|
||||
{content:part:bottom}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{content:part:end}
|
||||
|
|
@ -3,7 +3,7 @@ body {
|
|||
padding-bottom: 150px;
|
||||
}
|
||||
|
||||
div.module, div.chart {
|
||||
div.module, div.chart, div.report {
|
||||
border-color: #006600;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
|
|
@ -32,7 +32,7 @@ div.module table tr td.mod_line_val {
|
|||
color: #776666;
|
||||
}
|
||||
|
||||
div.module h3.mod_headline {
|
||||
div.module h3.mod_headline, div.report h3.report_head, div.chart h3.chart_headline {
|
||||
margin-top:2px;
|
||||
margin-left:2px;
|
||||
margin-bottom: 5px;
|
||||
|
|
@ -50,7 +50,7 @@ div.module h4.mod_subhead {
|
|||
color: #444444;
|
||||
}
|
||||
|
||||
div.module div.mod_subsec {
|
||||
div.module div.mod_subsec, div.report div.rpt_subsec {
|
||||
border-color: #D0B080;
|
||||
border-style: dotted;
|
||||
border-width: 1px;
|
||||
|
|
@ -78,20 +78,25 @@ div.module p.mod_description {
|
|||
font-size: 10pt;
|
||||
}
|
||||
|
||||
div.module div.mod_subsec div.chart_link_div a.chart_link {
|
||||
div.module div.mod_subsec div.chart_link_div{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.module div.mod_subsec div.chart_link_div a.chart_link, div.module div.mod_subsec div.report_link_div a.report_link {
|
||||
color: #666666;
|
||||
font-weight: 300;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
position: relative;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.module div.mod_subsec div.chart_link_div a.chart_link p.chart_link_desc{
|
||||
div.module div.mod_subsec div.chart_link_div a.chart_link p.chart_link_desc, div.module div.mod_subsec div.report_link_div a.report_link p.report_link_desc {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
top: -100px;
|
||||
}
|
||||
|
||||
div.module div.mod_subsec div.chart_link_div a.chart_link:hover p.chart_link_desc {
|
||||
div.module div.mod_subsec div.chart_link_div a.chart_link:hover p.chart_link_desc, div.module div.mod_subsec div.report_link_div a.report_link:hover p.report_link_desc {
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
visibility: visible;
|
||||
|
|
@ -141,3 +146,40 @@ overflow:auto;
|
|||
width: 820px;
|
||||
|
||||
}
|
||||
|
||||
div.report {
|
||||
width:400px;
|
||||
}
|
||||
|
||||
div.report div.rpt_subsec {
|
||||
width:350px;
|
||||
padding: 10px
|
||||
}
|
||||
|
||||
div.report div.rpt_subsec table.report_table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.report div.rpt_subsec table.report_table tr.report_line td {
|
||||
padding:2px;
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
div.report div.rpt_subsec table.report_table tr.report_head {
|
||||
background: #FFb696;
|
||||
}
|
||||
|
||||
div.report div.rpt_subsec table.report_table tr.report_line td.report_val {
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
div.report div.rpt_subsec table.report_table tr.report_line {
|
||||
background: #FDDDAD;
|
||||
}
|
||||
div.report div.rpt_subsec table.report_table tr.report_line:hover {
|
||||
background: #FFb696;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,67 @@
|
|||
|
||||
/* Graphen - Bilder */
|
||||
$cImg = array(
|
||||
/* Bild - Id Dateiname Link - Name Link - Beschreibung Vorschaubild Set */
|
||||
'temp_test_1' => array( "temp_ex.png", "Beispiel - Temp", "Zeigt den Temparaturverlauf der letzten 10 Tage", null, "chart"),
|
||||
'hum_test_1' => array( "hum_ex.png", "Beispiel - Hum", "Zeigt den Luftfeuchte - verlauf der letzten 10 Tage", null, "chart"),
|
||||
'press_test_1' => array( "press_ex.png", "Beispiel - Press", "Zeigt den Luftdruck - verlauf der letzten 10 Tage", null, "chart"),
|
||||
'' => array( "", "", "", null, "chart")
|
||||
/* Bild - Id Dateiname Link - Name Link - Beschreibung Vorschaubild Set */
|
||||
'temp_10_1' => array( "temp_ex.png", "Liniendiagram", "Zeigt den Temparaturverlauf der letzten 10 Tage in einem Diagram", null, "chart"),
|
||||
'temp_30_1' => array( "temp_ex.png", "Liniendiagram", "Zeigt den Temparaturverlauf der letzten 30 Tage in einem Diagram", null, "chart"),
|
||||
'temp_365_1' => array( "temp_ex.png", "Liniendiagram", "Zeigt den Temparaturverlauf des letzten Jahres in einem Diagram", null, "chart"),
|
||||
|
||||
'hum_10_1' => array( "hum_ex.png", "Liniendiagram", "Zeigt den Verlauf der Luftfeuchtigkeit in den letzten 10 Tagen als Diagram", null, "chart"),
|
||||
'hum_30_1' => array( "hum_ex.png", "Liniendiagram", "Zeigt den Verlauf der Luftfeuchtigkeit in den letzten 30 Tagen als Diagram", null, "chart"),
|
||||
'hum_365_1' => array( "hum_ex.png", "Liniendiagram", "Zeigt den Verlauf der Luftfeuchtigkeit im letztem Jahr als Diagram", null, "chart"),
|
||||
|
||||
'press_10_1' => array( "press_ex.png", "Liniendiagram", "Zeigt den Verlauf des Luftdrucks in den letzten 10 Tagen als Diagram", null, "chart"),
|
||||
'press_30_1' => array( "press_ex.png", "Liniendiagram", "Zeigt den Verlauf des Luftdrucks in den letzten 30 Tagen als Diagram", null, "chart"),
|
||||
'press_365_1' => array( "press_ex.png", "Liniendiagram", "Zeigt den Verlauf des Luftdrucks im letztem Jahr als Diagram", null, "chart"),
|
||||
|
||||
'rain_10_3' => array( "rain_ex.png", "Balkendiagram", "Zeigt die Niederschlagsmengen der letzten 10 Tage als Diagram", null, "chart"),
|
||||
'rain_30_3' => array( "rain_ex.png", "Balkendiagram", "Zeigt die Niederschlagsmengen der letzten 30 Tage als Diagram", null, "chart"),
|
||||
'rain_365_3' => array( "rain_ex.png", "Balkendiagram", "Zeigt die Niederschlagsmengen des letzten Jahres als Diagram", null, "chart"),
|
||||
|
||||
'wind_10_2' => array( "wind_ex.png", "Liniendiagram", "Zeigt den Verlauf der Windgeschwindigkeit in den letzten 10 Tagen als Diagram",null, "chart"),
|
||||
'wind_30_2' => array( "wind_ex.png", "Liniendiagram", "Zeigt den Verlauf der Windgeschwindigkeit in den letzten 30 Tagen als Diagram",null, "chart"),
|
||||
'wind_365_2' => array( "wind_ex.png", "Liniendiagram", "Zeigt den Verlauf der Windgeschwindigkeit im letzten Jahr als Diagram", null, "chart"),
|
||||
|
||||
'temp_10_4' => array( "temp_ex.png", "Liniendiagram", "Zeigt den Temparaturverlauf der letzten 10 Tage in einem Diagram", null, "chart"),
|
||||
'temp_30_4' => array( "temp_ex.png", "Liniendiagram", "Zeigt den Temparaturverlauf der letzten 30 Tage in einem Diagram", null, "chart"),
|
||||
'temp_365_4' => array( "temp_ex.png", "Liniendiagram", "Zeigt den Temparaturverlauf des letzten Jahres in einem Diagram", null, "chart"),
|
||||
|
||||
'hum_10_4' => array( "hum_ex.png", "Liniendiagram", "Zeigt den Verlauf der Luftfeuchtigkeit in den letzten 10 Tagen als Diagram", null, "chart"),
|
||||
'hum_30_4' => array( "hum_ex.png", "Liniendiagram", "Zeigt den Verlauf der Luftfeuchtigkeit in den letzten 30 Tagen als Diagram", null, "chart"),
|
||||
'hum_365_4' => array( "hum_ex.png", "Liniendiagram", "Zeigt den Verlauf der Luftfeuchtigkeit im letztem Jahr als Diagram", null, "chart"),
|
||||
'' => array( "", "", "", null, "chart")
|
||||
);
|
||||
|
||||
$report = array(
|
||||
/* Report-Id Link - Name Link - Beschreibung sensId TabellenFeld Interval Anz.Interval FeldBezeichn Fakt. Unit Mod_name Mittelwert DatumsFormat ModuleSet*/
|
||||
'temp_10_1' =>array( "Daten - Report", "Listet Stündliche Temparatur - Werte der Letzten 10 Tage", 1, "temp", "hour", "10 days", "Temparatur", 0.1, "°C", "temp", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'temp_30_1' =>array( "Daten - Report", "Listet Stündliche Temparatur - Werte der Letzten 30 Tage", 1, "temp", "hour", "30 days", "Temparatur", 0.1, "°C", "temp", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'temp_365_1' =>array( "Daten - Report", "Listet Tägliche Temparatur - Werte des letzten Jahres", 1, "temp", "day", "1 years", "Temparatur", 0.1, "°C", "temp", true, "DD.MM.YYYY ", "report"),
|
||||
|
||||
'hum_10_1' =>array( "Daten - Report", "Listet Stündliche Luftfeuchtigkeits - Werte der Letzten 10 Tage", 1, "hum", "hour", "10 days", "Luftfeuchtigkeit", 1, "%", "hum", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'hum_30_1' =>array( "Daten - Report", "Listet Stündliche Luftfeuchtigkeits - Werte der Letzten 10 Tage", 1, "hum", "hour", "30 days", "Luftfeuchtigkeit", 1, "%", "hum", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'hum_365_1' =>array( "Daten - Report", "Listet Stündliche Luftfeuchtigkeits - Werte der Letzten 10 Tage", 1, "hum", "day", "1 years", "Luftfeuchtigkeit", 1, "%", "hum", true, "DD.MM.YYYY ", "report"),
|
||||
|
||||
'press_10_1' =>array( "Daten - Report", "Listet Stündliche Luftdruck - Werte der Letzten 10 Tage", 1, "press", "hour", "10 days", "Luftdruck", 1, "hPa", "press", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'press_30_1' =>array( "Daten - Report", "Listet Stündliche Luftdruck - Werte der Letzten 10 Tage", 1, "press", "hour", "30 days", "Luftdruck", 1, "hPa", "press", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'press_365_1' =>array( "Daten - Report", "Listet Stündliche Luftdruck - Werte der Letzten 10 Tage", 1, "press", "day", "1 years", "Luftdruck", 1, "hPa", "press", true, "DD.MM.YYYY ", "report"),
|
||||
|
||||
'wind_10_2' =>array( "Daten - Report", "Listet Stündliche Windgeschwindigkeits - Werte der Letzten 10 Tage", 2, "geschw", "hour", "10 days", "Windgeschwindigkeit", 0.1, "<sup>km</sup>/<sub>h</sub>", "wind", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'wind_30_2' =>array( "Daten - Report", "Listet Stündliche Windgeschwindigkeits - Werte der Letzten 10 Tage", 2, "geschw", "hour", "30 days", "Windgeschwindigkeit", 0.1, "<sup>km</sup>/<sub>h</sub>", "wind", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'wind_365_2' =>array( "Daten - Report", "Listet Stündliche Windgeschwindigkeits - Werte der Letzten 10 Tage", 2, "geschw", "day", "1 years", "Windgeschwindigkeit", 0.1, "<sup>km</sup>/<sub>h</sub>", "wind", true, "DD.MM.YYYY ", "report"),
|
||||
|
||||
'rain_10_3' =>array( "Daten - Report", "Listet Stündliche Niederschlags - Werte der Letzten 10 Tage", 3, "count", "hour", "10 days", "Niederschlag", 0.001, "<sup>l</sup>/<sub>m<sup>2</sup></sub>", "rain", false, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'rain_30_3' =>array( "Daten - Report", "Listet Stündliche Niederschlags - Werte der Letzten 10 Tage", 3, "count", "hour", "30 days", "Niederschlag", 0.001, "<sup>l</sup>/<sub>m<sup>2</sup></sub>", "rain", false, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'rain_365_3' =>array( "Daten - Report", "Listet Stündliche Niederschlags - Werte der Letzten 10 Tage", 3, "count", "day", "1 years", "Niederschlag", 0.001, "<sup>l</sup>/<sub>m<sup>2</sup></sub>", "rain", false, "DD.MM.YYYY ", "report"),
|
||||
|
||||
'temp_10_4' =>array( "Daten - Report", "Listet Stündliche Temparatur - Werte der Letzten 10 Tage", 4, "temp", "hour", "10 days", "Temparatur", 0.1, "°C", "temp", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'temp_30_4' =>array( "Daten - Report", "Listet Stündliche Temparatur - Werte der Letzten 30 Tage", 4, "temp", "hour", "30 days", "Temparatur", 0.1, "°C", "temp", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'temp_365_4' =>array( "Daten - Report", "Listet Tägliche Temparatur - Werte des letzten Jahres", 4, "temp", "day", "1 years", "Temparatur", 0.1, "°C", "temp", true, "DD.MM.YYYY ", "report"),
|
||||
|
||||
'hum_10_4' =>array( "Daten - Report", "Listet Stündliche Luftfeuchtigkeits - Werte der Letzten 10 Tage", 4, "hum", "hour", "10 days", "Luftfeuchtigkeit", 1, "%", "hum", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'hum_30_4' =>array( "Daten - Report", "Listet Stündliche Luftfeuchtigkeits - Werte der Letzten 10 Tage", 4, "hum", "hour", "30 days", "Luftfeuchtigkeit", 1, "%", "hum", true, "DD.MM.YYYY HH24:MI", "report"),
|
||||
'hum_365_4' =>array( "Daten - Report", "Listet Stündliche Luftfeuchtigkeits - Werte der Letzten 10 Tage", 4, "hum", "day", "1 years", "Luftfeuchtigkeit", 1, "%", "hum", true, "DD.MM.YYYY ", "report")
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
@ -47,5 +101,10 @@ class Config{
|
|||
global $default_chart_dir;
|
||||
return $default_chart_dir;
|
||||
}
|
||||
|
||||
function getRptArray($rptId){
|
||||
global $report;
|
||||
return $report[$rptId];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -48,5 +48,13 @@ class Connection{
|
|||
return $returnArray;
|
||||
}
|
||||
|
||||
/* Result roh zurueckgeben */
|
||||
function &getRawResult($query){
|
||||
$this->_createConn();
|
||||
$result = pg_query($this->conn, $query)
|
||||
or die('Abfrage fehlgeschlagen: ' . pg_last_error());
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,10 @@ class Module{
|
|||
return Chart::generateChartLink($chartName.'_'.$this->sensId);
|
||||
}
|
||||
|
||||
function addReportLink($rptName){
|
||||
return Report::getReportLink($rptName.'_'.$this->sensId);
|
||||
}
|
||||
|
||||
function getModId($type){
|
||||
if($type == "css")
|
||||
return $this->modName."_".$this->sensId;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ include_once("php_inc/parser.inc.php");
|
|||
include_once("php_inc/connection.inc.php");
|
||||
include_once("php_inc/config.inc.php");
|
||||
include_once("php_inc/chart.inc.php");
|
||||
include_once("php_inc/report.inc.php");
|
||||
|
||||
|
||||
/* Klasse, die die ModuleSets Verwaltet */
|
||||
|
|
@ -16,7 +17,7 @@ class ModuleSet{
|
|||
$parser = & $this->_getParserInstance(); /* Parserinstanz holen */
|
||||
$parser->parseContent($this->_getSetFilename($setName), &$this, NULL); /* Set Parsen */
|
||||
|
||||
if($_REQUEST['chartName'] != ""){
|
||||
if($_REQUEST['chartName'] != "" || $_REQUEST['rptName'] != ""){
|
||||
$parser->appendContent($this->getBackLink());
|
||||
}
|
||||
|
||||
|
|
@ -54,6 +55,11 @@ class ModuleSet{
|
|||
new Module($params[0], $params[1], $this->_getParserInstance(), $this->_getConnInstance());
|
||||
}
|
||||
|
||||
/* Ein Report hinzufügen */
|
||||
function addReport($rptName){
|
||||
new Report($rptName, $this->_getParserInstance(), $this->_getConnInstance());
|
||||
}
|
||||
|
||||
function addChart($template){
|
||||
new Chart($template, $this->_getParserInstance());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ class Hum{
|
|||
$i = 1; /* Laufvariable */
|
||||
while($avData['count']<5){ /* Schleife prüft, in welchem Interval 5 Werte zusammenkommen */
|
||||
$i++; /* Laufvariable erhöhen */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*15)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*20)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
}
|
||||
|
||||
/* Werte den Klassenvariablen zuordnen */
|
||||
$this->avVal = $avData['average'];
|
||||
$this->avInter = $i*15;
|
||||
$this->avInter = $i*20;
|
||||
}
|
||||
|
||||
/* Bestimmt die Tendenz */
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ class Press{
|
|||
$i = 1; /* Laufvariable */
|
||||
while($avData['count']<5){ /* Schleife prüft, in welchem Interval 5 Werte zusammenkommen */
|
||||
$i++; /* Laufvariable erhöhen */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*15)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*20)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
}
|
||||
|
||||
/* Werte den Klassenvariablen zuordnen */
|
||||
$this->avVal = $avData['average'];
|
||||
$this->avInter = $i*15;
|
||||
$this->avInter = $i*20;
|
||||
}
|
||||
|
||||
/* Bestimmt die Tendenz */
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ class Temp{
|
|||
$i = 1; /* Laufvariable */
|
||||
while($avData['count']<5){ /* Schleife prüft, in welchem Interval 5 Werte zusammenkommen */
|
||||
$i++; /* Laufvariable erhöhen */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*15)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*20)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
}
|
||||
|
||||
/* Werte den Klassenvariablen zuordnen */
|
||||
$this->avVal = $avData['average'];
|
||||
$this->avInter = $i*15;
|
||||
$this->avInter = $i*20;
|
||||
}
|
||||
|
||||
/* Bestimmt die Tendenz */
|
||||
|
|
|
|||
|
|
@ -134,12 +134,12 @@ class Wind{
|
|||
$i = 1; /* Laufvariable */
|
||||
while($avData['count']<5){ /* Schleife prüft, in welchem Interval 5 Werte zusammenkommen */
|
||||
$i++; /* Laufvariable erhöhen */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*15)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
$avData = $this->_getAverage($sensId, $table, &$connection, ($i*20)." minutes"); /* Holt Werte mit gegebenem Interval */
|
||||
}
|
||||
|
||||
/* Werte den Klassenvariablen zuordnen */
|
||||
$this->avVal = $avData['average'];
|
||||
$this->avInter = $i*15;
|
||||
$this->avInter = $i*20;
|
||||
}
|
||||
|
||||
/* Bestimmt die Tendenz */
|
||||
|
|
@ -152,11 +152,11 @@ class Wind{
|
|||
}
|
||||
$changing = $shortAvData['average'] - $longAvData['average']; /* Aenderung berechnen */
|
||||
if($changing > 0){ /* Wenn Aenderung positiv */
|
||||
$this->changing = "steigend (+ ".abs($changing * 0.1)." hPa)"; /* dann steigende Tendenz ausgeben */
|
||||
$this->changing = "steigend (+ ".abs($changing * 0.1)." <sup>km</sup>/<sub>h</sub>)"; /* dann steigende Tendenz ausgeben */
|
||||
} elseif($changing < 0) { /* wenn Negativ */
|
||||
$this->changing = "fallend (- ".abs($changing * 0.1)." hPa)"; /* Fallende Tendenz ausgeben */
|
||||
$this->changing = "fallend (- ".abs($changing * 0.1)." <sup>km</sup>/<sub>h</sub>)"; /* Fallende Tendenz ausgeben */
|
||||
} else { /* an sonsten */
|
||||
$this->changing = "gleichbleibend (± 0 hPa)"; /* sagen, das es gleich geblieben ist */
|
||||
$this->changing = "gleichbleibend (± 0 <sup>km</sup>/<sub>h</sub>)"; /* sagen, das es gleich geblieben ist */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
<?
|
||||
include_once("php_inc/config.inc.php");
|
||||
|
||||
class Report{
|
||||
|
||||
var $tmplName; /* Template-Id */
|
||||
var $rptName; /* Report-Id */
|
||||
var $rptArray;
|
||||
var $connection; /* Connection - Instanz */
|
||||
var $parserInstance = NULL; /* Parser - Instanz */
|
||||
var $connectionInstance = NULL; /* Connection - Instanz */
|
||||
var $sensInstance = NULL; /* Sensor-Instanz */
|
||||
|
||||
/* Konstruktor */
|
||||
function Report($tplName, &$parser, &$connection){
|
||||
|
||||
/* Klassenvariablen zuordnen */
|
||||
$this->tmplName = $tplName;
|
||||
$this->rptName = $_REQUEST['rptName'];
|
||||
$this->rptArray = Config::getRptArray($this->rptName);
|
||||
$this->connInstance = &$connection;
|
||||
$this->parserInstance = &$parser;
|
||||
|
||||
$parser->parseContent($this->_getRptFilename($tplName), & $this, "top"); /* Oberen Modulrahmen parsen */
|
||||
$this->buildTable();
|
||||
$parser->parseContent($this->_getRptFilename($tplName), & $this, "bottom"); /* unteren Modulrahmen Parsen */
|
||||
}
|
||||
|
||||
/* Dateinamen des Modul-Files zusammenbauen */
|
||||
function _getRptFilename($modName){
|
||||
return "content/reports/rpt_".$modName.".html";
|
||||
}
|
||||
|
||||
|
||||
function buildTable(){
|
||||
|
||||
/* Tabelle des Sensors bestimmen */
|
||||
$tableQuery = "SELECT tabelle FROM sensoren, typen WHERE sensoren.id=".$this->rptArray[2]." AND typen.typ = sensoren.typ";
|
||||
$table = $this->connInstance->fetchQueryResultLine($tableQuery);
|
||||
|
||||
if($this->rptArray[10]){
|
||||
$div = "/count(".$this->rptArray[3].")";
|
||||
} else {
|
||||
$div = "";
|
||||
}
|
||||
|
||||
$result = &$this->connInstance->getRawResult("SELECT to_char(date_trunc('".$this->rptArray[4]."', timestamp), '".$this->rptArray[11]."') as ts, sum(".$this->rptArray[3].")".$div." as val FROM ".$table['tabelle']." WHERE sens_id=".$this->rptArray[2]." AND timestamp > (current_timestamp - INTERVAL '".$this->rptArray[5]."') GROUP BY ts ORDER BY max(timestamp) DESC");
|
||||
|
||||
$buff = '<table class="report_table">';
|
||||
$buff .= '<tr class="report_head"><th class="report_time">Zeit</th><th class="report_val">'.$this->rptArray[6].'</th></tr>';
|
||||
$buff .= "\n";
|
||||
|
||||
$this->parserInstance->appendContent($buff);
|
||||
|
||||
while($array = pg_fetch_assoc($result)){
|
||||
|
||||
$buff = '<tr class="report_line">';
|
||||
|
||||
$buff .= '<td class="report_time">';
|
||||
$buff .= $array['ts'];
|
||||
$buff .= '</td>';
|
||||
|
||||
$buff .= '<td class="report_val">';
|
||||
$buff .= round(($array['val'] * $this->rptArray[7]), 1).$this->rptArray[8];
|
||||
$buff .= '</td>';
|
||||
|
||||
$buff .= '</tr>';
|
||||
|
||||
$buff .= "\n";
|
||||
$this->parserInstance->appendContent($buff);
|
||||
|
||||
}
|
||||
|
||||
$buff = "</table>";
|
||||
$buff .= "\n";
|
||||
|
||||
$this->parserInstance->appendContent($buff);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Ein Modul hinzufügen */
|
||||
function addModule($modName){
|
||||
new Module($this->rptArray[9], $this->rptArray[2], $this->_getParserInstance(), $this->_getConnInstance());
|
||||
}
|
||||
|
||||
/* Callback-Funktion, wird ausgeführt wenn {content:fill:xyz} gefunden wird */
|
||||
function fill($contentId){
|
||||
$content_split = explode("_", $contentId); /* Modultyp bekommen */
|
||||
$callObject = & call_user_method("_get_".$content_split[0], $this); /* Instanz der zum Modul gehörenden Klasse */
|
||||
$funcName = "get".substr($contentId, strlen($content_split[0]), strlen($contentId)-strlen($content_split[0])); /* Namen der In der Instanz aufzurufenden Methode zusammenbauen */
|
||||
|
||||
return $callObject->$funcName($content_split[1]); /* Methode ausführen (Wert holen) und zurückgeben */
|
||||
}
|
||||
|
||||
/* Parser Instanzieren (wenn noch nicht ist) und zurückgeben */
|
||||
function &_getParserInstance(){
|
||||
if($this->parserInstance==NULL)
|
||||
$this->parserInstance = new Parser();
|
||||
return $this->parserInstance;
|
||||
}
|
||||
|
||||
function &_getConnInstance(){
|
||||
if($connInstance == NULL){
|
||||
$this->connInstance = new Connection();
|
||||
}
|
||||
return $this->connInstance;
|
||||
}
|
||||
|
||||
/* Instanz der Sensorklasse holen */
|
||||
function &_get_sens(){
|
||||
if($this->sensInstance == NULL)
|
||||
$this->sensInstance = new Sensor($this->sensId, & $this->connInstance);
|
||||
return $this->sensInstance;
|
||||
}
|
||||
|
||||
function getReportLink($rptName){
|
||||
$rptArray = Config::getRptArray($rptName);
|
||||
|
||||
$buff = '<div class="report_link_div">';
|
||||
|
||||
$buff .= '<a href="';
|
||||
$buff .= $_SERVER['PHP_SELF'].'?setType='.$rptArray[12]."&rptName=".$rptName;
|
||||
$buff .= '" class="report_link">';
|
||||
|
||||
$buff .= $rptArray[0];
|
||||
$buff .= '<p class="report_link_desc">';
|
||||
$buff .= $rptArray[1];
|
||||
$buff .= '</p>';
|
||||
|
||||
$buff .= '</a>';
|
||||
$buff .= '</div>';
|
||||
|
||||
return $buff;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue