));
}

$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&nbsp;<img src='".$moduleRelPath."/img/icon_arrow_down.gif' border=0></a></div>";
*/
         }
         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";
     }
     echo "</table>";
     //  echo "</pre>";
 } else {
     if ($op == 'sql') {
         $flight = new flight();
         $flight->getFlightFromDB($flightID);
         if (!L_auth::isModerator($userID)) {
             echo "go away";
            $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&nbsp;<img src='".$moduleRelPath."/img/icon_arrow_down.gif' border=0></a></div>";
*/
if ($flight->comments) {
    $comments = $flight->comments;
}
$linkURL = _N_A;
if ($flight->linkURL) {
    $linkURL = "<a href='" . formatURL($flight->linkURL, 0) . "' title='" . formatURL($flight->linkURL, 0) . "' target=_blank>" . formatURL($flight->linkURL, 15) . "</a>";
}
$flightBrandID = $row['gliderBrandID'];
 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;
 }
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%'>&nbsp;</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>&nbsp;</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>&nbsp;</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">&nbsp;</td>
    <td bgcolor="#E0E0E0">&nbsp;</td>
    <td>&nbsp;</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%'>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</td>
    <td bgcolor="#E9EDF5"><div align="right"></div></td>
    <td bgcolor="#E0E0E0">&nbsp;</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%'>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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 
}
Exemple #6
0
         }
     }
 }
 $olcScoreType = leoHtml::img($olcScoreTypeImg, 16, 16, 'top', formatOLCScoreType($olcScoreType, 0), 'icons1', '', 0);
 $gliderType = $row["cat"];
 // 1=pg 2=hg flex 4=hg rigid 8=glider
 $gliderBrandImg = brands::getBrandImg($row["gliderBrandID"], $row['flight_glider'], $gliderType);
 $gliderTypeDesc = $gliderCatList[$row["cat"]];
 if ($row["category"]) {
     $gliderTypeDesc .= " - " . $CONF['gliderClasses'][$row["cat"]]['classes'][$row["category"]];
     $categoryImg = leoHtml::img("icon_class_" . $row["category"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1', '', 0);
 } else {
     $categoryImg = '';
 }
 $gliderCat = leoHtml::img("icon_cat_" . $row["cat"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1 catListIcon', '', 0);
 $MAX_ALT = formatAltitude($row['MAX_ALT']);
 $MAX_VARIO = formatVario($row['MAX_VARIO']);
 $MIN_VARIO = formatVario($row['MIN_VARIO']);
 if ($singleFlight) {
     $flightID = $row['ID'] + 0;
     $flight = new flight();
     $flight->getFlightFromDB($flightID, 0);
     //$flight->makeJSON(0);  // no force
     $mapUrl = $flight->createStaticMap(0);
 }
 // $pref="http://xc.dhv.de/xc/modules/leonardo";
 $pref = "http://" . $_SERVER['SERVER_NAME'];
 $JSON_str .= ' {"flightID": "' . $row["ID"] . '", "date": "' . json::prepStr($row["DATE"]) . '", ' . '"DURATION": "' . json::prepStr($duration) . '", ' . '"START_TIME": "' . json::prepStr($START_TIME) . '", ' . '"END_TIME": "' . json::prepStr($END_TIME) . '", ' . '"MAX_ALT": "' . json::prepStr($MAX_ALT) . '", ' . '"MAX_VARIO": "' . json::prepStr($MAX_VARIO) . '", ';
 '"MIN_VARIO": "' . json::prepStr($MIN_VARIO) . '", ';
 if ($singleFlight) {
     $JSON_str .= '"g1": "' . json::prepStr($pref . substr($flight->getChartRelPath('alt', 1, 0), 0)) . '", ' . '"g2": "' . json::prepStr($pref . substr($flight->getChartRelPath('vario', 1, 0), 0)) . '" , ' . '"g3": "' . json::prepStr($pref . substr($flight->getChartRelPath('speed', 1, 0), 0)) . '" , ' . '"g4": "' . json::prepStr($pref . substr($flight->getChartRelPath('takeoff_distance', 1, 0), 0)) . '" , ' . '"firstLat": "' . json::prepStr($row["firstLat"]) . '", ' . '"firstLon": "' . json::prepStr($row["firstLon"]) . '", ' . '"lastLat": "' . json::prepStr($row["lastLat"]) . '", ' . '"lastLon": "' . json::prepStr($row["lastLon"]) . '", ' . '"map": "' . json::prepStr($pref . substr($mapUrl, 0)) . '" , ';