diff --git a/webstuff/frontend/content/charts/chart_frame.html b/webstuff/frontend/content/charts/chart_frame.html
new file mode 100644
index 0000000..e3102de
--- /dev/null
+++ b/webstuff/frontend/content/charts/chart_frame.html
@@ -0,0 +1,9 @@
+{content:part:top}
+
+
+{content:part:end}
+
+{content:part:bottom}
+
+
+{content:part:end}
diff --git a/webstuff/frontend/content/charts/chart_only.html b/webstuff/frontend/content/charts/chart_only.html
new file mode 100644
index 0000000..39d8d87
--- /dev/null
+++ b/webstuff/frontend/content/charts/chart_only.html
@@ -0,0 +1,2 @@
+Statistik:
+{content:insertChart:auto}
diff --git a/webstuff/frontend/content/modules/mod_temp.html b/webstuff/frontend/content/modules/mod_temp.html
index 12c0d1c..76bdf6f 100644
--- a/webstuff/frontend/content/modules/mod_temp.html
+++ b/webstuff/frontend/content/modules/mod_temp.html
@@ -25,3 +25,12 @@
+
+
+
Statistik
+
+
+ | 10 Tage | {content:addChartLink:temp_test} |
+
+
+
diff --git a/webstuff/frontend/css/example.css b/webstuff/frontend/css/example.css
index 36fb793..6ae4fed 100644
--- a/webstuff/frontend/css/example.css
+++ b/webstuff/frontend/css/example.css
@@ -1,8 +1,9 @@
body {
background: #FFFAF5;
+ padding-bottom: 150px;
}
-div.module {
+div.module, div.chart {
border-color: #006600;
border-style: solid;
border-width: 1px;
@@ -76,3 +77,67 @@ div.module p.mod_description {
font-weight: 600;
font-size: 10pt;
}
+
+div.module div.mod_subsec div.chart_link_div a.chart_link {
+ color: #666666;
+ font-weight: 300;
+ text-decoration: none;
+ position: relative;
+}
+
+div.module div.mod_subsec div.chart_link_div a.chart_link p.chart_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 {
+ top: 5px;
+ left: 5px;
+ visibility: visible;
+ margin-left: 5px;
+ background: #fafafa;
+ border: 1px solid #aa8888;
+ width: 250px;
+ color: #aa8888;
+ padding: 10px;
+ line-height:1.2em;
+ text-align: left;
+ font-variant: normal;
+ font-style: normal;
+ text-decoration: none;
+ z-index: 300;
+}
+
+div.module div.mod_subsec div.chart_link_div a.chart_link img.chart_link_prev {
+ margin-top: 5px;
+}
+
+div.back_link_div {
+ background: #fafafa;
+ border: 1px solid #aa8888;
+ position: absolute;
+ /*width: 80px;
+ height: 20px;*/
+ padding: 3px;
+ margin:5px;
+ left: 0px;
+ bottom: 0px:
+}
+
+div.back_link_div a.back_link {
+ color: #aa8888;
+ line-height:1.2em;
+ text-align: left;
+ font-variant: normal;
+ font-style: normal;
+ text-decoration: none;
+}
+
+div.chart {
+overflow:auto;
+ padding:10px;
+ text-align: center;
+ width: 820px;
+
+}
diff --git a/webstuff/frontend/php_inc/chart.inc.php b/webstuff/frontend/php_inc/chart.inc.php
new file mode 100644
index 0000000..29c0d0a
--- /dev/null
+++ b/webstuff/frontend/php_inc/chart.inc.php
@@ -0,0 +1,68 @@
+
+include_once("php_inc/config.inc.php");
+
+class Chart{
+
+ function Chart($template, &$parser){
+ $parser->parseContent($this->_getTemplateFileName("frame"), & $this, "top"); /* Oberen Modulrahmen parsen */
+ $parser->parseContent($this->_getTemplateFileName($template), & $this, NULL); /* Modul Parsen */
+ $parser->parseContent($this->_getTemplateFileName("frame"), & $this, "bottom"); /* unteren Modulrahmen Parsen */
+ }
+
+ function _getTemplateFileName($template_name){
+ return "content/charts/chart_".$template_name.".html";
+ }
+
+ function generateChartLink($chartName){
+ $chartArray = Config::getChartArray($chartName);
+
+ $buff = '';
+
+ $buff .= '
';
+
+ return $buff;
+ }
+
+ function insertChart($chartName){
+ if($chartName == "auto"){
+ $chartName = $_REQUEST['chartName'];
+ }
+ return Chart::_getChartImgTag($chartName);
+ }
+
+}
+
+?>
diff --git a/webstuff/frontend/php_inc/config.inc.php b/webstuff/frontend/php_inc/config.inc.php
index e713123..13fe9d1 100644
--- a/webstuff/frontend/php_inc/config.inc.php
+++ b/webstuff/frontend/php_inc/config.inc.php
@@ -6,7 +6,24 @@
$pg_pass = "";
/* Default-Werte */
- $default_set = "test";
+ $default_set = "test";
+ $default_chart_dir = "images/chart/";
+
+
+
+/* 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")
+);
+
+
+
+
+
/* Config-Klasse, Bitte nicht ändern! */
class Config{
@@ -21,5 +38,14 @@ class Config{
return $default_set;
}
+ function getChartArray($chartId){
+ global $cImg;
+ return $cImg[$chartId];
+ }
+
+ function getDefaultChartDir(){
+ global $default_chart_dir;
+ return $default_chart_dir;
+ }
}
?>
diff --git a/webstuff/frontend/php_inc/module.inc.php b/webstuff/frontend/php_inc/module.inc.php
index ef36ab0..2eb94f9 100644
--- a/webstuff/frontend/php_inc/module.inc.php
+++ b/webstuff/frontend/php_inc/module.inc.php
@@ -1,5 +1,6 @@
include_once("php_inc/parser.inc.php"); /* Parser */
+include_once("php_inc/chart.inc.php"); /* Chart */
include_once("php_inc/modules/sensor.inc.php"); /* Sensor-Klasse */
include_once("php_inc/modules/temp.inc.php"); /* Temp-Klasse */
include_once("php_inc/modules/rain.inc.php"); /* Rain-Klasse */
@@ -92,10 +93,18 @@ class Module{
return $callObject->$funcName($content_split[1]); /* Methode ausführen (Wert holen) und zurückgeben */
}
+ function addChartLink($chartName){
+ return Chart::generateChartLink($chartName.'_'.$this->sensId);
+ }
+
function getModId($type){
if($type == "css")
return $this->modName."_".$this->sensId;
}
+ function addChart($chartName){
+ Chart::insertChart($chartName);
+ }
+
}
?>
diff --git a/webstuff/frontend/php_inc/module_set.inc.php b/webstuff/frontend/php_inc/module_set.inc.php
index 6ad109b..4f5cdcd 100644
--- a/webstuff/frontend/php_inc/module_set.inc.php
+++ b/webstuff/frontend/php_inc/module_set.inc.php
@@ -3,6 +3,7 @@ include_once("php_inc/module.inc.php");
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");
/* Klasse, die die ModuleSets Verwaltet */
@@ -15,6 +16,10 @@ class ModuleSet{
$parser = & $this->_getParserInstance(); /* Parserinstanz holen */
$parser->parseContent($this->_getSetFilename($setName), &$this, NULL); /* Set Parsen */
+ if($_REQUEST['chartName'] != ""){
+ $parser->appendContent($this->getBackLink());
+ }
+
$parser->printContent();
if ($this->connInstance != NULL){
@@ -48,5 +53,21 @@ class ModuleSet{
$params = explode("_",$modName); /* Modulname und Sensorid trennen */
new Module($params[0], $params[1], $this->_getParserInstance(), $this->_getConnInstance());
}
+
+ function addChart($template){
+ new Chart($template, $this->_getParserInstance());
+ }
+
+ function getBackLink(){
+ $buff = '";
+
+ return $buff;
+ }
}
?>