[Phphtmllib-devel] SF.net SVN: phphtmllib:[3445] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
Brought to you by:
hemna
|
From: <he...@us...> - 2010-06-15 19:37:48
|
Revision: 3445
http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3445&view=rev
Author: hemna
Date: 2010-06-15 19:37:42 +0000 (Tue, 15 Jun 2010)
Log Message:
-----------
more shit
Modified Paths:
--------------
trunk/open2300/lib/modules/api/AviationWeather.inc
Modified: trunk/open2300/lib/modules/api/AviationWeather.inc
===================================================================
--- trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-15 17:51:46 UTC (rev 3444)
+++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-15 19:37:42 UTC (rev 3445)
@@ -16,20 +16,61 @@
const ID = "avwx";
- protected $url = "http://api.itimeteo.com/getMetar.ims?icao=XX_ICAO_XX&decoded=true&displayAirport=true&format=json";
+ //protected $url = "http://api.itimeteo.com/getMetar.ims?icao=XX_ICAO_XX&decoded=true&displayAirport=true&format=json";
//list of airports to fetch.
protected $airports;
+ protected $metars = array();
+
+ private $cache;
+
public function init() {
+ $airports = Request::singleton()->get("airports");
+ if (strlen($airports) >0) {
+ $this->airports = explode(',', strtoupper($airports));
+ }
+ $this->cache = AirportCache::singleton();
}
public function build_object() {
+
+ $size = count($this->airports);
+ if ($size > 0) {
+ foreach($this->airports as $icao) {
+ $airport = $this->process_airport($icao);
+ $this->metars[] = $airport;
+ }
+ }
+ return $this->metars;
}
+
+ public function process_airport($icao) {
+
+ $wxInfo = array();
+ $metar = $this->get_metar($icao, $wxInfo);
+
+ if ($metar != null && strlen($metar) > 0) {
+ $this->process_metar($metar, $wxInfo);
+ $wxInfo["metar"] = $metar;
+
+ $airport = $this->cache->get($icao);
+ if ($airport != null) {
+
+ }
+ $this->metars[] = $wxInfo;
+ //need to combine this info w/ the airport data cache.
+ }
+
+ return $wxInfo;
+
+ }
+
+
public function get_metar($station, &$wxInfo) {
// This function retrieves METAR information for a given station from the
// National Weather Service. It assumes that the station exists.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|