[Phphtmllib-devel] SF.net SVN: phphtmllib:[3337] trunk/open2300/lib/modules
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-02-21 22:11:13
|
Revision: 3337 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3337&view=rev Author: hemna Date: 2010-02-21 22:10:59 +0000 (Sun, 21 Feb 2010) Log Message: ----------- added showing graphs on a date Modified Paths: -------------- trunk/open2300/lib/modules/graphs/PressureLineGraph.inc trunk/open2300/lib/modules/graphs/RainLineGraph.inc trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc trunk/open2300/lib/modules/graphs/WindSpeedLineGraph.inc trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php trunk/open2300/lib/modules/graphs/myGraph.inc Added Paths: ----------- trunk/open2300/lib/modules/wxdate/ trunk/open2300/lib/modules/wxdate/page/ trunk/open2300/lib/modules/wxdate/page/WxDate.inc Modified: trunk/open2300/lib/modules/graphs/PressureLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/PressureLineGraph.inc 2010-02-21 19:59:21 UTC (rev 3336) +++ trunk/open2300/lib/modules/graphs/PressureLineGraph.inc 2010-02-21 22:10:59 UTC (rev 3337) @@ -26,7 +26,7 @@ public function load_data() { - $today = date("Y-m-d"); + $today = $this->date; $collection = weatherDataObject::find_all("datetime like :date order by datetime asc", array(':date'=> $today.'%')); $cnt=1; Modified: trunk/open2300/lib/modules/graphs/RainLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/RainLineGraph.inc 2010-02-21 19:59:21 UTC (rev 3336) +++ trunk/open2300/lib/modules/graphs/RainLineGraph.inc 2010-02-21 22:10:59 UTC (rev 3337) @@ -32,7 +32,7 @@ protected $line_color = "red"; public function load_data() { - $today = date("Y-m-d"); + $today = $this->date; $collection = weatherDataObject::find_all("datetime like :date order by datetime asc", array(':date'=> $today.'%')); $offset = 0; Modified: trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2010-02-21 19:59:21 UTC (rev 3336) +++ trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2010-02-21 22:10:59 UTC (rev 3337) @@ -16,7 +16,8 @@ } public function load_data() { - $today = date("Y-m-d"); + $today = $this->date; + Log::singleton()->debug("looking up data for ".$today); $collection = weatherDataObject::find_all("datetime like :date order by datetime asc", array(':date'=> $today.'%')); Modified: trunk/open2300/lib/modules/graphs/WindSpeedLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/WindSpeedLineGraph.inc 2010-02-21 19:59:21 UTC (rev 3336) +++ trunk/open2300/lib/modules/graphs/WindSpeedLineGraph.inc 2010-02-21 22:10:59 UTC (rev 3337) @@ -31,7 +31,7 @@ } public function load_data() { - $today = date("Y-m-d"); + $today = $this->date; $collection = weatherDataObject::find_all("datetime like :date order by datetime asc", array(':date'=> $today.'%')); /** Modified: trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php =================================================================== --- trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php 2010-02-21 19:59:21 UTC (rev 3336) +++ trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php 2010-02-21 22:10:59 UTC (rev 3337) @@ -23,7 +23,7 @@ <line x1='100' y1='250' x2='104' y2='250' thickness='2' color='666666' /><text x='105' y='242' width='30' align='left' size='12' color='999999'>29.5</text><line x1='100' y1='230' x2='104' y2='230' thickness='2' color='666666' /><text x='105' y='222' width='30' align='left' size='12' color='999999'>29.6</text><line x1='100' y1='210' x2='104' y2='210' thickness='2' color='666666' /><text x='105' y='202' width='30' align='left' size='12' color='999999'>29.7</text><line x1='100' y1='190' x2='104' y2='190' thickness='2' color='666666' /><text x='105' y='182' width='30' align='left' size='12' color='999999'>29.8</text><line x1='100' y1='170' x2='104' y2='170' thickness='2' color='666666' /><text x='105' y='162' width='30' align='left' size='12' color='999999'>29.9</text><line x1='100' y1='150' x2='104' y2='150' thickness='2' color='666666' /><text x='105' y='142' width='30' align='left' size='12' color='999999'>30</text><line x1='100' y1='130' x2='104' y2='130' thickness='2' color='666666' /><text x='105' y='122' width='30' align='left' size='12' color='999999'>30.1</text><line x1='100' y1='110' x2='104' y2='110' thickness='2' color='666666' /><text x='105' y='102' width='30' align='left' size='12' color='999999'>30.2</text><line x1='100' y1='89.999999999998' x2='104' y2='89.999999999998' thickness='2' color='666666' /><text x='105' y='81.999999999998' width='30' align='left' size='12' color='999999'>30.3</text><line x1='100' y1='69.999999999997' x2='104' y2='69.999999999997' thickness='2' color='666666' /><text x='105' y='61.999999999997' width='30' align='left' size='12' color='999999'>30.4</text><line x1='32' y1='250' x2='36' y2='250' thickness='2' color='666666' /><text x='0' y='242' width='30' align='right' size='12' color='999999'>29.5</text><line x1='32' y1='230' x2='36' y2='230' thickness='2' color='666666' /><text x='0' y='222' width='30' align='right' size='12' color='999999'>29.6</text><line x1='32' y1='210' x2='36' y2='210' thickness='2' color='666666' /><text x='0' y='202' width='30' align='right' size='12' color='999999'>29.7</text><line x1='32' y1='190' x2='36' y2='190' thickness='2' color='666666' /><text x='0' y='182' width='30' align='right' size='12' color='999999'>29.8</text><line x1='32' y1='170' x2='36' y2='170' thickness='2' color='666666' /><text x='0' y='162' width='30' align='right' size='12' color='999999'>29.9</text><line x1='32' y1='150' x2='36' y2='150' thickness='2' color='666666' /><text x='0' y='142' width='30' align='right' size='12' color='999999'>30</text><line x1='32' y1='130' x2='36' y2='130' thickness='2' color='666666' /><text x='0' y='122' width='30' align='right' size='12' color='999999'>30.1</text><line x1='32' y1='110' x2='36' y2='110' thickness='2' color='666666' /><text x='0' y='102' width='30' align='right' size='12' color='999999'>30.2</text><line x1='32' y1='89.999999999998' x2='36' y2='89.999999999998' thickness='2' color='666666' /><text x='0' y='81.999999999998' width='30' align='right' size='12' color='999999'>30.3</text><line x1='32' y1='69.999999999997' x2='36' y2='69.999999999997' thickness='2' color='666666' /><text x='0' y='61.999999999997' width='30' align='right' size='12' color='999999'>30.4</text> <!-- barometer pointer animated only if pressure has changed --> - <scale x='44' y='250' start_scale='29.5' end_scale='41.1' direction='vertical' step='1' shake_span='0' shake_frequency='0' shadow_alpha='0'> + <scale x='44' y='250' start_scale='29.5' end_scale='25' direction='vertical' step='1' shake_span='0' shake_frequency='0' shadow_alpha='0'> <rect x='44' y='50' width='48' height='200' fill_color='82827D' /> </scale> @@ -41,7 +41,7 @@ <line x1='92' y1='251' x2='96' y2='251' thickness='2' color='82827D' /> </move> - <update url='/index.php?target=my-pressure-flash-gauge' delay='300' delay_type='1' /> + <update url='/index.php?target=my-pressure-flash-gauge' delay='10' delay_type='1' /> </gauge> EOL; Modified: trunk/open2300/lib/modules/graphs/myGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/myGraph.inc 2010-02-21 19:59:21 UTC (rev 3336) +++ trunk/open2300/lib/modules/graphs/myGraph.inc 2010-02-21 22:10:59 UTC (rev 3337) @@ -4,16 +4,23 @@ */ abstract class myGraph { + + protected $date = null; /** * Class Constructor * */ - public function __construct() { - + public function __construct() { //do the nasty includes? include ("external/jpgraph-2.2/src/jpgraph.php"); $this->init_includes(); + + $this->date = Request::singleton()->get("date", date("Y-m-d")); + if (empty($this->date) || is_null($this->date)) { + $this->date = date("Y-m-d"); + } + $this->load_data(); } Added: trunk/open2300/lib/modules/wxdate/page/WxDate.inc =================================================================== --- trunk/open2300/lib/modules/wxdate/page/WxDate.inc (rev 0) +++ trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-02-21 22:10:59 UTC (rev 3337) @@ -0,0 +1,87 @@ +<?php +/** + * This file is responsible for displaying the + * weather on a specific date (in the past). + * + */ + + +class WxDate extends open2300Page { + + private $wx = null; + private $wxdate = null; + + function __construct() { + parent::__construct('Hemna WX Station'); + + $this->wxdate = Request::singleton()->get("date", date("Y-m-d")); + //Log::singleton()->debug("use date of ".$this->wxdate); + } + + + /** + * We override this method to automatically + * break up the main block into a + * left block and a right block + * + * @param TABLEtag object. + */ + protected function main_block() { + + $main = new DIVtag(array("id" => "centercontent", + "style" => "width: 510px; margin-left: auto; margin-right:auto;")); + + + $table = TABLEtag::factory("100%", 0); + + $table->add_row( TDtag::factory("rightblock", "", $this->content_block() )); + + $table->add_row(new TDtag(array("colspan"=> 2), + $this->footer_block())); + $main->add( $table ); + + return $main; + } + + /** + * build the main content for the page + * and return it all inside a container object + * + * @param Container object + */ + function content_block() { + //add some graphs + $right_div = new DIVtag(array('id' => '')); + $url = RequestBuilder::build_url("TempDewPointLineGraph", array("date"=> $this->wxdate)); + //Log::Singleton()->debug("temp graph of ".$url); + $img = IMGtag::factory($url); + $img->set_id('idTempDewLineGraph'); + $right_div->add(new DIVtag(array('id' => 'idTempDewLineGraphdiv', 'style'=> 'padding-top:0px;padding-bottom:5px;height:201px;'), $img)); + + $pressure_img = IMGtag::factory(RequestBuilder::build_url('PressureLineGraph', array("date"=> $this->wxdate))); + $pressure_img->set_id('idPressureLineGraph'); + $right_div->add(new DIVtag(array('id' => 'idPressureLineGraphdiv', 'style'=> 'padding-top:5px;padding-bottom:5px;height:201px;'),$pressure_img)); + + $wind_img = IMGtag::factory(RequestBuilder::build_url('WindSpeedLineGraph', array("date"=> $this->wxdate))); + $wind_img->set_id('idWindSpeedLineGraph'); + $right_div->add(new DIVtag(array('id' => 'idWindSpeedLineGraphdiv', 'style'=> 'padding-top:5px;padding-bottom:5px;height:201px;'),$wind_img)); + + $rain_img = IMGtag::factory(RequestBuilder::build_url('RainLineGraph', array("date"=> $this->wxdate))); + $rain_img->set_id('idRainLineGraph'); + $right_div->add(new DIVtag(array('id' => 'idRainLineGraphdiv', 'style'=> 'padding-top:5px;padding-bottom:5px;height:201px;'),$rain_img)); + + $this->add_js_link('/js/lightview/lightview.js'); + $this->add_css_link('/css/lightview/lightview.css'); + + $c = new Container(); + $c->add( H3tag::factory("Weather on ".date("l M d, Y", strtotime($this->wxdate))), + Brtag::factory(1), $right_div ); + + return $c; + +// $table = TABLEtag::factory("100%",0,0,0); +// $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:510px;'),$right_div)); +// return $table; + } +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |