Thread: [Phphtmllib-devel] SF.net SVN: phphtmllib:[3196] trunk/open2300/lib
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2008-11-07 19:56:45
|
Revision: 3196 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3196&view=rev Author: hemna Date: 2008-11-07 19:56:41 +0000 (Fri, 07 Nov 2008) Log Message: ----------- updated target ids Modified Paths: -------------- trunk/open2300/lib/autoload.inc trunk/open2300/lib/modules/home/widgets/MetarTextCurrentConditions.inc trunk/open2300/lib/modules/home/widgets/TextCurrentConditions.inc Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2008-11-07 19:55:15 UTC (rev 3195) +++ trunk/open2300/lib/autoload.inc 2008-11-07 19:56:41 UTC (rev 3196) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2008-11-07T11:53:26-08:00 by AutoloadGenerator + * Generated on 2008-11-07T11:56:01-08:00 by AutoloadGenerator * * @package open2300 */ @@ -289,8 +289,8 @@ 'tab-list'=>'TabList', 'tab-w'=>'TabWidget', 'temp-dew-point-line-graph'=>'TempDewPointLineGraph', +'text'=>'TextCurrentConditions', 'text-c-s-s-nav'=>'TextCSSNav', -'text-current-conditions'=>'TextCurrentConditions', 'text-nav'=>'TextNav', 'tree-item-w'=>'TreeItemWidget', 'vertical-c-s-s-nav-table'=>'VerticalCSSNavTable', @@ -360,8 +360,8 @@ 'TabList'=>'tab-list', 'TabWidget'=>'tab-w', 'TempDewPointLineGraph'=>'temp-dew-point-line-graph', +'TextCurrentConditions'=>'text', 'TextCSSNav'=>'text-c-s-s-nav', -'TextCurrentConditions'=>'text-current-conditions', 'TextNav'=>'text-nav', 'TreeItemWidget'=>'tree-item-w', 'VerticalCSSNavTable'=>'vertical-c-s-s-nav-table', Modified: trunk/open2300/lib/modules/home/widgets/MetarTextCurrentConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/MetarTextCurrentConditions.inc 2008-11-07 19:55:15 UTC (rev 3195) +++ trunk/open2300/lib/modules/home/widgets/MetarTextCurrentConditions.inc 2008-11-07 19:56:41 UTC (rev 3196) @@ -8,6 +8,10 @@ class MetarTextCurrentConditions extends Container { + /** + * the object's controller target + * + */ const ID="metar"; /** Modified: trunk/open2300/lib/modules/home/widgets/TextCurrentConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/TextCurrentConditions.inc 2008-11-07 19:55:15 UTC (rev 3195) +++ trunk/open2300/lib/modules/home/widgets/TextCurrentConditions.inc 2008-11-07 19:56:41 UTC (rev 3196) @@ -8,6 +8,12 @@ class TextCurrentConditions extends AjaxableHTMLWidget { + /** + * the object's controller target + * + */ + const ID="text"; + /** * This contains the current * weatherDataObject for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-02-17 15:09:04
|
Revision: 3216 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3216&view=rev Author: hemna Date: 2009-02-17 15:09:02 +0000 (Tue, 17 Feb 2009) Log Message: ----------- updated includes for OFC Modified Paths: -------------- trunk/open2300/lib/autoload.inc trunk/open2300/lib/init.inc Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2009-02-17 15:08:01 UTC (rev 3215) +++ trunk/open2300/lib/autoload.inc 2009-02-17 15:09:02 UTC (rev 3216) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2008-11-07T11:56:01-08:00 by AutoloadGenerator + * Generated on 2009-02-16T09:43:30-08:00 by AutoloadGenerator * * @package open2300 */ @@ -173,6 +173,7 @@ 'MessageBoxOKCancel'=>'external/phphtmllib/src/widgets/MessageBoxOKCancel.inc', 'MessageBoxWidget'=>'external/phphtmllib/src/widgets/MessageBoxWidget.inc', 'MetarTextCurrentConditions'=>'modules/home/widgets/MetarTextCurrentConditions.inc', +'myFlashGraph'=>'modules/graphs/flash/myFlashGraph.inc', 'myGraph'=>'modules/graphs/myGraph.inc', 'NavTable'=>'external/phphtmllib/src/widgets/NavTable.inc', 'NavTableCSS'=>'external/phphtmllib/src/widgets/css/NavTableCSS.inc', @@ -216,6 +217,7 @@ 'TabList'=>'external/phphtmllib/src/widgets/TabList.inc', 'TabListCSS'=>'external/phphtmllib/src/widgets/css/TabListCSS.inc', 'TabWidget'=>'external/phphtmllib/src/widgets/TabWidget.inc', +'TempDewPointLineFlashGraph'=>'modules/graphs/flash/TempDewPointLineFlashGraph.inc', 'TempDewPointLineGraph'=>'modules/graphs/TempDewPointLineGraph.inc', 'TextCSSNav'=>'external/phphtmllib/src/widgets/TextCSSNav.inc', 'TextCSSNavCSS'=>'external/phphtmllib/src/widgets/css/TextCSSNavCSS.inc', @@ -288,6 +290,7 @@ 'tab-control-w'=>'TabControlWidget', 'tab-list'=>'TabList', 'tab-w'=>'TabWidget', +'temp-dew-point-line-flash-graph'=>'TempDewPointLineFlashGraph', 'temp-dew-point-line-graph'=>'TempDewPointLineGraph', 'text'=>'TextCurrentConditions', 'text-c-s-s-nav'=>'TextCSSNav', @@ -359,6 +362,7 @@ 'TabControlWidget'=>'tab-control-w', 'TabList'=>'tab-list', 'TabWidget'=>'tab-w', +'TempDewPointLineFlashGraph'=>'temp-dew-point-line-flash-graph', 'TempDewPointLineGraph'=>'temp-dew-point-line-graph', 'TextCurrentConditions'=>'text', 'TextCSSNav'=>'text-c-s-s-nav', Modified: trunk/open2300/lib/init.inc =================================================================== --- trunk/open2300/lib/init.inc 2009-02-17 15:08:01 UTC (rev 3215) +++ trunk/open2300/lib/init.inc 2009-02-17 15:09:02 UTC (rev 3216) @@ -16,7 +16,13 @@ $GLOBALS['path_lib'] = $GLOBALS['path_base'].'/lib'; $GLOBALS['path_external'] = $GLOBALS['path_base'].'/lib/external'; +//used for the OFC classes +$ofc_path = $GLOBALS['path_external'].'/open-flash-chart2/php5-ofc-library/lib'; +$include_path = ini_get('include_path'); +$include_path .= ':'.realpath($ofc_path); +ini_set('include_path', $include_path); + /******************* EXCEPTION HANDLER **************************/ function exception_handler($exception) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-10-14 16:31:44
|
Revision: 3269 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3269&view=rev Author: hemna Date: 2009-10-14 16:31:36 +0000 (Wed, 14 Oct 2009) Log Message: ----------- added pressure graph Modified Paths: -------------- trunk/open2300/lib/autoload.inc Added Paths: ----------- trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2009-10-14 16:23:14 UTC (rev 3268) +++ trunk/open2300/lib/autoload.inc 2009-10-14 16:31:36 UTC (rev 3269) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2009-10-13T23:49:20-07:00 by AutoloadGenerator + * Generated on 2009-10-14T09:29:30-07:00 by AutoloadGenerator * * @package open2300 */ @@ -177,6 +177,7 @@ 'myFlashGraph'=>'modules/graphs/flash/myFlashGraph.inc', 'myGraph'=>'modules/graphs/myGraph.inc', 'myHumidityFlashGauge'=>'modules/graphs/gauge/myHumidityFlashGauge.php', +'myPressureFlashGauge'=>'modules/graphs/gauge/myPressureFlashGauge.php', 'myRainFlashGauge'=>'modules/graphs/gauge/myRainFlashGauge.php', 'myTemperatureFlashGauge'=>'modules/graphs/gauge/myTemperatureFlashGauge.php', 'NavTable'=>'external/phphtmllib/src/widgets/NavTable.inc', @@ -279,6 +280,7 @@ 'message-box-w'=>'MessageBoxWidget', 'metar'=>'MetarTextCurrentConditions', 'my-humidity-flash-gauge'=>'myHumidityFlashGauge', +'my-pressure-flash-gauge'=>'myPressureFlashGauge', 'my-rain-flash-gauge'=>'myRainFlashGauge', 'my-temperature-flash-gauge'=>'myTemperatureFlashGauge', 'nav-table'=>'NavTable', @@ -355,6 +357,7 @@ 'MessageBoxWidget'=>'message-box-w', 'MetarTextCurrentConditions'=>'metar', 'myHumidityFlashGauge'=>'my-humidity-flash-gauge', +'myPressureFlashGauge'=>'my-pressure-flash-gauge', 'myRainFlashGauge'=>'my-rain-flash-gauge', 'myTemperatureFlashGauge'=>'my-temperature-flash-gauge', 'NavTable'=>'nav-table', Added: trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php =================================================================== --- trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php (rev 0) +++ trunk/open2300/lib/modules/graphs/gauge/myPressureFlashGauge.php 2009-10-14 16:31:36 UTC (rev 3269) @@ -0,0 +1,99 @@ +<?php + +class myPressureFlashGauge extends myFlashGauge { + + + protected $xml = ""; + + protected $date; + + protected $data_object; + + public function __construct() { + parent::__construct(); + $this->xml = <<<EOL + +<gauge> + + <!-- barometer design --> + <rect x='40' y='46' width='56' height='208' fill_color='42423D' line_thickness='8' line_color='333333' /> + <text x='0' y='0' width='136' size='14' align='center' color='999999'>P R E S S U R E</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'>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'> + <rect x='44' y='50' width='48' height='200' fill_color='82827D' /> + </scale> + + <!-- current temp text --> + <text x='30' y='260' width='76' size='14' align='center' color='cccccc'>29.911in</text> + + <!-- high / low watermarks animated only if pressure has changed --> + + <move start_y_offset='0' end_y_offset='-82.2' shake_frequency='0'> + <line x1='40' y1='251' x2='44' y2='251' thickness='2' color='82827D' /> + <line x1='92' y1='251' x2='96' y2='251' thickness='2' color='82827D' /> + </move> + <move start_y_offset='0' end_y_offset='-34.8' shake_frequency='0'> + <line x1='40' y1='251' x2='44' y2='251' thickness='2' color='82827D' /> + <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' /> + +</gauge> +EOL; + } + + protected function load_data() { + $today = date("Y-m-d"); + //var_dump($today); + //$today = "2009-02-15"; + $this->date = $today; + $this->do = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); + + $this->getMinMaxHumidity($today); + } + + protected function getMinMaxPressure($today = null) { + if ($today == null) { + $today = $today = date("Y-m-d"); + } + $stmt = $this->db->queryBindOneRowCache("Select min(rel_pressure) as low, max(rel_pressure) as high from weather where datetime like :date", + array(":date" => $today.'%')); + $this->low_high["low"] = $stmt->low; + $this->low_high["high"] = $stmt->high; + + return $this->temp_low_high; + } + + protected function get_high() { + $high = $this->low_high["high"]; + + return $this->translate_num($high); + } + + protected function get_low() { + $low = $this->low_high["low"]; + + return $this->translate_num($low); + } + + protected function translate_num($num) { + $absolute_low = -1; + $absolute_high = -200; + + return (-2*$num); + } + + public function render() { + $search_arr = array("XX_CURR_XX", "XX_HIGH_XX", "XX_LOW_XX"); + $replace_arr = array($this->do->get_rel_pressure(), $this->get_high(), $this->get_low()); + + $output = str_replace($search_arr, $replace_arr, $this->xml); + echo $output; + } +} +?> \ 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-24 02:08:05
|
Revision: 3363 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3363&view=rev Author: hemna Date: 2010-02-24 02:07:59 +0000 (Wed, 24 Feb 2010) Log Message: ----------- fixed menus Modified Paths: -------------- trunk/open2300/lib/core/page/open2300Page.inc trunk/open2300/lib/modules/home/page/HomePage.inc trunk/open2300/lib/modules/wxdate/page/WxDate.inc Modified: trunk/open2300/lib/core/page/open2300Page.inc =================================================================== --- trunk/open2300/lib/core/page/open2300Page.inc 2010-02-24 02:07:07 UTC (rev 3362) +++ trunk/open2300/lib/core/page/open2300Page.inc 2010-02-24 02:07:59 UTC (rev 3363) @@ -40,6 +40,8 @@ * Where the nav blocks go */ const ID_NAV = 'leftBlock'; + + protected $centering_width = "500px"; /** * This is the constructor. @@ -123,13 +125,18 @@ } protected function header_block() { - $header = new DIVtag(array('id' => 'pageheader')); + $header = new Container(); $header->add( new DIVtag(array('id' => 'idPageHeadText'),"Hemna's Weather Station"), - new DIVtag(array('id' => 'idPageSubHeadText'),"Pilot Hill, CA"), - new DIVtag(array('id' => self::ID_MENU), $this->menu_block()) ); + new DIVtag(array('id' => 'idPageSubHeadText'),"Pilot Hill, CA") + ); - return $header; + $table = TABLEtag::factory("1024",0,0,0,"center"); + + $table->add_row(new TDtag(array("id" => "pageheader"), + $header)); + $table->add_row(new TDtag(array('id' => self::ID_MENU), $this->menu_block())); + return $table; } /** @@ -159,8 +166,8 @@ */ protected function main_block() { - $main = new DIVtag(); - $main->set_id(self::ID_BODY); + $main = new DIVtag(array("id" => self::ID_BODY, + "style" => "width: ".$this->centering_width."; margin-left: auto; margin-right:auto;")); $table = TABLEtag::factory("100%", 0); Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2010-02-24 02:07:07 UTC (rev 3362) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2010-02-24 02:07:59 UTC (rev 3363) @@ -12,6 +12,8 @@ class HomePage extends open2300Page { private $wx = null; + + protected $centering_width = "1400px"; function __construct() { @@ -21,25 +23,8 @@ public function request_vars() { return array(); - } + } - protected function main_block() { - - $main = new DIVtag(array("id" => self::ID_BODY, - "style" => "width: 1400px; margin-left: auto; margin-right:auto;")); - - $table = TABLEtag::factory("100%", 0); - - $table->add_row( TDtag::factory("leftblock", "", $this->left_block() ), - TDtag::factory("rightblock", "", $this->content_block() )); - - $table->add_row(new TDtag(array("colspan"=> 2), - $this->footer_block())); - $main->add( $table ); - - return $main; - } - /** * */ Modified: trunk/open2300/lib/modules/wxdate/page/WxDate.inc =================================================================== --- trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-02-24 02:07:07 UTC (rev 3362) +++ trunk/open2300/lib/modules/wxdate/page/WxDate.inc 2010-02-24 02:07:59 UTC (rev 3363) @@ -11,6 +11,8 @@ private $wx = null; private $wxdate = null; + protected $centering_width = "810px"; + function __construct() { parent::__construct('Hemna WX Station'); @@ -22,26 +24,6 @@ Log::singleton()->debug("use date of ".$this->wxdate); } - - - - protected function main_block() { - - $main = new DIVtag(array("id" => self::ID_BODY, - "style" => "width: 810px; margin-left: auto; margin-right:auto;")); - - $table = TABLEtag::factory("100%", 0); - - $table->add_row( TDtag::factory("leftblock", "", $this->left_block() ), - TDtag::factory("rightblock", "", $this->content_block() )); - - $table->add_row(new TDtag(array("colspan"=> 2), - $this->footer_block())); - $main->add( $table ); - - return $main; - } - protected function left_block() { global $config; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-02-26 07:10:19
|
Revision: 3368 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3368&view=rev Author: hemna Date: 2010-02-26 07:10:13 +0000 (Fri, 26 Feb 2010) Log Message: ----------- added new ticker at the top Modified Paths: -------------- trunk/open2300/lib/autoload.inc trunk/open2300/lib/core/page/open2300Page.inc Added Paths: ----------- trunk/open2300/lib/modules/home/widgets/TickerConditions.inc Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2010-02-26 07:09:14 UTC (rev 3367) +++ trunk/open2300/lib/autoload.inc 2010-02-26 07:10:13 UTC (rev 3368) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2010-02-21T20:41:36-08:00 by AutoloadGenerator + * Generated on 2010-02-25T19:54:06-08:00 by AutoloadGenerator * * @package open2300 */ @@ -154,6 +154,7 @@ 'InfoTable'=>'external/phphtmllib/src/widgets/InfoTable.inc', 'InfoTableCSS'=>'external/phphtmllib/src/widgets/css/InfoTableCSS.inc', 'IP'=>'external/phphtmllib/src/misc/IP.inc', +'JSONWidget'=>'external/phphtmllib/src/widgets/JSONWidget.inc', 'Log'=>'external/phphtmllib/src/logging/Log.inc', 'LogEvent'=>'external/phphtmllib/src/logging/LogEvent.inc', 'LogFormatter'=>'external/phphtmllib/src/logging/LogFormatter.inc', @@ -234,6 +235,7 @@ 'TextCurrentConditions'=>'modules/home/widgets/TextCurrentConditions.inc', 'TextNav'=>'external/phphtmllib/src/widgets/TextNav.inc', 'TextNavCSS'=>'external/phphtmllib/src/widgets/css/TextNavCSS.inc', +'TickerConditions'=>'modules/home/widgets/TickerConditions.inc', 'Timer'=>'external/phphtmllib/src/misc/Timer.inc', 'TreeItemWidget'=>'external/phphtmllib/src/widgets/TreeItemWidget.inc', 'Validator'=>'external/phphtmllib/src/validation/Validator.inc', @@ -314,6 +316,7 @@ 'text'=>'TextCurrentConditions', 'text-c-s-s-nav'=>'TextCSSNav', 'text-nav'=>'TextNav', +'ticker'=>'TickerConditions', 'tree-item-w'=>'TreeItemWidget', 'vertical-c-s-s-nav-table'=>'VerticalCSSNavTable', 'weather-dl'=>'WeatherDataListPage', @@ -395,6 +398,7 @@ 'TextCurrentConditions'=>'text', 'TextCSSNav'=>'text-c-s-s-nav', 'TextNav'=>'text-nav', +'TickerConditions'=>'ticker', 'TreeItemWidget'=>'tree-item-w', 'VerticalCSSNavTable'=>'vertical-c-s-s-nav-table', 'WeatherDataListPage'=>'weather-dl', Modified: trunk/open2300/lib/core/page/open2300Page.inc =================================================================== --- trunk/open2300/lib/core/page/open2300Page.inc 2010-02-26 07:09:14 UTC (rev 3367) +++ trunk/open2300/lib/core/page/open2300Page.inc 2010-02-26 07:10:13 UTC (rev 3368) @@ -42,6 +42,9 @@ const ID_NAV = 'leftBlock'; protected $centering_width = "500px"; + + + protected $include_ticker = true; /** * This is the constructor. @@ -122,20 +125,33 @@ $this->add_js_link( 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js' ); $this->add_js_link( '/js/ajax.js' ); $this->add_js_link( '/js/main.js' ); + $this->add_js_link( '/js/ticker.js' ); } protected function header_block() { - $header = new Container(); + $header = new Container(); + + + if ($this->include_ticker) { + $script = SCRIPTtag::factory(); + $script->add("Event.observe(window, 'load', start_ticker);"); + $header->add($script); + } + $header->add( new DIVtag(array('id' => 'idPageHeadText'),"Hemna's Weather Station"), new DIVtag(array('id' => 'idPageSubHeadText'),"Pilot Hill, CA") ); - $table = TABLEtag::factory("1024",0,0,0,"center"); + $table = TABLEtag::factory("1024",0,0,0,"center"); - $table->add_row(new TDtag(array("id" => "pageheader"), + $table->add_row(new TDtag(array("id" => "headtopleft"), "Pilot Hill, CA Weather"), + new TDtag(array("id" => "headtopcenter"), "something"), + new TDtag(array("id" => "headtopright"), "nothing")); + + $table->add_row(new TDtag(array("id" => "pageheader", "colspan" => "3"), $header)); - $table->add_row(new TDtag(array('id' => self::ID_MENU), $this->menu_block())); + $table->add_row(new TDtag(array('id' => self::ID_MENU, "colspan" => "3"), $this->menu_block())); return $table; } Added: trunk/open2300/lib/modules/home/widgets/TickerConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/TickerConditions.inc (rev 0) +++ trunk/open2300/lib/modules/home/widgets/TickerConditions.inc 2010-02-26 07:10:13 UTC (rev 3368) @@ -0,0 +1,140 @@ +<?php +/** + * This file contains the CurrentConditions + * widget class. + */ + + + +class TickerConditions extends JSONWidget { + + const ID = "ticker"; + + /** + * 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 init() { + $log = Log::singleton(); + $hots = "<span class=\"hot\">"; + $hote = "</span>"; + $colds = "<span class=\"cold\">"; + $colde = "</span>"; + + + 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"); + + //TEMPERATURE + $stmt = $db->queryBindOneRowCache("Select min(temp_out) as low, datetime from weather where datetime like :date", + array(":date" => $today.'%'), 60*5); + $this->temp_low_high["low"] = $stmt->low; + $this->temp_low_high["low_str"] = $colds.$stmt->low. "°F".$colde." at " . substr($stmt->datetime,10); + + $stmt = $db->queryBindOneRowCache("Select max(temp_out) as high, datetime from weather where datetime like :date", + array(":date" => $today.'%'), 60*5); + + $this->temp_low_high["high"] = $stmt->high; + $this->temp_low_high["high_str"] = $hots.$stmt->high . "°F".$hote." at " . substr($stmt->datetime,10); + + //HUMIDITY + $stmt = $db->queryBindOneRowCache("Select max(rel_hum_out) as high, datetime from weather where datetime like :date", + array(":date" => $today.'%'), 60*5); + + $this->temp_low_high["high_hum"] = $stmt->high; + $this->temp_low_high["high_hum_str"] = $hots.$stmt->high . "%".$hote." at " . substr($stmt->datetime,10); + + $stmt = $db->queryBindOneRowCache("Select min(rel_hum_out) as low, datetime from weather where datetime like :date", + array(":date" => $today.'%'), 60*5); + + $this->temp_low_high["low_hum"] = $stmt->low; + $this->temp_low_high["low_hum_str"] = $colds.$stmt->low . "%".$colde." at " . substr($stmt->datetime,10); + + + $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); + + + + //WIND + $stmt = $db->queryBindOneRowCache("Select avg(wind_speed) as average from weather where datetime like :date", + array(":date" => $today.'%'), 60*5); + $this->wind['average'] = sprintf("%0.2f",$stmt->average); + + //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 build_object() { + + $outside_temp = $this->wx->get_temp_out(); + $outside_tempC = WXConversion::fahrenheit_to_celsius($outside_temp); + + + $data = array(); + //the middle td + $data["middle"] = array("Last Update: ".$this->wx->get_datetime(), + "Low Temp: ".$this->temp_low_high["low_str"], + "High Temp: ".$this->temp_low_high["high_str"], + "Average Wind: ".$this->wind['average']."mph", + "Peak Wind ".$this->peak_wind['direction']." ". + $this->peak_wind['speed'].'mph@'.$this->peak_wind['angle']. + " ".$this->peak_wind['time'], + "Low Humidity: ".$this->temp_low_high["low_hum_str"], + "High Humidity: ".$this->temp_low_high["high_hum_str"]); + + //the right td + $data["right"] = array(date("G:i:s"), + $outside_temp."°F / ".$outside_tempC."°C", + $this->wx->get_wind_direction()." ".$this->wx->get_wind_speed().'mph@'.$this->wx->get_wind_angle(), + $this->wx->get_rel_pressure()." inHG", + "Humidity: ".$this->wx->get_rel_hum_out().'%', + "Rain 1h: ".$this->wx->get_rain_1h(), + "Rain 24h: ".$this->wx->get_rain_24h(), + "Rain Year: ".$this->rain_total); + + return $data; + } +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-02-26 07:17:21
|
Revision: 3374 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3374&view=rev Author: hemna Date: 2010-02-26 07:17:15 +0000 (Fri, 26 Feb 2010) Log Message: ----------- fixed some small issues Modified Paths: -------------- trunk/open2300/lib/core/page/open2300Page.inc trunk/open2300/lib/modules/home/widgets/TickerConditions.inc Modified: trunk/open2300/lib/core/page/open2300Page.inc =================================================================== --- trunk/open2300/lib/core/page/open2300Page.inc 2010-02-26 07:15:15 UTC (rev 3373) +++ trunk/open2300/lib/core/page/open2300Page.inc 2010-02-26 07:17:15 UTC (rev 3374) @@ -146,8 +146,8 @@ $table = TABLEtag::factory("1024",0,0,0,"center"); $table->add_row(new TDtag(array("id" => "headtopleft"), "Pilot Hill, CA Weather"), - new TDtag(array("id" => "headtopcenter"), "something"), - new TDtag(array("id" => "headtopright"), "nothing")); + new TDtag(array("id" => "headtopcenter"), ""), + new TDtag(array("id" => "headtopright"), "")); $table->add_row(new TDtag(array("id" => "pageheader", "colspan" => "3"), $header)); Modified: trunk/open2300/lib/modules/home/widgets/TickerConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/TickerConditions.inc 2010-02-26 07:15:15 UTC (rev 3373) +++ trunk/open2300/lib/modules/home/widgets/TickerConditions.inc 2010-02-26 07:17:15 UTC (rev 3374) @@ -93,9 +93,7 @@ $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.'%')); + $stmt = $db->queryBindOneRowCache($sql, array(":date" => $today.'%',":date2" => $today.'%'), 60*5); $log->debug(var_export($stmt,true)); $this->peak_wind['speed'] = $stmt->wind_speed; $this->peak_wind['angle'] = $stmt->wind_angle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-02-27 18:47:34
|
Revision: 3395 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3395&view=rev Author: hemna Date: 2010-02-27 18:47:26 +0000 (Sat, 27 Feb 2010) Log Message: ----------- fixed datalist Modified Paths: -------------- trunk/open2300/lib/autoload.inc trunk/open2300/lib/modules/home/datalist/WXDataList.inc trunk/open2300/lib/modules/home/page/WeatherDataListPage.inc Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2010-02-27 18:34:40 UTC (rev 3394) +++ trunk/open2300/lib/autoload.inc 2010-02-27 18:47:26 UTC (rev 3395) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2010-02-25T19:54:06-08:00 by AutoloadGenerator + * Generated on 2010-02-27T10:41:33-08:00 by AutoloadGenerator * * @package open2300 */ @@ -270,6 +270,7 @@ 'dark-blue-theme'=>'DarkBlueTheme', 'debug-panel-w'=>'DebugPanelWidget', 'dialog-w'=>'DialogWidget', +'dl'=>'WeatherDataListPage', 'error-box-w'=>'ErrorBoxWidget', 'exception-error'=>'ExceptionErrorPage', 'footer-nav'=>'FooterNav', @@ -319,7 +320,6 @@ 'ticker'=>'TickerConditions', 'tree-item-w'=>'TreeItemWidget', 'vertical-c-s-s-nav-table'=>'VerticalCSSNavTable', -'weather-dl'=>'WeatherDataListPage', 'web-cam'=>'WebCam', 'wind-flash-graph'=>'WindFlashGraph', 'wind-speed-line-graph'=>'WindSpeedLineGraph', @@ -352,6 +352,7 @@ 'DarkBlueTheme'=>'dark-blue-theme', 'DebugPanelWidget'=>'debug-panel-w', 'DialogWidget'=>'dialog-w', +'WeatherDataListPage'=>'dl', 'ErrorBoxWidget'=>'error-box-w', 'ExceptionErrorPage'=>'exception-error', 'FooterNav'=>'footer-nav', @@ -401,7 +402,6 @@ 'TickerConditions'=>'ticker', 'TreeItemWidget'=>'tree-item-w', 'VerticalCSSNavTable'=>'vertical-c-s-s-nav-table', -'WeatherDataListPage'=>'weather-dl', 'WebCam'=>'web-cam', 'WindFlashGraph'=>'wind-flash-graph', 'WindSpeedLineGraph'=>'wind-speed-line-graph', Modified: trunk/open2300/lib/modules/home/datalist/WXDataList.inc =================================================================== --- trunk/open2300/lib/modules/home/datalist/WXDataList.inc 2010-02-27 18:34:40 UTC (rev 3394) +++ trunk/open2300/lib/modules/home/datalist/WXDataList.inc 2010-02-27 18:47:26 UTC (rev 3395) @@ -40,7 +40,7 @@ $this->process_action(); - $this->add_header_item(self::LABEL_DATE, "100", "datetime", HTMLDataList::SORTABLE, HTMLDataList::SEARCHABLE, "left"); + $this->add_header_item(self::LABEL_DATE, "120", "datetime", HTMLDataList::SORTABLE, HTMLDataList::SEARCHABLE, "left"); $this->add_header_item(self::LABEL_OUT_TEMP, "20", "temp_out", HTMLDataList::SORTABLE, HTMLDataList::SEARCHABLE,"center"); $this->add_header_item(self::LABEL_DEWPOINT, "20", "dewpoint", HTMLDataList::SORTABLE, HTMLDataList::SEARCHABLE,"center"); $this->add_header_item(self::LABEL_WINDSPEED, "20", "wind_speed", HTMLDataList::SORTABLE, HTMLDataList::SEARCHABLE,"center"); @@ -79,13 +79,14 @@ $obj = $row_data['wind_speed'] . " mph"; break; - case self::LABEL_OUT_TEMP: + /* case self::LABEL_OUT_TEMP: $obj = $row_data['temp_out']. " F / ". WXConversion::fahrenheit_to_celsius($row_data['temp_out']). " C"; break; case self::LABEL_DEWPOINT: $obj = $row_data['dewpoint']. " F / ". WXConversion::fahrenheit_to_celsius($row_data['dewpoint']). " C"; break; + */ default: $obj = parent::build_column_item($row_data, $col_name); Modified: trunk/open2300/lib/modules/home/page/WeatherDataListPage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/WeatherDataListPage.inc 2010-02-27 18:34:40 UTC (rev 3394) +++ trunk/open2300/lib/modules/home/page/WeatherDataListPage.inc 2010-02-27 18:47:26 UTC (rev 3395) @@ -4,6 +4,10 @@ */ class WeatherDataListPage extends open2300Page { + + const ID = "dl"; + + protected $centering_width = "900px"; /** * Class Constructor @@ -13,6 +17,22 @@ parent::__construct('Hemna WX Station'); } +protected function main_block() { + + $main = new DIVtag(array("id" => self::ID_BODY, + "style" => "width: ".$this->centering_width."; margin-left: auto; margin-right:auto;")); + + $table = TABLEtag::factory("100%", 0); + + $table->add_row( TDtag::factory("", "", $this->content_block() )); + + $table->add_row(new TDtag(array(), + $this->footer_block())); + $main->add( $table ); + + return $main; + } + /** * build the main content for the page * and return it all inside a container object @@ -21,22 +41,13 @@ */ function content_block() { - $container = Container::factory(); - $container->add(' ', BRtag::factory(3)); - - $wx = weatherDataObject::find("1=1 order by datetime desc limit 0,1"); + $container = Container::factory(); - $left_div = new DIVtag(array('id'=> 'idLeftContent')); - - $left_div->add(new DIVtag(array('style' => "width: 300px;"),new CurrentConditions($wx))); - $left_div->add(BRtag::factory(2)); - $left_div->add('<object width="290" height="130"><param name="movie" value="http://www.wunderground.com/swf/pws_mini_rf_nc.swf?station=KCASANJO77&freq=2.5&units=english&lang=EN" /><embed src="http://www.wunderground.com/swf/pws_mini_rf_nc.swf?station=KCASANJO77&freq=2.5&units=english&lang=EN" type="application/x-shockwave-flash" width="290" height="130" /></object>'); - //add some graphs $right_div = new DIVtag(array('id' => 'idRightContent')); $right_div->add(new WXDataList); - $container->add($left_div, $right_div); + $container->add($right_div); $script = SCRIPTtag::factory(); $script->add("Event.observe(window, 'load', start_weather_dl_updates);"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-03-03 16:58:58
|
Revision: 3407 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3407&view=rev Author: hemna Date: 2010-03-03 16:58:52 +0000 (Wed, 03 Mar 2010) Log Message: ----------- added new remote metar fetcher for the dynamic banner image replacement Modified Paths: -------------- trunk/open2300/lib/autoload.inc trunk/open2300/lib/core/page/open2300Page.inc Added Paths: ----------- trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2010-03-03 16:57:32 UTC (rev 3406) +++ trunk/open2300/lib/autoload.inc 2010-03-03 16:58:52 UTC (rev 3407) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2010-02-27T10:41:33-08:00 by AutoloadGenerator + * Generated on 2010-03-02T10:13:35-08:00 by AutoloadGenerator * * @package open2300 */ @@ -199,6 +199,7 @@ 'ProjectGenerator'=>'external/phphtmllib/src/generator/ProjectGenerator.inc', 'RainLineGraph'=>'modules/graphs/RainLineGraph.inc', 'RedTheme'=>'external/phphtmllib/data/css/RedTheme.inc', +'RemoteMetarConditions'=>'modules/home/widgets/RemoteMetarConditions.inc', 'RemoteUpdate'=>'modules/api/RemoteUpdate.inc', 'Request'=>'external/phphtmllib/src/request/Request.inc', 'RequestBuilder'=>'external/phphtmllib/src/request/RequestBuilder.inc', @@ -301,6 +302,7 @@ 'rain-line-graph'=>'RainLineGraph', 'red-theme'=>'RedTheme', 'remote-update'=>'RemoteUpdate', +'rmetar'=>'RemoteMetarConditions', 'round-title-table'=>'RoundTitleTable', 'standard-dialog-w'=>'StandardDialogWidget', 'standard-theme'=>'StandardTheme', @@ -383,6 +385,7 @@ 'RainLineGraph'=>'rain-line-graph', 'RedTheme'=>'red-theme', 'RemoteUpdate'=>'remote-update', +'RemoteMetarConditions'=>'rmetar', 'RoundTitleTable'=>'round-title-table', 'StandardDialogWidget'=>'standard-dialog-w', 'StandardTheme'=>'standard-theme', Modified: trunk/open2300/lib/core/page/open2300Page.inc =================================================================== --- trunk/open2300/lib/core/page/open2300Page.inc 2010-03-03 16:57:32 UTC (rev 3406) +++ trunk/open2300/lib/core/page/open2300Page.inc 2010-03-03 16:58:52 UTC (rev 3407) @@ -124,8 +124,8 @@ $this->add_js_link( 'http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js' ); $this->add_js_link( 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js' ); $this->add_js_link( '/js/ajax.js' ); - $this->add_js_link( '/js/main.js' ); - $this->add_js_link( '/js/ticker.js' ); + $this->add_js_link( '/js/main.js' ); + $this->add_js_link( '/js/banner.js' ); } protected function header_block() { @@ -133,9 +133,7 @@ if ($this->include_ticker) { - $script = SCRIPTtag::factory(); - $script->add("Event.observe(window, 'load', start_ticker);"); - $header->add($script); + $this->add_js_link( '/js/ticker.js' ); } Added: trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc (rev 0) +++ trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc 2010-03-03 16:58:52 UTC (rev 3407) @@ -0,0 +1,193 @@ +<?php +/** + * This file contains the Metar conditions + * for our local area. + */ + + +/** + * We need to do this due to cross domain js issues. + * We can't make a direct js ajax call to the url, unless + * we are running in the same domain as the url. + * + * @author waboring + * + */ +class RemoteMetarConditions extends JSONWidget { + + const TOD_MORNING = "morning"; + const TOD_MIDDAY = "midday"; + const TOD_AFTERNOON = "afternoon"; + const TOD_EVENING = "evening"; + const TOD_NIGHT = "night"; + + + public static $tod_lookup = array(0=> RemoteMetarConditions::TOD_NIGHT, + 1=>RemoteMetarConditions::TOD_MORNING, + 2=>RemoteMetarConditions::TOD_MIDDAY, + 3=>RemoteMetarConditions::TOD_AFTERNOON, + 4=>RemoteMetarConditions::TOD_EVENING); + + public static $cloud_lookup = array(0 => "clear", + 1 => "few", + 2 => "scattered", + 3 => "broken", + 4 => "overcast"); + + const ID = "rmetar"; + + protected $url="http://api.itimeteo.com/metar.ims?icao=kaun&format=json&decoded=true"; + + /** + * Class Constructor + * + */ + public function init() { + + } + + + + public function build_object() { + + $proxy = $GLOBALS["config"]->get("proxy"); + if (!empty($proxy)) { + $context = stream_context_create(array("http" => array("proxy" => "tcp://web-proxy.rose.hp.com:8088"))); + } else { + $context = null; + } + + $json = file_get_contents($this->url,0, $context); + 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)); + + $conditions = array(); + $conditions["season"] = $GLOBALS["config"]->get("season"); + $clouds = $this->decode_clouds($metar->Metar->DecodeLine0->Clouds); + $conditions["clouds"] = $clouds; + $rained = $this->has_rained(); + $conditions["rained"] = $rained; + $conditions["banner"] = $this->get_banner_filename($conditions["season"], $clouds, $rained); + + return $conditions; + //return $metar; + } + + private function decode_clouds($cloudVar, $offset=null) { + $clouds = 0; + + if ($cloudVar->Overcast) { + $clouds = 4; + } else if ($cloudVar->Broken) { + $clouds = 3; + } else if ($cloudVar->Scattered) { + $clouds = 2; + } else if ($cloudVar->Few) { + $clouds = 1; + } else { + $clouds = 0; + } + + if (!is_null($offset)) { + $clouds += $offset; + + if ($clouds > 4) { + $clouds = 0; + } else if ($clouds < 0) { + $clouds = 4; + } + } + + return RemoteMetarConditions::$cloud_lookup[$clouds]; + } + + private function get_time_of_day($offset=null) { + $hour = date("G"); + $tod = null; + + if ($hour == 00 || $hour > 0 && $hour <6) { + $tod = 0; + } else if ($hour >= 6 && $hour <11) { + $tod = 1; + } else if ($hour >=11 && $hour < 16 ) { + $tod = 2; + } else if ($hour >=16 && $hour <19) { + $tod = 3; + } else if ($hour >=19 && $hour <24) { + $tod = 4; + } + + if (!is_null($offset)) { + $tod += $offset; + echo "tod = ".$tod." "; + + if ($tod > 4) { + $tod = 0; + } else if ($tod < 0) { + $tod = 4; + } + + echo "tod2 = ".$tod."\n"; + } + + return RemoteMetarConditions::$tod_lookup[$tod]; + } + + + private function get_banner_filename($season, $clouds, $rain, $offset=null) { + return null; + $tod = $this->get_time_of_day($offset); + //echo (var_export($tod, true)."\n"); + $filename = "/images/banners/".$season."/".$tod."_"; + + if ($rain) { + $filename .= "rain.jpg"; + } else { + $filename .= $clouds.".jpg"; + } + + //echo var_export($filename, true)."\n"; + if (file_exists($GLOBALS['path_base']."/htdocs".$filename)) { + return $filename; + } else { + return null; +// if (!is_null($offset)) { +// $offset += 1; +// } else { +// $offset = 1; +// } +// return $this->get_banner_filename($season, $clouds, $rain, $offset); + } + } + + /** + * Has it rained in the last 2 hours? + * If so, we are in "rain" mode. + * + * @return unknown_type + */ + private function has_rained() { + $db = open2300DB::singleton(); + $today = date("Y-m-d"); + + $sql = "select rain_1h from weather where datetime like :date order by datetime desc limit 0,1"; + $stmt = $db->queryBindOneRow($sql, array(":date" => $today."%")); + + //echo var_export($stmt->rain_1h,true)."\n"; + + if ( !is_null($stmt) ) { + $rain = $stmt->rain_1h; + if ($rain > 0) { + return true; + } else { + return false; + } + } else { + return false; + } + } +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-03-06 18:10:44
|
Revision: 3428 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3428&view=rev Author: hemna Date: 2010-03-06 18:10:38 +0000 (Sat, 06 Mar 2010) Log Message: ----------- updates for showing remote metar in the banner Modified Paths: -------------- trunk/open2300/lib/core/page/open2300Page.inc trunk/open2300/lib/modules/home/page/HomePage.inc trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc Modified: trunk/open2300/lib/core/page/open2300Page.inc =================================================================== --- trunk/open2300/lib/core/page/open2300Page.inc 2010-03-03 23:24:23 UTC (rev 3427) +++ trunk/open2300/lib/core/page/open2300Page.inc 2010-03-06 18:10:38 UTC (rev 3428) @@ -118,14 +118,18 @@ $this->add_css_link("/css/main.css"); $this->add_css_link("/css/fonts.css"); $this->add_css_link("/css/menu.css"); + $this->add_css_link("/css/prototip.css"); //$this->add_js_link( '/js/scriptaculous-js-1.7.0/lib/prototype.js' ); //$this->add_js_link( '/js/scriptaculous-js-1.7.0/src/scriptaculous.js' ); $this->add_js_link( 'http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js' ); - $this->add_js_link( 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js' ); + $this->add_js_link( 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js?load=effects' ); + $this->add_js_link( '/js/prototip.js' ); $this->add_js_link( '/js/ajax.js' ); $this->add_js_link( '/js/main.js' ); $this->add_js_link( '/js/banner.js' ); + $this->add_head_js("Event.observe(window, 'load', main_init);"); + $this->add_head_js("Event.observe(window, 'load', start_banner);"); } protected function header_block() { @@ -134,22 +138,27 @@ if ($this->include_ticker) { $this->add_js_link( '/js/ticker.js' ); + $this->add_head_js("Event.observe(window, 'load', start_ticker);"); } $header->add( new DIVtag(array('id' => 'idPageHeadText'),"Hemna's Weather Station"), - new DIVtag(array('id' => 'idPageSubHeadText'),"Pilot Hill, CA") + new DIVtag(array('id' => 'idPageSubHeadText'),"Pilot Hill, CA"), + new DIVtag(array('id' => 'idMetarContainer'), + new Divtag(array("id" => "idMetar"), " ") + ) ); $table = TABLEtag::factory("1024",0,0,0,"center"); $table->add_row(new TDtag(array("id" => "headtopleft"), "Pilot Hill, CA Weather"), - new TDtag(array("id" => "headtopcenter"), ""), - new TDtag(array("id" => "headtopright"), "")); + new TDtag(array("id" => "headtopcenter"), " "), + new TDtag(array("id" => "headtopright"), IMGtag::factory("/css/prototip_loader.gif"))); - $table->add_row(new TDtag(array("id" => "pageheader", "colspan" => "3"), - $header)); + $table->add_row(new TDtag(array("id" => "pageheader", "colspan" => "3"),$header)); + $table->add_row(new TDtag(array('id' => self::ID_MENU, "colspan" => "3"), $this->menu_block())); + return $table; } Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2010-03-03 23:24:23 UTC (rev 3427) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2010-03-06 18:10:38 UTC (rev 3428) @@ -31,10 +31,8 @@ function left_block() { $container = Container::factory(); - $script = SCRIPTtag::factory(); - $script->add("Event.observe(window, 'load', start_updates);"); + $this->add_head_js("Event.observe(window, 'load', start_updates);"); - $container->add($script); //$this->add_js_link("/js/cal.js"); $left_div = new DIVtag(array('id'=> '')); Modified: trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc 2010-03-03 23:24:23 UTC (rev 3427) +++ trunk/open2300/lib/modules/home/widgets/RemoteMetarConditions.inc 2010-03-06 18:10:38 UTC (rev 3428) @@ -145,10 +145,14 @@ //echo (var_export($tod, true)."\n"); $filename = "/images/banners/".$season."/".$tod."_"; + $conditions["tod"] = $tod; + if ($rain) { $filename .= "rain.jpg"; + $conditions["wx"] = "rain"; } else { $filename .= $clouds.".jpg"; + $conditions["wx"] = $clouds; } $conditions["filename"] = "http://".$GLOBALS["config"]->get("sitename").$filename; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |