Example #1
0
 function getTakeoffs($areaID)
 {
     global $db;
     global $waypointsTable, $areasTakeoffsTable;
     $query = "SELECT * FROM {$waypointsTable},{$areasTakeoffsTable}\t\n\t\t\tWHERE {$areasTakeoffsTable}.takeoffID = {$waypointsTable}.ID AND {$areasTakeoffsTable}.areaID={$areaID}";
     // echo $query;
     $res = $db->sql_query($query);
     if ($res <= 0) {
         echo "No takeoffs found for area ID {$areaID}<BR>";
         return array(array(), array());
     }
     $takeoffs = array();
     $takeoffsID = array();
     while ($row = $db->sql_fetchrow($res)) {
         $tnames[$row["takeoffID"]] = getWaypointName($row["takeoffID"], -1, 1);
     }
     if (!empty($tnames)) {
         asort($tnames);
         foreach ($tnames as $takeoffID => $takeoffName) {
             array_push($takeoffs, $takeoffName);
             array_push($takeoffsID, $takeoffID);
         }
     }
     return array($takeoffs, $takeoffsID);
 }
Example #2
0
function getTakeoffList()
{
    global $db;
    global $flightsTable;
    $query = "SELECT DISTINCT takeoffID FROM {$flightsTable} WHERE takeoffID<>0";
    // echo $query;
    $res = $db->sql_query($query);
    if ($res <= 0) {
        return array(array(), array());
    }
    $takeoffs = array();
    $takeoffsID = array();
    while ($row = $db->sql_fetchrow($res)) {
        $tnames[$row["takeoffID"]] = getWaypointName($row["takeoffID"], -1, 1);
    }
    if (!empty($tnames)) {
        asort($tnames);
        foreach ($tnames as $takeoffID => $takeoffName) {
            array_push($takeoffs, $takeoffName);
            array_push($takeoffsID, $takeoffID);
        }
    }
    return array($takeoffs, $takeoffsID);
}
function listFlights($res, $legend, $queryExtraArray = array(), $sortOrder = "DATE")
{
    global $db, $Theme;
    global $takeoffRadious;
    global $userID, $serverID;
    global $NACclubID;
    global $clubID, $clubFlights, $clubsList, $add_remove_mode;
    global $moduleRelPath;
    global $PREFS, $CONF;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $currentlang, $nativeLanguage, $opMode;
    global $CONF_photosPerFlight, $CONF_use_validation, $CONF_airspaceChecks;
    global $CONF_new_flights_days_threshold;
    global $gliderCatList;
    $clubIcon = "<img src='" . $moduleRelPath . "/img/icon_club_small.gif' width=12 height=12 border=0 align='absmiddle' >";
    $removeFromClubIcon = "<img src='" . $moduleRelPath . "/img/icon_club_remove.gif' width=22 height=12 border=0 align='absmiddle' title='Remove flight from this league'>";
    $addToClubIcon = "<img src='" . $moduleRelPath . "/img/icon_club_add.gif' width=12 height=12 border=0 align='absmiddle' title='Add flight to this league'>";
    if ($clubID && (L_auth::isClubAdmin($userID, $clubID) || L_auth::isAdmin($userID))) {
        ?>

<script language="javascript">

function addClubFlight(clubID,flightID) {
	$("#updateDiv").load('<?php 
        echo $moduleRelPath;
        ?>
/EXT_club_functions.php?op=add&clubID='+clubID+'&flightID='+flightID);
	$('#fl_'+flightID).html("<a href=\"#\" onclick=\"removeClubFlight("+clubID+","+flightID+");return false;\"><?php 
        echo $removeFromClubIcon;
        ?>
</a>");
	
}

function removeClubFlight(clubID,flightID) {
	$("#updateDiv").load('<?php 
        echo $moduleRelPath;
        ?>
/EXT_club_functions.php?op=remove&clubID='+clubID+'&flightID='+flightID);
	$('#fl_'+flightID).html("<a href=\"#\" onclick=\"addClubFlight("+clubID+","+flightID+");return false;\"><?php 
        echo $addToClubIcon;
        ?>
</a>");
}
</script>

<?php 
        echo "<div class='tableInfo shadowBox'>You can administer this club ";
        if ($clubsList[$clubID]['addManual']) {
            if ($add_remove_mode) {
                $queryExtraArray['admClub'] = '0';
                echo "<a href='" . getLeonardoLink(array('op' => 'list_flights', 'sortOrder' => $sortOrder) + $queryExtraArray) . "'>Return to normal view</a>";
            } else {
                $queryExtraArray['admClub'] = '1';
                echo "<a href='" . getLeonardoLink(array('op' => 'list_flights', 'sortOrder' => $sortOrder) + $queryExtraArray) . "'>Add / remove flights</a>";
            }
        }
        echo "<div id='updateDiv' style='display:block'></div>";
        echo "</div>";
    }
    ?>
  	<table class='listTable' style='clear:both' width="100%" cellpadding="2" cellspacing="0">
	<tr> 
	  <td class='SortHeader indexCell' width="25"><?php 
    echo _NUM;
    ?>
</td>
		 <?php 
    printHeader(60, $sortOrder, "DATE", _DATE_SORT, $queryExtraArray);
    printHeader(160, $sortOrder, "pilotName", _PILOT, $queryExtraArray);
    printHeader(0, $sortOrder, "takeoffID", _TAKEOFF, $queryExtraArray);
    printHeader(40, $sortOrder, "DURATION", _DURATION_HOURS_MIN, $queryExtraArray);
    if ($CONF['list_flights']['fields']['scoring'][0] == 'LINEAR_DISTANCE') {
        printHeader(60, $sortOrder, "LINEAR_DISTANCE", _LINEAR_DISTANCE, $queryExtraArray);
    } else {
        printHeader(60, $sortOrder, "SCORE_SPEED", _MEAN_SPEED1, $queryExtraArray);
    }
    printHeader(60, $sortOrder, "FLIGHT_KM", _OLC_KM, $queryExtraArray);
    printHeader(65, $sortOrder, "FLIGHT_POINTS", _OLC_SCORE, $queryExtraArray);
    ?>
	  <td width="18" class='SortHeader'>&nbsp;</td>
  	  <td width="50" class='SortHeader'>&nbsp;</td>
	  <td width="70" class='SortHeader displayCell alLeft'><?php 
    echo _SHOW;
    ?>
</td>
  </tr>
<?php 
    $i = 1;
    $currDate = "";
    while ($row = $db->sql_fetchrow($res)) {
        $is_private = $row["private"];
        $flightID = $row['ID'];
        if ($pilotNames[$row["userServerID"] . '_' . $row["userID"]]) {
            $name = $pilotNames[$row["userServerID"] . '_' . $row["userID"]];
        } else {
            $name = getPilotRealName($row["userID"], $row["userServerID"], 1);
            $pilotNames[$row["userServerID"] . '_' . $row["userID"]] = $name;
        }
        $name = prepare_for_js($name);
        if ($takeoffNames[$row["flight_takeoffID"]]) {
            $takeoffName = $takeoffNames[$row["flight_takeoffID"]];
        } else {
            $takeoffName = prepare_for_js(getWaypointName($row["flight_takeoffID"], -1, 0, 20));
            $takeoffNames[$row["flight_takeoffID"]] = $takeoffName;
        }
        $takeoffVinicity = $row["takeoffVinicity"];
        $takeoffNameFrm = formatLocation($takeoffName, $takeoffVinicity, $takeoffRadious);
        $sortRowClass = $i % 2 ? "l_row1" : "l_row2";
        $i++;
        $days_from_submission = floor((mktime() - datetime2UnixTimestamp($row["dateAdded"])) / 86400);
        // 60*60*24 sec per day
        if (!$is_private) {
            $privateIcon = '&nbsp;';
        } else {
            $privateIcon = '';
            if ($is_private & 0x1) {
                $privateIcon .= "<img src='" . $moduleRelPath . "/img/icon_private.gif' align='absmiddle' width='13' height='13'>";
            }
            if ($is_private & 0x2) {
                $privateIcon .= "<img src='" . $moduleRelPath . "/img/icon_disabled.gif' align='absmiddle' width='13' height='13'>";
            }
            if ($is_private & 0x4) {
                $privateIcon .= "<img src='" . $moduleRelPath . "/img/locked.gif' align='absmiddle' width='13' height='13'>";
            }
        }
        if ($row["DATE"] != $currDate || $sortOrder != 'DATE') {
            $currDate = $row["DATE"];
            $dateStr = formatDate($row["DATE"]);
            $rowStr = " newDate ";
        } else {
            $dateStr = "<span class='dateHidden'>" . formatDate($row["DATE"]) . "</span>";
            $rowStr = "";
        }
        $date2row = "";
        if ($days_from_submission <= $CONF_new_flights_days_threshold) {
            $newSubmissionStr = _SUBMIT_FLIGHT . ': ' . $row["dateAdded"] . ' GMT';
            $date2row .= leoHtml::img("icon_new.png", 25, 12, 'absmiddle', $newSubmissionStr, 'icons1');
        }
        if ($row['excludeFrom'] & 0x1) {
            $date2row .= "*";
        }
        //$extLinkImgStr=getExternalLinkIconStr($row["serverID"],$row["originalURL"],3);
        //if ($extLinkImgStr) $extLinkImgStr="<a href='".$row["originalURL"]."' target='_blank'>$extLinkImgStr</a>";
        $date2row .= $extLinkImgStr;
        if ($date2row == '') {
            $date2row .= '&nbsp;';
        }
        echo "\n\n<tr class='{$sortRowClass} {$rowStr}' id='row_{$flightID}'>\n";
        $duration = sec2Time($row['DURATION'], 1);
        $linearDistance = formatDistanceOpen($row["LINEAR_DISTANCE"]);
        $olcDistance = formatDistanceOpen($row["FLIGHT_KM"]);
        $olcScore = formatOLCScore($row["FLIGHT_POINTS"]);
        $gliderType = $row["cat"];
        // 1=pg 2=hg flex 4=hg rigid 8=glider
        # Martin Jursa 20.05.2007
        $scoreSpeed = formatSpeed($row["SCORE_SPEED"]);
        // get the OLC score type
        $olcScoreType = $row['BEST_FLIGHT_TYPE'];
        if ($olcScoreType == "FREE_FLIGHT") {
            $olcScoreTypeImg = "icon_turnpoints.gif";
        } else {
            if ($olcScoreType == "FREE_TRIANGLE") {
                $olcScoreTypeImg = "icon_triangle_free.gif";
            } else {
                if ($olcScoreType == "FAI_TRIANGLE") {
                    $olcScoreTypeImg = "icon_triangle_fai.gif";
                } else {
                    $olcScoreTypeImg = "photo_icon_blank.gif";
                }
            }
        }
        $gliderBrandImg = brands::getBrandImg($row["gliderBrandID"], $row['flight_glider'], $gliderType);
        echo "\n<TD {$first_col_back_color} class='indexCell'><div>" . ($i - 1 + $startNum) . "</div>{$privateIcon}</TD>";
        echo "<TD class='dateString' valign='top'><div>{$dateStr}</div>{$date2row}";
        if ((L_auth::isClubAdmin($userID, $clubID) || L_auth::isAdmin($userID)) && $add_remove_mode) {
            // echo "<BR>";
            if (in_array($flightID, $clubFlights)) {
                echo "<div id='fl_{$flightID}' style='display:inline;margin:0px;padding:0px'><a href=\"#\" onclick=\"removeClubFlight({$clubID},{$flightID});return false;\">{$removeFromClubIcon}</a></div>";
            } else {
                echo "<div id='fl_{$flightID}' style='display:inline'><a href=\"#\" onclick=\"addClubFlight({$clubID},{$flightID});return false;\">{$addToClubIcon}</a></div>";
            }
        }
        echo "</TD>";
        echo "<TD  class='pilotTakeoffCell' colspan=2 " . $sortArrayStr["pilotName"] . $sortArrayStr["takeoffID"] . ">" . "<div id='p_{$i}' class='pilotLink'>";
        //echo "<span class='fl sprite-gr'></span>";
        //echo  getNationalityDescription($row["pilotCountryCode"],1,0);
        $thisPilot = new pilot($row["userServerID"], $row["userID"]);
        if ($thisPilot->isPilotLocal() || L_auth::isAdmin($userID)) {
            echo " <a href=\"javascript:pilotTip.newTip('inline', 0, 13, 'p_{$i}', 250, '" . $row["userServerID"] . "_" . $row["userID"] . "','" . addslashes($name) . "' )\"  onmouseout=\"pilotTip.hide()\">{$name}</a>\n";
        } else {
            echo " <a href=\"javascript:pilotTipExt.newTip('inline', 0, 13, 'p_{$i}', 200, '" . $row["userServerID"] . "_" . $row["userID"] . "','" . addslashes($name) . "' )\"  onmouseout=\"pilotTip.hide()\">{$name}</a>\n";
        }
        echo "</div>";
        echo "<div id='at_{$i}' class='takeoffLink'>";
        echo "<a id='t_{$i}' href=\"javascript:takeoffTip.newTip('inline',-25, 13,'t_{$i}', 250, '" . $row["takeoffID"] . "','" . addslashes($takeoffName) . "')\"  onmouseout=\"takeoffTip.hide()\">{$takeoffNameFrm}</a>\n";
        echo "</div></TD>" . "<TD>{$duration}</TD>";
        if ($CONF['list_flights']['fields']['scoring'][0] == 'LINEAR_DISTANCE') {
            echo "<TD class='distance'>{$linearDistance}</TD>";
        } else {
            echo "<TD class='speed'>{$scoreSpeed}</TD>";
        }
        echo "<TD class='distance'>{$olcDistance}</TD>";
        //P. Wild 22.03.2011 - Deutschland Flüge Fett hervorheben, Admin Farbkennzeichnung Luftraum
        $tmpairspaceName = $row['airspaceCheckMsg'];
        if (strrchr($tmpairspaceName, "Punkte")) {
            echo "<TD nowrap class='OLCScore'><b>{$olcScore}</b>&nbsp;" . leoHtml::img($olcScoreTypeImg, 16, 16, 'top', formatOLCScoreType($olcScoreType, 0), 'icons1');
        } else {
            echo "<TD nowrap class='OLCScore'>{$olcScore}&nbsp;" . leoHtml::img($olcScoreTypeImg, 16, 16, 'top', formatOLCScoreType($olcScoreType, 0), 'icons1');
        }
        if ($CONF_use_validation) {
            $isValidated = $row['validated'];
            if ($isValidated == -1) {
                $vImg = "icon_valid_nok.gif";
            } else {
                if ($isValidated == 0) {
                    $vImg = "icon_valid_unknown.gif";
                } else {
                    if ($isValidated == 1) {
                        $vImg = "icon_valid_ok.gif";
                    }
                }
            }
            $valStr = leoHtml::img($vImg, 12, 12, '', '', 'icons1 listIcons');
            echo $valStr;
        }
        echo "</TD>";
        echo "<TD><div class='catInfo'>";
        $gliderTypeDesc = $gliderCatList[$row["cat"]];
        if ($row["category"]) {
            $gliderTypeDesc .= " - " . $CONF['gliderClasses'][$row["cat"]]['classes'][$row["category"]];
            $categoryImg = "<div class='categoryListIconDiv'>" . leoHtml::img("icon_class_" . $row["category"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1', '') . "</div>";
        } else {
            $categoryImg = '';
        }
        echo leoHtml::img("icon_cat_" . $row["cat"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1 catListIcon') . $categoryImg;
        echo "</div></td>\n\t<TD><div align='center'>{$gliderBrandImg}</div></td>";
        if (L_auth::airspaceVisible($userID, $row["userID"], $row["userServerID"])) {
            /*
            		$CONF_airspaceChecks && 
            			( L_auth::isAdmin($userID) || $CONF['airspace']['view']=='public' ||   
            			( $CONF['airspace']['view']=='registered' && $userID >0 ) || 
            			( $CONF['airspace']['view']=='own' && $userID == $row["userID"] && $row["userServerID"]==$serverID )   
            		) 
            		) {*/
            if ($row['airspaceCheckFinal'] == -1) {
                //original: $airspaceProblem=' bgcolor=#F7E5C9 ';
                # peter Wild hack taking into account the deutschlandpokal-hack
                $tmpairspaceName = $row['airspaceCheckMsg'];
                if (strrchr($tmpairspaceName, "Punkte")) {
                    $airspaceProblem = ' bgcolor=#009cff ';
                    //Blue
                    if (strpos($tmpairspaceName, "HorDist")) {
                        $airspaceProblem = ' bgcolor=#FFFF00 ';
                        //Yellow
                    }
                    //mod.31.12.08 different colours for bad infringements. P. Wild
                    if (strpos($tmpairspaceName, 'CLASSC') !== false) {
                        $airspaceProblem = ' bgcolor=#FF0008 ';
                        //Red
                    }
                    if (strpos($tmpairspaceName, 'CLASSD') !== false) {
                        $airspaceProblem = ' bgcolor=#FF0008 ';
                    }
                } else {
                    $airspaceColor = '';
                    foreach ($CONF['aispace']['list']['colors'] as $className => $classColor) {
                        if (strpos($tmpairspaceName, $className) !== false) {
                            $airspaceColor = $classColor;
                            break;
                        }
                    }
                    if (!$airspaceColor) {
                        $airspaceColor = $CONF['aispace']['list']['colors']['ALLOTHER'];
                    }
                    $airspaceProblem = " bgcolor=#{$airspaceColor} ";
                }
                # end hack
            } else {
                $airspaceProblem = '';
            }
        }
        $isExternalFlight = $row['externalFlightType'];
        echo "<TD {$airspaceProblem} align=left valign='top'>";
        echo "<div class='smallInfo'>";
        if ($isExternalFlight == 0 || $isExternalFlight == 2 || $CONF['servers']['list'][$row['serverID']]['treat_flights_as_local']) {
            // add class='betterTip' for tooltip
            $flightLinkUrl = getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row["ID"]));
            global $deletedFlights;
            if ($deletedFlights) {
                $flightLinkUrl .= "&deleted=1";
            }
            echo "<a class='flightLink' id='tpa3_{$flightID}' href='" . $flightLinkUrl . "'>" . leoHtml::img("icon_look.gif", 0, 0, 'top', _SHOW, 'icons1 flightIcon', '', 1) . "</a>";
            echo "<a href='javascript:nop()' onclick=\"geTip.newTip('inline', -315, -5, 'ge_{$i}', 300, '" . $row["ID"] . "' , '{$currentlang}')\"  onmouseout=\"geTip.hide()\">" . leoHtml::img("geicon.gif", 0, 0, 'top', _Navigate_with_Google_Earth, 'icons1 geIcon', 'ge_' . $i) . "</a>";
        } else {
            echo "<a class='flightLink' href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row["ID"])) . "'>" . leoHtml::img("icon_look.gif", 0, 0, 'top', _SHOW, 'icons1 flightIcon') . "</a>";
            $originalKML = $row["originalKML"];
            global $CONF;
            if ($CONF['servers']['list'][$row["serverID"]]['isLeo'] == 1) {
                if ($row["original_ID"]) {
                    $originalKML = 'http://' . $CONF['servers']['list'][$row["serverID"]]['url_base'] . '/download.php?type=kml_trk&flightID=' . $row["original_ID"];
                }
            }
            if ($originalKML) {
                echo "<a  href='" . $originalKML . "'>" . leoHtml::img("geicon.gif", 0, 0, 'top', _Navigate_with_Google_Earth, 'icons1 geIcon') . "</a>";
            } else {
                echo leoHtml::img("photo_icon_blank.gif", 16, 16, '', '', 'icons1 geIcon');
            }
        }
        $photosNum = $row["hasPhotos"];
        if ($photosNum) {
            echo "<span><a class='betterTip2' id='tpa1_{$flightID}' href='javascript:nop();'>" . leoHtml::img("icon_camera.gif", 0, 0, '', $photosNum . ' ' . _PHOTOS, 'icons1 photoIcon2') . "</a></span>";
        }
        if ($row["commentsNum"] > 0) {
            $hasComments = 1;
            if ($row["commentsNum"] > 1) {
                $commentsImgName = "icon_comments_many.gif";
            } else {
                $commentsImgName = "icon_comments.gif";
            }
        } else {
            $hasComments = 0;
        }
        if ($hasComments) {
            echo "<a class='betterTip' id='tpa2_{$flightID}' href='javascript:nop();'>" . leoHtml::img($commentsImgName, 0, 0, '', $row["commentsNum"] . ' ' . _COMMENTS, 'icons1 commentDiv', '', 1) . "</a>";
        }
        if (1) {
            echo "<span class='preview'><a class='betterTip' id='tpa0_{$flightID}' href='javascript:nop()'>" . leoHtml::img("icon_info.gif", 0, 0, 'top', _SHOW, 'icons1 previewDiv', '', 1) . "</a></span>";
        }
        if ($isExternalFlight && !$CONF['servers']['list'][$row['serverID']]['treat_flights_as_local']) {
            $extServerStr = $CONF['servers']['list'][$row['serverID']]['name'];
            $extServerStrShort = $CONF['servers']['list'][$row['serverID']]['short_name'];
            if ($isExternalFlight == 2) {
                echo leoHtml::img("icon_link_dark.gif", 0, 0, '', _External_Entry . ": {$extServerStr}", 'icons1 extLink');
                echo "<div class='extLinkName'>{$extServerStrShort}</div>";
            } else {
                if ($CONF['servers']['list'][$row['serverID']]['isLeo']) {
                    $url_flight = $CONF['servers']['list'][$row['serverID']]['url_flight'];
                    if ($url_flight) {
                        $extFlightLink = 'http://' . str_replace("%FLIGHT_ID%", $row['original_ID'], $url_flight) . "&lng={$currentlang}";
                    } else {
                        $extFlightLink = 'http://' . $CONF['servers']['list'][$row['serverID']]['url'] . '&op=show_flight&flightID=' . $row['original_ID'] . "&lng={$currentlang}";
                    }
                } else {
                    $extFlightLink = $row['originalURL'];
                }
                echo "<a href='{$extFlightLink}' target='_blank' class='extLinkDiv' title='{$extServerStr}: " . _Ext_text2 . "' >";
                // also put the direct link in the place of the photo
                echo "<img class='extServerLogo' src='" . $moduleRelPath . "/img/servers/" . sprintf("%03d", $row['serverID']) . ".gif' width='16' height='16'  border='0'/>";
                echo leoHtml::img("icon_link_dark.gif", 0, 0, '', '', 'icons1 extLinkIcon');
                echo "<div class='extLinkDescr'>{$extServerStrShort}</div>";
                //echo "<span class='extLinkDescr'>$extServerStrShort</span>";
                echo "</a>";
            }
        }
        # P.Wild, martin jursa: considering $CONF_new_flights_days_threshold
        global $CONF_new_flights_submit_window;
        //P. Wild - edited to submit window (old version false)
        $inWindow = empty($CONF_new_flights_submit_window) ? true : $days_from_submission <= $CONF_new_flights_submit_window;
        if ($row["userID"] == $userID && $inWindow || L_auth::isAdmin($userID)) {
            echo "<div id='ac_{$i}' class='actionLink'>";
            echo "<a href=\"javascript:flightActionTip.newTip('inline', -100, 13, 'ac_{$i}', 120, " . $row["ID"] . " )\"  onmouseout=\"flightActionTip.hide()\">" . leoHtml::img("icon_action_select.gif", 0, 0, 'bottom', '', 'icons1') . "</a>";
            echo "</div>";
        }
        $checkedByStr = '';
        if ($row['checkedBy'] && L_auth::isAdmin($userID)) {
            $checkedByArray = explode(" ", $row['checkedBy']);
            $checkedByStr = "<div class='checkedBy' align=right>" . $checkedByArray[0] . "</div>";
            echo $checkedByStr;
        }
        echo "</div>";
        echo "</TD>\n";
        echo "</TR>";
    }
    echo "</table>\n\n";
    $db->sql_freeresult($res);
}
             $olcScoreTypeImg = "icon_triangle_free.gif";
         } else {
             if ($olcScoreType == "FAI_TRIANGLE") {
                 $olcScoreTypeImg = "icon_triangle_fai.gif";
             } else {
                 $olcScoreTypeImg = "photo_icon_blank.gif";
             }
         }
     }
     echo "<TR class='hr'><TD>" . _OLC_SCORE_TYPE . "</td><td>" . formatOLCScoreType($flight->BEST_FLIGHT_TYPE) . " " . leoHtml::img($olcScoreTypeImg, 0, 0, 'absmiddle', '', 'icons1', '', 0) . "\n";
     echo "<TR><TD>" . _OLC_DISTANCE . "</td><td>" . formatDistanceOpen($flight->FLIGHT_KM) . " ({$olcDistanceSpeed})\n";
     echo "<TR><TD>" . _OLC_SCORING . "</td><td>" . formatOLCScore($flight->FLIGHT_POINTS) . "<td></tr>\n";
     echo "<TR class='hr'><TD>" . _OPEN_DISTANCE . "</td><td>" . formatDistanceOpen($flight->LINEAR_DISTANCE) . " ({$openDistanceSpeed})" . "<td></tr>\n";
     echo "<TR><TD>" . _MAX_DISTANCE . "</td><td>" . formatDistanceOpen($flight->MAX_LINEAR_DISTANCE) . " ({$maxDistanceSpeed})\n";
 }
 echo "<TR class='hr'><TD>" . _TAKEOFF_LOCATION . "</td><td>" . formatLocation(getWaypointName($flight->takeoffID), $flight->takeoffVinicity, $takeoffRadious) . "<td></tr>\n";
 echo "<TR><TD>" . _TAKEOFF_TIME . "</td><td>" . sec2Time($flight->START_TIME) . "<td></tr>\n";
 echo "<TR><TD>" . _DURATION . "</td><td>" . sec2Time($flight->DURATION) . "<td></tr>\n";
 echo "<TR class='hr'><TD>" . _MAX_SPEED . "</td><td>" . formatSpeed($flight->MAX_SPEED) . "<td></tr>\n";
 echo "<TR><TD>" . _MAX_VARIO . "</td><td>" . formatVario($flight->MAX_VARIO) . "<td></tr>\n";
 echo "<TR><TD>" . _MIN_VARIO . "</td><td>" . formatVario($flight->MIN_VARIO) . "<td></tr>\n";
 if ($flight->is3D()) {
     echo "<TR><TD>" . _MAX_ALTITUDE . "</td><td>" . formatAltitude($flight->MAX_ALT) . "<td></tr>\n";
     echo "<TR><TD>" . _TAKEOFF_ALTITUDE . "</td><td>" . formatAltitude($flight->TAKEOFF_ALT) . "<td></tr>\n";
 }
 if ($flight->commentsNum && 0) {
     $flightComments = new flightComments($flightID);
     $commentRow = $flightComments->getFirstFromDB();
     $comment = leoHtml::cutString($commentRow['text'], 300);
     echo "<TR class='hr'><TD>" . _COMMENTS . "</td><td>" . $comment . "</td></tr>\n";
 }
$flightHours = $flight->DURATION / 3600;
if ($flightHours) {
    $openDistanceSpeed = formatSpeed($flight->LINEAR_DISTANCE / ($flightHours * 1000));
    $maxDistanceSpeed = formatSpeed($flight->MAX_LINEAR_DISTANCE / ($flightHours * 1000));
    $olcDistanceSpeed = formatSpeed($flight->FLIGHT_KM / ($flightHours * 1000));
} else {
    $openDistanceSpeed = 0;
    $maxDistanceSpeed = 0;
    $olcDistanceSpeed = 0;
}
$takeoffLink = "<div id='takeoffAddPos'><a href=\"javascript:takeoffTip.newTip('inline',0,13, 'takeoffAddPos', 250, '" . $flight->takeoffID . "','" . str_replace("'", "\\'", $location) . "'," . $firstPoint->lat . "," . $firstPoint->lon . ")\"  onmouseout=\"takeoffTip.hide()\">{$location}</a>";
if ($flight->takeoffVinicity > $takeoffRadious * 2) {
    $takeoffLink .= "<div id='attentionLinkPos' class='attentionLink'><a\n\t\t\t href=\"javascript:user_add_takeoff(" . $firstPoint->lat . "," . $firstPoint->lon . "," . $flight->takeoffID . ")\" \n\t\t\t onmouseover='unknownTakeoffTip.show(\"floating\")'  onmouseout='unknownTakeoffTip.hide()'><img\n\t\t\t src='{$moduleRelPath}/img/icon_att3.gif' border=0 align=absmiddle>" . _Unknown_takeoff . "<img \n\t\t\t src='{$moduleRelPath}/img/icon_att3.gif' border=0 align=absmiddle></a></div>";
}
$takeoffLink .= "</div>";
$Ltemplate->assign_vars(array('TAKEOFF_LOCATION' => $takeoffLink, 'TAKEOFF_TIME' => sec2Time($flight->START_TIME), 'LANDING_LOCATION' => formatLocation(getWaypointName($flight->landingID), $flight->landingVinicity, $landingRadious), 'LANDING_TIME' => sec2Time($flight->END_TIME), 'LINEAR_DISTANCE' => formatDistanceOpen($flight->LINEAR_DISTANCE) . " ({$openDistanceSpeed})", 'DURATION' => sec2Time($flight->DURATION), 'VALI' => $valiStr));
if ($scoringServerActive) {
    $olcScoreType = $flight->BEST_FLIGHT_TYPE;
    if ($olcScoreType == "FREE_FLIGHT") {
        $olcScoreTypeImg = "icon_turnpoints.gif";
    } else {
        if ($olcScoreType == "FREE_TRIANGLE") {
            $olcScoreTypeImg = "icon_triangle_free.gif";
        } else {
            if ($olcScoreType == "FAI_TRIANGLE") {
                $olcScoreTypeImg = "icon_triangle_fai.gif";
            } else {
                $olcScoreTypeImg = "photo_icon_blank.gif";
            }
        }
    }
} else {
    $countryLegend = _WORLD_WIDE;
    $allCountriesDisplay = 1;
}
$pilotLegend = "";
$allPilotsDisplay = 0;
if ($pilotID) {
    $pilotLegend = getPilotRealName($pilotID, $serverID);
} else {
    $pilotLegend = _ALL_PILOTS;
    $allPilotsDisplay = 1;
}
$takeoffLegend = "";
$allTakeoffDisplay = 0;
if ($takeoffID) {
    $takeoffLegend = getWaypointName($takeoffID);
} else {
    $takeoffLegend = _ALL_TAKEOFFS;
    $allTakeoffDisplay = 1;
}
# Martin Jursa, 22.05.2007
$showNacClubSelection = !empty($CONF_use_NAC) && empty($dontShowNacClubSelection);
if ($showNacClubSelection) {
    $nacClubLegend = _ALL_NACCLUBS;
    if (!empty($forceNacId)) {
        $nacid = $forceNacId;
    }
    # just to make sure
    if ($nacid) {
        if ($nacclubid) {
            require_once dirname(__FILE__) . "/CL_NACclub.php";
<?php

//************************************************************************
// Leonardo XC Server, http://www.leonardoxc.net
//
// Copyright (c) 2004-2010 by Andreadakis Manolis
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// $Id: GUI_flight_delete.php,v 1.12 2010/03/14 20:56:11 manolis Exp $
//
//************************************************************************
$flightID = makeSane($_REQUEST["flightID"], 1);
$confirmed = makeSane($_REQUEST["confirmed"]);
$flight = new flight();
$flight->getFlightFromDB($flightID);
if ($confirmed && ($flight->belongsToUser($userID) || L_auth::isAdmin($userID))) {
    $flight->deleteFlight();
    echo "<br><span class='ok'>" . _THE_FLIGHT_HAS_BEEN_DELETED . "</span><br><br>";
    echo "<a href='" . getLeonardoLink(array('op' => 'list_flights')) . "'>" . _RETURN . "</a><br></div>";
} else {
    $location = formatLocation(getWaypointName($flight->takeoffID), $flight->takeoffVinicity, $takeoffRadious);
    openMain(_CAUTION_THE_FLIGHT_WILL_BE_DELETED, 0, "delete_icon.png");
    echo "<div align=center><br><b>" . _PILOT . ": " . $flight->userName . " &nbsp;&nbsp; " . _THE_DATE . ": " . formatDate($flight->DATE) . "  &nbsp;&nbsp; " . _TAKEOFF_LOCATION . ": " . $location . "</b> ";
    echo "<br><br><a href='" . getLeonardoLink(array('op' => 'delete_flight', 'flightID' => $flightID, 'confirmed' => '1')) . "'>" . _YES . "</a> | <a href='javascript:history.go(-1)'>" . _NO . "</a>";
    echo "<br></div>";
    closeMain();
}
Example #8
0
            } else {
                $dateStr = '';
            }
            echo "<span>{$dateStr}<a {$linkStr}>" . $newsItem['text'] . "</a></span>\n";
        }
    }
}
if ($CONF['news']['config']['showBestFlights']) {
    global $prefix, $db, $sitename, $user, $cookie, $flightsTable;
    global $CONF_glider_types, $gliderCatList, $module_name;
    $count = 1;
    $content .= "<span><b>Best scores for " . date("Y") . "</b> </span>";
    foreach ($CONF_glider_types as $gl_id => $gl_type) {
        $query = "SELECT * FROM {$flightsTable}\n\t\t\t\t\tWHERE DATE_FORMAT( DATE, '%Y' ) =" . date("Y") . " AND cat =" . $gl_id . "\n\t\t\t\t\tORDER BY flight_points DESC\n\t\t\t\t\tLIMIT 1 ";
        $result1 = $db->sql_query($query);
        // Listing Topics
        while ($row = $db->sql_fetchrow($result1)) {
            $flightID = $row["ID"];
            $name = getPilotRealName($row["userID"], $row["serverID"], 0, 0, 0);
            $takeoffName = getWaypointName($row["takeoffID"]);
            $takeoffVinicity = $row["takeoffVinicity"];
            $takeoffNameFrm = formatLocation($takeoffName, $takeoffVinicity, $takeoffRadious);
            $flightDurationFrm = sec2Time($row['DURATION'], 1);
            $content .= "<span>:: <span>" . $gliderCatList[$gl_id] . "</span>";
            $content .= "<a href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $flightID)) . "'>";
            $content .= "{$name}</a> [ {$takeoffName} ] " . formatDate($row["DATE"]) . " <a href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $flightID)) . "'>" . _OLC_SCORING . ":" . formatOLCScore($row['FLIGHT_POINTS']) . "</a> </span>";
            $count = $count + 1;
        }
    }
    echo $content;
}
      <td colspan="2"  valign="top">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
			<fieldset class="legendBox">
			<legend><? echo _PILOT_NAME ?></legend>
			<div align="left">
			<b><? echo $flight->userName ?></b>
			</b>	  </div>
			</fieldset>	
			</td>
            <td>
				<fieldset class="legendBox">
				<legend><? echo _THE_DATE." - "._TAKEOFF ?></legend>
				<div align="left">
				<b><? echo  formatDate($flight->DATE)." - ".getWaypointName($flight->takeoffID) ?></b>
				</b>	  </div>
				</fieldset>	
			</td>
            <td>
				<fieldset class="legendBox">
				<legend><? echo _IGC_FILE_OF_THE_FLIGHT ?></legend>
				<div align="left">
				<b><? echo  $flight->filename ?></b>
				</b>	  </div>
				</fieldset>	
			</td>
          </tr>
        </table>    
</td>
    </tr>
Example #10
0
 function kmlGetDescription($ext, $getFlightKML, $loadTrackLink = 0)
 {
     if ($this->takeoffVinicity > $takeoffRadious) {
         $location = getWaypointName($this->takeoffID, 0) . " [~" . sprintf("%.1f", $this->takeoffVinicity / 1000) . " km]";
     } else {
         $location = getWaypointName($this->takeoffID, 0);
     }
     if ($this->landingVinicity > $landingRadious) {
         $location_land = getWaypointName($this->landingID, 0) . " [~" . sprintf("%.1f", $this->landingVinicity / 1000) . " km]";
     } else {
         $location_land = getWaypointName($this->landingID, 0);
     }
     $fl_url = $this->getFlightLinkURL();
     //$fl_url=str_replace("&","&#38;",$this->getFlightLinkURL());
     //$fl_url=str_replace("&nbsp;"," ",$fl_url);
     $str = "<description><![CDATA[<table cellpadding=0 cellspacing=0>";
     if ($loadTrackLink) {
         $str .= "<tr bgcolor='#D7E1EE'><td></td><td><div align='right'><a href='{$getFlightKML}'><b>Load Track</b></a></div></td></tr>";
     } else {
         $str .= "<tr bgcolor='#D7E1EE'><td></td><td><div align='right'><a href='{$fl_url}'><b>" . _See_more_details . "</b></a></div></td></tr>";
     }
     $str .= "<tr bgcolor='#CCCCCC'><td>" . _PILOT . "</td><td>  " . htmlspecialchars($this->userName) . "</td></tr>" . "<tr><td>" . _TAKEOFF_LOCATION . "</td><td> " . $location . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _TAKEOFF_TIME . "</td><td>    " . formatDate($this->DATE, false) . " - " . sec2Time($this->START_TIME, 1) . "</td></tr>" . "<tr><td>" . _LANDING_LOCATION . "</td><td> " . $location_land . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _OPEN_DISTANCE . "</td><td> " . formatDistance($this->LINEAR_DISTANCE, 1) . "</td></tr>" . "<tr><td>" . _DURATION . "</td><td> " . sec2Time($this->DURATION, 1) . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _OLC_SCORE_TYPE . "</td><td> " . htmlspecialchars(formatOLCScoreType($this->BEST_FLIGHT_TYPE, false)) . "</td></tr>" . "<tr><td>" . _OLC_DISTANCE . "</td><td> " . formatDistance($this->FLIGHT_KM, 1) . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _OLC_SCORING . "</td><td> " . sprintf("%.1f", $this->FLIGHT_POINTS) . "</td></tr>" . "<tr><td>" . _MAX_SPEED . "</td><td> " . formatSpeed($this->MAX_SPEED) . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _MAX_VARIO . "</td><td> " . formatVario($this->MAX_VARIO) . "</td></tr>" . "<tr><td>" . _MIN_VARIO . "</td><td> " . formatVario($this->MIN_VARIO) . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _MAX_ALTITUDE . "</td><td> " . formatAltitude($this->MAX_ALT) . "</td></tr>" . "<tr><td>" . _MIN_ALTITUDE . "</td><td> " . formatAltitude($this->MIN_ALT) . "</td></tr>" . "<tr bgcolor='#CCCCCC'><td>" . _TAKEOFF_ALTITUDE . "</td><td> " . formatAltitude($this->TAKEOFF_ALT) . "</td></tr>" . "<tr><td>" . _GLIDER . "</td><td>" . $this->glider . "</td></tr>" . "<tr bgcolor='#D7E1EE'><td></td><td><div align='right'>" . _KML_file_made_by . " <a href='http://www.leonardoxc.net'>Leonardo</a></div></td></tr>";
     if ($ext) {
         $str .= "<tr bgcolor='#D7E1EE'><td></td><td><div align='right'>Extra analysis module by  Man\\'s <a href='http://www.parawing.net'>GPS2GE V2.0</a></div></td></tr>";
     }
     $str .= "<tr bgcolor='#D7E1EE'><td></td><td><div align='right'><a href='{$getFlightKML}&show_url=1'>URL of this KML file</div></td></tr>";
     $str .= "</table>]]></description>";
     return $str;
 }
Example #11
0
function flights_find($arg)
{
    global $db, $flightsTable;
    global $takeoffRadious, $CONF;
    require_once "FN_pilot.php";
    $sitePass = $arg[0];
    $lat = $arg[1];
    $lon = -$arg[2];
    $limit = $arg[3];
    if (!securityCheck($sitePass)) {
        return new IXR_Error(4000, 'Access Denied');
    }
    $firstPoint = new gpsPoint();
    $firstPoint->lat = $lat;
    $firstPoint->lon = $lon;
    // calc TAKEOFF - LANDING PLACES
    if (count($waypoints) == 0) {
        $waypoints = getWaypoints(0, 1);
    }
    $takeoffIDTmp = 0;
    $minTakeoffDistance = 10000000;
    $i = 0;
    foreach ($waypoints as $waypoint) {
        $takeoff_distance = $firstPoint->calcDistance($waypoint);
        if ($takeoff_distance < $minTakeoffDistance) {
            $minTakeoffDistance = $takeoff_distance;
            $takeoffIDTmp = $waypoint->waypointID;
        }
        $i++;
    }
    $nearestWaypoint = new waypoint($takeoffIDTmp);
    $nearestWaypoint->getFromDB();
    //$nearestWaypoint;
    //$minTakeoffDistance;
    if ($limit > 0) {
        $lim = "LIMIT {$limit}";
    } else {
        $lim = "";
    }
    $where_clause = "AND takeoffID={$nearestWaypoint->waypointID}";
    $query = "SELECT * FROM {$flightsTable} WHERE private=0 {$where_clause} ORDER BY FLIGHT_POINTS  DESC {$lim} ";
    //echo $query;
    $res = $db->sql_query($query);
    if ($res <= 0) {
        return new IXR_Error(4000, 'Error in query! ' . $query);
    }
    $flights = array();
    $i = 0;
    while ($row = mysql_fetch_assoc($res)) {
        $name = getPilotRealName($row["userID"], $row["serverID"]);
        $link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])));
        $this_year = substr($row['DATE'], 0, 4);
        $linkIGC = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getRelMainDir() . str_replace("%PILOTID%", getPilotID($row["userServerID"], $row["userID"]), str_replace("%YEAR%", $this_year, $CONF['paths']['igc'])) . '/' . $row['filename']);
        //$flightsRelPath."/".$row[userID]."/flights/".$this_year."/".$row[filename] );
        if ($row['takeoffVinicity'] > $takeoffRadious) {
            $location = getWaypointName($row['takeoffID']) . " [~" . sprintf("%.1f", $row['takeoffVinicity'] / 1000) . " km]";
        } else {
            $location = getWaypointName($row['takeoffID']);
        }
        $flights[$i]['pilot'] = htmlspecialchars($name);
        $flights[$i]['takeoff'] = htmlspecialchars($location);
        $flights[$i]['date'] = $row['DATE'];
        $flights[$i]['duration'] = $row['DURATION'];
        $flights[$i]['openDistance'] = $row['MAX_LINEAR_DISTANCE'];
        $flights[$i]['OLCkm'] = $row['FLIGHT_KM'];
        $flights[$i]['OLCScore'] = $row['FLIGHT_POINTS'];
        $flights[$i]['OLCtype'] = $row['BEST_FLIGHT_TYPE'];
        $flights[$i]['displayLink'] = $link;
        $i++;
    }
    return array($i, $flights);
    //return array($i,0);
}
			max( DURATION ) AS maxDuration,
			max( MAX_ALT ) AS maxAlt,
			max( MAX_ALT - TAKEOFF_ALT ) AS maxAltGain,
			
		   ' . ' count( * ) AS totalFlights, 
			sum( LINEAR_DISTANCE ) AS totalDistance, 
			sum( DURATION ) AS totalDuration, ' . ' sum( LINEAR_DISTANCE )/count( * ) as mean_distance, ' . ' sum( DURATION )/count( * ) as mean_duration, ' . ' sum( FLIGHT_KM ) as totalOlcKm, ' . ' sum( FLIGHT_POINTS ) as totalOlcScore, ' . ' max( FLIGHT_POINTS ) as bestOlcScore ' . ' FROM ' . $flightsTable . $extra_table_str . ' WHERE ' . $flightsTable . '.userID = ' . $pilotIDview . ' AND ' . $flightsTable . '.userServerID = ' . $serverIDview . $where_clause . ' GROUP BY takeoffID' . ' ';
//echo "<hr>stats query: $query<hr>";
$res = $db->sql_query($query);
if ($res <= 0) {
    echo "<H3> Error in pilot stats query </H3>\n";
    return;
}
$groupBy = 'takeoffID';
while ($row = mysql_fetch_assoc($res)) {
    $takeoffName = getWaypointName($row['takeoffID']);
    echo "<h2>{$takeoffName}</h2>";
    showStats($row, 'takeoffID', $where_clause, " AND takeoffID=" . $row['takeoffID'], $row['takeoffID']);
    //echo "<hr>";
    //print_r($row);
}
echo "<h1> Breakdown per Glider</h1>";
/*
 * Break down per glider
 */
$query = 'SELECT DISTINCT gliderBrandID,glider, max( LINEAR_DISTANCE ) AS bestDistance,
			min(DATE) as firstFlightDate,max(DATE) as lastFlightDate,
			(TO_DAYS(max(DATE)) - TO_DAYS(MIN(DATE))) as flyingPeriod,
			max( DURATION ) AS maxDuration,
			max( MAX_ALT ) AS maxAlt,
			max( MAX_ALT - TAKEOFF_ALT ) AS maxAltGain,
Example #13
0
//			$title="OLCscore: $score :: Pilot: $name :: takeoff: $takeoffName :: duration: $duration :: open distance: $linKM";
			$title="$score pts :: Open $linKM - OLC ".formatDistance($row['FLIGHT_KM']). " km :: T/off: $takeoffName";
			$title=str_replace("&nbsp;"," ",$title);

			// MANOLIS new way of writing URLS
			$link=htmlspecialchars ("http://".$_SERVER['SERVER_NAME'].
			getLeonardoLink(array('op'=>'show_flight','flightID'=>$row['flightID'])) );


		if ($row['takeoffVinicity'] > $takeoffRadious ) 
			$location=getWaypointName($row['takeoffID'])." [~".sprintf("%.1f",$row['takeoffVinicity']/1000)." km]"; 
		else $location=getWaypointName($row['takeoffID']);

		if ($row['landingVinicity'] > $landingRadious ) 
			$location_land=getWaypointName($row['landingID'])." [~".sprintf("%.1f",$row['landingVinicity']/1000)." km]"; 
		else $location_land=getWaypointName($row['landingID']);

$star="=";
$linear_stars = str_repeat($star,intval( $row['LINEAR_DISTANCE'] / 20000 ) );
$hour_stars = str_repeat($star,intval( $row['DURATION'] / 3600 ) );
$score_stars = str_repeat($star,intval( $row['FLIGHT_POINTS'] / 50 ) );
$olc_km_stars = str_repeat($star,intval( $row['FLIGHT_KM'] / 20000 ) );
$min_alt_stars = str_repeat($star,intval( $row['MIN_ALT'] / 500 ) );
$max_alt_stars = str_repeat($star,intval( $row['MAX_ALT'] / 500 ) );
$takeoff_stars = str_repeat($star,intval( $row['TAKEOFF_ALT'] / 500 ) );
$speed_stars = str_repeat($star,intval( $row['MAX_SPEED'] / 20 ) );

$desc="<font size=\"+1\">Pilot:  <b><font color=\"#ff0000\">$name</font></b></font>".
"<br>Glider: <b>".$row['glider'].
"</b><br><font color=\"#aa6600\">Date - Time: <b>".formatDate($row['DATE'],false)." - ".sec2Time($row['START_TIME'],1). 
"</b></font><br><font color=\"#00aa00\">Takeoff: <b>$location</b></font>".
	$takeoffLink="<div id='takeoffAddPos'><a href=\"javascript:takeoffTip.newTip('inline',0,13, 'takeoffAddPos', 250, '".$flight->takeoffID."','".str_replace("'","\'",$location)."',".$firstPoint->lat.",".$firstPoint->lon.")\"  onmouseout=\"takeoffTip.hide()\">$location</a>";
		
	if ($flight->takeoffVinicity>$takeoffRadious*2 ) {
		$takeoffLink.="<div id='attentionLinkPos' class='attentionLink'><a
			 href=\"javascript:user_add_takeoff(".$firstPoint->lat.",".$firstPoint->lon.",".$flight->takeoffID.")\" 
			 onmouseover='unknownTakeoffTip.show(\"floating\")'  onmouseout='unknownTakeoffTip.hide()'><img
			 src='$moduleRelPath/img/icon_att3.gif' border=0 align=absmiddle>"._Unknown_takeoff."<img 
			 src='$moduleRelPath/img/icon_att3.gif' border=0 align=absmiddle></a></div>";
	}
	$takeoffLink.="</div>";


$Ltemplate->assign_vars(array(
	'TAKEOFF_LOCATION'=>$takeoffLink,
	'TAKEOFF_TIME'=>sec2Time($flight->START_TIME),
	'LANDING_LOCATION'=>formatLocation(getWaypointName($flight->landingID),$flight->landingVinicity,$landingRadious),
	'LANDING_TIME'=>sec2Time($flight->END_TIME),
	'LINEAR_DISTANCE'=>formatDistanceOpen($flight->LINEAR_DISTANCE)." ($openDistanceSpeed)",
	'DURATION'=>sec2Time($flight->DURATION),
	'VALI'=>$valiStr,
));

if ( $scoringServerActive ) {
		$olcScoreType=$flight->BEST_FLIGHT_TYPE;
		if ($olcScoreType=="FREE_FLIGHT") {
			$olcScoreTypeImg="icon_turnpoints.gif";
		} else if ($olcScoreType=="FREE_TRIANGLE") {
			$olcScoreTypeImg="icon_triangle_free.gif";
		} else if ($olcScoreType=="FAI_TRIANGLE") {
			$olcScoreTypeImg="icon_triangle_fai.gif";
		} else { 
Example #15
0
function listFlights($res, $legend, $query_str = "", $sortOrder = "DATE")
{
    global $Theme;
    global $module_name;
    global $takeoffRadious;
    global $userID;
    global $moduleRelPath;
    global $admin_users;
    global $PREFS;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $currentlang, $nativeLanguage, $opMode;
    $legendRight = "";
    if ($pagesNum > 1) {
        if ($page_num > 1) {
            $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num=" . ($page_num - 1) . "'><<</a>&nbsp;";
        } else {
            $legendRight .= "<<&nbsp;";
        }
        for ($k = 1; $k <= $pagesNum; $k++) {
            if ($k != $page_num) {
                $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num={$k}'>{$k}</a>&nbsp;";
            } else {
                $legendRight .= "{$k}&nbsp;";
            }
        }
        if ($page_num < $pagesNum) {
            $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num=" . ($page_num + 1) . "'>>></a>&nbsp;";
        } else {
            $legendRight .= ">>&nbsp;";
        }
    }
    $endNum = $startNum + $PREFS->itemsPerPage;
    if ($endNum > $itemsNum) {
        $endNum = $itemsNum;
    }
    $legendRight .= " [ " . ($startNum + 1) . "-" . $endNum . " " . _From . " " . $itemsNum . " ]";
    if ($itemsNum == 0) {
        $legendRight = "[ 0 ]";
    }
    $headerSelectedBgColor = "#F2BC66";
    open_inner_table("<table class=main_text width=100%><tr><td>{$legend}</td><td valign=top width=400 align=right bgcolor=#eeeeee>{$legendRight}</td></tr></table>", 750, -1);
    ?>
  <td width="25" bgcolor="<?php 
    echo $Theme->color1;
    ?>
"><div align=left><?php 
    echo _NUM;
    ?>
</div></td>
 <?php 
    printHeader(80, $headerSelectedBgColor, $Theme->color0, $sortOrder, "DATE", _DATE_SORT, $query_str);
    printHeader(160, $headerSelectedBgColor, $Theme->color0, $sortOrder, "pilotName", _PILOT, $query_str);
    printHeader(0, $headerSelectedBgColor, $Theme->color1, $sortOrder, "takeoffID", _TAKEOFF, $query_str);
    printHeader(40, $headerSelectedBgColor, $Theme->color2, $sortOrder, "DURATION", _DURATION_HOURS_MIN, $query_str);
    printHeader(65, $headerSelectedBgColor, $Theme->color3, $sortOrder, "LINEAR_DISTANCE", _LINEAR_DISTANCE, $query_str);
    printHeader(65, $headerSelectedBgColor, $Theme->color3, $sortOrder, "FLIGHT_KM", _OLC_KM, $query_str);
    printHeader(40, $headerSelectedBgColor, $Theme->color3, $sortOrder, "FLIGHT_POINTS", _OLC_SCORE, $query_str);
    ?>
  <td width="18" bgcolor="<?php 
    echo $Theme->color4;
    ?>
">&nbsp;</td>
  <td width="72" bgcolor="<?php 
    echo $Theme->color4;
    ?>
"><div align=left><?php 
    echo _SHOW;
    ?>
</div></td></tr>
<?php 
    $i = 1;
    while ($row = mysql_fetch_assoc($res)) {
        $is_private = $row["private"];
        $name = getPilotRealName($row["userID"], $row["serverID"]);
        $takeoffName = getWaypointName($row["takeoffID"]);
        $takeoffVinicity = $row["takeoffVinicity"];
        $takeoffNameFrm = formatLocation($takeoffName, $takeoffVinicity, $takeoffRadious);
        $sortRowBgColor = $i % 2 ? "#CCCACA" : "#E7E9ED";
        $i++;
        open_tr();
        $days_from_submission = floor((mktime() - datetime2UnixTimestamp($row["dateAdded"])) / 86400);
        // 60*60*24 sec per day
        if ($is_private) {
            $first_col_back_color = " bgcolor=#33dd33 ";
        } else {
            $first_col_back_color = "";
        }
        echo "<TD {$first_col_back_color} ><div align=left>" . ($i - 1 + $startNum) . "</div></TD>      \n\t   <TD " . ($sortOrder == "DATE" ? "bgcolor=" . $sortRowBgColor : "") . ">\n\t\t\t<div align=right>";
        if ($days_from_submission <= 3) {
            echo "<img src='" . $moduleRelPath . "/img/icon_new.png' >";
        }
        echo formatDate($row["DATE"]) . "</div></TD>" . "<TD width=300 colspan=2 valign=top " . ($sortOrder == "pilotName" || $sortOrder == "takeoffID" ? "bgcolor=" . $sortRowBgColor : "") . ">" . "<div align=left>" . "<a href='?name={$module_name}&op=pilot_profile&pilotIDview=" . $row["userID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>" . "<a href='?name={$module_name}&op=pilot_profile_stats&pilotIDview=" . $row["userID"] . "'><img src='" . $moduleRelPath . "/img/icon_stats.gif' border=0></a>&nbsp;" . "<a href='?name={$module_name}&op=list_flights&pilotID=" . $row["userID"] . "'>{$name}</a>" . "</div><div align=right>" . "<a href='?name={$module_name}&op=list_flights&takeoffID=" . $row["takeoffID"] . "'>{$takeoffNameFrm}</a>&nbsp;" . "<a href='?name={$module_name}&op=show_waypoint&waypointIDview=" . $row["takeoffID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>" . "<a href='" . $moduleRelPath . "/download.php?type=kml_wpt&wptID=" . $row["takeoffID"] . "'><img src='" . $moduleRelPath . "/img/gearth_icon.png' border=0></a>" . "</div></TD>" . "<TD " . ($sortOrder == "DURATION" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . sec2Time($row['DURATION'], 1) . "</div></TD>\n\t   <TD " . ($sortOrder == "LINEAR_DISTANCE" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatDistanceOpen($row["LINEAR_DISTANCE"]) . "</div></TD>\t\n\t   <TD " . ($sortOrder == "FLIGHT_KM" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatDistanceOpen($row["FLIGHT_KM"]) . "</div></TD>\t\n\t   <TD " . ($sortOrder == "FLIGHT_POINTS" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatOLCScore($row["FLIGHT_POINTS"]) . "</div></TD>" . "<td><img src='" . $moduleRelPath . "/img/icon_cat_" . $row["cat"] . ".png' border=0></td>" . "<TD align=left><a href='?name={$module_name}&op=show_flight&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>";
        echo "<a href='" . $moduleRelPath . "/download.php?type=kml_trk&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/gearth_icon.png' border=0></a>";
        if ($row["photo1Filename"]) {
            echo "<img src='" . $moduleRelPath . "/img/photo_icon.jpg' width=16 height=16>";
        } else {
            echo "<img src='" . $moduleRelPath . "/img/photo_icon_blank.gif' width=16 height=16>";
        }
        if ($row["userID"] == $userID || in_array($userID, $admin_users)) {
            // admin IDS in $admin_users
            echo "<a href='?name={$module_name}&op=delete_flight&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/x_icon.gif' width=16 height=16 border=0 align=bottom></a>";
            echo "<a href='?name={$module_name}&op=edit_flight&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/change_icon.png' width=16 height=16 border=0 align=bottom></a>";
        }
        echo "</TD>";
        close_tr();
    }
    close_inner_table();
    mysql_freeResult($res);
}
Example #16
0
 if ($res <= 0) {
     echo "<H3> Error in query! {$query} </H3>\n";
     exit;
 }
 $i = 0;
 $str = '';
 while ($row = mysql_fetch_assoc($res)) {
     $name = getPilotRealName($row["userID"], $row["userServerID"], 0, 0, 0);
     $link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])));
     $this_year = substr($row[DATE], 0, 4);
     $linkIGC = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getRelMainDir() . str_replace("%PILOTID%", getPilotID($row["userServerID"], $row["userID"]), str_replace("%YEAR%", $this_year, $CONF['paths']['igc'])) . '/' . $row['filename']);
     //$flightsRelPath."/".$row[userID]."/flights/".$this_year."/".$row[filename] );
     if ($row['takeoffVinicity'] > $takeoffRadious) {
         $location = getWaypointName($row['takeoffID']) . " [~" . sprintf("%.1f", $row['takeoffVinicity'] / 1000) . " km]";
     } else {
         $location = getWaypointName($row['takeoffID']);
     }
     $flight = new flight();
     $flight->getFlightFromDB($row['ID'], 0, $row);
     $extendedInfo = 0;
     $lineColor = "ff0000";
     $exaggeration = 1;
     $lineWidth = 2;
     $getFlightKML = $flight->getFlightKML() . "&c={$lineColor}&w={$lineWidth}&an={$extendedInfo}";
     $desc = $flight->kmlGetDescription($extendedInfo, $getFlightKML, 1);
     $snippet = "<![CDATA[" . formatDistance($flight->FLIGHT_KM, 1) . ", " . _DURATION . ": " . sec2Time($flight->DURATION, 1) . "]]>";
     $str .= "<Placemark>\n\t\t\t\t<name><![CDATA[{$location}]]></name>\n\t\t\t\t<styleUrl>#marker_cat_" . $row['cat'] . "</styleUrl>\n\t\t\t\t<Snippet  maxLines='1'>{$snippet}</Snippet>\n\t\t\t\t" . $desc . "\n\t\t\t\t<Point>\n\t\t\t\t<coordinates>" . $row['firstLon'] . ',' . $row['firstLat'] . "</coordinates>\n\t\t\t\t</Point>\n\t\t\t\t</Placemark>\t\t\t\n\t\t\t";
     $i++;
 }
 $trackNum = $i;
 $incWaypoints = 1;
Example #17
0
 function getTakeoffList($in_string = '')
 {
     global $db;
     global $flightsTable;
     $takeoffs = array();
     $sql = "SELECT DISTINCT takeoffID FROM {$flightsTable} WHERE takeoffID<>0";
     if ($in_string) {
         $sql .= ' AND takeoffID IN (' . $in_string . ')';
     }
     $res = $db->sql_query($sql);
     if ($res) {
         while (false !== ($row = $db->sql_fetchrow($res))) {
             $takeoffs[$row['takeoffID']] = getWaypointName($row['takeoffID'], -1, 1);
         }
         if (!empty($takeoffs)) {
             asort($takeoffs);
         }
     }
     return $takeoffs;
 }