$linkToInfoHdr1 = "<img src='" . $moduleRelPath . "/img/paraglidingearth_logo.gif' border=0>";
    $linkToInfoStr1 = "<ul>";
    foreach ($takoffsList as $takeoffItem) {
        $distance = $takeoffItem['distance'];
        if ($takeoffItem['area'] != 'not specified') {
            $areaStr = " - " . $takeoffItem['area'];
        } else {
            $areaStr = "";
        }
        $jsStr = "fillInForm('" . addslashes($takeoffItem['name']) . "','" . addslashes($takeoffItem['area']) . "','" . addslashes($takeoffItem['countryCode']) . "');";
        $takeoffLink = "<a href=\"javascript:{$jsStr}\">" . $takeoffItem['name'] . "{$areaStr} (" . $takeoffItem['countryCode'] . ") [~" . formatDistance($distance, 1) . "]</a>";
        $linkToInfoStr1 .= "<li>{$takeoffLink}";
    }
    $linkToInfoStr1 .= "</ul>";
}
$takoffsList = getExtrernalServerTakeoffs(2, $waypointLat, -$waypointLon, 20, 5);
if (count($takoffsList) > 0) {
    $linkToInfoHdr2 = "<img src='" . $moduleRelPath . "/img/paraglider365logo.gif' border=0>";
    $linkToInfoStr2 = "<ul>";
    foreach ($takoffsList as $takeoffItem) {
        $distance = $takeoffItem['distance'];
        if ($takeoffItem['area'] != 'not specified') {
            $areaStr = " - " . $takeoffItem['area'];
        } else {
            $areaStr = "";
        }
        $jsStr = "fillInForm('" . addslashes($takeoffItem['name']) . "','" . addslashes($takeoffItem['area']) . "','" . addslashes($takeoffItem['countryCode']) . "');";
        $takeoffLink = "<a href=\"javascript:{$jsStr}\">" . $takeoffItem['name'] . "{$areaStr} (" . $takeoffItem['countryCode'] . ") [~" . formatDistance($distance, 1) . "]</a>";
        $linkToInfoStr2 .= "<li>{$takeoffLink}";
    }
    $linkToInfoStr2 .= "</ul>";
				if ($takeoffItem['area']!='not specified')
					$areaStr=" - ".$takeoffItem['area'];
				else 
					$areaStr="";

				$takeoffLink="<a href='".$takeoffItem['url']."' target=_blank>".$takeoffItem['name']."$areaStr (".$takeoffItem['countryCode'].") [~".formatDistance($distance,1)."]</a>";

				$linkToInfoStr1.="<li>$takeoffLink";
		}
		$linkToInfoStr1.="</ul>";
  }
  $xmlSites1=str_replace("<","&lt;",$xmlSites);
//-------------------------------------------------------------------
// get from paragliding365.com
//-------------------------------------------------------------------
  	$takoffsList=getExtrernalServerTakeoffs(2,$firstPoint->lat,-$firstPoint->lon,50,5);
	if (count($takoffsList) >0 ) {
		$linkToInfoHdr2="<a href='http://www.paragliding365.com/paragliding_sites.html?longitude=".-$firstPoint->lon."&latitude=".$firstPoint->lat."&radius=50' target=_blank>";
		$linkToInfoHdr2.="<img src='".$moduleRelPath."/img/paraglider365logo.gif' border=0> "._FLYING_AREA_INFO."</a>";
			
		$linkToInfoStr2="<ul>";
		foreach ($takoffsList as $takeoffItem)  {
				if ($takeoffItem['area']!='not specified')	$areaStr=" - ".$takeoffItem['area'];
				else $areaStr="";
				$linkToInfoStr2.="<li><a href='".$takeoffItem['url']."' target=_blank>".
									$takeoffItem['name']."$areaStr (".$takeoffItem['countryCode'].
									") [~".formatDistance($takeoffItem['distance'],1)."]</a>";
		}
		$linkToInfoStr2.="</ul>";
  }
  $xmlSites2=str_replace("<","&lt;",$xmlSites);
示例#3
0
 function findTakeoff($lat, $lon)
 {
     require_once dirname(__FILE__) . "/CL_gpsPoint.php";
     list($version, $sub_version, $revision) = $this->version();
     if ($version >= 2) {
         // new rpc method
         require_once dirname(__FILE__) . "/lib/xml_rpc/IXR_Library.inc.php";
         $serverURL = "http://" . $this->data['url_op'];
         $client = new IXR_Client($serverURL);
         if ($this->DEBUG) {
             $client->debug = true;
         }
         if (!$client->query('takeoffs.findTakeoff', $this->data['site_pass'], $lat, $lon)) {
             echo 'findTakeoff: Error ' . $client->getErrorCode() . " -> " . $client->getErrorMessage();
             return array(0, -1);
             // $client->getErrorCode();
         } else {
             list($nearestWaypoint, $minTakeoffDistance) = $client->getResponse();
             $nearestWaypoint = (object) $nearestWaypoint;
             return array($nearestWaypoint, $minTakeoffDistance);
         }
     } else {
         if ($version == 1 && $sub_version >= 4) {
             // use EXT_takeoff.php method
             require_once dirname(__FILE__) . "/FN_functions.php";
             $serverURL = "http://" . $this->data['url_base'] . "/EXT_takeoff.php?op=find_wpt&lat={$lat}&lon={$lon}";
             //echo $serverURL;
             $contents = fetchURL($serverURL);
             if (!$contents) {
                 echo "SERVER at: " . $this->data['url_base'] . " is NOT ACTIVE<br>";
                 return array(0, -1);
             }
             //echo $contents;
             require_once dirname(__FILE__) . '/lib/miniXML/minixml.inc.php';
             $xmlDoc = new MiniXMLDoc();
             $xmlDoc->fromString($contents);
             $xmlArray = $xmlDoc->toArray();
             $wpt = new waypoint();
             $wpt->waypointID = $xmlArray[search][waypoint][name];
             $wpt->name = $xmlArray[search][waypoint][name];
             $wpt->intName = $xmlArray[search][waypoint][intName];
             $wpt->location = $xmlArray[search][waypoint][location];
             $wpt->intLocation = $xmlArray[search][waypoint][intLocation];
             $wpt->type = $xmlArray[search][waypoint][type];
             $wpt->countryCode = $xmlArray[search][waypoint][countryCode];
             $wpt->lat = $xmlArray[search][waypoint][lat];
             $wpt->lon = $xmlArray[search][waypoint][lon];
             $wpt->link = $xmlArray[search][waypoint][link];
             $wpt->description = $xmlArray[search][waypoint][description];
             $wpt->modifyDate = $xmlArray[search][waypoint][modifyDate];
             $distance = $xmlArray[search][distance];
             return array($wpt, $distance);
         } else {
             if ($version == 0 && !$this->isLeo) {
                 // we are dealing with 'alien' servers
                 require_once dirname(__FILE__) . "/FN_functions.php";
                 //the installation_type in this case point to the ID of the alien server
                 $takeoffsList = getExtrernalServerTakeoffs($this->data['installation_type'], $lat, $lon, 1000, 1);
                 $wpt = new waypoint();
                 $distance = $takeoffsList[0]['distance'];
                 $wpt->intName = $takeoffsList[0]['name'];
                 $wpt->name = $takeoffsList[0]['name'];
                 $wpt->location = $takeoffsList[0]['area'];
                 $wpt->intLocation = $takeoffsList[0]['area'];
                 $wpt->countryCode = $takeoffsList[0]['countryCode'];
                 $wpt->link = $takeoffsList[0]['url'];
                 $wpt->lat = $takeoffsList[0]['lat'];
                 $wpt->lon = $takeoffsList[0]['lon'];
                 return array($wpt, $distance);
             }
         }
     }
 }