charts added to webfrontend
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@114 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
cac1a73c77
commit
504ee3b339
|
|
@ -0,0 +1,9 @@
|
|||
{content:part:top}
|
||||
<!--Modul Begin-->
|
||||
<div class="chart">
|
||||
{content:part:end}
|
||||
|
||||
{content:part:bottom}
|
||||
</div>
|
||||
<!--Modul End-->
|
||||
{content:part:end}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<h3 class="mod_headline">Statistik:</h3>
|
||||
{content:insertChart:auto}
|
||||
|
|
@ -25,3 +25,12 @@
|
|||
</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:temp_test}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = '<div class="chart_link_div">';
|
||||
|
||||
$buff .= '<a href="';
|
||||
$buff .= $_SERVER['PHP_SELF'].'?setType='.$chartArray[4]."&chartName=".$chartName;
|
||||
$buff .= '" class="chart_link">';
|
||||
|
||||
$buff .= $chartArray[1];
|
||||
$buff .= '<p class="chart_link_desc">';
|
||||
$buff .= $chartArray[2];
|
||||
|
||||
if ($chartArray[3] == null){
|
||||
$buff .= '<img class="chart_link_prev" width="250" height="100" src="';
|
||||
$buff .= Chart::_getChartImgLink($chartArray[0]);
|
||||
$buff .= '">';
|
||||
} else {
|
||||
$buff .= '<img class="chart_link_prev" width="250" height="100" src="';
|
||||
$buff .= Chart::_getChartImgLink($chartArray[3]);
|
||||
$buff .= '">';
|
||||
}
|
||||
$buff .= '</p>';
|
||||
|
||||
$buff .= '</a>';
|
||||
$buff .= '</div>';
|
||||
return $buff;
|
||||
}
|
||||
|
||||
function _getChartImgLink($img_filename){
|
||||
return Config::getDefaultChartDir().$img_filename;
|
||||
}
|
||||
|
||||
function _getChartImgTag($chartName){
|
||||
$chartArray = Config::getChartArray($chartName);
|
||||
|
||||
$buff = '<img class="chart_img" src="';
|
||||
$buff .= Chart::_getChartImgLink($chartArray[0]);
|
||||
$buff .= '">';
|
||||
|
||||
return $buff;
|
||||
}
|
||||
|
||||
function insertChart($chartName){
|
||||
if($chartName == "auto"){
|
||||
$chartName = $_REQUEST['chartName'];
|
||||
}
|
||||
return Chart::_getChartImgTag($chartName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -7,6 +7,23 @@
|
|||
|
||||
/* Default-Werte */
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -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 = '<div class="back_link_div">';
|
||||
$buff .= '<a class="back_link" href="';
|
||||
$buff .= $_SERVER['HTTP_REFERER'];
|
||||
$buff .= '">';
|
||||
$buff .= 'zurück';
|
||||
$buff .= "</a>";
|
||||
$buff .= "</div>";
|
||||
|
||||
return $buff;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue