diff --git a/webstuff/frontend/content/modules/mod_temp.html b/webstuff/frontend/content/modules/mod_temp.html
index 9988222..9afb5ac 100644
--- a/webstuff/frontend/content/modules/mod_temp.html
+++ b/webstuff/frontend/content/modules/mod_temp.html
@@ -1,23 +1,23 @@
-
Temparatur - {content:fill:pre:location}
-{content:fill:pre:description}
+Temparatur - {content:fill:sens_location}
+{content:fill:sens_description}
Momentane Werte
- | Momentan: | {content:fill:pre:temp_now_val} | {content:fill:pre:temp_now_date} |
+ Momentan: | {content:fill:temp_now_val} | {content:fill:temp_now_date} |
- | Durchschnitt (halbe std.): | {content:fill:pre:temp_av_value} | |
+ Durchschnitt (halbe std.): | {content:fill:temp_av_value} | |
- | Tendenz (2 std.): | {content:fill:pre:temp_changing} | |
+ Tendenz (2 std.): | {content:fill:temp_changing} | |
Extrema
- | Max: | {content:fill:pre:temp_max_val} | {content:fill:pre:temp_max_date} |
+ Max: | {content:fill:temp_max_val} | {content:fill:temp_max_date} |
- | Min: | {content:fill:pre:temp_min_val} | {content:fill:pre:temp_min_date} |
+ Min: | {content:fill:temp_min_val} | {content:fill:temp_min_date} |
diff --git a/webstuff/frontend/php_inc/module.inc.php b/webstuff/frontend/php_inc/module.inc.php
index ea5c8f9..1bdb566 100644
--- a/webstuff/frontend/php_inc/module.inc.php
+++ b/webstuff/frontend/php_inc/module.inc.php
@@ -1,22 +1,50 @@
include_once("php_inc/parser.inc.php");
+include_once("php_inc/sensor.inc.php");
+include_once("php_inc/temp.inc.php");
class Module{
+ var $sensId; /* Sensor-Id */
+ var $connection; /* Connection - Instanz */
var $parserInstance = NULL; /* Parser - Instanz */
var $connectionInstance = NULL; /* Connection - Instanz */
+ var $sensInstance = NULL; /* Sensor-Instanz */
+ var $tempInstance = NULL; /* Temp-Instanz */
+
function Module($modName, $sensId, $parser, $connection){
- $parser->parseContent($this->_getModuleFilename($modName));
+ $this->$sensId = $sensId;
+ $this->$connection = $connection;
+
+ $parser->parseContent($this->_getModuleFilename("frame"), $this, "top");
+ $parser->parseContent($this->_getModuleFilename($modName), $this, NULL);
+ $parser->parseContent($this->_getModuleFilename("frame"), $this, "bottom");
}
function _getModuleFilename($modName){
- return "/content/modules/mod_".$modName.".html";
+ return "content/modules/mod_".$modName.".html";
+ }
+
+ function _get_sens(){
+ if($sensInstance == NULL)
+ $this->$sensInstance = new Sensor($this->$sensId, $this->$connection);
+ return $this->$sensInstance;
+ }
+
+ function _get_temp(){
+ if($tempInstance == NULL)
+ $this->$tempInstance = new Temp($this->$sensId, $this->$connection);
+ return $this->$tempInstance;
}
function fill($contentId){
$content_split = explode("_", $contentId);
- return $this->"get".$content_split[0]($content_split[1])
+ $callObject = call_user_method("_get_".$content_split[0], $this);
+ $funcName = "get".substr($contentId, strlen($content_split[0]), strlen($contentId)-strlen($content_split[0]));
+
+ echo "\n\naufruf: ".$funcName."()\n\n";
+ return $callObject->$funcName($content_split[1]);
}
}
diff --git a/webstuff/frontend/php_inc/module_set.inc.php b/webstuff/frontend/php_inc/module_set.inc.php
index f0ae15a..1d07acd 100644
--- a/webstuff/frontend/php_inc/module_set.inc.php
+++ b/webstuff/frontend/php_inc/module_set.inc.php
@@ -12,6 +12,9 @@ class ModuleSet{
function ModuleSet($setName){
$parser = $this->_getParserInstance(); /* Parserinstanz holen */
$parser->parseContent($this->_getSetFilename($setName), $this, NULL); /* Set Parsen */
+
+ echo "\n\n";
+ $parser->printContent();
}
/* Dateinamen eines Setz aus dessen Namen zusammenbauen */
@@ -21,15 +24,20 @@ class ModuleSet{
/* Parser Instanzieren (wenn noch nicht ist) und zurückgeben */
function _getParserInstance(){
- if($this->parserInstance==NULL)
- $parserInstance = new Parser();
- return $parserInstance;
+ if($this->$parserInstance==NULL)
+ $this->$parserInstance = new Parser();
+ return $this->$parserInstance;
+ }
+
+ function _getConnInstance(){
+ // TODO: Muss noch Implementiert werden!!
+ return $connInstance;
}
/* Ein Modul hinzufügen */
- function _addModule($modName){
+ function addModule($modName){
$params = explode("_",$modName); /* Modulname und Sensorid trennen */
- include("content/modules/mod_".$params[0].".html");
+ new Module($params[0], $params[1], $this->_getParserInstance(), $this->_getConnInstance());
}
}
?>
diff --git a/webstuff/frontend/php_inc/parser.inc.php b/webstuff/frontend/php_inc/parser.inc.php
index 49d0bd3..e22f932 100644
--- a/webstuff/frontend/php_inc/parser.inc.php
+++ b/webstuff/frontend/php_inc/parser.inc.php
@@ -14,7 +14,9 @@ class Parser{
function appendContent($newContent){
if(is_array($newContent)){
for($i = 0; $i < count($newContent); $i++){
+ echo "adding: ".$newContent[$i]."\n";
array_push($this->contentArray, $newContent[$i]);
+ echo "added: ".$this->contentArray[count($this->contentArray)-1]."\n";
}
} else {
array_push($this->contentArray, $newContent);
@@ -23,6 +25,8 @@ class Parser{
/* Zeigt den Geparsten Inhalt an */
function printContent(){
+ echo "\n ---- Printing ----\n";
+ echo "";
$array = &$this->getContentArray();
for ($i = 0; $i < count($array); $i++){
echo $array[$i];
@@ -31,20 +35,22 @@ class Parser{
function parseContent($fileName, $callingObject, $filePart=null){
+ echo "\n\nparse: ".$fileName."\n\n";
$fileArray = file($fileName); /* File als Array einlesen */
if($filePart != null){
$fileArray = $this->_fetchFilePart(&$fileArray, $filePart); /* Wenn File aus mehreren Template-Teilen besteht, dann wird hir der relevante Zeil geholt */
}
for($i = 0; $i < count($fileArray); $i++){ /* Das Array durchlaufen ... */
+ echo "Zeile: ".$i." = ".$fileArray[$i]."\n";
if(0 != preg_match_all("/\{content:([a-z]+):([a-z0-9_]+)\}/i", $fileArray[$i], $results)){
- print_r($results);
+ //print_r($results);
for($j = 0; $j < count($results[1]); $j++){
$callingObject->$results[1][$j]($results[2][$j]);
//$fileArray[$i] = preg_replace("/\{content:fill:".$results[1][$j]."\}/i", $fileContents[$results[1][$j]], $fileArray[$i]);
}
}
}
- //$this->appendContent($fileArray);
+ $this->appendContent($fileArray);
}