예제 #1
0
 /**
  * Load conditions for location
  * @param Location $Location
  */
 public function loadForecast(Location $Location)
 {
     $this->Result = array();
     if ($Location->isOld() && $Location->hasLocationName()) {
         $this->setFromURL(self::URL_HISTORY . '/city?q=' . $Location->name() . '&start=' . $Location->time() . '&cnt=1');
     }
     if (empty($this->Result)) {
         if ($Location->hasPosition()) {
             $this->setFromURL(self::URL . '?lat=' . $Location->lat() . '&lon=' . $Location->lon());
         } elseif ($Location->hasLocationName()) {
             $this->setFromURL(self::URL . '?q=' . $Location->name(), $this->cacheKey($Location->name()));
         }
     }
 }
예제 #2
0
 /**
  * Load conditions for location
  * @param Location $Location
  */
 public function loadForecast(Location $Location)
 {
     $this->Result = array();
     if ($Location->isOld() && $Location->hasLocationName()) {
         // Historical data needs a paid account (150$/month)
         // @see http://openweathermap.org/price
         //$this->setFromURL( self::URL_HISTORY.'/city?q='.$Location->name().'&start='.$Location->time().'&cnt=1' );
     }
     if (empty($this->Result)) {
         if ($Location->hasPosition()) {
             $this->setFromURL(self::URL . '?lat=' . $Location->lat() . '&lon=' . $Location->lon());
         } elseif ($Location->hasLocationName()) {
             $this->setFromURL(self::URL . '?q=' . $Location->name(), $this->cacheKey($Location->name()));
         }
     }
 }