Esempio n. 1
0
        if ($s_id == $CONF['defaultStartType']) {
            $is_type_sel = "selected";
        } else {
            $is_type_sel = "";
        }
        echo "<option {$is_type_sel} value={$s_id}>" . $s_type . "</option>\n";
    }
    ?>
      </select></td>
      <td  valign="top">&nbsp;</td>
    </tr>
	<?php 
    if ($CONF['NAC']['clubPerFlight']) {
        list($flightNacID, $defaultPilotNacClubID) = NACclub::getPilotClub($userID);
        $NACName = $CONF_NAC_list[$flightNacID]['name'];
        $NACclub = NACclub::getClubName($flightNacID, $defaultPilotNacClubID);
        ?>
		<tr>
            <td>
			<div align="right" class="styleItalic">
				<?php 
        echo _MEMBER_OF;
        ?>
 <strong><?php 
        echo $NACName;
        ?>
</strong>
            </div>
			</td>
            
            <td colspan=2>
Esempio n. 2
0
} else {
    $takeoffLegend = _ALL_TAKEOFFS;
    $allTakeoffDisplay = 1;
}
# Martin Jursa, 22.05.2007
$showNacClubSelection = !empty($CONF_use_NAC) && empty($dontShowNacClubSelection);
if ($showNacClubSelection) {
    $nacClubLegend = _ALL_NACCLUBS;
    if (!empty($forceNacId)) {
        $nacid = $forceNacId;
    }
    # just to make sure
    if ($nacid) {
        if ($nacclubid) {
            require_once dirname(__FILE__) . "/CL_NACclub.php";
            $nacClubLegend = NACclub::getClubName($nacid, $nacclubid);
            if ($nacClubLegend == '') {
                $nacclubid = 0;
                $nacClubLegend = _ALL_NACCLUBS;
            }
        }
    }
}
if ($op == "list_pilots" && $comp) {
    $isCompDisplay = 1;
} else {
    $isCompDisplay = 0;
}
$arrDownImg = leoHtml::img("icon_arrow_left.gif", 0, 0, '', '', 'icons1');
?>
Esempio n. 3
0
require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/lang-" . $currentlang . ".php";
require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/countries-" . $currentlang . ".php";
require_once dirname(__FILE__) . "/CL_NACclub.php";
$clubID = $_GET['clubID'] + 0;
$NAC_ID = $_GET['NAC_ID'] + 0;
// $charset=$langEncodings[$currentlang];
# $_GET['option'] is to control scenario dependent options
$option = empty($_GET['option']) ? 1 : $_GET['option'];
# url parameters in case of option 2
$params = empty($_GET['params']) ? '' : urldecode($_GET['params']);
if ($option == 2) {
    $withFlightsOnly = 1;
} else {
    $withFlightsOnly = 0;
}
$clubList = NACclub::getClubs($NAC_ID, $withFlightsOnly);
// print_r($clubList);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  >
<html>
<head>
  <title><?php 
echo _Select_Club;
?>
</title>
  <meta http-equiv="content-type" content="text/html; charset=<?php 
echo $CONF_ENCODING;
?>
">

<style type="text/css">
Esempio n. 4
0
function addFlightFromFile($filename, $calledFromForm, $userIDstr, $argArray = array())
{
    global $CONF_default_cat_add, $CONF_photosPerFlight, $CONF;
    global $CONF_NAC_list, $CONF_use_NAC, $CONF_use_validation, $CONF_airspaceChecks, $CONF_server_id;
    global $userID, $CONF_new_flights_submit_window;
    global $flightsTable;
    set_time_limit(120);
    global $CONF_server_id;
    list($thisServerID, $userIDforFlight) = splitServerPilotStr($userIDstr);
    if (!$thisServerID) {
        $thisServerID = $CONF_server_id;
    }
    require_once dirname(__FILE__) . '/CL_actionLogger.php';
    $log = new Logger();
    $log->userID = $userID + 0;
    // the userId that is logged in , not the one that the flight will be atrributed to
    $log->ItemType = 1;
    // flight;
    $log->ItemID = 0;
    // 0 at start will fill in later if successfull
    $log->ServerItemID = $thisServerID;
    $log->ActionID = 1;
    //1  => add  2  => edit;
    $log->ActionXML = '';
    $log->Modifier = 0;
    $log->ModifierID = 0;
    $log->ServerModifierID = 0;
    $log->Result = 0;
    $log->ResultDescription = "";
    if (!$filename) {
        $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_YOU_HAVENT_SUPPLIED_A_FLIGHT_FILE, 0);
        if (!$log->put()) {
            echo "Problem in logger<BR>";
        }
        return array(ADD_FLIGHT_ERR_YOU_HAVENT_SUPPLIED_A_FLIGHT_FILE, 0);
    }
    // now is the time to remove bad chars from the filename!
    $newFilename = str_replace("'", " ", $filename);
    $newFilename = toLatin1($newFilename);
    if ($newFilename != $filename) {
        rename($filename, $newFilename);
        $filename = $newFilename;
    }
    if (!is_file($filename)) {
        $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_NO_SUCH_FILE, 0);
        if (!$log->put()) {
            echo "Problem in logger<BR>";
        }
        return array(ADD_FLIGHT_ERR_NO_SUCH_FILE, 0);
    }
    if (strtolower(substr($filename, -4)) != ".igc") {
        $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_FILE_DOESNT_END_IN_IGC, 0);
        if (!$log->put()) {
            echo "Problem in logger<BR>";
        }
        return array(ADD_FLIGHT_ERR_FILE_DOESNT_END_IN_IGC, 0);
    }
    $tmpIGCPath = $filename;
    $flight = new flight();
    if ($thisServerID != $CONF_server_id) {
        $flight->userServerID = $thisServerID;
    }
    $flight->userID = $userIDforFlight;
    /*
    	$flight->cat=$gliderCat;
    	$flight->private=$is_private;
    	$flight->category=$category;
    	$flight->comments=$comments;
    	$flight->glider=$glider;
    	$flight->linkURL=$linkURL;
    */
    foreach ($argArray as $varName => $varValue) {
        if ($varName == 'NACclubID' || $varName == 'NACid' || $varName == 'comments') {
            continue;
        }
        $flight->{$varName} = $varValue;
    }
    $comments = $argArray['comments'];
    if ($comments) {
        $flight->commentsNum = 1;
    }
    if (strtolower(substr($flight->linkURL, 0, 7)) == "http://") {
        $flight->linkURL = substr($flight->linkURL, 7);
    }
    if ($flight->cat == -1) {
        $flight->cat = $CONF_default_cat_add;
    }
    # martin jursa 22.06.2008:
    # in case the glider is not given otherwise, try to extract it from the IGC file
    if (empty($flight->glider)) {
        $flight->glider = extractGlider($lines);
    }
    // if no brand was given , try to detect
    $flight->checkGliderBrand();
    //  we must cope with some cases here
    //  1. more flights in the igc
    //  2. garmin saved paths -> zero time difference -> SOLVED!
    if (!$flight->getFlightFromIGC($tmpIGCPath)) {
        $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_THIS_ISNT_A_VALID_IGC_FILE, 0);
        if (!$log->put()) {
            echo "Problem in logger<BR>";
        }
        return array(ADD_FLIGHT_ERR_THIS_ISNT_A_VALID_IGC_FILE, 0);
    }
    // Compute hash now
    $lines = file($tmpIGCPath);
    $hash = md5(implode('', $lines));
    $flight->hash = $hash;
    unset($lines);
    // check for mac newlines -> NOT USED NOW
    // we now use auto_detect_line_endings=true;
    /*
    	if ( count ($lines)==1) {
    		if ($lines[0]=preg_replace("/\r([^\n])/","\r\n\\1",$lines[0])) {		
    			DEBUG('addFlightFromFile',1,"addFlightFromFile: MAC newlines found<BR>");
    			if (!$handle = fopen($tmpIGCPath, 'w')) { 
    				print "Cannot open file ($filename)"; 
    				exit; 
    			} 
    			if (!fwrite($handle, $lines[0])) { 
    			   print "Cannot write to file ($filename)"; 
    			   exit; 
    			} 
    			fclose($handle); 
    		} 
    	}
    */
    // echo $flight->DATE	." >  ". date("Y-m-d",time()+3600*10) ."<BR>";
    // check for dates in the furure
    if ($flight->DATE > date("Y-m-d", time() + 3600 * 10)) {
        @unlink($flight->getIGCFilename(1));
        @unlink($tmpIGCPath . ".olc");
        @unlink($tmpIGCPath);
        $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_DATE_IN_THE_FUTURE, 0);
        if (!$log->put()) {
            echo "Problem in logger<BR>";
        }
        return array(ADD_FLIGHT_ERR_DATE_IN_THE_FUTURE, 0);
    }
    // Two week time limit check - P.Wild
    /// Modification martin jursa 08.05.2007 cancel the upload if flight is too old
    if ($CONF_new_flights_submit_window > 0) {
        if (!L_auth::isAdmin($userID)) {
            if ($flight->DATE < date("Y-m-d", time() - $CONF_new_flights_submit_window * 24 * 3600)) {
                @unlink($flight->getIGCFilename(1));
                @unlink($tmpIGCPath . ".olc");
                @unlink($tmpIGCPath);
                $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_OUTSIDE_SUBMIT_WINDOW, 0);
                if (!$log->put()) {
                    echo "Problem in logger<BR>";
                }
                return array(ADD_FLIGHT_ERR_OUTSIDE_SUBMIT_WINDOW, 0);
            }
        }
    }
    // end martin / peter
    $sameFilenameID = $flight->findSameFilename(basename($filename));
    if ($sameFilenameID > 0) {
        if ($flight->allowDuplicates) {
            while (is_file($flight->getIGCFilename())) {
                $flight->filename = '_' . $flight->filename;
            }
        } else {
            @unlink($flight->getIGCFilename(1));
            @unlink($tmpIGCPath . ".olc");
            @unlink($tmpIGCPath);
            $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_FILENAME_FLIGHT, 0);
            if (!$log->put()) {
                echo "Problem in logger<BR>";
            }
            return array(ADD_FLIGHT_ERR_SAME_FILENAME_FLIGHT, $sameFilenameID);
        }
    }
    $sameFlightsArray = $flight->findSameTime();
    if (count($sameFlightsArray) > 0) {
        if ($flight->allowDuplicates) {
            // we allow duplicates if they are from another server
            $dupFound = 0;
            foreach ($sameFlightsArray as $k => $fArr) {
                if ($fArr['serverID'] == $flight->serverID) {
                    // if a same flight from this server is present we dont re-insert
                    $dupFound = 1;
                    break;
                } else {
                    // fill in ids of flights to 'disable'
                    $disableFlightsList[$fArr['ID']]++;
                }
            }
        } else {
            $dupFound = 1;
        }
        if ($dupFound) {
            @unlink($flight->getIGCFilename(1));
            @unlink($tmpIGCPath . ".olc");
            @unlink($tmpIGCPath);
            $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_DATE_FLIGHT, 0);
            if (!$log->put()) {
                echo "Problem in logger<BR>";
            }
            //	return  array( ADD_FLIGHT_ERR_SAME_DATE_FLIGHT,$sameFlightsArray[0]['serverID'].'_'. $sameFlightsArray[0]['ID']);
            return array(ADD_FLIGHT_ERR_SAME_DATE_FLIGHT, $sameFlightsArray[0]['ID']);
        } else {
            DEBUG("FLIGHT", 1, "addFlightFromFile: Duplicate DATE/TIME flight will be inserted<br>");
        }
    }
    $sameFlightsArray = $flight->findSameHash($hash);
    if (count($sameFlightsArray) > 0) {
        if ($flight->allowDuplicates) {
            // we allow duplicates if they are from another server
            //echo "searching in dups ";
            //print_r($sameFlightsArray);
            $dupFound = 0;
            $flightPilot = new pilot($flight->userServerID + 0, $flight->userID + 0);
            $flightPilotMapTable = $flightPilot->pilotMapping();
            // print_r($flightPilotMapTable);
            foreach ($sameFlightsArray as $k => $fArr) {
                if ($fArr['serverID'] == $flight->serverID) {
                    // if a same flight from this server is present we dont re-insert
                    $dupFound = 1;
                    break;
                } else {
                    // check that the existing flight belongs to a pilot that is 'mapped' to
                    // $flight->userID + $flight->userServerID
                    if (!$flightPilotMapTable[$fArr['userServerID']][$fArr['userID']]) {
                        DEBUG("FLIGHT", 1, "addFlightFromFile: Same hash from external Server BUT from the pilot was not mapped into local <br>");
                        // We allow the flight to be submitted but then we must check and disable all duplicates but one
                        //$dupFound=1;
                        //break;
                    }
                    // fill in ids of flights to 'disable'
                    $disableFlightsList[$fArr['ID']]++;
                }
            }
        } else {
            // echo "no dups allowesd";
            $dupFound = 1;
        }
        if ($dupFound) {
            @unlink($flight->getIGCFilename(1));
            @unlink($tmpIGCPath . ".olc");
            @unlink($tmpIGCPath);
            $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT, 0);
            if (!$log->put()) {
                echo "Problem in logger<BR>";
            }
            return array(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT, $sameFlightsArray[0]['ID']);
        } else {
            DEBUG("FLIGHT", 1, "addFlightFromFile: Duplicate HASH flight will be inserted<br>");
            // echo "addFlightFromFile: Duplicate HASH flight will be inserted<br>";
        }
    }
    // print_r($disableFlightsList);
    /*
    	if ( ! $flight->allowDuplicates ) {
    		$sameHashIDArray=$flight->findSameHash( $hash );
    		if (count($sameHashIDArray)>0) 	 {
    			@unlink($flight->getIGCFilename(1));
    			@unlink($tmpIGCPath.".olc");
    			@unlink($tmpIGCPath);
    			$log->ResultDescription=getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT,0);
    			if (!$log->put()) echo "Problem in logger<BR>";
    			return array(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT,$sameHashIDArray[0]['serverID'].'_'.$sameHashIDArray[0]['ID']);	
    		}
    	}
    */
    //******************************************************
    // PASSED ALL TESTS , NOW DO SOME WORK WITH OUR FLIGHT
    //******************************************************
    // move the flight to corresponding year
    $flight->checkDirs();
    //$yearPath=$flightsAbsPath."/".$userIDstr."/flights/".$flight->getYear();
    //$maps_dir=$flightsAbsPath."/".$userIDstr."/maps/".$flight->getYear();
    //$charts_dir=$flightsAbsPath."/".$userIDstr."/charts/".$flight->getYear();
    //$photos_dir=$flightsAbsPath."/".$userIDstr."/photos/".$flight->getYear();
    //if (!is_dir($yearPath))  	mkdir($yearPath,0755);
    //if (!is_dir($maps_dir))  	mkdir($maps_dir,0755);
    //if (!is_dir($charts_dir))	mkdir($charts_dir,0755);
    //if (!is_dir($photos_dir))	mkdir($photos_dir,0755);
    /**
     * Martin Jursa; to avoid error log flooding
     */
    if (file_exists($tmpIGCPath)) {
        @rename($tmpIGCPath, $flight->getIGCFilename());
    }
    // in case an olc file was created too
    if (file_exists($tmpIGCPath . ".olc")) {
        @rename($tmpIGCPath . ".olc", $flight->getIGCFilename() . ".olc");
    }
    // these commands seem redundant:
    //@unlink($tmpIGCPath.".olc");
    //@unlink($tmpIGCPath);
    /*old:	@rename($tmpIGCPath, $flight->getIGCFilename() );
    	// in case an olc file was created too
    	@rename($tmpIGCPath.".olc", $flight->getIGCFilename().".olc" );
    	@unlink($tmpIGCPath.".olc");
    	@unlink($tmpIGCPath);
    */
    // if we use NACclubs
    // get the NACclubID for userID
    // and see if the flight is in the current year (as defined in the NAclist array
    if ($CONF_use_NAC) {
        require_once dirname(__FILE__) . "/CL_NACclub.php";
        list($pilotNACID, $pilotNACclubID) = NACclub::getPilotClub($userIDforFlight);
        DEBUG("FLIGHT", 1, "addFlightFromFile: pilotNACID:{$pilotNACID}, pilotNACclubID: {$pilotNACclubID}<br>");
        if ($CONF_NAC_list[$pilotNACID]['use_clubs']) {
            DEBUG("FLIGHT", 1, "addFlightFromFile: use_clubs is on<br>");
            if ($argArray['NACclubID'] > 0 && $argArray['NACid'] > 0) {
                $flight->NACclubID = $argArray['NACclubID'];
                $flight->NACid = $argArray['NACid'];
                DEBUG("FLIGHT", 1, "addFlightFromFile: using arguments NACclubID NACid<br>");
            } else {
                DEBUG("FLIGHT", 1, "addFlightFromFile: calculating  NACclubID NACid<br>");
                // check year -> we only put the club for the current season , so that results for previous seasons cannot be affected
                $currSeasonYear = $CONF_NAC_list[$pilotNACID]['current_year'];
                DEBUG("FLIGHT", 1, "addFlightFromFile: currSeasonYear:  {$currSeasonYear}<br>");
                if ($CONF_NAC_list[$pilotNACID]['periodIsNormal']) {
                    $seasonStart = $currSeasonYear - 1 . "-12-31";
                    $seasonEnd = $currSeasonYear . "-12-31";
                } else {
                    $seasonStart = $currSeasonYear - 1 . $CONF_NAC_list[$pilotNACID]['periodStart'];
                    $seasonEnd = $currSeasonYear . $CONF_NAC_list[$pilotNACID]['periodStart'];
                }
                DEBUG("FLIGHT", 1, "addFlightFromFile: seasonStart:{$seasonStart} , seasonEnd:{$seasonEnd}<br>");
                if ($flight->DATE > $seasonStart && $flight->DATE <= $seasonEnd) {
                    DEBUG("FLIGHT", 1, "addFlightFromFile: inside Season !!<br>");
                    $flight->NACclubID = $pilotNACclubID;
                    $flight->NACid = $pilotNACID;
                }
            }
        }
    }
    if ($CONF_use_validation) {
        $ok = $flight->validate(0);
        // dont update DB
    }
    if ($CONF_airspaceChecks) {
        $flight->checkAirspace(0);
        // dont update DB
    }
    $flight->putFlightToDB(0);
    // now do the photos
    if ($calledFromForm) {
        require_once dirname(__FILE__) . "/CL_flightPhotos.php";
        $flightPhotos = new flightPhotos($flight->flightID);
        // $flightPhotos->getFromDB();
        $j = 0;
        for ($i = 0; $i < $CONF_photosPerFlight; $i++) {
            $var_name = "photo" . $i . "Filename";
            $photoName = $_FILES[$var_name]['name'];
            $photoFilename = $_FILES[$var_name]['tmp_name'];
            if ($photoName) {
                if (CLimage::validJPGfilename($photoName) && CLimage::validJPGfile($photoFilename)) {
                    // $newPhotoName=toLatin1($photoName);
                    // Fix for same photo filenames 2009.02.03
                    //global $flightsAbsPath;
                    global $CONF;
                    $newPhotoName = flightPhotos::getSafeName(LEONARDO_ABS_PATH . '/' . str_replace("%PILOTID%", $flight->getPilotID(), str_replace("%YEAR%", $flight->getYear(), $CONF['paths']['photos'])), $photoName);
                    //$flightsAbsPath.'/'.$flight->getPilotID()."/photos/".$flight->getYear() ,
                    //$photoName	) ;
                    $phNum = $flightPhotos->addPhoto($j, $flight->getPilotID() . "/photos/" . $flight->getYear(), $newPhotoName, $description);
                    $photoAbsPath = $flightPhotos->getPhotoAbsPath($j);
                    if (move_uploaded_file($photoFilename, $photoAbsPath)) {
                        CLimage::resizeJPG($CONF['photos']['thumbs']['max_width'], $CONF['photos']['thumbs']['max_height'], $photoAbsPath, $photoAbsPath . ".icon.jpg", $CONF['photos']['compression']);
                        CLimage::resizeJPG($CONF['photos']['normal']['max_width'], $CONF['photos']['normal']['max_height'], $photoAbsPath, $photoAbsPath, $CONF['photos']['compression']);
                        $flight->hasPhotos++;
                        $j++;
                    } else {
                        //upload not successfull
                        $flightPhotos->deletePhoto($j);
                    }
                }
            }
        }
        // also try to get geotag info
        $flightPhotos->computeGeoInfo();
    }
    // took care of photos
    // tkae care of comments
    if ($comments) {
        global $lang2isoGoogle, $currentlang;
        $flightComments = new flightComments($flight->flightID);
        $commentInsertResult = $flightComments->addComment(array('parentID' => 0, 'userID' => $flight->userID + 0, 'userServerID' => $flight->userServerID + 0, 'guestName' => '', 'guestPass' => '', 'guestEmail' => '', 'text' => $comments, 'languageCode' => $lang2isoGoogle[$currentlang]), 0);
    }
    // now is a good time to disable duplicate flights we have found from other servers
    // AND are from the same user (using pilot's mapping table to find that out)
    global $db;
    if (0) {
        foreach ($disableFlightsList as $dFlightID => $num) {
            $query = "UPDATE {$flightsTable} SET private = private | 0x02 WHERE  ID={$dFlightID} ";
            $res = $db->sql_query($query);
            # Error checking
            if ($res <= 0) {
                echo "<H3> Error in query: {$query}</H3>\n";
            }
        }
    }
    //or
    $flight->hideSameFlights();
    set_time_limit(200);
    $flight->computeScore();
    $flight->updateTakeoffLanding();
    //	echo "TakeoffID:".$flight->takeoffID."<BR>";
    if (in_array($flight->takeoffID, $CONF['takeoffs']['private'])) {
        $flight->private = 1;
    }
    $flight->putFlightToDB(1);
    // update
    return array(1, $flight->flightID);
    // ALL OK;
}
Esempio n. 5
0
</div></td>
  </tr>
  <tr> 
    <td valign="top" bgcolor="#E9EDF5"><div align="right"><?php 
echo _Last_Name;
?>
</div></td>
    <td valign="top" bgcolor="#F9F9F9"> <?php 
echo $pilot['LastName'];
?>
    </td>
    <td>&nbsp;</td>
    <td colspan="2" valign="top" bgcolor="#F5F2EB"><div align="left">
	<?php 
if ($CONF_use_NAC) {
    echo "<strong>" . _Club . ":</strong> " . NACclub::getClubName($pilot['NACid'], $pilot['NACclubID']);
}
?>
</div></td>
  </tr>
  <tr> 
    <td valign="top" bgcolor="#E9EDF5"><div align="right"><?php 
echo _COUNTRY;
?>
</div></td>
    <td valign="top" bgcolor="#F9F9F9"> <?php 
echo getNationalityDescription($pilot['countryCode']);
?>
    </td>
    <td>&nbsp;</td>
    <td colspan="2" rowspan="8" valign="top"><?php 
Esempio n. 6
0
 echo "</select>";
 echo '<font color="#FF2222">***</font>';
 foreach ($CONF_NAC_list as $NACid => $NAC) {
     if ($NAC['description']) {
         echo "<div style='background:#d0d0d0; padding:10px; ' >" . $NAC['description'] . "</div> ";
     }
 }
 echo "<div id='mID' style='display:" . ($pilot['NACid'] == 0 ? "none" : "inline") . "'> ";
 $memberid_readonly = in_array('NACmemberID', $readonly_fields) ? 'readonly' : '';
 echo "<span style='white-space:nowrap'>" . _MemberID . ": <input size='5' type='text' name='NACmemberID' value='" . $pilot['NACmemberID'] . "' {$memberid_readonly}  /></span> ";
 echo '<font color="#FF2222">***</font>';
 echo "<div id='mIDselect' style='display:" . ($memberid_readonly ? "block" : "none") . "'> ";
 echo "[&nbsp;<a href='#' onclick=\"setID();return false;\">" . _EnterID . "</a>&nbsp;]";
 echo "</div>";
 echo "<div align=left id='mClubSelect' style='display:" . ($CONF_NAC_list[$pilot['NACid']]['use_clubs'] ? "block" : "none") . "' >" . _Club . " ";
 $NACclub = NACclub::getClubName($pilot['NACid'], $pilot['NACclubID']);
 if ($CONF_NAC_list[$pilot['NACid']]['club_change_period_active'] || $CONF_NAC_list[$pilot['NACid']]['add_to_club_period_active'] && !$pilot['NACclubID'] || L_auth::isAdmin($userID) || L_auth::isModerator($userID)) {
     $showChangeClubLink = "inline";
 } else {
     $showChangeClubLink = "none";
 }
 echo "<div id=\"mClubLink\" style=\"display: {$showChangeClubLink}\">[ <a href='#' onclick=\"setClub();return false;\">" . _Select_Club . "</a> ]</div>";
 /*
 
                 echo "[ <a href='#' onclick=\"setClub();return false;\">"._Select_CLub."</a> ]";
             } else {
                 echo "";
             }
 */
 echo "<br><input  type='hidden' name='NACclubID' value='" . $pilot['NACclubID'] . "' /> ";
 echo "<input  type='text' size='50' name='NACclub' value='" . $NACclub . "' readonly /></div> ";
Esempio n. 7
0
function listClubs($legend, $header, $category, $key, $formatFunction = "")
{
    global $clubs, $NACid;
    global $Theme, $countries;
    global $moduleRelPath;
    global $CONF_compItemsPerPage;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $op, $cat;
    global $countHowManyFlights, $pilotsMax, $pilotsMin;
    global $tabID;
    global $sort_funcs_pilots;
    require_once dirname(__FILE__) . "/CL_NACclub.php";
    $clubNamesList = NACclub::getClubs($NACid);
    $legendRight = "";
    // show all pilots up to  $CONF_compItemsPerPage
    // $legend.=" (".$countHowMany." "._N_BEST_FLIGHTS.")";
    echo "<table class='listTable listTableTabber listTable2' cellpadding='2' cellspacing='0'>\n   \t\t\t<tr><td class='tableTitleExtra' colspan='" . ($pilotsMax + 3) . "'>{$legend}</td></tr>";
    ?>
   <tr>
   <td class="SortHeader" width="30"><?php 
    echo _NUM;
    ?>
</td>
   <td class="SortHeader"><div align=left><?php 
    echo _Club;
    ?>
</div></td>
   <?php 
    for ($ii = 1; $ii <= $pilotsMax; $ii++) {
        ?>
   <td class="SortHeader" width="55"><div align=left><?php 
        echo _PILOT . " #{$ii}";
        ?>
</div></td>
   <?php 
    }
    ?>
   <td class="SortHeader" width="70"><?php 
    echo $header;
    ?>
</td>
   </tr>
   <?php 
    $i = 1;
    foreach ($clubs as $clubID => $club) {
        // if ($i>$CONF_compItemsPerPage) break;
        if (!$club['sum']) {
            continue;
        }
        $sortRowClass = $i % 2 ? "l_row1" : "l_row2";
        if ($i == 1) {
            $bg = " class='compFirstPlace'";
        } else {
            if ($i == 2) {
                $bg = " class='compSecondPlace'";
            } else {
                if ($i == 3) {
                    $bg = " class='compThirdPlace'";
                } else {
                    $bg = " class='{$sortRowClass}'";
                }
            }
        }
        $i++;
        echo "<TR {$bg}>";
        echo "<TD>" . ($i - 1 + $startNum) . "</TD>";
        echo "<TD width='25%'><div align=left >" . $clubNamesList[$clubID] . "</div></TD>";
        unset($pilotBrands);
        $pilotBrands = array();
        $j = 0;
        foreach ($club as $pilotID => $pilot) {
            $k = 0;
            $pilotIDparts = split('_', $pilotID, 2);
            if (!is_numeric($pilotIDparts[1])) {
                continue;
            }
            // echo "#".$pilotID."#";
            $pilotName = getPilotRealName($pilotIDparts[1], $pilotIDparts[0], 1);
            $pilotName = prepare_for_js($pilotName);
            $pilotIDinfo = str_replace("_", "u", $pilotID);
            echo "<TD width='20%'>";
            echo "<table width='100%' cellpadding='0' cellspacing='0' class='listTable3'><TR><TD colspan=3 id='{$arrayName}" . "_{$pilotID}' class='pilotLink'>" . "<a class='clubPilot betterTip' id='tpa0_{$pilotIDinfo}' href=\"javascript:pilotTip.newTip('inline', 0, 13, '{$arrayName}" . "_{$pilotID}', 200, '" . $pilotID . "','" . addslashes($pilotName) . "' )\"  onmouseout=\"pilotTip.hide()\">" . $pilotName . "</a>" . "</td></tr><tr>";
            foreach ($pilot['flights_sel'] as $flightID) {
                $val = $pilot['flights'][$flightID]['score'];
                $glider = $pilot['flights'][$flightID]['glider'];
                $country = $countries[$pilot['flights'][$flightID]['country']];
                $thisFlightBrandID = $pilot['flights'][$flightID]['brandID'];
                if ($thisFlightBrandID) {
                    $pilotBrands[$thisFlightBrandID]++;
                }
                if (!$val) {
                    $outVal = "&nbsp;";
                } else {
                    if ($formatFunction) {
                        $outVal = $formatFunction($val);
                    } else {
                        $outVal = $val;
                    }
                }
                // $descr=_PILOT.": $pilotName, "._GLIDER.": $glider, "._COUNTRY.": $country";
                $descr = _GLIDER . ": {$glider}, " . _COUNTRY . ": {$country}";
                $descr = '';
                if ($val) {
                    echo "<TD width='33%'><a class='betterTip' id='tpa2_{$flightID}' href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $flightID)) . "' alt='{$descr}'  title='{$descr}'>" . $outVal . "</a></TD>";
                } else {
                    echo "<TD width='33%'>" . $outVal . "</TD>";
                }
                $k++;
                if ($k >= $countHowManyFlights) {
                    break;
                }
            }
            if ($k != $countHowManyFlights) {
                for ($kk = $k; $kk < $countHowManyFlights; $kk++) {
                    echo "<TD >&nbsp;</TD>";
                }
            }
            echo "</tr></table></td>";
            $j++;
            if ($j >= $pilotsMax) {
                break;
            }
        }
        if ($j != $pilotsMax) {
            for ($jj = $j; $jj < $pilotsMax; $jj++) {
                echo "<TD width='20%'>-</TD>";
                //				for($jjj=0;$jjj<$countHowManyFlights;$jjj++) {
                //					echo "<TD>-</TD>";
                //				}
            }
        }
        if ($formatFunction) {
            $outVal = $formatFunction($club["sum"]);
        } else {
            $outVal = $club["sum"];
        }
        echo "<TD>" . $outVal . "</TD>";
        echo "</tr>";
    }
    // next club
    echo "</table>";
    //	echo '</div>';
}
Esempio n. 8
0
			// $flightNacID=24;
		}
		?>
		<tr>
            <td>
			<fieldset class="legendBox ">
			<legend><? echo _MEMBER_OF ?></legend>
			<div align="left">
				<? $NACName= $CONF_NAC_list[$flightNacID]['name']; ?>
                <strong><? echo $NACName ?></strong>
            </div>
			</fieldset>	
			</td>
            
            <td>
  			<?	$NACclub=NACclub::getClubName($flightNacID,$flight->NACclubID);	?>
				<fieldset class="legendBox legend2">
				<legend><? echo _Club ?></legend>
				<div align="left">
				<input name="NACclub" id="NACclub" type="text" size="60" value="<?php 
echo $NACclub;
?>
">
                <input name="NACclubID" id="NACclubID" type="hidden" value="<?php 
echo $flight->NACclubID;
?>
">
				<input name="NACid" id="NACid" type="hidden" value="<?php 
echo $flightNacID;
?>
">