コード例 #1
0
ファイル: EXT_thermals.php プロジェクト: Peter2121/leonardoxc
    if ($inPageLink) {
        echo "<b>" . $description . "</b><br><img src=\\'img/icon_pin.png\\' align=\\'absmiddle\\' border=0> <a href=\\'javascript:show_waypoint({$wpID});\\' >" . _SITE_INFO . "</a><br>";
        // echo "<b>".$description."</b><br><img src='img/icon_pin.png' align='absmiddle' border=0> <a  href='GUI_EXT_waypoint_info.php?wID=$wpID' rel='facebox'>"._SITE_INFO."</a><br>";
    } else {
        echo "<b>" . $description . "</b><br><img src=\\'img/icon_pin.png\\' align=\\'absmiddle\\' border=0> <a  target=\\'_top\\' href=\\'" . getLeonardoLink(array('op' => 'show_waypoint', 'waypointIDview' => $wpID)) . "\\'>" . _SITE_INFO . "</a><br>";
    }
    $query = "SELECT  MAX(MAX_LINEAR_DISTANCE) as record_km, ID  FROM {$flightsTable}  WHERE takeoffID =" . $wpID . " GROUP BY ID ORDER BY record_km DESC ";
    $flightNum = 0;
    $res = $db->sql_query($query);
    if ($res > 0) {
        $flightNum = mysql_num_rows($res);
        if ($flightNum > 0) {
            echo "<img src=\\'img/icon_magnify_small.gif\\' align=\\'absmiddle\\' border=0> <a href=\\'" . getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => $wpID, 'year' => '0', 'month' => '0', 'season' => '0', 'pilotID' => '0', 'country' => '0', 'cat' => '0')) . "\\' target=\\'_top\\'>" . _See_flights_near_this_point . " [ " . $flightNum . " ]</a><br>";
            echo "<img src=\\'img/icon_trophy.gif\\' align=\\'absmiddle\\' border=0> <b>" . _SITE_RECORD . "</b>:";
            $row = mysql_fetch_assoc($res);
            echo '<a target=\'_top\' href=\'http://' . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])) . '\'>' . formatDistance($row['record_km'], 1) . '</a>';
        } else {
            echo " No flights from this location";
        }
    }
    echo ' " } ';
} else {
    if ($op == "getTakeoffsForArea") {
        $areaID = $_GET['areaID'] + 0;
        $sql = "SELECT * FROM {$waypointsTable},{$areasTakeoffsTable}\t\n\t\t\tWHERE {$areasTakeoffsTable}.takeoffID = {$waypointsTable}.ID AND {$areasTakeoffsTable}.areaID={$areaID}";
        $dbres = $db->sql_query($sql);
        if ($dbres <= 0) {
            echo '{ "waypoints": [ ]  }';
            return;
        }
        $res = '{ "waypoints": [ ';
コード例 #2
0
ファイル: onmyway.php プロジェクト: JamesMilnerUK/on-my-way-1
function setMessageText($userName, $routeLength, $routeTime, $mode)
{
    // Return the message string to be sent to the friend
    return "Your friend {$userName} is on their way! They are " . $mode . " and are currently " . formatDistance($routeLength) . " They will be with you in about " . convertToHours($routeTime);
}
コード例 #3
0
ファイル: download.php プロジェクト: Peter2121/leonardoxc
     $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;
 if ($cameraAlt > 100000) {
     $incWaypoints = 0;
 }
 if ($incWaypoints) {
     $query = "SELECT * FROM {$waypointsTable} WHERE \n\t\t\t\t type=1000 AND\n\t\t\t\t lat>={$south} AND lat<={$north} AND \n\t\t\t\t lon<=" . -$west . " AND lon>=" . -$east . " ORDER BY ID";
     //echo $query;
     $res = $db->sql_query($query);
     if ($res <= 0) {
         echo "<H3> Error in query! {$query} </H3>\n";
         exit;
コード例 #4
0
?>
</b></span></td>
        </tr>
        <tr bgcolor="#EBE1C5">
          <td bgcolor="#EBE1C5" valign="top"><b><?php 
echo _SITE_RECORD;
?>
</b>:
              <?php 
$query = "SELECT  MAX(MAX_LINEAR_DISTANCE) as record_km, ID FROM {$flightsTable}  WHERE takeoffID =" . $waypointIDview . " GROUP BY ID ORDER BY record_km DESC ";
$flightNum = 0;
$res = $db->sql_query($query);
if ($res > 0) {
    $flightNum = mysql_num_rows($res);
    $row = mysql_fetch_assoc($res);
    echo "<a target='_blank' href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])) . "'>" . formatDistance($row['record_km'], 1) . "</a>";
}
?>
		          <p> <strong><?php 
echo "<a target='_blank'  href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => $waypointIDview, 'year' => '0', 'month' => '0', 'season' => '0', 'pilotID' => '0', 'country' => '0', 'cat' => '0')) . "'>" . _See_flights_near_this_point . " [ " . $flightNum . " ]</a>";
?>
</strong></td>
        </tr>
        <tr bgcolor="#49766D">
          <td><div align="left" ></div>
              <div align="left" class="titleWhite"><b><?php 
echo _COORDINATES;
?>
</b></div></td>
        </tr>
        <tr bgcolor="#EBE1C5">
コード例 #5
0
  $xmlSites1=str_replace("<","&lt;",$xmlSites);
//-------------------------------------------------------------------
// get from paragliding365.com
//-------------------------------------------------------------------
  	$takoffsList=getExtrernalServerTakeoffs(2,$firstPoint->lat,-$firstPoint->lon,50,5);
	if (count($takoffsList) >0 ) {
		$linkToInfoHdr2="<a href='http://www.paragliding365.com/paragliding_sites.html?longitude=".-$firstPoint->lon."&latitude=".$firstPoint->lat."&radius=50' target=_blank>";
		$linkToInfoHdr2.="<img src='".$moduleRelPath."/img/paraglider365logo.gif' border=0> "._FLYING_AREA_INFO."</a>";
			
		$linkToInfoStr2="<ul>";
		foreach ($takoffsList as $takeoffItem)  {
				if ($takeoffItem['area']!='not specified')	$areaStr=" - ".$takeoffItem['area'];
				else $areaStr="";
				$linkToInfoStr2.="<li><a href='".$takeoffItem['url']."' target=_blank>".
									$takeoffItem['name']."$areaStr (".$takeoffItem['countryCode'].
									") [~".formatDistance($takeoffItem['distance'],1)."]</a>";
		}
		$linkToInfoStr2.="</ul>";
  }
  $xmlSites2=str_replace("<","&lt;",$xmlSites);
  
$adminPanel="";
if (L_auth::isAdmin($userID) ) {
	$adminPanel="<b>"._TIMES_VIEWED.":</b> ".$flight->timesViewed."  ";
	$adminPanel.="<b>"._SUBMISION_DATE.":</b> ".$flight->dateAdded." :: ";

	//	$adminPanel.='<pre>'.processIGC($flight->getIGCFilename());

	// DEBUG TIMEZONE DETECTION 
	// $firstPoint=new gpsPoint($flight->FIRST_POINT);
	$firstPoint=new gpsPoint('',$flight->timezone);
コード例 #6
0
    }
    $linkToInfoStr1 .= "</ul>";
}
$takoffsList = getExtrernalServerTakeoffs(2, $waypointLat, -$waypointLon, 20, 5);
if (count($takoffsList) > 0) {
    $linkToInfoHdr2 = "<img src='" . $moduleRelPath . "/img/paraglider365logo.gif' border=0>";
    $linkToInfoStr2 = "<ul>";
    foreach ($takoffsList as $takeoffItem) {
        $distance = $takeoffItem['distance'];
        if ($takeoffItem['area'] != 'not specified') {
            $areaStr = " - " . $takeoffItem['area'];
        } else {
            $areaStr = "";
        }
        $jsStr = "fillInForm('" . addslashes($takeoffItem['name']) . "','" . addslashes($takeoffItem['area']) . "','" . addslashes($takeoffItem['countryCode']) . "');";
        $takeoffLink = "<a href=\"javascript:{$jsStr}\">" . $takeoffItem['name'] . "{$areaStr} (" . $takeoffItem['countryCode'] . ") [~" . formatDistance($distance, 1) . "]</a>";
        $linkToInfoStr2 .= "<li>{$takeoffLink}";
    }
    $linkToInfoStr2 .= "</ul>";
}
?>
 
<script language="javascript">
function MWJ_findObj( oName, oFrame, oDoc ) {
	if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } }
	if( oDoc[oName] ) { return oDoc[oName]; } if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
	if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); }
	for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
	for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } }
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
		var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
コード例 #7
0
                            }
                            $takeoffLink = "<a href='" . $takeoffItem['url'] . "' target=_blank>" . $takeoffItem['name'] . "{$areaStr} (" . $takeoffItem['countryCode'] . ") [~" . formatDistance($distance, 1) . "]</a>";
                            $linkToInfoStr1 .= "<li>{$takeoffLink}";
                        }
                        $linkToInfoStr1 .= "</ul>";
                    }
                    // $xmlSites1=str_replace("<","&lt;",$xmlSites);
                    //-------------------------------------------------------------------
                    // get from paragliding365.com
                    //-------------------------------------------------------------------
                    $takoffsList = getExtrernalServerTakeoffs(2, $firstPoint->lat, -$firstPoint->lon, 50, 5);
                    if (count($takoffsList) > 0) {
                        $linkToInfoHdr2 = "<a href='http://www.paragliding365.com/paragliding_sites.html?longitude=" . -$firstPoint->lon . "&latitude=" . $firstPoint->lat . "&radius=50' target=_blank>";
                        $linkToInfoHdr2 .= "<img src='" . $moduleRelPath . "/img/paraglider365logo.gif' border=0> " . _FLYING_AREA_INFO . "</a>";
                        $linkToInfoStr2 = "<ul>";
                        foreach ($takoffsList as $takeoffItem) {
                            if ($takeoffItem['area'] != 'not specified') {
                                $areaStr = " - " . $takeoffItem['area'];
                            } else {
                                $areaStr = "";
                            }
                            $linkToInfoStr2 .= "<li><a href='" . $takeoffItem['url'] . "' target=_blank>" . $takeoffItem['name'] . "{$areaStr} (" . $takeoffItem['countryCode'] . ") [~" . formatDistance($takeoffItem['distance'], 1) . "]</a>";
                        }
                        $linkToInfoStr2 .= "</ul>";
                    }
                    echo $linkToInfoHdr1 . $linkToInfoStr1 . $linkToInfoHdr2 . $linkToInfoStr2;
                }
            }
        }
    }
}
コード例 #8
0
ファイル: FN_waypoint.php プロジェクト: Peter2121/leonardoxc
function makeWaypointPlacemark($waypointID, $returnCountryCode = 0, $includeStyle = 1, $includeLookat = 1, $styleUrl = '')
{
    global $db, $waypointsTable;
    global $flightsTable, $countries, $CONF_mainfile, $moduleRelPath;
    $wpInfo = new waypoint($waypointID);
    $wpInfo->getFromDB();
    $wpName = selectWaypointName($wpInfo->name, $wpInfo->intName, $wpInfo->countryCode);
    $wpLocation = selectWaypointLocation($wpInfo->location, $wpInfo->intLocation, $wpInfo->countryCode);
    $query = "SELECT  MAX(MAX_LINEAR_DISTANCE) as record_km, ID FROM {$flightsTable}  WHERE takeoffID =" . $waypointID . " GROUP BY ID ORDER BY record_km DESC ";
    $flightNum = 0;
    $res = $db->sql_query($query);
    if ($res > 0) {
        $flightNum = mysql_num_rows($res);
        $row = $db->sql_fetchrow($res);
        $siteRecordLink = "<a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])) . "'>" . formatDistance($row['record_km'], 1) . "</a>";
    } else {
        $siteRecordLink = "";
    }
    $pointFlightsLink = "<a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => $waypointID, 'year' => '0', 'season' => '0')) . "'>" . _See_flights_near_this_point . " [ " . $flightNum . " ]</a>";
    $countryFlightsLink = "<a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => '0', 'year' => '0', 'season' => '0', 'country' => $wpInfo->countryCode)) . "'>" . $countries[$wpInfo->countryCode] . "</a>";
    if ($wpInfo->link) {
        $siteLink = '<a href="' . formatURL($wpInfo->link) . '" target="_blank">' . formatURL($wpInfo->link) . '</a>';
    } else {
        $siteLink = "-";
    }
    // "<?xml version='1.0' encoding='".$langEncodings[$currentlang]."'? >
    // <?xml version="1.0" encoding="UTF-8"? >
    $xml_text = '<Placemark>
  <name><![CDATA[' . $wpName . ' ]]></name>
  <description><![CDATA[<table cellpadding=0 cellspacing=0 width=300>' . '<tr bgcolor="#D7E1EE"><td>' . _SITE_REGION . ': ' . $wpLocation . ' - ' . $countryFlightsLink . '</td></tr>' . '<tr bgcolor="#CCCCCC"><td>' . $pointFlightsLink . '</td></tr>' . '<tr ><td>' . _SITE_RECORD . ' : ' . $siteRecordLink . '</td></tr>' . '<tr bgcolor="#CCCCCC"><td>' . _SITE_LINK . ' : ' . $siteLink . '</td></tr>' . '<tr ><td>' . $wpInfo->description . '</td></tr>' . '<tr ><td></td></tr>' . '</table>	
    ]]>
 </description>';
    if ($includeLookat) {
        $xml_text .= '
  <LookAt>
    <longitude>' . -$wpInfo->lon . '</longitude>
    <latitude>' . $wpInfo->lat . '</latitude>
    <range>10000</range>
    <tilt>0</tilt>
    <heading>0</heading>
  </LookAt>
  ';
    }
    if ($includeStyle) {
        $xml_text .= '  
  <styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
  <Style>
    <IconStyle>
      <scale>0.8</scale>
      <Icon>
        <href>root://icons/palette-4.png</href>
        <x>160</x>
        <y>128</y>
        <w>32</w>
        <h>32</h>
      </Icon>
    </IconStyle>
    <LabelStyle>
      <scale>0.8</scale>
    </LabelStyle>
  </Style>
  ';
    }
    if ($styleUrl) {
        $xml_text .= "<styleUrl>{$styleUrl}</styleUrl>\n";
    }
    $xml_text .= '
  <Point>
    <coordinates>' . -$wpInfo->lon . ',' . $wpInfo->lat . ',0</coordinates>
  </Point>
</Placemark>';
    if ($returnCountryCode) {
        return array($xml_text, $wpInfo->countryCode);
    } else {
        return $xml_text;
    }
}
コード例 #9
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;
 }
コード例 #10
0
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 
}
コード例 #11
0
ファイル: rss.php プロジェクト: WooSeungho/leonardoxc
$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>".
"<br><font color=#006600>Landing: <b>".$location_land.

"</b></font><br>&nbsp;<br><font color=\"#ff0000\">Straight Distance: <b>".formatDistance($row['LINEAR_DISTANCE'])." km</b> $linear_stars</font>".
"<br><font color=\"#aa0000\">OLC Km: <b>".formatDistance($row['FLIGHT_KM'])." km $olc_km_stars</b></font>".
"<br><font color=\"#0000ff\">OLC score: <b>".sprintf("%.1f",$row['FLIGHT_POINTS'])."</b> $score_stars</font>".
"<br>Flight Type: <b>".formatOLCScoreType($row['BEST_FLIGHT_TYPE'],false)."</b>".

"<br><br>Duration: <b>".sprintf("%d hrs %d min",$row['DURATION']/3600,($row['DURATION']%3600)/60)."</b> $hour_stars".

"<br>&nbsp;<br><font color=\"#000000\">Max speed: <b>".sprintf("%.2f km/h",$row['MAX_SPEED']).
"</b> $speed_stars</font><br><font color=\"#006600\">Max vario: <b>+".sprintf("%.1f m/sec",$row['MAX_VARIO']).
"</b></font><br><font color=\"#aa0000\">Min vario: <b>".sprintf("%.1f m/sec",$row['MIN_VARIO'])."</b></font>".

"<br><font color=\"#006600\">Max Alt ASL: <b>".$row['MAX_ALT'].
" m </b>$max_alt_stars</font><br><font color=\"#aa0000\">Min Alt ASL: <b>".$row['MIN_ALT'].
" m </b>$min_alt_stars</font><br>Takeoff alt: <b>".$row['TAKEOFF_ALT']." m </b>$takeoff_stars";

if ( $row['commentsNum']  && 0)  // dont diplay commnents anyway
{
コード例 #12
0
function textNextobjectOut($near, $caption, $lat, $lon)
{
    if ($near) {
        $singular = substr($caption, 0, -1);
        $output .= "<tr><td><span><u>" . $caption . ":</u></span></td></tr>\n";
        foreach ($near as $entry) {
            if (!$entry[2]) {
                $entry[2] = _("Unnamed");
            }
            $entry[3] = formatDistance($entry[3]);
            $output .= "<tr><td>&nbsp;&nbsp;<span><a href=\"javascript:showPoint(" . $entry[1] . ", " . $entry[0] . ", " . $lat . ", " . $lon . ");\">" . $entry[2] . "</a> (" . $entry[3] . ")</span></td></tr>\n";
        }
    }
    return $output;
}
コード例 #13
0
ファイル: FN_output.php プロジェクト: Peter2121/leonardoxc
function formatDistanceOLC($distance, $showKm = true)
{
    // in meters
    return '<span class="distance_style">' . formatDistance($distance, $showKm) . '</span>';
}
コード例 #14
0
ファイル: rss.php プロジェクト: Peter2121/leonardoxc
 }
 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>" . "<br><font color=#006600>Landing: <b>" . $location_land . "</b></font><br>&nbsp;<br><font color=\"#ff0000\">Straight Distance: <b>" . formatDistance($row['LINEAR_DISTANCE']) . " km</b> {$linear_stars}</font>" . "<br><font color=\"#aa0000\">OLC Km: <b>" . formatDistance($row['FLIGHT_KM']) . " km {$olc_km_stars}</b></font>" . "<br><font color=\"#0000ff\">OLC score: <b>" . sprintf("%.1f", $row['FLIGHT_POINTS']) . "</b> {$score_stars}</font>" . "<br>Flight Type: <b>" . formatOLCScoreType($row['BEST_FLIGHT_TYPE'], false) . "</b>" . "<br><br>Duration: <b>" . sprintf("%d hrs %d min", $row['DURATION'] / 3600, $row['DURATION'] % 3600 / 60) . "</b> {$hour_stars}" . "<br>&nbsp;<br><font color=\"#000000\">Max speed: <b>" . sprintf("%.2f km/h", $row['MAX_SPEED']) . "</b> {$speed_stars}</font><br><font color=\"#006600\">Max vario: <b>+" . sprintf("%.1f m/sec", $row['MAX_VARIO']) . "</b></font><br><font color=\"#aa0000\">Min vario: <b>" . sprintf("%.1f m/sec", $row['MIN_VARIO']) . "</b></font>" . "<br><font color=\"#006600\">Max Alt ASL: <b>" . $row['MAX_ALT'] . " m </b>{$max_alt_stars}</font><br><font color=\"#aa0000\">Min Alt ASL: <b>" . $row['MIN_ALT'] . " m </b>{$min_alt_stars}</font><br>Takeoff alt: <b>" . $row['TAKEOFF_ALT'] . " m </b>{$takeoff_stars}";
 if ($row['commentsNum'] && 0) {
     $row['comments'] = trim($row['comments'], " \n\r");
     $row['comments'] = str_replace("  ", " ", $row['comments']);
     $row['comments'] = str_replace(" />", ">", $row['comments']);
     $row['comments'] = str_replace("/leonardo/js/fckeditor/", "{$url_root}/js/fckeditor/", $row['comments']);
     $desc .= '<br>&nbsp;<br>Comments: <font color="#000088"><i>"' . $row['comments'] . '"</i> - ' . $name . '</font>';
 }
 //           1111111111
 // 01234567890123456789
 // 0000-00-00 00:00:00
 /*
 $date = $row['dateAdded'];
 $gyear  = substr($date,0,4);
 $gmonth = substr($date,5,2);
 $gday   = substr($date,8,2);