From: Christian Weiske Date: Mon, 31 Oct 2011 19:33:05 +0000 (+0100) Subject: (html) file generator X-Git-Tag: v1.0.0~16 X-Git-Url: https://git.cweiske.de/usb-wde1-tools.git/commitdiff_plain/133a6dff495236e2d3a4eb70081ddb1448765625 (html) file generator --- diff --git a/htmlreport/.gitignore b/htmlreport/.gitignore new file mode 100644 index 0000000..2ea1723 --- /dev/null +++ b/htmlreport/.gitignore @@ -0,0 +1,2 @@ +config.php +testdata diff --git a/htmlreport/config.php.dist b/htmlreport/config.php.dist new file mode 100644 index 0000000..0720e33 --- /dev/null +++ b/htmlreport/config.php.dist @@ -0,0 +1,22 @@ + 'Schlafzimmer', + 1 => 'Wohnzimmer', + 2 => 'Buero', + 3 => 'Aussen', + 4 => 'Bad', + 5 => 'Kinderzimmer', + 6 => 'Kueche', +); +?> \ No newline at end of file diff --git a/htmlreport/gen-html.php b/htmlreport/gen-html.php new file mode 100644 index 0000000..f495622 --- /dev/null +++ b/htmlreport/gen-html.php @@ -0,0 +1,36 @@ + $name) { + $data[$id]['name'] = $name; + foreach (array('humidity', 'temperature') as $item) { + $lu = rrd_lastupdate( + str_replace( + array('{item}', '{id}'), + array($item, $id), + $filetemplate + ) + ); + if ($lu === false) { + throw new Exception(rrd_error()); + } + + $data[$id][$item] = reset($lu['data']); + } +} + +foreach (glob(__DIR__ . '/templates/*.php') as $tplfile) { + $outfile = $outdir . basename($tplfile, '.php'); + ob_start(); + include $tplfile; + $content = ob_get_contents(); + ob_end_clean(); + file_put_contents($outfile, $content); +} +?> \ No newline at end of file diff --git a/htmlreport/templates/plain.txt.php b/htmlreport/templates/plain.txt.php new file mode 100644 index 0000000..0881184 --- /dev/null +++ b/htmlreport/templates/plain.txt.php @@ -0,0 +1,21 @@ +Zimmer Temperatur Luftfeuchte +------------------------------------------- +