function listTakeoffs($res, $legend, $queryExtraArray = array(), $sortOrder = "CountryCode")
{
    global $db, $Theme, $takeoffRadious, $userID, $moduleRelPath;
    global $PREFS;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $currentlang, $nativeLanguage, $countries;
    $headerSelectedBgColor = "#F2BC66";
    ?>
  <table class='listTable' width="100%" cellpadding="2" cellspacing="0">
  <tr>
  	<td width="25" class='SortHeader'><?php 
    echo _NUM;
    ?>
</td>
 	<?php 
    printHeaderTakeoffs(100, $sortOrder, "CountryCode", _COUNTRY, $queryExtraArray);
    printHeaderTakeoffs(0, $sortOrder, "intName", _TAKEOFF, $queryExtraArray);
    printHeaderTakeoffs(80, $sortOrder, "FlightsNum", _NUMBER_OF_FLIGHTS, $queryExtraArray);
    printHeaderTakeoffs(100, $sortOrder, "max_distance", _SITE_RECORD_OPEN_DISTANCE, $queryExtraArray);
    ?>
	</tr>
<?php 
    $currCountry = "";
    $i = 1;
    while ($row = $db->sql_fetchrow($res)) {
        $takeoffName = selectWaypointName($row["name"], $row["intName"], $row["countryCode"]);
        $sortRowClass = "l_row1";
        if ($countries[$row["countryCode"]] != $currCountry || $sortOrder != 'CountryCode') {
            $currCountry = $countries[$row["countryCode"]];
            $country_str = "<a href='" . getLeonardoLink(array('op' => 'list_flights', 'country' => $row["countryCode"], 'takeoffID' => '0')) . "'>" . $currCountry . "</a>";
            if ($sortOrder == 'CountryCode') {
                $sortRowClass = "l_row2";
            } else {
                $sortRowClass = $i % 2 ? "l_row1" : "l_row2";
            }
        } else {
            $country_str = "&nbsp;";
        }
        $i++;
        echo "<TR class='{$sortRowClass}'>";
        echo "<TD>" . ($i - 1 + $startNum) . "</TD>";
        echo "<TD>{$country_str}</TD>";
        $takeoffNameSafe = str_replace("'", "\\'", $takeoffName);
        $takeoffNameSafe = str_replace('"', '\\"', $takeoffNameSafe);
        $takeoffNameSafe = htmlspecialchars($takeoffName);
        echo "<TD class='alLeft'><div align=left id='t_{$i}'>";
        //	echo "<a href='javascript:nop()' onclick=\"takeoffTip.newTip('inline', 0, 13, 't_$i', 250, '".$row["takeoffID"]."','".str_replace("'","\'",$takeoffName)."')\"  onmouseout=\"takeoffTip.hide()\">$takeoffName</a>";
        echo "<a href=\"javascript:takeoffTip.newTip('inline', 0, 13, 't_{$i}', 250, '" . $row["takeoffID"] . "','" . str_replace("'", "\\'", $takeoffNameSafe) . "')\"  onmouseout=\"takeoffTip.hide()\">{$takeoffName}</a>";
        echo "</div></TD>";
        echo "<TD>" . $row["FlightsNum"] . "</TD>";
        echo "<TD>" . formatDistanceOpen($row["max_distance"]) . "</TD>";
        echo "</TR>";
    }
    echo "</table>";
    $db->sql_freeresult($res);
}
">
  <style type="text/css">
  body, p, table,tr,td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
  body {margin:0px}
  </style>
<script language="javascript" src="<?php 
echo $moduleRelPath;
?>
/js/DHTML_functions.js"></script>
</head>
<?php 
$waypointIDview = makeSane($_GET['wID'], 1);
$wpInfo = new waypoint($waypointIDview);
$wpInfo->getFromDB();
//  $wpName= getWaypointName($waypointIDview);
$wpName = selectWaypointName($wpInfo->name, $wpInfo->intName, $wpInfo->countryCode);
$wpLocation = selectWaypointLocation($wpInfo->location, $wpInfo->intLocation, $wpInfo->countryCode);
if (L_auth::isAdmin($userID)) {
    $opString = "<a href='" . getLeonardoLink(array('op' => 'edit_waypoint', 'waypointIDedit' => $waypointIDview)) . "'><img src='" . $moduleRelPath . "/img/change_icon.png' border=0 align=bottom></a>";
}
$titleString = _Waypoint_Name . " : " . $wpName . " (" . $countries[$wpInfo->countryCode] . ") &nbsp;";
//$opString="<a href='#' onclick=\"toggleVisible('takeoffID','takeoffPos',14,-20,0,0);return false;\">
//<img src='".$moduleRelPath."/templates/".$PREFS->themeName."/img/exit.png' border=0></a>";
open_inner_table("<table class=main_text width=100% cellpadding=0 cellspacing=0><tr><td>" . $titleString . "</td><td align=right width=50><div align=right>" . $opString . "</div></td></tr></table>", 705, "icon_pin.png");
open_tr();
echo "<td>";
?>

<style type="text/css">
<!--
.style1 {font-weight: bold}
Example #3
0
function makeWaypointPlacemark($waypointID, $returnCountryCode = 0, $includeStyle = 1, $includeLookat = 1, $styleUrl = '')
{
    global $db, $waypointsTable;
    global $flightsTable, $countries, $CONF_mainfile, $moduleRelPath;
    $wpInfo = new waypoint($waypointID);
    $wpInfo->getFromDB();
    $wpName = selectWaypointName($wpInfo->name, $wpInfo->intName, $wpInfo->countryCode);
    $wpLocation = selectWaypointLocation($wpInfo->location, $wpInfo->intLocation, $wpInfo->countryCode);
    $query = "SELECT  MAX(MAX_LINEAR_DISTANCE) as record_km, ID FROM {$flightsTable}  WHERE takeoffID =" . $waypointID . " GROUP BY ID ORDER BY record_km DESC ";
    $flightNum = 0;
    $res = $db->sql_query($query);
    if ($res > 0) {
        $flightNum = mysql_num_rows($res);
        $row = $db->sql_fetchrow($res);
        $siteRecordLink = "<a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])) . "'>" . formatDistance($row['record_km'], 1) . "</a>";
    } else {
        $siteRecordLink = "";
    }
    $pointFlightsLink = "<a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => $waypointID, 'year' => '0', 'season' => '0')) . "'>" . _See_flights_near_this_point . " [ " . $flightNum . " ]</a>";
    $countryFlightsLink = "<a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => '0', 'year' => '0', 'season' => '0', 'country' => $wpInfo->countryCode)) . "'>" . $countries[$wpInfo->countryCode] . "</a>";
    if ($wpInfo->link) {
        $siteLink = '<a href="' . formatURL($wpInfo->link) . '" target="_blank">' . formatURL($wpInfo->link) . '</a>';
    } else {
        $siteLink = "-";
    }
    // "<?xml version='1.0' encoding='".$langEncodings[$currentlang]."'? >
    // <?xml version="1.0" encoding="UTF-8"? >
    $xml_text = '<Placemark>
  <name><![CDATA[' . $wpName . ' ]]></name>
  <description><![CDATA[<table cellpadding=0 cellspacing=0 width=300>' . '<tr bgcolor="#D7E1EE"><td>' . _SITE_REGION . ': ' . $wpLocation . ' - ' . $countryFlightsLink . '</td></tr>' . '<tr bgcolor="#CCCCCC"><td>' . $pointFlightsLink . '</td></tr>' . '<tr ><td>' . _SITE_RECORD . ' : ' . $siteRecordLink . '</td></tr>' . '<tr bgcolor="#CCCCCC"><td>' . _SITE_LINK . ' : ' . $siteLink . '</td></tr>' . '<tr ><td>' . $wpInfo->description . '</td></tr>' . '<tr ><td></td></tr>' . '</table>	
    ]]>
 </description>';
    if ($includeLookat) {
        $xml_text .= '
  <LookAt>
    <longitude>' . -$wpInfo->lon . '</longitude>
    <latitude>' . $wpInfo->lat . '</latitude>
    <range>10000</range>
    <tilt>0</tilt>
    <heading>0</heading>
  </LookAt>
  ';
    }
    if ($includeStyle) {
        $xml_text .= '  
  <styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
  <Style>
    <IconStyle>
      <scale>0.8</scale>
      <Icon>
        <href>root://icons/palette-4.png</href>
        <x>160</x>
        <y>128</y>
        <w>32</w>
        <h>32</h>
      </Icon>
    </IconStyle>
    <LabelStyle>
      <scale>0.8</scale>
    </LabelStyle>
  </Style>
  ';
    }
    if ($styleUrl) {
        $xml_text .= "<styleUrl>{$styleUrl}</styleUrl>\n";
    }
    $xml_text .= '
  <Point>
    <coordinates>' . -$wpInfo->lon . ',' . $wpInfo->lat . ',0</coordinates>
  </Point>
</Placemark>';
    if ($returnCountryCode) {
        return array($xml_text, $wpInfo->countryCode);
    } else {
        return $xml_text;
    }
}