return marker;
			
	}
	function drawPhoto(lat,lon,num,imgIcon,imgBig,width,height){ 	
			var photoPoint= new GLatLng(lat, lon) ;			
			var photoMarker = createPhotoMarker(photoPoint,num,imgIcon,imgBig,width,height);
			photoMarkers[num] = photoMarker ;	
			map.addOverlay(photoMarker );

	}
<?php 
// draw the photo positions if any
if ($flight->hasPhotos) {
    require_once dirname(__FILE__) . "/CL_flightPhotos.php";
    $flightPhotos = new flightPhotos($flight->flightID);
    $flightPhotos->getFromDB();
    // get geoinfo
    $flightPhotos->computeGeoInfo();
    $imagesHtml = "";
    foreach ($flightPhotos->photos as $photoNum => $photoInfo) {
        if ($photoInfo['lat'] && $photoInfo['lon']) {
            $imgIconRel = $flightPhotos->getPhotoRelPath($photoNum) . ".icon.jpg";
            $imgBigRel = $flightPhotos->getPhotoRelPath($photoNum);
            $imgIcon = $flightPhotos->getPhotoAbsPath($photoNum) . ".icon.jpg";
            $imgBig = $flightPhotos->getPhotoAbsPath($photoNum);
            if (file_exists($imgBig)) {
                list($width, $height, $type, $attr) = getimagesize($imgBig);
                list($width, $height) = CLimage::getJPG_NewSize($CONF['photos']['mid']['max_width'], $CONF['photos']['mid']['max_height'], $width, $height);
                $imgTarget = $imgBigRel;
            } else {
                if (file_exists($imgIcon)) {
Пример #2
0
 function changeUser($newUserID, $newUserServerID)
 {
     global $CONF, $CONF_photosPerFlight;
     $pilotDir = $this->getPilotAbsDir();
     if ($newUserServerID) {
         $extra_prefix = $newUserServerID . '_';
     } else {
         $extra_prefix = '';
     }
     $newPilotDir = LEONARDO_ABS_PATH . '/' . str_replace("%PILOTID%", $extra_prefix . $newUserID, $CONF['paths']['pilot']);
     // delete non critical files
     $this->deleteFile($this->getIGCFilename(1));
     $this->deleteFile($this->getIGCFilename(2));
     $this->deleteSecondaryFiles();
     $this->deleteFile($this->getMapFilename());
     for ($metric_system = 1; $metric_system <= 2; $metric_system++) {
         for ($raw = 0; $raw <= 1; $raw++) {
             # martin jursa 28.05.2008: delete using the deleteFile() method to avoid log flooding
             $this->deleteFile($this->getChartFilename("alt", $metric_system, $raw));
             $this->deleteFile($this->getChartFilename("speed", $metric_system, $raw));
             $this->deleteFile($this->getChartFilename("vario", $metric_system, $raw));
             $this->deleteFile($this->getChartFilename("takeoff_distance", $metric_system, $raw));
         }
     }
     $flightYear = $this->getYear();
     $subdirs = array('flights', 'charts', 'maps');
     // create all dirs on the target user as well in case they are missing
     $this->checkDirs($extra_prefix . $newUserID, $flightYear);
     /*
     foreach ($subdirs as $subdir){
     	$sourceDir="$pilotDir/$subdir/$flightYear";
     	$targetDir="$newPilotDir/$subdir/$flightYear";
     
     	if ($handle = opendir($sourceDir)) {
     		while (false !== ($file = readdir($handle))) {
     			if (  substr( $file,0,strlen($this->filename) )==$this->filename  ) {
     				// echo "$file\n";
     				$filesToMove[$sourceDir.'/'.$file]=$targetDir.'/'.$file;
     			}
     		}
     		closedir($handle);
     	}
     }
     
     //	this is old code, does not work nay more!
     for($i=1;$i<=$CONF_photosPerFlight;$i++) {
     	$var_name="photo".$i."Filename";
     	$file=$this->$var_name;
     	if ($file) {
     		$sourceDir="$pilotDir/photos/$flightYear";
     		$targetDir="$newPilotDir/photos/$flightYear";
     		$filesToMove[$sourceDir.'/'.$file]=$targetDir.'/'.$file;
     	}
     }
     
     array_push($subdirs,'photos');
     
     foreach ($subdirs as $subdir){
     	makeDir("$newPilotDir/$subdir");
     }
     
     foreach ($filesToMove as $src=>$target){
     	makeDir($target);
     	@rename($src,$target);
     }
     */
     // Take care of photos!
     if ($this->hasPhotos) {
         $flightPhotos = new flightPhotos($this->flightID);
         $flightPhotos->getFromDB();
         // print_r($flightPhotos->photos );
         foreach ($flightPhotos->photos as $photoNum => $photoInfo) {
             $flightPhotos->changeUser($photoNum, getPilotID($newUserServerID, $newUserID));
         }
         $flightPhotos->putToDB(0);
     }
     // store the original paths of the files
     $igcOrg = $this->getIGCFilename(0);
     // store away the original userID
     $this->originalUserID = $this->userServerID + 0 . '_' . $this->userID;
     $this->userID = $newUserID;
     $this->userServerID = $newUserServerID;
     // now move the igc file (and optionally the olc if it exists
     @rename($igcOrg, $this->getIGCFilename(0));
     @rename($igcOrg . ".olc", $this->getIGCFilename(0) . ".olc");
     //  echo "will put to db $newUserServerID $newUserID<BR>";
     $this->putFlightToDB(1);
     // take care of same flights (hide /unhide)
     $this->hideSameFlights();
     // now also log this action
 }