本文整理汇总了PHP中OperationsData::GetAirportInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP OperationsData::GetAirportInfo方法的具体用法?PHP OperationsData::GetAirportInfo怎么用?PHP OperationsData::GetAirportInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationsData
的用法示例。
在下文中一共展示了OperationsData::GetAirportInfo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if ($this->get->maptype == 'hubmap') {
// Show hubmap
$params = array('s.depicao' => $this->get->hub, 's.enabled' => 1);
// Show only 20 routes
$allschedules = SchedulesData::findSchedules($params, Config::Get('ROUTE_MAP_SHOW_NUMBER'));
if (count($allschedules) == 0) {
echo 'There are no departures from this airport!';
return;
}
$airportinfo = OperationsData::GetAirportInfo($this->get->hub);
echo '<h3>Departures from ' . $airportinfo->name . '</h3>';
} else {
# Get all of the schedule
$allschedules = SchedulesData::findSchedules(array('s.enabled' => 1), Config::Get('ROUTE_MAP_SHOW_NUMBER'));
}
$this->set('allschedules', $allschedules);
$this->render('flown_routes_map.tpl');
}
示例2: getFuelPrice
/**
* Get the current fuel price for an airport, returns it in the
* unit specified in the config file
*
* @param string $apt_icao ICAO of the airport
* @return float Fuel price
*
* @version 709 rewritten
*/
public static function getFuelPrice($apt_icao)
{
$price = false;
$aptinfo = OperationsData::GetAirportInfo($apt_icao);
// Live pricing enabled, and the airport is set to '0' for a live price
if (Config::Get('FUEL_GET_LIVE_PRICE') == true && ($aptinfo->fuelprice == '0' || $aptinfo->fuelprice == '')) {
$price = self::get_cached_price($apt_icao);
if (!$price) {
$price = self::get_from_server($apt_icao);
if (!is_bool($price)) {
return $price;
// Returns the JetA price
}
} else {
return $price->jeta;
}
}
/* Live price stuff above failed or was "off" */
if ($aptinfo->fuelprice == '' || $aptinfo->fuelprice == 0) {
return Config::Get('FUEL_DEFAULT_PRICE');
} else {
return $aptinfo->fuelprice;
}
}
示例3: index
public function index()
{
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postText = file_get_contents('php://input');
$rec_xml = trim(utf8_encode(file_get_contents('php://input')));
$xml = simplexml_load_string($rec_xml);
if (!$xml) {
#$this->log("Invalid XML Sent: \n".$rec_xml, 'kacars');
return;
}
#$this->log(print_r($xml->asXML(), true), 'kacars');
$case = strtolower($xml->switch->data);
switch ($case) {
case 'verify':
$results = Auth::ProcessLogin($xml->verify->pilotID, $xml->verify->password);
if ($results) {
$params = array('loginStatus' => '1');
//echo 1;
} else {
$params = array('loginStatus' => '0');
//echo 0;
}
$send = self::sendXML($params);
break;
case 'getbid':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
$pilotinfo = PilotData::getPilotData($pilotid);
$biddata = SchedulesData::getLatestBid($pilotid);
$aircraftinfo = OperationsData::getAircraftByReg($biddata->registration);
if (count($biddata) == 1) {
if ($aircraftinfo->enabled == 1) {
$params = array('flightStatus' => '1', 'flightNumber' => $biddata->code . $biddata->flightnum, 'aircraftReg' => $biddata->registration, 'aircraftICAO' => $aircraftinfo->icao, 'aircraftFullName' => $aircraftinfo->fullname, 'flightLevel' => $biddata->flightlevel, 'aircraftMaxPax' => $aircraftinfo->maxpax, 'aircraftCargo' => $aircraftinfo->maxcargo, 'depICAO' => $biddata->depicao, 'arrICAO' => $biddata->arricao, 'route' => $biddata->route, 'depTime' => $biddata->deptime, 'arrTime' => $biddata->arrtime, 'flightTime' => $biddata->flighttime, 'flightType' => $biddata->flighttype, 'aircraftName' => $aircraftinfo->name, 'aircraftRange' => $aircraftinfo->range, 'aircraftWeight' => $aircraftinfo->weight, 'aircraftCruise' => $aircraftinfo->cruise);
} else {
$params = array('flightStatus' => '3');
// Aircraft Out of Service.
}
} else {
$params = array('flightStatus' => '2');
// You have no bids!
}
$send = $this->sendXML($params);
break;
case 'getflight':
$flightinfo = SchedulesData::getProperFlightNum($xml->pirep->flightNumber);
$params = array('s.code' => $flightinfo['code'], 's.flightnum' => $flightinfo['flightnum'], 's.enabled' => 1);
$biddata = SchedulesData::findSchedules($params, 1);
$aircraftinfo = OperationsData::getAircraftByReg($biddata[0]->registration);
if (count($biddata) == 1) {
$params = array('flightStatus' => '1', 'flightNumber' => $biddata[0]->code . $biddata[0]->flightnum, 'aircraftReg' => $biddata[0]->registration, 'aircraftICAO' => $aircraftinfo->icao, 'aircraftFullName' => $aircraftinfo->fullname, 'flightLevel' => $biddata[0]->flightlevel, 'aircraftMaxPax' => $aircraftinfo->maxpax, 'aircraftCargo' => $aircraftinfo->maxcargo, 'depICAO' => $biddata[0]->depicao, 'arrICAO' => $biddata[0]->arricao, 'route' => $biddata[0]->route, 'depTime' => $biddata[0]->deptime, 'arrTime' => $biddata[0]->arrtime, 'flightTime' => $biddata[0]->flighttime, 'flightType' => $biddata[0]->flighttype, 'aircraftName' => $aircraftinfo->name, 'aircraftRange' => $aircraftinfo->range, 'aircraftWeight' => $aircraftinfo->weight, 'aircraftCruise' => $aircraftinfo->cruise);
} else {
$params = array('flightStatus' => '2');
}
$send = $this->sendXML($params);
break;
case 'liveupdate':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
# Get the distance remaining
$depapt = OperationsData::GetAirportInfo($xml->liveupdate->depICAO);
$arrapt = OperationsData::GetAirportInfo($xml->liveupdate->arrICAO);
$dist_remain = round(SchedulesData::distanceBetweenPoints($xml->liveupdate->latitude, $xml->liveupdate->longitude, $arrapt->lat, $arrapt->lng));
# Estimate the time remaining
if ($xml->liveupdate->groundSpeed > 0) {
$Minutes = round($dist_remain / $xml->liveupdate->groundSpeed * 60);
$time_remain = self::ConvertMinutes2Hours($Minutes);
} else {
$time_remain = '00:00';
}
$lat = str_replace(",", ".", $xml->liveupdate->latitude);
$lon = str_replace(",", ".", $xml->liveupdate->longitude);
$fields = array('pilotid' => $pilotid, 'flightnum' => $xml->liveupdate->flightNumber, 'pilotname' => '', 'aircraft' => $xml->liveupdate->registration, 'lat' => $lat, 'lng' => $lon, 'heading' => $xml->liveupdate->heading, 'alt' => $xml->liveupdate->altitude, 'gs' => $xml->liveupdate->groundSpeed, 'depicao' => $xml->liveupdate->depICAO, 'arricao' => $xml->liveupdate->arrICAO, 'deptime' => $xml->liveupdate->depTime, 'arrtime' => '', 'route' => $xml->liveupdate->route, 'distremain' => $dist_remain, 'timeremaining' => $time_remain, 'phasedetail' => $xml->liveupdate->status, 'online' => '', 'client' => 'kACARS');
#$this->log("UpdateFlightData: \n".print_r($fields, true), 'kacars');
ACARSData::UpdateFlightData($pilotid, $fields);
break;
case 'pirep':
$flightinfo = SchedulesData::getProperFlightNum($xml->pirep->flightNumber);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
# Make sure airports exist:
# If not, add them.
if (!OperationsData::GetAirportInfo($xml->pirep->depICAO)) {
OperationsData::RetrieveAirportInfo($xml->pirep->depICAO);
}
if (!OperationsData::GetAirportInfo($xml->pirep->arrICAO)) {
OperationsData::RetrieveAirportInfo($xml->pirep->arrICAO);
}
# Get aircraft information
$reg = trim($xml->pirep->registration);
$ac = OperationsData::GetAircraftByReg($reg);
# Load info
/* If no passengers set, then set it to the cargo */
$load = $xml->pirep->pax;
if (empty($load)) {
$load = $xml->pirep->cargo;
}
/* Fuel conversion - kAcars only reports in lbs */
$fuelused = $xml->pirep->fuelUsed;
if (Config::Get('LiquidUnit') == '0') {
# Convert to KGs, divide by density since d = mass * volume
$fuelused = $fuelused * 0.45359237 / 0.8075;
//.........这里部分代码省略.........
示例4: routeinfo
public function routeinfo()
{
if ($this->get->depicao == '' || $this->get->arricao == '') {
return;
}
$depinfo = OperationsData::GetAirportInfo($this->get->depicao);
if (!$depinfo) {
$depinfo = OperationsData::RetrieveAirportInfo($this->get->depicao);
}
$arrinfo = OperationsData::GetAirportInfo($this->get->arricao);
if (!$arrinfo) {
$arrinfo = OperationsData::RetrieveAirportInfo($this->get->arricao);
}
// Convert to json format
$c = array();
$c['depapt'] = (array) $depinfo;
$c['arrapt'] = (array) $arrinfo;
echo json_encode($c);
}
示例5: updateFlightData
/**
* This updates the ACARS live data for a pilot
*
* @param mixed $data This is the data structure with flight properties
* @return mixed Nothing
*
*/
public static function updateFlightData($pilotid, $data)
{
if (!is_array($data)) {
self::$lasterror = 'Data not array';
return false;
}
if (isset($data['code']) && isset($data['flightnum'])) {
$data['flightnum'] = $data['code'] . $data['flightnum'];
}
// Add pilot info
$pilotinfo = PilotData::getPilotData($pilotid);
$data['pilotid'] = $pilotid;
$data['pilotname'] = $pilotinfo->firstname . ' ' . $pilotinfo->lastname;
// Store for later
if (isset($data['registration'])) {
$ac_registration = $data['registration'];
unset($data['registration']);
}
if (isset($data['depicao'])) {
$dep_apt = OperationsData::GetAirportInfo($data['depicao']);
$data['depapt'] = DB::escape($dep_apt->name);
}
if (isset($data['arricao'])) {
$arr_apt = OperationsData::GetAirportInfo($data['arricao']);
$data['arrapt'] = DB::escape($arr_apt->name);
}
if (isset($data['route']) && empty($data['route'])) {
$flight_info = SchedulesData::getProperFlightNum($data['flightnum']);
$params = array('s.code' => $flight_info['code'], 's.flightnum' => $flight_info['flightnum']);
$schedule = SchedulesData::findSchedules($params);
$schedule = $schedule[0];
$data['route'] = $schedule->route;
//$data['route_details'] = serialize(SchedulesData::getRouteDetails($schedule->id));
} elseif (isset($data['route']) && !empty($data['route'])) {
/*$tmp = new stdClass();
$tmp->deplat = $dep_apt->lat;
$tmp->deplng = $dep_apt->lng;
$tmp->route = $data['route'];
$data['route_details'] = NavData::parseRoute($tmp);
$data['route_details'] = serialize($data['route_details']);
unset($tmp);*/
}
if (!empty($data['route_details'])) {
$data['route_details'] = DB::escape($data['route_details']);
}
if (isset($dep_apt)) {
unset($dep_apt);
}
if (isset($arr_apt)) {
unset($arr_apt);
}
// Clean up times
if (isset($data['deptime']) && !is_numeric($data['deptime'])) {
$data['deptime'] = strtotime($data['deptime']);
}
if (isset($data['arrtime']) && !is_numeric($data['arrtime'])) {
$data['arrtime'] = strtotime($data['arrtime']);
}
/* Check the heading for the flight
If none is specified, then point it straight to the arrival airport */
if ($data['heading'] == '' || !isset($data['heading']) && isset($data['lat']) && isset($data['lng'])) {
/* Calculate an angle based on current coords and the
destination coordinates */
$data['heading'] = intval(atan2($data['lat'] - $arr_apt->lat, $data['lng'] - $arr_apt->lng) * 180 / 3.14);
if ($data['lat'] - $data['lng'] < 0) {
$data['heading'] += 180;
}
if ($data['heading'] < 0) {
$data['heading'] += 360;
}
}
// Manually add the last set
$data['lastupdate'] = 'NOW()';
// first see if we exist:
$sql = 'SELECT `id`
FROM ' . TABLE_PREFIX . "acarsdata \n\t\t\t\tWHERE `pilotid`={$pilotid}";
$exist = DB::get_row($sql);
$flight_id = '';
if ($exist) {
// update
$upd = array();
$flight_id = $exist->id;
foreach ($data as $field => $value) {
$value = DB::escape(trim($value));
// Append the message log
if ($field === 'messagelog') {
$upd[] = "`messagelog`=CONCAT(`messagelog`, '{$value}')";
} elseif ($field === 'lastupdate') {
$upd[] = "`lastupdate`=NOW()";
} elseif ($field === 'deptime' || $field === 'arrtime') {
/* If undefined, set a default time to now (penalty for malformed data?)
Won't be quite accurate.... */
//.........这里部分代码省略.........
示例6: acars
/**
* Process ACARS messages here
*
*/
public function acars()
{
if (!isset($_REQUEST['DATA1'])) {
die("0|Invalid Data");
}
if (!isset($_REQUEST['DATA1'])) {
die("0|Invalid Data");
}
// TEST, BEGINFLIGHT, PAUSEFLIGHT, ENDFLIGHT and MESSAGE
$method = strtoupper($_REQUEST['DATA2']);
if (!isset($_REQUEST['DATA3'])) {
$value = '';
} else {
$value = $_REQUEST['DATA3'];
}
if (!isset($_REQUEST['DATA4'])) {
$message = '';
} else {
$message = $_REQUEST['DATA4'];
}
$this->log("Method: {$method}", 'fsfk');
$fields = array();
# Go through each method now
if ($method == 'TEST') {
$pilotid = $value;
echo '1|30';
return;
} elseif ($method == 'BEGINFLIGHT') {
$flight_data = explode('|', $value);
if (count($flight_data) < 10) {
echo '0|Invalid login data';
return;
}
/*preg_match('/^([A-Za-z]*)(\d*)/', $flight_data[0], $matches);
$code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');*/
$pilotid = PilotData::parsePilotID($flight_data[0]);
$coords = $this->get_coordinates($flight_data[6]);
$route = explode('~', $flight_data[5]);
$depicao = $route[0];
$arricao = $route[count($route) - 1];
unset($route[0]);
unset($route[count($route) - 1]);
$route = implode(' ', $route);
$flightinfo = SchedulesData::getProperFlightNum($flight_data[2]);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
$aircraft = $flight_data[3];
$heading = $flight_data[12];
$alt = $flight_data[7];
$gs = 0;
$dist_remain = $flight_data[16];
$time_remain = 0;
$deptime = time();
$online = 0;
$fields = array('pilotid' => $pilotid, 'flightnum' => $code . $flightnum, 'aircraft' => $aircraft, 'lat' => $coords['lat'], 'lng' => $coords['lng'], 'heading' => $heading, 'route' => $route, 'alt' => $alt, 'gs' => $gs, 'depicao' => $depicao, 'arricao' => $arricao, 'distremain' => $dist_remain, 'timeremaining' => $time_remain, 'phasedetail' => 'On the ground', 'online' => $online, 'client' => 'fsfk');
} elseif ($method == 'MESSAGE') {
$pilotid = $value;
$flight_data = ACARSData::get_flight_by_pilot($pilotid);
// Get the flight
preg_match("/Flight ID: (.*)\n/", $message, $matches);
$flightinfo = SchedulesData::getProperFlightNum($matches[1]);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
// Get the aircraft
preg_match("/.*Aircraft Reg: \\.\\.(.*)\n/", $message, $matches);
$aircraft_data = OperationsData::GetAircraftByReg(trim($matches[1]));
$aircraft = $aircraft_data->id;
$depicao = $flight_data->depicao;
$arricao = $flight_data->arricao;
// Get coordinates from ACARS message
$count = preg_match("/POS(.*)\n/", $message, $matches);
if ($count > 0) {
$coords = $this->get_coordinates(trim($matches[1]));
} else {
$coords = array('lat' => $flight_data->lat, 'lng' => $flight_data->lng);
}
// Get our heading
preg_match("/\\/HDG.(.*)\n/", $message, $matches);
$heading = $matches[1];
// Get our altitude
preg_match("/\\/ALT.(.*)\n/", $message, $matches);
$alt = $matches[1];
// Get our speed
preg_match("/\\/IAS.(.*)\\//", $message, $matches);
$gs = $matches[1];
$fields = array('pilotid' => $pilotid, 'aircraft' => $aircraft, 'lat' => $coords['lat'], 'lng' => $coords['lng'], 'heading' => $heading, 'alt' => $alt, 'gs' => $gs, 'phasedetail' => 'Enroute');
} elseif ($method == 'UPDATEFLIGHTPLAN') {
$flight_id = $value;
$flight_data = explode("|", $message);
echo '1|';
return;
}
$depapt = OperationsData::GetAirportInfo($depicao);
$dist_remain = SchedulesData::distanceBetweenPoints($coords->lat, $coords->lng, $depapt->lat, $depapt->lng);
# Estimate the time remaining
//.........这里部分代码省略.........
示例7: routeinfo
public function routeinfo($depicao = '', $arricao = '')
{
header('Content-type: text/xml');
if ($depicao == '') {
$depicao = $_GET['depicao'];
}
if ($arricao == '') {
$arricao = $_GET['arricao'];
}
if ($depicao == '' || $arricao == '') {
return;
}
$depinfo = OperationsData::GetAirportInfo($depicao);
if (!$depinfo) {
$depinfo = OperationsData::RetrieveAirportInfo($depicao);
}
$arrinfo = OperationsData::GetAirportInfo($arricao);
if (!$arrinfo) {
$arrinfo = OperationsData::RetrieveAirportInfo($arricao);
}
$xml = new SimpleXMLElement('<flightinfo/>');
$dep = $xml->addChild('departure');
$dep->addAttribute('icao', $depinfo->icao);
$dep->addAttribute('name', $depinfo->name);
$dep->addAttribute('country', $depinfo->country);
$dep->addAttribute('lat', $depinfo->lat);
$dep->addAttribute('lng', $depinfo->lng);
$arr = $xml->addChild('arrival');
$arr->addAttribute('icao', $arrinfo->icao);
$arr->addAttribute('name', $arrinfo->name);
$arr->addAttribute('country', $arrinfo->country);
$arr->addAttribute('lat', $arrinfo->lat);
$arr->addAttribute('lng', $arrinfo->lng);
header('Content-type: text/xml');
echo $xml->asXML();
}
示例8: process_airport_list
protected static function process_airport_list()
{
self::set_xml('process_airport_list');
foreach (self::$response->airport as $apt) {
// Get from API
$apt = OperationsData::GetAirportInfo($apt->icao);
if ($apt) {
$airport = self::$xml->addChild('airport');
$airport->addChild('icao', $apt->icao);
$airport->addChild('name', $apt->name);
$airport->addChild('location', $apt->country);
$airport->addChild('lat', $apt->lat);
$airport->addChild('lng', $apt->lng);
}
}
}
示例9: array
$_GET['dest'] = DB::escape($_GET['dest']);
# Get schedule info, using minimal information
# Check if they forgot the flight code
if ($code == '') {
# Find a flight using just the flight code
$sched = SchedulesData::FindFlight($flightnum);
# Can't do it. They completely fucked this up
if (!$sched) {
return;
}
$code = $sched->code;
$flightnum = $sched->flightnum;
if ($_GET['origin'] != $sched->depicao || $_GET['dest'] != $sched->arricao) {
$comment = 'phpVMS Message: Arrival or Departure does not match schedule';
}
}
# Make sure airports exist:
# If not, add them.
if (!OperationsData::GetAirportInfo($_GET['origin'])) {
OperationsData::RetrieveAirportInfo($_GET['origin']);
}
if (!OperationsData::GetAirportInfo($_GET['dest'])) {
OperationsData::RetrieveAirportInfo($_GET['dest']);
}
# Convert the time to xx.xx
$flighttime = number_format(floatval(str_replace(':', '.', $_GET['duration'])), 2);
$data = array('pilotid' => $pilotid, 'code' => $code, 'flightnum' => $flightnum, 'depicao' => $_GET['origin'], 'arricao' => $_GET['dest'], 'aircraft' => $ac->id, 'flighttime' => $flighttime, 'landingrate' => $landingrate, 'submitdate' => 'NOW()', 'comment' => $comment, 'fuelused' => $_GET['fuel'], 'source' => 'fsacars', 'route' => $route, 'load' => $load, 'rawdata' => $log, 'log' => $_GET['log']);
$ret = ACARSData::FilePIREP($pilotid, $data);
echo 'OK';
break;
}
示例10: editairport
public function editairport()
{
$this->set('title', 'Edit Airport');
$this->set('action', 'editairport');
$this->set('airport', OperationsData::GetAirportInfo($this->get->icao));
$this->render('ops_airportform.tpl');
}
示例11: intval
$pilot_code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');
}
else
{
$pilotid = $data[0];
}*/
$pilotid = PilotData::parsePilotID($data[0]);
# Make sure airports exist:
# If not, add them.
$depicao = $data[6];
$arricao = $data[7];
if (!OperationsData::GetAirportInfo($depicao)) {
OperationsData::RetrieveAirportInfo($depicao);
}
if (!OperationsData::GetAirportInfo($arricao)) {
OperationsData::RetrieveAirportInfo($arricao);
}
# Get aircraft information
$reg = trim($data[3]);
$ac = OperationsData::GetAircraftByReg($reg);
# Load info
/* If no passengers set, then set it to the cargo */
$load = $data[14];
if (empty($load)) {
$load = $data[15];
}
# Convert the time to xx.xx
$flighttime = floatval(str_replace(':', '.', $data[11])) * 1.0;
/* Fuel conversion - XAcars only reports in lbs */
$fuelused = $data[12];
示例12: processimport
public function processimport()
{
echo '<h3>Processing Import</h3>';
if (!file_exists($_FILES['uploadedfile']['tmp_name'])) {
$this->set('message', 'File upload failed!');
$this->render('core_error.tpl');
return;
}
echo '<p><strong>DO NOT REFRESH OR STOP THIS PAGE</strong></p>';
set_time_limit(270);
$errs = array();
$skip = false;
# Fix for bug VMS-325
$temp_name = $_FILES['uploadedfile']['tmp_name'];
$new_name = CACHE_PATH . $_FILES['uploadedfile']['name'];
move_uploaded_file($temp_name, $new_name);
$fp = fopen($new_name, 'r');
if (isset($_POST['header'])) {
$skip = true;
}
/* Delete all schedules before doing an import */
if (isset($_POST['erase_routes'])) {
SchedulesData::deleteAllSchedules();
}
$added = 0;
$updated = 0;
$total = 0;
echo '<div style="overflow: auto; height: 400px; border: 1px solid #666; margin-bottom: 20px; padding: 5px; padding-top: 0px; padding-bottom: 20px;">';
while ($fields = fgetcsv($fp, 1000, ',')) {
// Skip the first line
if ($skip == true) {
$skip = false;
continue;
}
// list fields:
$code = $fields[0];
$flightnum = $fields[1];
$depicao = $fields[2];
$arricao = $fields[3];
$route = $fields[4];
$aircraft = $fields[5];
$flightlevel = $fields[6];
$distance = $fields[7];
$deptime = $fields[8];
$arrtime = $fields[9];
$flighttime = $fields[10];
$notes = $fields[11];
$price = $fields[12];
$flighttype = $fields[13];
$daysofweek = $fields[14];
$enabled = $fields[15];
$week1 = $fields[16];
$week2 = $fields[17];
$week3 = $fields[18];
$week4 = $fields[19];
if ($code == '') {
continue;
}
// Check the code:
if (!OperationsData::GetAirlineByCode($code)) {
echo "Airline with code {$code} does not exist! Skipping...<br />";
continue;
}
// Make sure airports exist:
if (!($depapt = OperationsData::GetAirportInfo($depicao))) {
$this->get_airport_info($depicao);
}
if (!($arrapt = OperationsData::GetAirportInfo($arricao))) {
$this->get_airport_info($arricao);
}
# Check the aircraft
$aircraft = trim($aircraft);
$ac_info = OperationsData::GetAircraftByReg($aircraft);
# If the aircraft doesn't exist, skip it
if (!$ac_info) {
echo 'Aircraft "' . $aircraft . '" does not exist! Skipping<br />';
continue;
}
$ac = $ac_info->id;
if ($flighttype == '') {
$flighttype = 'P';
}
if ($daysofweek == '') {
$daysofweek = '0123456';
}
// Replace a 7 (Sunday) with 0 (since PHP thinks 0 is Sunday)
$daysofweek = str_replace('7', '0', $daysofweek);
# Check the distance
if ($distance == 0 || $distance == '') {
$distance = OperationsData::getAirportDistance($depicao, $arricao);
}
$flighttype = strtoupper($flighttype);
if ($enabled == '0') {
$enabled = false;
} else {
$enabled = true;
}
# This is our 'struct' we're passing into the schedule function
# to add or edit it
$data = array('code' => $code, 'flightnum' => $flightnum, 'depicao' => $depicao, 'arricao' => $arricao, 'route' => $route, 'aircraft' => $ac, 'flightlevel' => $flightlevel, 'distance' => $distance, 'deptime' => $deptime, 'arrtime' => $arrtime, 'flighttime' => $flighttime, 'daysofweek' => $daysofweek, 'notes' => $notes, 'enabled' => $enabled, 'price' => $price, 'flighttype' => $flighttype, 'week1' => $week1, 'week2' => $week2, 'week3' => $week3, 'week4' => $week4);
//.........这里部分代码省略.........