Thread: [Phphtmllib-devel] SF.net SVN: phphtmllib:[3179] trunk/open2300/lib/modules
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2008-11-07 06:39:57
|
Revision: 3179 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3179&view=rev Author: hemna Date: 2008-11-07 06:39:50 +0000 (Fri, 07 Nov 2008) Log Message: ----------- added Added Paths: ----------- trunk/open2300/lib/modules/api/ trunk/open2300/lib/modules/api/RemoteUpdate.inc Added: trunk/open2300/lib/modules/api/RemoteUpdate.inc =================================================================== --- trunk/open2300/lib/modules/api/RemoteUpdate.inc (rev 0) +++ trunk/open2300/lib/modules/api/RemoteUpdate.inc 2008-11-07 06:39:50 UTC (rev 3179) @@ -0,0 +1,43 @@ +<?php +/** + * This is a target that + * is called to add a new entry to the + * database from a remote wx box. + */ + +class RemoteUpdate extends Container { + + function __construct() { + + } + + function render($indent_level=0, $output_debug=0) { + $GLOBALS['log']->debug('RemoteUpdate called'); + $r = Request::singleton(); + + //first lets make sure we don't already have this entry + //in the db + $datetime = $r->get('datetime'); + if (!is_null($datetime)) { + $wx = weatherDataObject::find("datetime = :time", array(":time"=> $datetime)); + $GLOBALS['log']->debug('RemoteUpdate -- Dupe.'); + return "Duplicate"; + } + + $wx = new weatherDataObject(); + $meta = $wx->get_meta_data(); + + foreach($meta as $key => $val) { + //look for the request var + $method = "set_".$key; + $r_val = $r->get($key); + call_user_method($method, $wx, $r_val); + } + + //now save it to the db + $wx->save(); + $GLOBALS['log']->debug('RemoteUpdate -- saved new entry.'); + + } +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-03-01 21:10:37
|
Revision: 3231 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3231&view=rev Author: hemna Date: 2009-03-01 21:10:28 +0000 (Sun, 01 Mar 2009) Log Message: ----------- size changes Modified Paths: -------------- trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc trunk/open2300/lib/modules/home/page/HomePage.inc Modified: trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc 2009-03-01 21:07:42 UTC (rev 3230) +++ trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc 2009-03-01 21:10:28 UTC (rev 3231) @@ -67,7 +67,7 @@ public function render() { // Create the graph. These two calls are always required - $graph = new Graph(400,200,"auto"); + $graph = new Graph(450,200,"auto"); $graph->img->SetImgFormat('gif'); $graph->SetScale("datlin"); Modified: trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2009-03-01 21:07:42 UTC (rev 3230) +++ trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2009-03-01 21:10:28 UTC (rev 3231) @@ -33,7 +33,7 @@ public function render() { // Create the graph. These two calls are always required - $graph = new Graph(400,200,"auto"); + $graph = new Graph(450,200,"auto"); $graph->img->SetImgFormat('gif'); $graph->SetScale("datlin"); //$graph->SetY2Scale("lin"); Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-03-01 21:07:42 UTC (rev 3230) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-03-01 21:10:28 UTC (rev 3231) @@ -80,7 +80,7 @@ $table = TABLEtag::factory("100%",0,0,10); - $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:410px;'),$right_div), + $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:460px;'),$right_div), new TDtag(array('style' => 'vertical-align:top;'),$radar_div)); return $table; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-03-01 21:12:25
|
Revision: 3232 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3232&view=rev Author: hemna Date: 2009-03-01 21:12:16 +0000 (Sun, 01 Mar 2009) Log Message: ----------- size changes Modified Paths: -------------- trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc trunk/open2300/lib/modules/home/page/HomePage.inc Modified: trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2009-03-01 21:10:28 UTC (rev 3231) +++ trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2009-03-01 21:12:16 UTC (rev 3232) @@ -33,7 +33,7 @@ public function render() { // Create the graph. These two calls are always required - $graph = new Graph(450,200,"auto"); + $graph = new Graph(480,200,"auto"); $graph->img->SetImgFormat('gif'); $graph->SetScale("datlin"); //$graph->SetY2Scale("lin"); Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-03-01 21:10:28 UTC (rev 3231) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-03-01 21:12:16 UTC (rev 3232) @@ -73,14 +73,14 @@ $right_div->add(new DIVtag(array('id' => 'idRainLineGraphdiv', 'style'=> 'padding-top:5px;padding-bottom:5px;height:201px;'),$rain_img)); $radar_img = IMGtag::factory("http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=DAX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.172&noclutter=0&t=1235925219&lat=38.81977081&lon=-121.02596283&label=Pilot+Hill%2C+CA&showstorms=0&map.x=400&map.y=240¢erx=21¢ery=408&transx=-379&transy=168&showlabels=1&severe=0&rainsnow=0&lightning=0&smooth=0", - 410,300); + 440,300); $radar_img->set_id('idRadarImg'); $radar_div = new DIVtag(array('id' => 'idRadardiv'),$radar_img); $table = TABLEtag::factory("100%",0,0,10); - $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:460px;'),$right_div), + $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:480px;'),$right_div), new TDtag(array('style' => 'vertical-align:top;'),$radar_div)); return $table; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-03-01 21:14:13
|
Revision: 3233 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3233&view=rev Author: hemna Date: 2009-03-01 21:13:56 +0000 (Sun, 01 Mar 2009) Log Message: ----------- sizes Modified Paths: -------------- trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc trunk/open2300/lib/modules/graphs/SingleDataDateScatterGraph.inc trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc trunk/open2300/lib/modules/home/page/HomePage.inc Modified: trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc 2009-03-01 21:12:16 UTC (rev 3232) +++ trunk/open2300/lib/modules/graphs/SingleDataDateLineGraph.inc 2009-03-01 21:13:56 UTC (rev 3233) @@ -67,7 +67,7 @@ public function render() { // Create the graph. These two calls are always required - $graph = new Graph(450,200,"auto"); + $graph = new Graph(510,200,"auto"); $graph->img->SetImgFormat('gif'); $graph->SetScale("datlin"); Modified: trunk/open2300/lib/modules/graphs/SingleDataDateScatterGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/SingleDataDateScatterGraph.inc 2009-03-01 21:12:16 UTC (rev 3232) +++ trunk/open2300/lib/modules/graphs/SingleDataDateScatterGraph.inc 2009-03-01 21:13:56 UTC (rev 3233) @@ -55,7 +55,7 @@ public function render() { // Create the graph. These two calls are always required - $graph = new Graph(400,200,"auto"); + $graph = new Graph(510,200,"auto"); $graph->img->SetImgFormat('gif'); $graph->SetScale("datlin"); //$graph->SetTickDensity(TICKD_DENSE, TICKD_VERYSPARSE); Modified: trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc =================================================================== --- trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2009-03-01 21:12:16 UTC (rev 3232) +++ trunk/open2300/lib/modules/graphs/TempDewPointLineGraph.inc 2009-03-01 21:13:56 UTC (rev 3233) @@ -33,7 +33,7 @@ public function render() { // Create the graph. These two calls are always required - $graph = new Graph(480,200,"auto"); + $graph = new Graph(510,200,"auto"); $graph->img->SetImgFormat('gif'); $graph->SetScale("datlin"); //$graph->SetY2Scale("lin"); Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-03-01 21:12:16 UTC (rev 3232) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-03-01 21:13:56 UTC (rev 3233) @@ -73,14 +73,14 @@ $right_div->add(new DIVtag(array('id' => 'idRainLineGraphdiv', 'style'=> 'padding-top:5px;padding-bottom:5px;height:201px;'),$rain_img)); $radar_img = IMGtag::factory("http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=DAX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.172&noclutter=0&t=1235925219&lat=38.81977081&lon=-121.02596283&label=Pilot+Hill%2C+CA&showstorms=0&map.x=400&map.y=240¢erx=21¢ery=408&transx=-379&transy=168&showlabels=1&severe=0&rainsnow=0&lightning=0&smooth=0", - 440,300); + 460,320); $radar_img->set_id('idRadarImg'); $radar_div = new DIVtag(array('id' => 'idRadardiv'),$radar_img); - $table = TABLEtag::factory("100%",0,0,10); + $table = TABLEtag::factory("100%",0,0,5); - $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:480px;'),$right_div), + $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:510px;'),$right_div), new TDtag(array('style' => 'vertical-align:top;'),$radar_div)); return $table; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-10-14 07:33:25
|
Revision: 3261 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3261&view=rev Author: hemna Date: 2009-10-14 07:33:16 +0000 (Wed, 14 Oct 2009) Log Message: ----------- added rain gauges Modified Paths: -------------- trunk/open2300/lib/modules/graphs/gauge/myHumidityFlashGauge.php trunk/open2300/lib/modules/graphs/gauge/myTemperatureFlashGauge.php trunk/open2300/lib/modules/home/page/HomePage.inc Added Paths: ----------- trunk/open2300/lib/modules/graphs/gauge/myRainFlashGauge.php Modified: trunk/open2300/lib/modules/graphs/gauge/myHumidityFlashGauge.php =================================================================== --- trunk/open2300/lib/modules/graphs/gauge/myHumidityFlashGauge.php 2009-10-14 02:14:47 UTC (rev 3260) +++ trunk/open2300/lib/modules/graphs/gauge/myHumidityFlashGauge.php 2009-10-14 07:33:16 UTC (rev 3261) @@ -10,8 +10,8 @@ protected $data_object; public function __construct() { - parent::__construct(); - $this->xml = <<<EOL + parent::__construct(); + $this->xml = <<<EOL <gauge> <!-- humidity design --> @@ -51,7 +51,7 @@ //var_dump($today); //$today = "2009-02-15"; $this->date = $today; - $this->do = weatherDataObject::find("1=1 order by datetime desc"); + $this->do = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); $this->getMinMaxHumidity($today); } Added: trunk/open2300/lib/modules/graphs/gauge/myRainFlashGauge.php =================================================================== --- trunk/open2300/lib/modules/graphs/gauge/myRainFlashGauge.php (rev 0) +++ trunk/open2300/lib/modules/graphs/gauge/myRainFlashGauge.php 2009-10-14 07:33:16 UTC (rev 3261) @@ -0,0 +1,83 @@ +<?php + +class myRainFlashGauge extends myFlashGauge { + + + protected $xml = ""; + + protected $date; + + protected $data_object; + + protected $mode = ""; + protected $rain_amount = 0; + + public function __construct() { + parent::__construct(); + + $this->xml = <<<EOL +<gauge> + + <!-- rain gauge design --> + <rect x='40' y='46' width='56' height='208' fill_color='000066' line_thickness='8' line_color='333333' /> + <text x='0' y='0' width='136' size='14' align='center' color='999999'>XX_DESC_XX</text> + <text x='12' y='26' width='200' size='14' color='cccccc'>in in</text> + +<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'>0</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'>1</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'>2</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'>3</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'>4</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'>5</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'>6</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'>7</text><line x1='100' y1='90' x2='104' y2='90' thickness='2' color='666666' /><text x='105' y='82' width='30' align='left' size='12' color='999999'>8</text><line x1='100' y1='70' x2='104' y2='70' thickness='2' color='666666' /><text x='105' y='62' width='30' align='left' size='12' color='999999'>9</text><line x1='100' y1='50' x2='104' y2='50' thickness='2' color='666666' /><text x='105' y='42' width='30' align='left' size='12' color='999999'>10</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'>0</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'>1</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'>2</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'>3</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'>4</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'>5</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'>6</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'>7</text><line x1='32' y1='90' x2='36' y2='90' thickness='2' color='666666' /><text x='0' y='82' width='30' align='right' size='12' color='999999'>8</text><line x1='32' y1='70' x2='36' y2='70' thickness='2' color='666666' /><text x='0' y='62' width='30' align='right' size='12' color='999999'>9</text><line x1='32' y1='50' x2='36' y2='50' thickness='2' color='666666' /><text x='0' y='42' width='30' align='right' size='12' color='999999'>10</text> + + <!-- rain gauge pointer animated only if rainfall has changed--> + <scale x='44' y='250' start_scale='0' end_scale='XX_VAL_XX' direction='vertical' step='1' shake_span='0' shake_frequency='0' shadow_alpha='0'> + <rect x='44' y='50' width='48' height='200' fill_color='0000ff' /> + </scale> + + <!-- current rainfall text --> + <text x='40' y='260' width='56' size='14' align='center' color='cccccc'>XX_CURR_XXin</text> + + <update url='/index.php?target=my-rain-flash-gauge&mode=XX_MODE_XX' delay='10' delay_type='1' /> + +</gauge> +EOL; + + } + + protected function load_data() { + $this->mode = Request::singleton()->get("mode"); + + $today = date("Y-m-d"); + $current_do = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); + + switch ($this->mode) { + case "1hr": + $this->rain_amount = $current_do->get_rain_1h(); + $this->desc = "1 H R R A I N"; + break; + + case "24hr": + $this->rain_amount = $current_do->get_rain_24h(); + $this->desc = "24 H R R A I N"; + break; + + case "total": + $this->rain_amount = $current_do->get_rain_total(); + $this->desc = "Y E A R R A I N"; + break; + } + } + + + protected function translate_num($num) { + $absolute_low = -1; + $absolute_high = -200; + return (-10*$num); + } + + public function render() { + $search_arr = array("XX_CURR_XX", "XX_VAL_XX", "XX_MODE_XX", "XX_DESC_XX"); + $replace_arr = array($this->rain_amount, $this->translate_num($this->rain_amount), + $this->mode, $this->desc); + + $output = str_replace($search_arr, $replace_arr, $this->xml); + echo $output; + } +} +?> \ No newline at end of file Modified: trunk/open2300/lib/modules/graphs/gauge/myTemperatureFlashGauge.php =================================================================== --- trunk/open2300/lib/modules/graphs/gauge/myTemperatureFlashGauge.php 2009-10-14 02:14:47 UTC (rev 3260) +++ trunk/open2300/lib/modules/graphs/gauge/myTemperatureFlashGauge.php 2009-10-14 07:33:16 UTC (rev 3261) @@ -71,7 +71,7 @@ //var_dump($today); //$today = "2009-02-15"; $this->date = $today; - $this->do = weatherDataObject::find("1=1 order by datetime desc"); + $this->do = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); $this->getMinMaxTemps($today); } Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-10-14 02:14:47 UTC (rev 3260) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-10-14 07:33:16 UTC (rev 3261) @@ -88,8 +88,81 @@ return $container; } + + protected function get_rain_div() { + $rain_div = new DIVtag(array('id'=> 'idRain','style'=> 'padding-top:5px;')); + + $rain_div->add('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" + WIDTH="140" + HEIGHT="300" + id="gauge" /> +<PARAM NAME="movie" VALUE="/flash/gauge.swf?xml_source=index.php?target=my-rain-flash-gauge%26mode%3D1hr" /> +<PARAM NAME="quality" VALUE="high" /> +<PARAM NAME="bgcolor" VALUE="#000000" /> +<param name="allowScriptAccess" value="sameDomain" /> +<EMBED src="/flash/gauge.swf?xml_source=index.php?target=my-rain-flash-gauge%26mode%3D1hr" + quality="high" + bgcolor="#000000" + WIDTH="140" + HEIGHT="300" + NAME="gauge" + allowScriptAccess="sameDomain" + swLiveConnect="true" + TYPE="application/x-shockwave-flash" + PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> +</EMBED> +</OBJECT> +<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" + WIDTH="140" + HEIGHT="300" + id="gauge" /> +<PARAM NAME="movie" VALUE="/flash/gauge.swf?xml_source=index.php?target=my-rain-flash-gauge%26mode%3D24hr" /> +<PARAM NAME="quality" VALUE="high" /> +<PARAM NAME="bgcolor" VALUE="#000000" /> +<param name="allowScriptAccess" value="sameDomain" /> +<EMBED src="/flash/gauge.swf?xml_source=index.php?target=my-rain-flash-gauge%26mode%3D24hr" + quality="high" + bgcolor="#000000" + WIDTH="140" + HEIGHT="300" + NAME="gauge" + allowScriptAccess="sameDomain" + swLiveConnect="true" + TYPE="application/x-shockwave-flash" + PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> +</EMBED> +</OBJECT> +<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" + WIDTH="140" + HEIGHT="300" + id="gauge" /> +<PARAM NAME="movie" VALUE="/flash/gauge.swf?xml_source=index.php?target=my-rain-flash-gauge%26mode%3Dtotal" /> +<PARAM NAME="quality" VALUE="high" /> +<PARAM NAME="bgcolor" VALUE="#000000" /> +<param name="allowScriptAccess" value="sameDomain" /> +<EMBED src="/flash/gauge.swf?xml_source=index.php?target=my-rain-flash-gauge%26mode%3Dtotal" + quality="high" + bgcolor="#000000" + WIDTH="140" + HEIGHT="300" + NAME="gauge" + allowScriptAccess="sameDomain" + swLiveConnect="true" + TYPE="application/x-shockwave-flash" + PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> +</EMBED> +</OBJECT> + '); + + return $rain_div; + } + + /** * build the main content for the page * and return it all inside a container object @@ -121,11 +194,13 @@ $radar_img->set_id('idRadarImg'); $radar_div = new DIVtag(array('id' => 'idRadardiv'),$radar_img); + + $rain_div = $this->get_rain_div(); $table = TABLEtag::factory("100%",0,0,0); $table->add_row(new TDtag(array('style' => 'vertical-align:top;width:510px;'),$right_div), - new TDtag(array('style' => 'vertical-align:top;padding-left:8px;'),$radar_div)); + new TDtag(array('style' => 'vertical-align:top;padding-left:8px;'),$radar_div, $rain_div)); return $table; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <he...@us...> - 2010-02-22 08:11:31
|
Revision: 3357 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3357&view=rev Author: hemna Date: 2010-02-22 08:11:24 +0000 (Mon, 22 Feb 2010) Log Message: ----------- menu Modified Paths: -------------- trunk/open2300/lib/modules/home/page/HomePage.inc trunk/open2300/lib/modules/wxdate/page/WxDate.inc Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2010-02-22 07:23:50 UTC (rev 3356) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2010-02-22 08:11:24 UTC (rev 3357) @@ -25,9 +25,8 @@ protected function main_block() { - $main = new DIVtag(array("id" => "maincontent", + $main = new DIVtag(array("id" => self::ID_BODY, "style" => "width: 1400px; margin-left: auto; margin-right:auto;")); - $main->set_id("maincontent"); $table = TABLEtag::factory("100%", 0); @@ -51,7 +50,7 @@ $script->add("Event.observe(window, 'load', start_updates);"); $container->add($script); - $this->add_js_link("/js/cal.js"); + //$this->add_js_link("/js/cal.js"); $left_div = new DIVtag(array('id'=> '')); Modified: trunk/open2300/lib/modules/wxdate/page/WxDate.inc =================================================================== --- trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-02-22 07:23:50 UTC (rev 3356) +++ trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-02-22 08:11:24 UTC (rev 3357) @@ -27,9 +27,8 @@ protected function main_block() { - $main = new DIVtag(array("id" => "maincontent", + $main = new DIVtag(array("id" => self::ID_BODY, "style" => "width: 810px; margin-left: auto; margin-right:auto;")); - $main->set_id("maincontent"); $table = TABLEtag::factory("100%", 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-03-03 18:06:39
|
Revision: 3410 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3410&view=rev Author: hemna Date: 2010-03-03 18:06:33 +0000 (Wed, 03 Mar 2010) Log Message: ----------- updates to pull out debug code Modified Paths: -------------- trunk/open2300/lib/modules/api/RemoteUpdate.inc trunk/open2300/lib/modules/home/widgets/CurrentConditions.inc trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc Modified: trunk/open2300/lib/modules/api/RemoteUpdate.inc =================================================================== --- trunk/open2300/lib/modules/api/RemoteUpdate.inc 2010-03-03 17:13:33 UTC (rev 3409) +++ trunk/open2300/lib/modules/api/RemoteUpdate.inc 2010-03-03 18:06:33 UTC (rev 3410) @@ -12,7 +12,7 @@ } function render($indent_level=0, $output_debug=0) { - $GLOBALS['log']->debug('RemoteUpdate called'); + //$GLOBALS['log']->debug('RemoteUpdate called'); $r = Request::singleton(); //first lets make sure we don't already have this entry @@ -46,8 +46,7 @@ //now save it to the db $wx->save(); - $GLOBALS['log']->debug('RemoteUpdate -- saved new entry.'); - + //$GLOBALS['log']->debug('RemoteUpdate -- saved new entry.'); } } ?> \ No newline at end of file Modified: trunk/open2300/lib/modules/home/widgets/CurrentConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/CurrentConditions.inc 2010-03-03 17:13:33 UTC (rev 3409) +++ trunk/open2300/lib/modules/home/widgets/CurrentConditions.inc 2010-03-03 18:06:33 UTC (rev 3410) @@ -1,142 +1,141 @@ <?php /** - * This file contains the CurrentConditions + * This file contains the CurrentConditions * widget class. */ - + class CurrentConditions extends AjaxableHTMLWidget { - - /** - * This contains the current - * weatherDataObject for - * the conditions that you want to display - * - * @var weatherDataObject - */ - protected $wx; - - protected $rain_total; - - protected $temp_low_high = array("low" => 0, + + /** + * This contains the current + * weatherDataObject for + * the conditions that you want to display + * + * @var weatherDataObject + */ + protected $wx; + + protected $rain_total; + + protected $temp_low_high = array("low" => 0, "high" => 0); - /** - * Class Constructor - * - */ - public function __construct(weatherDataObject $wx=null) { - $log = Log::singleton(); - parent::__construct(); - if ($wx == null) { - //we don't have the current conditions. - //we need to get them - $this->wx = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); - } else { - $this->wx = $wx; - } - - //load min max temps - $db = open2300DB::singleton(); - $today = date("Y-m-d"); - $stmt = $db->queryBindOneRowCache("Select min(temp_out) as low, max(temp_out) as high from weather where datetime like :date", - array(":date" => $today.'%')); - $this->temp_low_high["low"] = $stmt->low; - $this->temp_low_high["high"] = $stmt->high; - - $year = date("Y"); - $stmt = $db->queryBindOneRowCache("Select rain_total from weather where datetime like :date order by datetime asc limit 0,1", - array(":date" => $year.'%')); - $year_rain_start = $stmt->rain_total; - - $this->rain_total = sprintf("%0.2f", $this->wx->get_rain_total() - $year_rain_start); + /** + * Class Constructor + * + */ + public function __construct(weatherDataObject $wx=null) { + $log = Log::singleton(); + parent::__construct(); + if ($wx == null) { + //we don't have the current conditions. + //we need to get them + $this->wx = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); + } else { + $this->wx = $wx; + } - //get the peak winds - //$db->set_debug_flag(true); - $sql = "select datetime,wind_speed, wind_angle, wind_direction from weather where ". + //load min max temps + $db = open2300DB::singleton(); + $today = date("Y-m-d"); + $stmt = $db->queryBindOneRowCache("Select min(temp_out) as low, max(temp_out) as high from weather where datetime like :date", + array(":date" => $today.'%')); + $this->temp_low_high["low"] = $stmt->low; + $this->temp_low_high["high"] = $stmt->high; + + $year = date("Y"); + $stmt = $db->queryBindOneRowCache("Select rain_total from weather where datetime like :date order by datetime asc limit 0,1", + array(":date" => $year.'%')); + $year_rain_start = $stmt->rain_total; + + $this->rain_total = sprintf("%0.2f", $this->wx->get_rain_total() - $year_rain_start); + + //get the peak winds + //$db->set_debug_flag(true); + $sql = "select datetime,wind_speed, wind_angle, wind_direction from weather where ". "wind_speed = (select max(wind_speed) from weather where datetime like :date) ". "and datetime like :date2"; - $stmt = $db->queryBindOneRow($sql, - array(":date" => $today.'%', - ":date2" => $today.'%')); - $log->debug(var_export($stmt,true)); - $this->peak_wind['speed'] = $stmt->wind_speed; - $this->peak_wind['angle'] = $stmt->wind_angle; - $this->peak_wind['direction'] = $stmt->wind_direction; - $this->peak_wind['time'] = substr($stmt->datetime,10); - $log->debug("peak wind was ".$stmt->wind_speed); - } - - public function get_content() { - - $div = new DIVtag(array('id'=>$this->get_ajax_replacement_divid().'contents')); + $stmt = $db->queryBindOneRow($sql, + array(":date" => $today.'%', ":date2" => $today.'%')); + //$log->debug(var_export($stmt,true)); + $this->peak_wind['speed'] = $stmt->wind_speed; + $this->peak_wind['angle'] = $stmt->wind_angle; + $this->peak_wind['direction'] = $stmt->wind_direction; + $this->peak_wind['time'] = substr($stmt->datetime,10); + //$log->debug("peak wind was ".$stmt->wind_speed); + } - //build the title - //$title = DIVtag::factory('cctitle', Atag::factory(AjaxRequestBuilder::build_replace_url('CurrentConditions', array(), $this->get_ajax_replacement_divid()), 'Current Conditions', 'linkrefresh')); - $title = DIVtag::factory('cctitle', "Current Conditions -- Updated : ", new SPANtag(array('id' => 'idUpdateSeconds'),'')); - $div->add($title); - - //now add the update block - $update_div = new DIVtag(array('id' => 'idcclastupdate'), $this->wx->get_datetime()); - $div->add($update_div); - - - $table = TABLEtag::factory("100%",0,2); - $outside_temp = $this->wx->get_temp_out(); - $table->add_row(new TDtag(array("width" => "120"),"Outside :"), - new DIVtag(array('style' => 'text-align:center; padding-top:2px;height:75px; background-color:#ffffcc;'), - new SPANtag(array('id' => 'idTempF', 'style' => 'font-weight:bold;'),$outside_temp)," F / ", - new SPANtag(array('id' => 'idTempC','style' => 'font-weight:bold;'),WXConversion::fahrenheit_to_celsius($outside_temp)),' C / ', - new SPANtag(array('id' => 'idTempK','style' => 'font-weight:bold;'),WXConversion::fahrenheit_to_kelvin($outside_temp)), " K", - BRtag::factory(), $this->wx->get_forecast(), - new DIVtag(array('style' => 'padding-top:5px;'), 'Feels like '.$this->wx->get_wind_chill()." F"), - new DIVtag(array('style' => 'padding-top:5px;'), $this->temp_low_high["low"].' F / '.$this->temp_low_high["high"].' F Low/High'))); - - $table->add_row("Relative Humidity : ", $this->wx->get_rel_hum_out().' %'); - - //wind - $table->add_row("Wind : ",new TDtag(array(), SPANtag::factory('',"From the ".$this->wx->get_wind_direction()." ".$this->wx->get_wind_speed().'mph@'.$this->wx->get_wind_angle()), - $this->get_wind_angle_image($this->wx->get_wind_angle()), - SPANtag::factory('',"Peak winds ".$this->peak_wind['direction']." ".$this->peak_wind['speed'].'mph@'.$this->peak_wind['angle']." ".$this->peak_wind['time']))); - - $table->add_row(" ", " "); - $pressure = $this->wx->get_rel_pressure(); - $table->add_row("Pressure : ", $pressure. ' inHG / '.WXConversion::inchmercury_to_millibars($pressure). ' mbar'); - - - $table->add_row('Rainfall : ',$this->wx->get_rain_1h().'"/ '.$this->wx->get_rain_24h().'" / '.$this->rain_total.'"<br>'. + public function get_content() { + + $div = new DIVtag(array('id'=>$this->get_ajax_replacement_divid().'contents')); + + //build the title + //$title = DIVtag::factory('cctitle', Atag::factory(AjaxRequestBuilder::build_replace_url('CurrentConditions', array(), $this->get_ajax_replacement_divid()), 'Current Conditions', 'linkrefresh')); + $title = DIVtag::factory('cctitle', "Current Conditions -- Updated : ", new SPANtag(array('id' => 'idUpdateSeconds'),'')); + $div->add($title); + + //now add the update block + $update_div = new DIVtag(array('id' => 'idcclastupdate'), $this->wx->get_datetime()); + $div->add($update_div); + + + $table = TABLEtag::factory("100%",0,2); + $outside_temp = $this->wx->get_temp_out(); + $table->add_row(new TDtag(array("width" => "120"),"Outside :"), + new DIVtag(array('style' => 'text-align:center; padding-top:2px;height:75px; background-color:#ffffcc;'), + new SPANtag(array('id' => 'idTempF', 'style' => 'font-weight:bold;'),$outside_temp)," F / ", + new SPANtag(array('id' => 'idTempC','style' => 'font-weight:bold;'),WXConversion::fahrenheit_to_celsius($outside_temp)),' C / ', + new SPANtag(array('id' => 'idTempK','style' => 'font-weight:bold;'),WXConversion::fahrenheit_to_kelvin($outside_temp)), " K", + BRtag::factory(), $this->wx->get_forecast(), + new DIVtag(array('style' => 'padding-top:5px;'), 'Feels like '.$this->wx->get_wind_chill()." F"), + new DIVtag(array('style' => 'padding-top:5px;'), $this->temp_low_high["low"].' F / '.$this->temp_low_high["high"].' F Low/High'))); + + $table->add_row("Relative Humidity : ", $this->wx->get_rel_hum_out().' %'); + + //wind + $table->add_row("Wind : ",new TDtag(array(), SPANtag::factory('',"From the ".$this->wx->get_wind_direction()." ".$this->wx->get_wind_speed().'mph@'.$this->wx->get_wind_angle()), + $this->get_wind_angle_image($this->wx->get_wind_angle()), + SPANtag::factory('',"Peak winds ".$this->peak_wind['direction']." ".$this->peak_wind['speed'].'mph@'.$this->peak_wind['angle']." ".$this->peak_wind['time']))); + + $table->add_row(" ", " "); + $pressure = $this->wx->get_rel_pressure(); + $table->add_row("Pressure : ", $pressure. ' inHG / '.WXConversion::inchmercury_to_millibars($pressure). ' mbar'); + + + $table->add_row('Rainfall : ',$this->wx->get_rain_1h().'"/ '.$this->wx->get_rain_24h().'" / '.$this->rain_total.'"<br>'. ' 1hr / 24hrs / total.'); - - $table->add_row(" ", " "); - $inside_temp = $this->wx->get_temp_in(); - $table->add_row('Inside : ', $inside_temp." F / ". WXConversion::fahrenheit_to_celsius($inside_temp).'C / '.WXConversion::fahrenheit_to_kelvin($inside_temp). " K");; - - - $div->add($table); - - //$div->add(new DIVtag(array('style' => 'padding-top:10px;background-color: #aaaaaa;'),$this->wx)); - - $script = SCRIPTtag::factory(); - $ts = time(); - $script->add("set_orig_time_ts(".$ts.");"); - - //$div->add($script); - return $div; - } - - - protected function get_wind_angle_image($angle) { - - //calculate the offset to the image from the angle. - if ($angle == 360) { - $angle = 0; - } - - $offset = -1*round($angle) * 14; - $img = new IMGtag(array('id' => 'idWindArrow', 'style' => 'overflow: hidden; left: '.$offset.'px; position: relative;', + + $table->add_row(" ", " "); + $inside_temp = $this->wx->get_temp_in(); + $table->add_row('Inside : ', $inside_temp." F / ". WXConversion::fahrenheit_to_celsius($inside_temp).'C / '.WXConversion::fahrenheit_to_kelvin($inside_temp). " K");; + + + $div->add($table); + + //$div->add(new DIVtag(array('style' => 'padding-top:10px;background-color: #aaaaaa;'),$this->wx)); + + $script = SCRIPTtag::factory(); + $ts = time(); + $script->add("set_orig_time_ts(".$ts.");"); + + //$div->add($script); + return $div; + } + + + protected function get_wind_angle_image($angle) { + + //calculate the offset to the image from the angle. + if ($angle == 360) { + $angle = 0; + } + + $offset = -1*round($angle) * 14; + $img = new IMGtag(array('id' => 'idWindArrow', 'style' => 'overflow: hidden; left: '.$offset.'px; position: relative;', 'src' =>'/images/360arrows_blue.gif')); - return new DIVtag(array('id' => 'idWindArrowDiv', 'style' => 'position:relative;overflow:hidden;top:1px;left:1px;width:14px;height:14px;'), $img); - } + return new DIVtag(array('id' => 'idWindArrowDiv', 'style' => 'position:relative;overflow:hidden;top:1px;left:1px;width:14px;height:14px;'), $img); + } } ?> Modified: trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc 2010-03-03 17:13:33 UTC (rev 3409) +++ trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc 2010-03-03 18:06:33 UTC (rev 3410) @@ -52,17 +52,17 @@ $proxy = $GLOBALS["config"]->get("proxy"); if (!empty($proxy)) { - $context = stream_context_create(array("http" => array("proxy" => "tcp://web-proxy.rose.hp.com:8088"))); + $context = stream_context_create(array("http" => array("proxy" => "tcp://".$proxy))); } else { $context = null; } $json = file_get_contents($this->url,0, $context); - Log::singleton()->debug("json returned is ".$json); + //Log::singleton()->debug("json returned is ".$json); $metar = json_decode($json); //echo var_export($metar, true)."\n"; $metar->season = "Spring"; - Log::singleton()->debug(var_export($metar, true)); + //Log::singleton()->debug(var_export($metar, true)); $conditions = array(); $conditions["season"] = $GLOBALS["config"]->get("season"); @@ -70,7 +70,7 @@ $conditions["clouds"] = $clouds; $rained = $this->has_rained(); $conditions["rained"] = $rained; - $conditions["banner"] = $this->get_banner_filename($conditions["season"], $clouds, $rained); + $conditions = $this->get_banner_filename(&$conditions, $rained); return $conditions; //return $metar; @@ -137,7 +137,9 @@ } - private function get_banner_filename($season, $clouds, $rain, $offset=null) { + private function get_banner_filename($conditions, $rain, $offset=null) { + $season = $conditions["season"]; + $clouds = $conditions["clouds"]; $tod = $this->get_time_of_day($offset); //echo (var_export($tod, true)."\n"); $filename = "/images/banners/".$season."/".$tod."_"; @@ -148,11 +150,12 @@ $filename .= $clouds.".jpg"; } - //echo var_export($filename, true)."\n"; + $conditions["filename"] = $filename; if (file_exists($GLOBALS['path_base']."/htdocs".$filename)) { - return $filename; + $conditions["banner"] = "yes"; } else { - return null; + $conditions["banner"] = "no"; + Log::singleton()->debug("Need banner image ".$filename); // if (!is_null($offset)) { // $offset += 1; // } else { @@ -160,6 +163,7 @@ // } // return $this->get_banner_filename($season, $clouds, $rain, $offset); } + return $conditions; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |