function listTakeoffs($res, $legend, $query_str = "", $sortOrder = "CountryCode") { global $db, $Theme; global $takeoffRadious; global $userID; global $moduleRelPath; global $PREFS; global $page_num, $pagesNum, $startNum, $itemsNum; global $currentlang, $nativeLanguage, $opMode; global $countries; $legendRight = ""; $headerSelectedBgColor = "#F2BC66"; open_inner_table("<table class=main_text width=100%><tr><td>{$legend}</td><td width=300 align=right bgcolor=#eeeeee>{$legendRight}</td></tr></table>", 750); ?> <td width="25" bgcolor="<?php echo $Theme->color1; ?> "><div align=left><?php echo _NUM; ?> </div></td> <?php printHeaderTakeoffs(120, $headerSelectedBgColor, $Theme->color0, $sortOrder, "CountryCode", _COUNTRY, $query_str); printHeaderTakeoffs(0, $headerSelectedBgColor, $Theme->color2, $sortOrder, "clubName", _CLUB_NAME, $query_str); printHeaderTakeoffs(120, $headerSelectedBgColor, $Theme->color3, $sortOrder, "FlightsNum", _NUMBER_OF_FLIGHTS, $query_str); printHeaderTakeoffs(100, $headerSelectedBgColor, $Theme->color4, $sortOrder, "max_distance", _SITE_RECORD_OPEN_DISTANCE, $query_str); ?> </tr> <?php $currCountry = ""; $i = 1; while ($row = $db->sql_fetchrow($res)) { $takeoffName = $row["name"]; // $sortRowBgColor=($i%2)?"#CCCACA":"#E7E9ED"; $sortRowBgColor = "#E7E9ED"; $bgcolor = ""; if ($countries[$row["countryCode"]] != $currCountry || $sortOrder != 'CountryCode') { $currCountry = $countries[$row["countryCode"]]; $country_str = "<div align=left>" . "<a href='" . CONF_MODULE_ARG . "&op=list_clubs&country=" . $row["countryCode"] . "'>" . $currCountry . "</a>" . "</div>"; if ($sortOrder == 'CountryCode') { $bgcolor = "bgcolor=#DDDDDD"; } else { $bgcolor = $i % 2 ? "bgcolor=#DDDDDD" : ""; } } else { $country_str = ""; } $i++; echo "<TR {$bgcolor} align=right>"; echo "<TD {$first_col_back_color} ><div align=left>" . ($i - 1 + $startNum) . "</div></TD> "; echo "<TD valign=top>{$country_str}</TD>"; echo "<TD " . ($sortOrder == "takeoffID" ? "bgcolor=" . $sortRowBgColor : "") . ">" . "<div align=left>" . "<a href='" . CONF_MODULE_ARG . "&op=show_club&clubIDview=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>" . " " . "<a href='" . CONF_MODULE_ARG . "&op=list_flights&clubID=" . $row["ID"] . "'>" . $takeoffName . "</a>" . "</div></TD>"; echo "<TD " . ($sortOrder == "LINEAR_DISTANCE" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . $row["FlightsNum"] . " (<a href='" . CONF_MODULE_ARG . "&op=list_flights&clubID=" . $row["ID"] . "'>" . _SHOW_FLIGHTS . "</a>)</div></TD>\t"; echo "<TD " . ($sortOrder == "LINEAR_DISTANCE" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatDistanceOpen($row["max_distance"]) . "</div></TD>\t"; close_tr(); } close_inner_table(); $db->sql_freeresult($res); }
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'> </td> <td width="50" class='SortHeader'> </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 = ' '; } 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 .= ' '; } 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> " . leoHtml::img($olcScoreTypeImg, 16, 16, 'top', formatOLCScoreType($olcScoreType, 0), 'icons1'); } else { echo "<TD nowrap class='OLCScore'>{$olcScore} " . 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); }
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"; } $Ltemplate->assign_vars(array( 'MAX_DISTANCE'=>formatDistanceOpen($flight->MAX_LINEAR_DISTANCE)." ($maxDistanceSpeed)", 'OLC_TYPE'=>formatOLCScoreType($flight->BEST_FLIGHT_TYPE)." ".leoHtml::img($olcScoreTypeImg,0,0,'absmiddle','','icons1'), 'OLC_KM'=>formatDistanceOpen($flight->FLIGHT_KM)." ($olcDistanceSpeed)", 'OLC_SCORE'=>formatOLCScore($flight->FLIGHT_POINTS), 'SCORE_INFO_LINK'=>$showScoreInfo, )); } else { $Ltemplate->assign_vars(array( 'MAX_DISTANCE'=>0, 'OLC_TYPE'=>0, 'OLC_KM'=>0, 'OLC_SCORE'=>0, )); } $Ltemplate->assign_vars(array( 'MAX_SPEED'=>formatSpeed($flight->MAX_SPEED), 'MAX_VARIO'=>formatVario($flight->MAX_VARIO),
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"; } } } $Ltemplate->assign_vars(array('MAX_DISTANCE' => formatDistanceOpen($flight->MAX_LINEAR_DISTANCE) . " ({$maxDistanceSpeed})", 'OLC_TYPE' => formatOLCScoreType($flight->BEST_FLIGHT_TYPE) . " " . leoHtml::img($olcScoreTypeImg, 0, 0, 'absmiddle', '', 'icons1'), 'OLC_KM' => formatDistanceOpen($flight->FLIGHT_KM) . " ({$olcDistanceSpeed})", 'OLC_SCORE' => formatOLCScore($flight->FLIGHT_POINTS), 'SCORE_INFO_LINK' => $showScoreInfo)); } else { $Ltemplate->assign_vars(array('MAX_DISTANCE' => 0, 'OLC_TYPE' => 0, 'OLC_KM' => 0, 'OLC_SCORE' => 0)); } $Ltemplate->assign_vars(array('MAX_SPEED' => formatSpeed($flight->MAX_SPEED), 'MAX_VARIO' => formatVario($flight->MAX_VARIO), 'MEAN_SPEED' => formatSpeed($flight->MEAN_SPEED), 'MIN_VARIO' => formatVario($flight->MIN_VARIO))); if ($flight->is3D()) { $Ltemplate->assign_vars(array('MAX_ALT' => formatAltitude($flight->MAX_ALT), 'TAKEOFF_ALT' => formatAltitude($flight->TAKEOFF_ALT), 'MIN_ALT' => formatAltitude($flight->MIN_ALT), 'ALTITUDE_GAIN' => formatAltitude($flight->MAX_ALT - $flight->TAKEOFF_ALT))); } else { $Ltemplate->assign_vars(array('MAX_ALT' => 0, 'TAKEOFF_ALT' => 0, 'MIN_ALT' => 0, 'ALTITUDE_GAIN' => 0)); } /* $flight->filename echo "<div id='geOptionsPos' style='float:right'>"; echo "<a href='javascript:nop()' onclick=\"toggleVisible('geOptionsID','geOptionsPos',14,-80,170,'auto');return false;\">Google Earth <img src='".$moduleRelPath."/img/icon_arrow_down.gif' border=0></a></div>"; */ if ($flight->comments) { $comments = $flight->comments;
} 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"; } } } 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);
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> "; } else { $legendRight .= "<< "; } 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> "; } else { $legendRight .= "{$k} "; } } if ($page_num < $pagesNum) { $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num=" . ($page_num + 1) . "'>>></a> "; } else { $legendRight .= ">> "; } } $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; ?> "> </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> " . "<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> " . "<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); }
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 = " "; } $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); }
function listPilots($res, $legend, $queryExtraArray = array(), $sortOrder = "bestDistance", $is_comp = 0) { global $db, $Theme; global $moduleRelPath; global $PREFS; global $page_num, $pagesNum, $startNum, $itemsNum; global $op, $opMode, $CONF; global $currentlang, $nativeLanguage; ?> <table class='listTable' width="100%" cellpadding="2" cellspacing="0"> <tr> <td width="25" class='SortHeader'><?php echo _NUM; ?> </td> <?php // was _TOTAL_KM -> bug if ($PREFS->metricSystem == 1) { $OPEN_DISTANCE_str = _TOTAL_DISTANCE . " " . _KM; } else { $OPEN_DISTANCE_str = _TOTAL_DISTANCE . " " . _MI; } printHeaderPilotsTotals(0, $sortOrder, "pilotName", _PILOT, $queryExtraArray, $is_comp); printHeaderPilotsTotals(60, $sortOrder, "totalFlights", _NUMBER_OF_FLIGHTS, $queryExtraArray, $is_comp); printHeaderPilotsTotals(80, $sortOrder, "bestDistance", _BEST_DISTANCE, $queryExtraArray, $is_comp); if (!is_comp) { printHeaderPilotsTotals(60, $sortOrder, "mean_distance", _MEAN_KM, $queryExtraArray, $is_comp); } printHeaderPilotsTotals(80, $sortOrder, "totalDistance", $OPEN_DISTANCE_str, $queryExtraArray, $is_comp); printHeaderPilotsTotals(80, $sortOrder, "totalDuration", _TOTAL_DURATION_OF_FLIGHTS, $queryExtraArray, $is_comp); if (!is_comp) { printHeaderPilotsTotals(60, $sortOrder, "mean_duration", _MEAN_DURATION, $queryExtraArray, $is_comp); } if (!is_comp) { printHeaderPilotsTotals(60, $sortOrder, "totalOlcKm", _TOTAL_OLC_KM, $queryExtraArray, $is_comp); } printHeaderPilotsTotals(60, $sortOrder, "totalOlcPoints", _TOTAL_OLC_SCORE, $queryExtraArray, $is_comp); printHeaderPilotsTotals(60, $sortOrder, "bestOlcScore", _BEST_OLC_SCORE, $queryExtraArray, $is_comp); echo "</tr>"; $i = 1; while ($row = $db->sql_fetchrow($res)) { $name = getPilotRealName($row["userID"], $row["userServerID"], 1, 1, 1); $name = prepare_for_js($name); $mean_duration = $row["totalDuration"] / $row["totalFlights"]; $mean_distance = $row["totalDistance"] / $row["totalFlights"]; $sortRowClass = $i % 2 ? "l_row1" : "l_row2"; $i++; echo "\n\n<tr class='{$sortRowClass}'>"; echo "<TD>" . ($i - 1 + $startNum) . "</TD>"; echo "<TD><div align=left id='p_{$i}' class='pilotLink'>"; // echo getNationalityDescription($row["countryCode"],1,0); echo "<a class='betterTip' id='tpa0_" . $row["userServerID"] . "u" . $row["userID"] . "' href=\"javascript:pilotTip.newTip('inline',0,13, 'p_{$i}', 200,'" . $row["userServerID"] . "_" . $row["userID"] . "','" . addslashes($name) . "' )\" \n\t\t onmouseout=\"pilotTip.hide()\">{$name}</a>"; // echo "#".$row['NACid'].$row['NACmemberID'].$row['NACclubID']."#"; if ($row['NACid'] && $row['NACmemberID'] && $row['NACclubID'] && $CONF['NAC']['display_club_details_on_pilot_list']) { echo " <a class='betterTip' id='tpa1_" . $row["userServerID"] . "u" . $row["userID"] . "' href=\"javascript:nop();\"><img src='{$moduleRelPath}/img/icon_nac_member.gif' align='absmiddle' border=0></a>"; } echo "</div></TD>"; echo "<TD>" . $row["totalFlights"] . "</TD>" . "<TD>" . formatDistanceOpen($row["bestDistance"]) . "</TD>"; if (!is_comp) { echo " <TD>" . formatDistanceOpen($mean_distance) . "</TD>"; } echo "<TD>" . formatDistanceOpen($row["totalDistance"]) . "</TD>" . "<TD>" . sec2Time($row["totalDuration"]) . "</TD>"; if (!is_comp) { echo "<TD>" . sec2Time($mean_duration) . "</TD>"; } if (!is_comp) { echo "<TD>" . formatDistanceOLC($row["totalOlcKm"]) . "</TD>"; } echo "<TD>" . formatOLCScore($row["totalOlcPoints"]) . "</TD>" . "<TD>" . formatOLCScore($row["bestOlcScore"]) . "</TD>"; echo "</TR>"; } echo "</table>"; $db->sql_freeresult($res); }
function showStats($row, $groupBy, $where_clause, $where_clause2, $suffix = '') { global $CONF, $db, $flightsTable, $pilotIDview, $serverIDview, $extra_table_str; $suffixHash = md5($groupBy . $where_clause . $where_clause2 . $suffix); $query = 'SELECT DISTINCT ' . $groupBy . ', max( FLIGHT_KM ) AS BestFreeTriangle ' . ' FROM ' . $flightsTable . $extra_table_str . ' WHERE ' . $flightsTable . '.userID = ' . $pilotIDview . ' AND ' . $flightsTable . '.userServerID = ' . $serverIDview . $where_clause . $where_clause2 . ' AND BEST_FLIGHT_TYPE = "FREE_TRIANGLE" ' . ' GROUP BY ' . $groupBy . ' ' . ' '; // echo "<hr>stats query: $query<hr>"; $res = $db->sql_query($query); if ($res <= 0) { echo "<H3> Error in pilot stats query </H3>\n"; return; } $row0 = mysql_fetch_assoc($res); $BestFreeTriangle = $row0["BestFreeTriangle"]; $query = 'SELECT DISTINCT ' . $groupBy . ', max( FLIGHT_KM ) AS BestFAITriangle ' . ' FROM ' . $flightsTable . $extra_table_str . ' WHERE ' . $flightsTable . '.userID = ' . $pilotIDview . ' AND ' . $flightsTable . '.userServerID = ' . $serverIDview . $where_clause . $where_clause2 . ' AND BEST_FLIGHT_TYPE = "FAI_TRIANGLE" ' . ' GROUP BY ' . $groupBy . ' ' . ' '; $res = $db->sql_query($query); if ($res <= 0) { echo "<H3> Error in pilot stats query </H3>\n"; return; } $row0 = mysql_fetch_assoc($res); $BestFAITriangle = $row0["BestFAITriangle"]; if ($row["totalFlights"]) { $mean_duration = $row["totalDuration"] / $row["totalFlights"]; $mean_distance = $row["totalDistance"] / $row["totalFlights"]; } else { $mean_duration = "N/A"; $mean_distance = "N/A"; } list($flyingYears, $flyingMonths) = days2YearsMonths($row["flyingPeriod"]); $flyingPeriod = $flyingMonths . " months"; if ($flyingYears > 0) { $flyingPeriod = $flyingYears . " years - " . $flyingPeriod; } $flyingMonthsReal = $row["flyingPeriod"] / 30; $flyingYearsReal = $row["flyingPeriod"] / 365; if ($flyingMonthsReal > 1) { $MeanflightsperMonth = sprintf("%.1f", $row["totalFlights"] / $flyingMonthsReal); $MeanflightsperYear = sprintf("%.1f", $row["totalFlights"] / $flyingYearsReal); $MeanDurationPerMonth = sec2Time($row["totalDuration"] / $flyingMonthsReal, 1); $MeanDurationPerYear = sec2Time($row["totalDuration"] / $flyingYearsReal, 1); $MeanDistancePerMonth = formatDistance($row["totalDistance"] / $flyingMonthsReal, 1); $MeanDistancePerYear = formatDistance($row["totalDistance"] / $flyingYearsReal, 1); } else { $MeanflightsperMonth = "N/A"; $MeanflightsperYear = "N/A"; $MeanDurationPerMonth = "N/A"; $MeanDurationPerYear = "N/A"; $MeanDistancePerMonth = "N/A"; $MeanDistancePerYear = "N/A"; } if ($row["totalFlights"]) { // MAKE some graphs $query = 'SELECT count(*) as flightsCount, SUM(DURATION) as sum_duration, DATE_FORMAT(`DATE`,"%Y-%m") as flightDate ' . ' FROM ' . $flightsTable . $extra_table_str . ' WHERE ' . $flightsTable . '.userID = ' . $pilotIDview . ' AND ' . $flightsTable . '.userServerID = ' . $serverIDview . $where_clause . $where_clause2 . ' GROUP BY DATE_FORMAT(DATE,"%Y-%m") ' . ' '; $query1 = $query . ' ASC'; $res1 = $db->sql_query($query1); # Error checking if ($res1 <= 0) { echo "<H3> Error in profile stats query!</H3>\n"; return; } $first_month = substr($row['firstFlightDate'], 0, 7); $last_month = substr($row['lastFlightDate'], 0, 7); $year_month_array = fill_year_month_array($first_month, $last_month); $data_time1 = array(); $yvalues1 = array(); $yvalues2 = array(); $yval_num = array(); $yval_dur = array(); while ($row1 = mysql_fetch_assoc($res1)) { array_push($data_time1, $row1['flightDate']); array_push($yval_num, $row1['flightsCount']); array_push($yval_dur, $row1['sum_duration']); } $i = 0; $j = 0; foreach ($year_month_array as $y_m) { if (in_array($y_m, $data_time1)) { $yvalues1[$i] = $yval_num[$j]; $yvalues2[$i] = sprintf("%.1f", $yval_dur[$j] / 3600); $j++; } else { $yvalues1[$i] = 0; $yvalues2[$i] = ""; } $i++; } $path = dirname(getPilotStatsFilename($pilotIDview, 2)); if (!is_dir($path)) { makeDir($path); } $graph = new Graph(680, 250, "auto"); $graph->SetFrame(true, "#FFBC46"); $graph->SetScale("textlin"); $graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#D8E6F2@0.5'); $graph->yaxis->HideZeroLabel(); $graph->SetMarginColor("#FFF6DF"); $graph->img->SetMargin(40, 40, 20, 70); $graph->title->Set($title); $graph->xaxis->SetTextTickInterval(1); $graph->xaxis->SetTextLabelInterval(1); $graph->xaxis->SetTickLabels($year_month_array); $graph->xaxis->SetPos("min"); $graph->xaxis->SetLabelAngle(90); $graph->xaxis->SetTextLabelInterval(ceil(count($year_month_array) / 60)); // Create the bar plot $b1 = new BarPlot($yvalues1); $b1->SetFillColor("#FFBC46"); $b1->SetShadow("#9C989E", 2, 2); // $b1->value->Show(); $graph->Add($b1); $graph->Stroke(getPilotStatsFilename($pilotIDview, '1' . $suffixHash)); $graph = new Graph(680, 250, "auto"); $graph->SetFrame(true, "#FFBC46"); $graph->SetScale("textlin"); $graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#D8E6F2@0.5'); $graph->yaxis->HideZeroLabel(); $graph->SetMarginColor("#FFF6DF"); $graph->img->SetMargin(40, 40, 20, 70); $graph->title->Set($title); $graph->xaxis->SetTextTickInterval(1); $graph->xaxis->SetTextLabelInterval(1); $graph->xaxis->SetTickLabels($year_month_array); $graph->xaxis->SetPos("min"); $graph->xaxis->SetLabelAngle(90); $graph->xaxis->SetTextLabelInterval(ceil(count($year_month_array) / 60)); // Create the bar plot $b1 = new BarPlot($yvalues2); $b1->SetFillColor("#FFBC46"); $b1->SetShadow("#9C989E", 2, 2); $b1->value->Show(); $b1->value->SetFormat('%0.1f h'); $graph->Add($b1); $graph->Stroke(getPilotStatsFilename($pilotIDview, '2' . $suffixHash)); } ?> <div id='stats_<?php echo $pilotIDview . $suffix; ?> ' class='stat_totals'> <div class='infoHeader'><?php echo _Totals; ?> </div> <table class=main_text width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td width='38%' valign="top" bgcolor="#FFFFFF"> <div align="right"><?php echo _First_flight_logged; ?> </div></td> <td width='12%' bgcolor="#F1FAE2"> <?php echo $row['firstFlightDate']; ?> </td> <td width='1%'> </td> <td width='38%'bgcolor="#FFFFFF"><div align="right"><?php echo _Total_Distance; ?> (km) </div></td> <td width='11%' bgcolor="#F1FAE2"> <?php echo formatDistanceOpen($row["totalDistance"], 1); ?> </td> </tr> <tr> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Last_flight_logged; ?> </div></td> <td bgcolor="#E0E0E0"> <?php echo $row['lastFlightDate']; ?> </td> <td> </td> <td bgcolor="#E9EDF5"><div align="right"><?php echo _Total_OLC_Score; ?> </div></td> <td bgcolor="#E0E0E0"><?php echo formatOLCScore($row["totalOlcScore"]); ?> </td> </tr> <tr> <td valign="top" bgcolor="#FFFFFF"> <div align="right"><?php echo _Flying_period_covered; ?> </div></td> <td bgcolor="#F1FAE2"> <?php echo $flyingPeriod; ?> </td> <td> </td> <td bgcolor="#FFFFFF"><div align="right"><?php echo _Total_Hours_Flown; ?> (<?php echo _hh_mm; ?> )</div></td> <td bgcolor="#F1FAE2"> <?php echo sec2Time($row["totalDuration"], 1); ?> </td> </tr> <tr> <td valign="top" bgcolor="#E9EDF5"> </td> <td bgcolor="#E0E0E0"> </td> <td> </td> <td bgcolor="#E9EDF5"><div align="right"><?php echo _Total_num_of_flights; ?> </div></td> <td bgcolor="#E0E0E0"> <?php echo $row['totalFlights']; ?> </td> </tr> </table> <div class='infoHeader'><?php echo _Personal_Bests; ?> </div> <table class=main_text width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td width='38%' bgcolor="#FFFFFF"><div align="right"><?php echo _Best_Open_Distance; ?> (km) </div></td> <td width='12%' bgcolor="#F1FAE2"> <?php echo formatDistanceOpen($row["bestDistance"], 1); ?> </td> <td width='1%'> </td> <td width='38%' bgcolor="#FFFFFF"><div align="right"><?php echo _Best_OLC_score; ?> </div></td> <td width='11%' bgcolor="#F1FAE2"><?php echo formatOLCScore($row["bestOlcScore"]); ?> </td> </tr> <tr> <td bgcolor="#E9EDF5"><div align="right"><?php echo _Best_FAI_Triangle; ?> (km)</div></td> <td bgcolor="#E0E0E0"> <?php echo formatDistanceOpen($BestFAITriangle, 1); ?> </td> <td> </td> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Absolute_Height_Record; ?> (m)</div></td> <td bgcolor="#E0E0E0"> <?php echo formatAltitude($row['maxAlt']); ?> </td> </tr> <tr> <td valign="top" bgcolor="#FFFFFF"> <div align="right"><?php echo _Best_Free_Triangle; ?> (km) </div></td> <td bgcolor="#F1FAE2"> <?php echo formatDistanceOpen($BestFreeTriangle, 1); ?> </td> <td> </td> <td valign="top" bgcolor="#FFFFFF"> <div align="right"><?php echo _Altitute_gain_Record; ?> (m)</div></td> <td bgcolor="#F1FAE2"> <?php echo formatAltitude($row['maxAltGain']); ?> </td> </tr> <tr> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Longest_Flight; ?> (<?php echo _hh_mm; ?> )</div></td> <td bgcolor="#E0E0E0"> <?php echo sec2Time($row['maxDuration'], 1); ?> </td> <td> </td> <td bgcolor="#E9EDF5"><div align="right"></div></td> <td bgcolor="#E0E0E0"> </td> </tr> </table> <div class='infoHeader'><?php echo _Mean_values; ?> </div> <table class=main_text width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td width='38%' bgcolor="#FFFFFF"><div align="right"><?php echo _Mean_distance_per_flight; ?> (km) </div></td> <td width='12%' bgcolor="#F1FAE2"><?php echo formatDistanceOpen($mean_distance, 1); ?> </td> <td width='1%'> </td> <td width='38%' bgcolor="#FFFFFF"><div align="right"><?php echo _Mean_duration_per_flight; ?> (<?php echo _hh_mm; ?> )</div></td> <td width='11%' bgcolor="#F1FAE2"> <?php echo sec2Time($row["mean_duration"], 1); ?> </td> </tr> <tr> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Mean_flights_per_Month; ?> </div></td> <td bgcolor="#E0E0E0"> <?php echo $MeanflightsperMonth; ?> </td> <td> </td> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Mean_flights_per_Year; ?> </div></td> <td bgcolor="#E0E0E0"> <?php echo $MeanflightsperYear; ?> </td> </tr> <tr> <td valign="top" bgcolor="#FFFFFF"> <div align="right"><?php echo _Mean_distance_per_Month; ?> (km) </div></td> <td bgcolor="#F1FAE2"> <?php echo $MeanDistancePerMonth; ?> </td> <td> </td> <td valign="top" bgcolor="#FFFFFF"> <div align="right"><?php echo _Mean_distance_per_Year; ?> (km) </div></td> <td bgcolor="#F1FAE2"> <?php echo $MeanDistancePerYear; ?> </td> </tr> <tr> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Mean_duration_per_Month; ?> (<?php echo _hh_mm; ?> ) </div></td> <td bgcolor="#E0E0E0"> <?php echo $MeanDurationPerMonth; ?> </td> <td> </td> <td valign="top" bgcolor="#E9EDF5"> <div align="right"><?php echo _Mean_duration_per_Year; ?> (<?php echo _hh_mm; ?> )</div></td> <td bgcolor="#E0E0E0"> <?php echo $MeanDurationPerYear; ?> </td> </tr> </table> <div class='infoHeader'><?php echo _Total_num_of_flights; ?> </div> <table class=main_text width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td colspan="5" valign="top"><img src='<?php echo getPilotStatsRelFilename($pilotIDview, '1' . $suffixHash); ?> ' border=0></td> </tr> </table> <div class='infoHeader'><?php echo _Total_Hours_Flown; ?> </div> <table class=main_text width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td colspan="5" valign="top"><img src='<?php echo getPilotStatsRelFilename($pilotIDview, '2' . $suffixHash); ?> ' border=0></td> </tr> </table> </div> <?php }
$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']); } if ($i > 0) { $JSON_str .= ", "; } $START_TIME = sec2Time24h($row['START_TIME'], 1); $END_TIME = sec2Time24h($row['END_TIME'], 1); $duration = sec2Time($row['DURATION'], 1); $linearDistance = formatDistanceOpen($row["LINEAR_DISTANCE"]); $olcDistance = formatDistanceOpen($row["FLIGHT_KM"]); $olcScore = formatOLCScore($row["FLIGHT_POINTS"]); $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"; }