[Phphtmllib-devel] SF.net SVN: phphtmllib:[3269] trunk/open2300/lib
Status: Beta
Brought to you by:
hemna
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. |