protected function saveModel($airport = false) { if (Input::get('id')) { $airport = Airport::find(Input::get('id')); } if (!$airport) { $airport = new Airport(); } $airport->name = Input::get('name'); $address = $airport->address()->first() ?: new Address(); $country = Country::where('name', Input::get('country'))->first(); $address->country()->associate($country); $address->address = Input::get('address_address'); $address->postal_code = Input::get('address_postal_code'); $address->city = Input::get('address_city'); $address->state_province = Input::get('address_state_province'); $address->phone = Input::get('address_phone'); $address->fax = Input::get('address_fax'); $address->email = Input::get('address_email'); $address->website = Input::get('address_website'); $address->save(); $airport->address()->associate($address); $hotel->save(); return $airport; }
public function new_item_info() { $origin = Airport::where('id', Input::get('origin_airport_id'))->first(); $destination = Airport::where('id', Input::get('destination_airport_id'))->first(); $distance = great_circle_distance($origin->lat, $origin->lng, $destination->lat, $destination->lng); return Response::json(array('flight_duration' => flight_duration(Input::get('speed'), $distance), 'origin_iata_code' => $origin->iata_code, 'distance' => $distance, 'destination_iata_code' => $destination->iata_code)); }
function show(Airport $airport) { $departures = $airport->departures()->with('pilot', 'arrival', 'arrival.country')->whereIn('state', array(0, 1, 4))->whereMissing(false)->where('arrival_id', '!=', '')->get(); $arrivals = $airport->arrivals()->with('pilot', 'departure', 'departure.country')->whereIn('state', array(1, 3))->whereMissing(false)->get(); try { $metar = file_get_contents('http://weather.noaa.gov/pub/data/observations/metar/stations/' . strtoupper($airport->icao) . '.TXT'); } catch (ErrorException $e) { $metar = null; } try { $taf = file_get_contents('http://weather.noaa.gov/pub/data/forecasts/taf/stations/' . strtoupper($airport->icao) . '.TXT'); } catch (ErrorException $e) { $taf = null; } $this->autoRender(compact('airport', 'departures', 'arrivals', 'metar', 'taf'), $airport->icao . ' - ' . $airport->name); }
function index() { $q = trim(Input::get('q')); if (empty($q) || !Input::has('q')) { return Redirect::home(); } if (!Input::has('guess') || Input::get('guess') != 'no') { $regex = array('pilot' => '[0-9]+', 'airport' => '[A-Z0-9]{4}', 'airline' => '[A-Z0-9]{3}', 'airportIata' => '[A-Z0-9]{3}', 'citypair' => '([A-Z0-9]{3,4})(?:(?:\\s*?[-|>]\\s*?)|\\s+to\\s+|\\s+)([A-Z0-9]{3,4})', 'callsign' => '.*'); $search = new Search($q); foreach ($regex as $type => $pattern) { if (preg_match('/^' . $pattern . '$/i', $q, $matches) && ($match = $search->quick($type, $matches))) { Messages::info('You were redirected here by a best guess of the search system. <a href="' . URL::route('search', array('q' => $q, 'guess' => 'no')) . '" class="alert-link">Return to search results.</a>'); return $match; } } } $pilots = Pilot::where(function ($search) use($q) { $search->where('vatsim_id', '=', $q); $search->orWhere(function ($name) use($q) { $name->where('name', 'LIKE', '%' . $q . '%'); $name->where('anonymous', '=', false); }); })->where('vatsim_id', '!=', 0)->get(); $flights = Flight::where('callsign', '=', $q)->orderBy('departure_time', 'desc')->get(); $airlines = Airline::where('icao', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->get(); $airports = Airport::where('icao', '=', $q)->orWhere('iata', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->orWhere('city', 'LIKE', '%' . $q . '%')->get(); $this->autoRender(compact('q', 'flights', 'pilots', 'airlines', 'airports'), 'Search'); }
function citypair($departureId, $arrivalId) { $routes = Flight::select('id', 'route', DB::raw('COUNT(route) AS count'))->whereDepartureId($departureId)->whereArrivalId($arrivalId)->where('route', '!=', '')->whereState(2)->groupBy('route')->orderBy('count', 'desc')->get(); $departure = Airport::whereIcao($departureId)->first(); $arrival = Airport::whereIcao($arrivalId)->first(); $this->autoRender(compact('departure', 'arrival', 'routes', 'airports', 'departureId', 'arrivalId'), 'Routes for ' . $departureId . ' - ' . $arrivalId); }
public function to_string() { date_default_timezone_set('America/New_York'); $res = "Total cost: \${$this->cost}</br>"; $res = "{$res} Total flights: {$this->num_flights}</br>"; $fuck_php = round($this->get_trip_time() / 60, 0); $time = date('Y-m-d H:i:s', $this->flights[0]['e_depart_time']); $res = "{$res} Departs at: {$time} </br>"; $time = date('Y-m-d H:i:s', $this->flights[$this->num_flights - 1]['e_arrival_time']); $res = "{$res} Arrives at: {$time} </br>"; $res = "{$res} Total time (minutes): {$fuck_php}</br>"; $res = "{$res} Flights: </br>"; $count = 1; foreach ($this->flights as $flight) { $a = Airport::get_name_by_id($flight['org_id'], new users()); $b = Airport::get_name_by_id($flight['dest_id'], new users()); $res = $res . $count . " : " . $a . " to " . $b . "</br>"; //$res .= " departs at: " . date('D M j, Y - g:i', $flight['e_depart_time']) . "<br>"; //$res .= " arrives at: " . date('D M j, Y - g:i', $flight['e_arrival_time']) . "<br>"; $res .= " departs at: " . $flight['e_depart_time'] . "<br>"; $res .= " arrives at: " . $flight['e_arrival_time'] . "<br>"; $count++; } $res .= "<br>"; return $res; }
function topAirports() { $other = 0; $result = array(); $chart = array(); $names = array(); $counter = $this->query()->select(DB::raw('airport_id, count(airport_id) as counter'))->groupBy('airport_id')->whereNotNull('airport_id')->orderBy('counter', 'DESC')->lists('counter', 'airport_id'); $other = $this->_total - array_sum($counter); if (count($counter) > 0) { $namesRaw = Airport::with('country')->whereIn('icao', array_keys($counter))->get(); foreach ($namesRaw as $airport) { $names[$airport->icao] = $airport; } foreach ($counter as $key => $flights) { if (count($result) < 5 && array_key_exists($key, $names)) { $percentage = $this->_total == 0 ? 0 : number_format($flights / $this->_total * 100, 1); $result[] = array('data' => $names[$key], 'count' => $flights, 'percent' => $percentage, 'key' => $key); if ($percentage > 0) { $chart[] = [$key, $percentage]; } } else { $other += $flights; } } } $result['Other'] = array('count' => $other, 'percent' => $this->_total == 0 ? 0 : number_format($other / $this->_total * 100, 1), 'key' => 'Other'); $chart[] = ['Other', $result['Other']['percent']]; $piechartData = piechartData($chart); return array('table' => $result, 'chart' => $piechartData['javascript'], 'colours' => $piechartData['colours']); }
function citypair($matches) { $departure = strtoupper($matches[1]); $arrival = strtoupper($matches[2]); if (!is_null(Airport::whereIcao($departure)->first()) && !is_null(Airport::whereIcao($arrival)->first())) { return Redirect::route('citypair', array('departure' => $departure, 'arrival' => $arrival)); } return false; }
public function run() { //DB::table('airports')->delete(); // waw Airport::create(array('iata_code' => 'waw', 'name' => 'Warsaw Chopin Airport', 'country' => 'pl', 'slots_per_hour' => 25, 'lat' => '52.165833', 'lng' => '20.967222', 'runway_length' => 3600)); // krk Airport::create(array('iata_code' => 'krk', 'name' => 'Kraków Balice', 'country' => 'pl', 'slots_per_hour' => 15, 'lat' => '50.077778', 'lng' => '19.784722', 'runway_length' => 2550)); // ktw Airport::create(array('iata_code' => 'ktw', 'name' => 'Katowice Pyrzowice', 'country' => 'pl', 'slots_per_hour' => 5, 'lat' => '50.474167', 'lng' => '19.08', 'runway_length' => 3200)); // fra Airport::create(array('iata_code' => 'fra', 'name' => 'Frankfurt', 'country' => 'de', 'slots_per_hour' => 40, 'lat' => '50.026422', 'lng' => '8.543125', 'runway_length' => 4000)); // lhr Airport::create(array('iata_code' => 'lhr', 'name' => 'London Heathrow', 'country' => 'gb', 'slots_per_hour' => 45, 'lat' => '51.470833', 'lng' => '-0.460556', 'runway_length' => 3900)); }
public static function getAirportByPk($id) { if (isset(Airport::$airports[$id])) { return Airport::$airports[$id]; } else { $airport = Airport::model()->findByPk($id); if ($airport) { $city = $airport->city; Airport::$airports[$airport->id] = $airport; Airport::$codeIdMap[$airport->code] = $airport->id; return Airport::$airports[$id]; } else { throw new CException(Yii::t('application', 'City with id {id} not found', array('{id}' => $id))); } } }
<?php include_once '../../class/pattern/abstractFactory.php'; $barrack = new Barrack(); //建立軍營 $terranUnit = $barrack->outputTerranUnit(); //產生人類士兵 $zergUnit = $barrack->outputZergUnit(); //產生異形士兵 $terranUnit->playSlogan(); $zergUnit->shout(); $commandCenter = new CommandCenter(); //建立指揮中心 $terranUnit = $commandCenter->outputTerranUnit(); //產生人類工兵 $zergUnit = $commandCenter->outputZergUnit(); //產生異形工兵 $terranUnit->playSlogan(); $zergUnit->shout(); $airport = new Airport(); //建立機場 $terranUnit = $airport->outputTerranUnit(); //產生人類飛機 $zergUnit = $airport->outputZergUnit(); //產生異形飛機 $terranUnit->playSlogan(); $zergUnit->shout();
/** * Declares an association between this object and a Airport object. * * @param Airport $v * @return Camp The current object (for fluent API support) * @throws PropelException */ public function setAirport(Airport $v = null) { if ($v === null) { $this->setAirportId(NULL); } else { $this->setAirportId($v->getId()); } $this->aAirport = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Airport object, it will not be re-added. if ($v !== null) { $v->addCamp($this); } return $this; }
<!-- airport.php airport flights page Erich --> <?php require_once '../includes/Airport.php'; $airportID = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_NUMBER_INT); $airport = new Airport($airportID); ?> <!DOCTYPE html> <html> <?php include_once 'head.php'; ?> <body> <div id="flights" class="container"> <?php include_once 'header.php'; ?> <!-- page content --> <div class="content-wrap"> <div class="content-left"> <?php include_once 'nav-airport.php'; ?> </div>
<?php include_once '../../class/pattern/factory.php'; $barrack = new Barrack(); // 建立軍營 $solider = $barrack->outputUnit(); // 產生單位 $solider->playSlogan(); $commandCenter = new CommandCenter(); // 建立指揮中心 $worker = $commandCenter->outputUnit(); // 產生單位 $worker->playSlogan(); $airport = new Airport(); // 建立機場 $aircraft = $airport->outputUnit(); // 產生單位 $aircraft->playSlogan();
public function __construct($oParams) { if (is_object($oParams)) { $this->departureCityId = $oParams->departure_city->id; $this->arrivalCityId = $oParams->arrival_city->id; $this->timestampBegin = strtotime($oParams->datetime_begin); $this->timestampEnd = strtotime($oParams->datetime_end); $this->datetimeBegin = $oParams->datetime_begin; $this->datetimeEnd = $oParams->datetime_end; $this->code = $oParams->code; $this->duration = $oParams->duration; $this->departureTerminalCode = $oParams->departure_terminal_code; $this->arrivalTerminalCode = $oParams->arrival_terminal_code; $this->aircraftCode = $oParams->aircraft_code; //$this->aircraft_name = $oParams->aircraft_name; $this->transportAirlineCode = $oParams->transport_airline->code; $this->opAirline = $oParams->opAirline; $this->markAirline = $oParams->markAirline; $this->departureAirportId = $oParams->departure_airport->id; $this->arrivalAirportId = $oParams->arrival_airport->id; $this->departureAirport = $oParams->departure_airport; $this->arrivalAirport = $oParams->arrival_airport; $this->stopNum = $oParams->stopNum; $this->bookingCodes = $oParams->aBookingCodes; } else { $this->departureCityId = $oParams['departureCityId']; $this->arrivalCityId = $oParams['arrivalCityId']; $this->timestampBegin = strtotime($oParams['datetimeBegin']); $this->timestampEnd = strtotime($oParams['datetimeEnd']); $this->datetimeBegin = $oParams['datetimeBegin']; $this->datetimeEnd = $oParams['datetimeEnd']; $this->code = $oParams['flightCode']; $this->duration = $oParams['duration']; //$this->departureTerminalCode = $oParams['departureCityId']; //$this->arrivalTerminalCode = $oParams->arrival_terminal_code; $this->aircraftCode = $oParams['aircraftCode']; //$this->aircraft_name = $oParams->aircraft_name; $this->transportAirlineCode = $oParams['transportAirline']; if ($oParams['markAirline']) { $this->markAirline = Airline::getAirlineByCode($oParams['markAirline']); } else { $this->markAirline = Airline::getAirlineByCode($oParams['transportAirline']); } //$this->opAirline = $oParams['duration']; //$this->markAirline = $oParams['duration']; $this->departureAirportId = $oParams['departureAirportId']; $this->arrivalAirportId = $oParams['arrivalAirportId']; $this->departureAirport = Airport::getAirportByPk($oParams['departureAirportId']); $this->arrivalAirport = Airport::getAirportByPk($oParams['arrivalAirportId']); $this->stopNum = $oParams['stopNum']; $this->bookingCodes = array($oParams['bookingCode']); } }
public function asString() { return $this->origin->asCode() . ' to ' . $this->destination->asCode(); }
<!-- shopping.php airport shopping & food page Erich --> <?php require_once '../includes/Airport.php'; $airportID = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_NUMBER_INT); $airport = new Airport($airportID); ?> <!DOCTYPE html> <html> <?php include_once 'head.php'; ?> <body> <div id="shopping" class="container"> <?php include_once 'header.php'; ?> <!-- page content --> <div class="content-wrap"> <div class="content-left"> <?php include_once 'nav-airport.php'; ?> </div> <div class="content-right">
public function addRoundTripToCache($row, $url) { $price = ceil($row->ReturnPrice); $codesFrom = explode('*', $row->OutboundWebsiteFlightCode); $codesTo = explode('*', $row->InboundWebsiteFlightCode); if (sizeof($codesFrom) > 1 && sizeof($codesTo) > 1) { $airline = $codesFrom[2]; $depAirportDate = $codesFrom[1]; $arrAirportDate = end($codesFrom); $fromAirp = Airport::model()->findByAttributes(array('code' => substr($depAirportDate, 0, 3))); if (!$fromAirp) { echo "Airport {$depAirportDate} not defined \n"; return false; } $toAirp = Airport::model()->findByAttributes(array('code' => substr($arrAirportDate, 0, 3))); if (!$toAirp) { echo "Airport {$arrAirportDate} not defined \n"; return false; } $from = $fromAirp->cityId; $to = $toAirp->cityId; } else { $airline = ''; $from = $this->intRouters[$url][0]; $to = $this->intRouters[$url][1]; if (!$from || !$to) { echo "Cities not defined \n"; return false; } } $timeFrom = strtotime($row->OutboundDepartureDate); $timeBack = strtotime($row->InboundDepartureDate); if ($timeFrom == 0 || $timeBack == 0) { echo "Time does not determined\n"; return false; } $dateFrom = date('Y-m-d', $timeFrom); $dateBack = date('Y-m-d', $timeBack); $flightCache = FlightCache::model()->findByAttributes(array('from' => $from, 'to' => $to, 'dateFrom' => $dateFrom, 'dateBack' => $dateBack)); if (!$flightCache) { echo "Creating record {$from} - {$to} - {$from} at {$dateFrom} <-> {$dateBack}. It is {$price}\n"; $flightCache = new FlightCache(); } else { if ($flightCache->priceBestPrice > $price) { echo "Updating record {$from} - {$to} - {$from} at {$dateFrom} <-> {$dateBack}. It was {$flightCache->priceBestPrice} become {$price}\n"; } else { return true; } } $flightCache->from = $from; $flightCache->to = $to; $flightCache->dateFrom = $dateFrom; $flightCache->dateBack = $dateBack; $flightCache->priceBestPrice = $price; $flightCache->transportBestPrice = $airline; $flightCache->validatorBestPrice = $airline; return $flightCache->save(); }
<!-- reviews.php airport reviews page Erich --> <?php require_once '../includes/Airport.php'; $airportID = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_NUMBER_INT); $airport = new Airport($airportID); ?> <!DOCTYPE html> <html> <?php include_once 'head.php'; ?> <body> <div id="reviews" class="container"> <?php include_once 'header.php'; ?> <!-- page content --> <div class="content-wrap"> <div class="content-left"> <?php include_once 'nav-airport.php'; ?> </div> <div class="content-right">
/** * Show the form for creating a new resource. * * @return Response */ public function store() { return Airport::create(["name" => Input::get("name"), "city" => Input::get("city")]); }
/** * Add new airport from pop up by ajax * CODE:airport_create */ public function executeUpdateAjax(sfWebRequest $request) { # security if (!$this->getUser()->hasCredential(array('Administrator'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } // $this->setLayout(false); $airport = new Airport(); $this->airport = $airport; $this->form = new AirportForm($airport); $this->back = $request->getReferer(); if ($request->isMethod('post')) { $this->referer = $request->getReferer(); $this->form->bind($request->getParameter('airp')); if ($this->form->isValid() && $this->form->getValue('ident')) { if ($this->form->getValue('ident') && $request->getParameter('id')) { $is_used = AirportPeer::getByIdent($this->form->getValue('ident')); $airport->setIdent($is_used->getIdent()); } elseif ($this->form->getValue('ident') && !$request->getParameter('id')) { //new $is_used = AirportPeer::getByIdent($this->form->getValue('ident')); if (isset($is_used)) { if ($is_used->getIdent() == $this->form->getValue('ident')) { if ($request->getParameter('back') == null) { $last = $request->getReferer(); } else { $last = $request->getParameter('back'); } if (strstr($last, 'camp/create')) { $back_url = $last; } elseif (strstr($last, 'fbo/create')) { $back_url = $last; } else { $back_url = 'airport'; } $this->getUser()->setFlash('success', 'This Airport Ident has already used. Please confirm else!'); $this->redirect($back_url); } } elseif ($this->form->getValue('ident') == 'null') { $airport->setIdent(null); } else { $airport->setIdent($this->form->getValue('ident')); } } $airport->setName($this->form->getValue('name')); $airport->setCity($this->form->getValue('city')); $airport->setState($this->form->getValue('state')); $airport->setLatitude($this->form->getValue('latitude')); $airport->setLongitude($this->form->getValue('longitude')); $airport->setRunwayLength($this->form->getValue('runway_length')); if ($this->form->getValue('wing_id') == 0) { $airport->setWingId(null); } else { $airport->setWingId($this->form->getValue('wing_id')); } $airport->setGmtOffset($this->form->getValue('gmt_offset')); $airport->setDstOffset($this->form->getValue('dst_offset')); $airport->setZipcode($this->form->getValue('zipcode')); if ($this->form->getValue('closed') == null) { $airport->setClosed(0); } else { $airport->setClosed($this->form->getValue('closed')); } if ($airport->isNew()) { $content = $this->getUser()->getName() . ' added new Airport: ' . $airport->getName() . ' (' . $airport->getIdent() . ')'; ActivityPeer::log($content); } $airport->save(); $str = '<script type="text/javascript">' . 'var a = $id;' . "window.\$('#back_airport_id').val('');" . "window.\$('#back_airport_id').val(a);" . "window.\$('#back1').val(\$('#camp_agency_id').val());" . "window.location.reload();" . '</script>'; $this->getUser()->setFlash('success', 'New Airport created successfully!'); $this->formValid = true; $this->airportName = $airport->getName(); //return $this->renderText($str); } else { $str = '<script type="text/javascript">' . "//window.setTimeout(\\'window.location.reload()\\', 1500);" . 'window.location.reload();' . '</script>'; $this->getUser()->setFlash('success', 'Can not create new Airport without datas!'); $this->formNotValid = true; //return $this->renderText($str); } } else { # Set referer URL $this->referer = $request->getReferer() ? $request->getReferer() : '@airport'; } $this->airport = $airport; }
function topAirports() { $other = 0; $result = array(); $chart = array(); $names = array(); $origCounter = $this->query()->select(DB::raw('departure_id, count(departure_id) as counter'))->groupBy('departure_id')->where('departure_id', '!=', '')->orderBy('counter', 'DESC')->lists('counter', 'departure_id'); $destCounter = $this->query()->select(DB::raw('arrival_id, count(arrival_id) as counter'))->groupBy('arrival_id')->where('arrival_id', '!=', '')->orderBy('counter', 'DESC')->lists('counter', 'arrival_id'); $airportsId = array_unique(array_merge(array_keys($origCounter), array_keys($destCounter))); $counter = array_combine($airportsId, $airportsId); foreach ($counter as &$airportId) { $airportId = @$origCounter[$airportId] + @$destCounter[$airportId]; } arsort($counter); if (count($counter) > 0) { $namesRaw = Airport::with('country')->whereIn('icao', array_slice(array_keys($counter), 0, 5))->get(); foreach ($namesRaw as $airport) { $names[$airport->icao] = $airport; } } foreach ($counter as $key => $flights) { if (count($result) < 5 && array_key_exists($key, $names)) { $percentage = $this->_total == 0 ? 0 : number_format($flights / ($this->_total * 2) * 100, 1); $result[] = array('data' => $names[$key], 'count' => $flights, 'percent' => $percentage, 'key' => $names[$key]->icao); if ($percentage > 0) { $chart[] = [$names[$key]->icao, $percentage]; } } else { $other += $flights; } } $result['Other'] = array('count' => $other, 'percent' => $this->_total == 0 ? 0 : number_format($other / ($this->_total * 2) * 100, 1), 'key' => 'Other'); $chart[] = ['Other', $result['Other']['percent']]; $piechartData = piechartData($chart); return array('table' => $result, 'chart' => $piechartData['javascript'], 'colours' => $piechartData['colours']); }
<!-- parking.php airport parking page Erich --> <?php require_once '../includes/Airport.php'; $airportID = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_NUMBER_INT); $airport = new Airport($airportID); ?> <!DOCTYPE html> <html> <?php include_once 'head.php'; ?> <body> <div id="parking" class="container"> <?php include_once 'header.php'; ?> <!-- page content --> <div class="content-wrap"> <div class="content-left"> <?php include_once 'nav-airport.php'; ?> </div> <div class="content-right">
<section id="content"> <div class="wrapper pad1"> <!-- DO YOU WORK HERE !!!! --> <?php echo "<strong>My Flights</strong><img src= images/plus.png class=but1 />"; echo "<div class=content_1 style=background-color:#eee9e9;>"; echo "you currently have " . count($reservations) . " reservation(s) on your account."; echo " <table width=77% border=1 cellpadding=5>\n <tr>\n <td><strong>Departure</strong></td>\n <td><strong>Destination</strong></td>\n <td><strong>Ticket#</strong></td>\n <td><strong>Flight#</strong></td>\n <td><strong>Seat#</strong></td>\n <td><strong>Price</strong></td>\n\t<td><strong>Status</strong></td>\n\t<td><strong>Action</strong></td>\n </tr>"; foreach ($results as $result) { $depart = Airport::get_name_by_id($result['org_id'], $users); $arrival = Airport::get_name_by_id($result['dest_id'], $users); $ticket_id = $result['ticket_id']; echo "<tr>\n <td>{$depart}</td>\n\t<td>{$arrival}</td>\n <td>{$result['ticket_id']}</td>\n <td>{$result['flight_id']}</td>\n <td>{$result['seat_id']}</td>\n <td>\${$result['price']}</td>\n\t<td><strong style=color:green;>Active</strong></td>"; echo "<td><a href='checkin.php?id=" . $result['ticket_id'] . "'><input type=submit style=background-color:#87ceeb; value=check-in></td>"; echo "<td><a href='delete.php?id=" . $result['ticket_id'] . "'><button class=button1 onclick='return doConfirmDelete(this.id);'>Delete</button></a></td>"; echo "\n </tr>"; } echo "</table>"; echo "</div>"; ?> </div> </section>
function fire($job, $vatsim_id) { $pilot = Pilot::whereVatsimId($vatsim_id)->first(); if ($pilot->processing == 1) { $job->delete(); return; } try { $it = new XmlIterator\XmlIterator('https://cert.vatsim.net/vatsimnet/idstatusint.php?cid=' . $vatsim_id, 'user'); $official = iterator_to_array($it)[0]; $pilot->name = $official['name_first'] . ' ' . $official['name_last']; $pilot->rating_id = $official['rating']; } catch (ErrorException $e) { } $newFlights = array(); $flights = Flight::whereVatsimId($pilot->vatsim_id)->whereState(2)->get(); $totalDistance = 0; $totalDuration = 0; $totalFlights = $flights->count(); foreach ($flights as $flight) { if ($flight->processed == 1) { $totalDistance += $flight->distance; $totalDuration += $flight->duration; } else { $callsign = str_replace('-', '', strtoupper($flight->callsign)); if (!is_null($airline = $this->getAirlines($callsign))) { // Airline $flight->isAirline($airline->icao); unset($airline); } elseif (!is_null($registration = $this->getRegistrations($callsign))) { $flight->isPrivate($registration->country_id); unset($registration); } if (!is_null($flight->departure_time) && !is_null($flight->arrival_time)) { $duration = $this->duration($flight->departure_time, $flight->arrival_time); $flight->duration = $duration; $totalDuration += $duration; unset($duration); } $distance = 0; foreach ($flight->positions as $key => $position) { if ($key > 0) { $distance += $this->distance($position->lat, $position->lon, $previous->lat, $previous->lon); } $previous = $position; } $flight->distance = $distance; // $flight->processed = true; // $flight->save(); if (!is_nan($distance)) { $totalDistance += $distance; } unset($distance, $previous); } $newFlights[] = array('id' => $flight->id, 'duration' => $flight->duration, 'distance' => $flight->distance, 'airline_id' => $flight->airline_id, 'callsign_type' => $flight->callsign_type); unset($flight); } unset($flights); Log::info('queue:legacy[' . $job->getJobId() . '] - processed flights'); DB::statement("create temporary table if not exists flights_temp (\n\t\t\t`id` int(10) unsigned NOT NULL,\n\t\t\t`callsign_type` tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t`airline_id` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t`duration` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t`distance` smallint(6) NOT NULL DEFAULT '0',\n\t\t\tPRIMARY KEY (`id`)\n\t\t)"); Log::info('queue:legacy[' . $job->getJobId() . '] - created temp table flights'); $remaining = count($newFlights); $step = 0; do { Log::info('queue:legacy[' . $job->getJobId() . '] - inserted flights - ' . $remaining); DB::table('flights_temp')->insert(array_slice($newFlights, 100 * $step, 100)); $remaining -= 100; $step++; } while ($remaining > 0); Log::info('queue:legacy[' . $job->getJobId() . '] - inserted flights - done'); DB::statement("update flights dest, flights_temp src set\n\t\t\tdest.callsign_type = src.callsign_type,\n\t\t\tdest.airline_id = src.airline_id,\n\t\t\tdest.duration = src.duration,\n\t\t\tdest.distance = src.distance,\n\t\t\tdest.processed = 1\n\t\twhere dest.id = src.id\n\t\t"); Log::info('queue:legacy[' . $job->getJobId() . '] - updated flights'); $atcs = ATC::whereVatsimId($vatsim_id)->whereNotNull('end')->get(); $totalDurationAtc = 0; $totalAtc = $atcs->count(); $newAtc = array(); foreach ($atcs as $atc) { if ($atc->processed) { if ($atc->facility_id != 99) { $totalDurationAtc += $atc->duration; } else { $totalAtc--; } } else { $atc->facility_id = ends_with($atc->callsign, '_ATIS') ? 99 : $atc->facility_id; $duration = $this->duration($atc->start, $atc->end); $atc->duration = $duration; if ($atc->facility_id != 99) { $totalDurationAtc += $duration; } if ($atc->facility_id < 6) { $airport = Airport::select('icao')->whereIcao(explode('_', $atc->callsign)[0])->orWhere('iata', '=', explode('_', $atc->callsign)[0])->pluck('icao'); $atc->airport_id = is_null($airport) ? null : $airport; unset($airport); } elseif ($atc->facility_id == 6) { $sector = SectorAlias::select('sectors.code')->where('sector_aliases.code', '=', explode('_', $atc->callsign)[0])->join('sectors', 'sector_aliases.sector_id', '=', 'sectors.id')->pluck('code'); $atc->sector_id = is_null($sector) ? null : $sector; unset($sector); } else { $totalAtc--; } // $atc->processed = true; // $atc->save(); } $newAtc[] = array('id' => $atc->id, 'airport_id' => $atc->airport_id, 'sector_id' => $atc->sector_id, 'duration' => $atc->duration, 'facility_id' => $atc->facility_id); unset($atc); } unset($atcs); Log::info('queue:legacy[' . $job->getJobId() . '] - processed atc'); DB::statement("create temporary table if not exists atc_temp (\n\t\t\t`id` int(10) unsigned NOT NULL,\n\t\t\t`facility_id` smallint(6) unsigned NOT NULL,\n\t\t\t`airport_id` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t`sector_id` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t`duration` smallint(6) NOT NULL DEFAULT '0',\n\t\t\tPRIMARY KEY (`id`)\n\t\t)"); Log::info('queue:legacy[' . $job->getJobId() . '] - created temp table atc'); $remaining = count($newAtc); $step = 0; do { Log::info('queue:legacy[' . $job->getJobId() . '] - inserted atc - ' . $remaining); DB::table('atc_temp')->insert(array_slice($newAtc, 100 * $step, 100)); $remaining -= 100; $step++; } while ($remaining > 0); Log::info('queue:legacy[' . $job->getJobId() . '] - inserted atc - done'); DB::statement("update atc dest, atc_temp src set\n\t\t\tdest.duration = src.duration,\n\t\t\tdest.facility_id = src.facility_id,\n\t\t\tdest.airport_id = src.airport_id,\n\t\t\tdest.sector_id = src.sector_id,\n\t\t\tdest.processed = 1\n\t\twhere dest.id = src.id\n\t\t"); Log::info('queue:legacy[' . $job->getJobId() . '] - updated atc'); $pilot->processing = 1; $pilot->distance = $totalDistance; $pilot->duration = $totalDuration; $pilot->counter = $totalFlights; $pilot->counter_atc = $totalAtc; $pilot->duration_atc = $totalDurationAtc; $pilot->save(); $job->delete(); }
<?php require_once '../includes/Airport.php'; $airportID = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_NUMBER_INT); $airport = new Airport($airportID); ?> <!DOCTYPE html> <html> <?php include_once 'head.php'; ?> <body> <div id="reviews" class="container"> <?php include_once 'header.php'; ?> <!-- page content --> <div class="content-wrap"> <div class="content-left"> <?php include_once 'nav-airport.php'; ?> </div> <div class="content-right"> <?php if (!$airport->exists()) { Common::error("Error: Airport could not be found!");
if (isset($_POST['go'])) { $message = " <div style=background-image:url(images/ticket.jpg); width:959px;height:500px;><strong>Print ticket<strong>\n\t <img input type=image src=images/print.png height=40px width=40px onClick=window.print()/>\n\t<form id=CheckOutForm action=survey.php method=post >\n\t<div style=margin-left:400px;>\n\t<tr><br/><br/><br/><br/>\n\t<strong><td>First Name</td></strong>\n\t<?\techo {$_POST['First_N']}\t?>\n\t</br>\n\t\n\t<strong><td>Last Name</td></strong>\n\t<?\techo {$_POST['Last_N']}\t?>\n\t</br>\n\t\n\t<strong><td>Email</td></strong>\n\t<?\techo {$_POST['email']}\t?>\n\t</br>\n\t\n\t<strong><td>Your Flight ID: </td></strong>\n\t<?\techo {$this_id}\t?>\n\t</br>\n\t\n\t<!-- ONLY DOES FOR 1 SEAT SELECTED -->\n\t<strong><td>Your Seat(s) ID: </td></strong>\n\t<?\techo {$_SESSION['seat_id']};\t?>\n\t</br>\n\t\n\t<strong><td>From: </td></strong>\n\t<? echo {$a}\t?>\n\t</br>\n\t\n\t<strong><td>TO: </td></strong>\n\t<? echo {$b}\t?>\n\t</br>\n\t\n\t<strong><td>Departure Time: </td></strong>\n\t<? echo {$d_date}\t?>\n\t</br>\n\t\n\t<strong><td>Arrival Time: </td></strong>\n\t<? echo {$a_date}\t?>\n\t</br>\n\t\n\t<button><input type=submit id =Sumbit class=button1 value=Take quick survey><button>\n\t\n\t</div>"; $email = new email($_POST['email'], $message, "Password Recovery (GA)"); $email->send_email(); } $users = new users(); $num = trim($_SESSION['leave_ids']); $id_array = explode("_", $num); $this_id = $id_array[0]; $seat = $_SESSION['seat_id']; $flight = $users->get_specific_flight($this_id); $d_time = $flight[0]['e_depart_time']; $a_time = $flight[0]['e_arrival_time']; //echo $this_id; $a = Airport::get_name_by_id($flight[0]['org_id'], $users); $b = Airport::get_name_by_id($flight[0]['dest_id'], $users); $d_date = date('M j, Y - g:ia', $d_time); $a_date = date('M j, Y - g:ia', $a_time); //$d_date = $_SESSION['d_time']; //$a_date = $_SESSION['a_time']; $record = array(); //$record['seat_id'] = $seat; if (isset($_SESSION['leave_ids'])) { if (isset($_SESSION['loggedIn'])) { $record['cid'] = $_SESSION['cid']; } else { $record['cid'] = 1; } $price = $users->get_price($flight[0]['flight_id']); $record['price'] = $price[0]['coach_class_cost']; $record['flight_id'] = $flight[0]['flight_id'];
public function executeAutoAddMissionsOnCamp(sfWebRequest $request) { // see if there is airport exist with this name $airport_name = $request->getParameter('airportname'); $airport = AirportPeer::getBySpecificAirportName($airport_name); // If there is no airport then insert it into airport table if (!$airport) { // @TODO Set default airport fields values $airport = new Airport(); $airport->setName($airport_name); $airport->save(); } $pass_id = $request->getParameter('passenger'); $camp_id = $request->getParameter('camp_id'); $camp_passenger = new CampPassenger(); $camp_passenger->setCampId($camp_id); $camp_passenger->setPassengerId($pass_id); if (CampPassengerPeer::doCount($camp_passenger->buildCriteria())) { $passenger = PassengerPeer::retrieveByPK($pass_id); $this->getUser()->setFlash('warning', 'Passenger "' . $passenger->getPerson()->getName() . '" has already been added!'); return $this->redirect('camp/view?id=' . $request->getParameter('camp_id')); } $camp = CampPeer::retrieveByPK($camp_id); $this->forward404Unless($camp); $note = $request->getParameter('note'); //$camp_passenger->setAirportId($camp->getAirportId ()); // Camp Location Id $camp_passenger->setNote($note); //if ($camp_passenger->save()){ //return $this->renderText($airport->getId()); //} $mission_type = MissionTypePeer::getByName('normal'); if (!$mission_type instanceof MissionType) { $mission_type = MissionTypePeer::doSelectOne(new Criteria()); $this->forward404Unless($mission_type); } $airport = AirportPeer::getBySpecificAirportName($airport_name); $camp_location = $camp->getAirport(); $itinerary = new Itinerary(); $itinerary->setCampId($camp->getId()); $itinerary->setPassengerId($pass_id); $itinerary->setDateRequested(time()); $itinerary->setApointTime('unspecified'); $itinerary->setMissionTypeId($mission_type->getId()); $itinerary->setAgencyId($camp->getAgencyId()); $itinerary->setCancelItinerary(1); $itinerary->save(); // Mission 1 $mission1 = new Mission(); $mission1->setItineraryId($itinerary->getId()); $mission1->setCampId($camp->getId()); $mission1->setCancelMission(1); $mission1->setPassengerId($pass_id); $mission1->setMissionCount(1); $mission1->setDateRequested(time()); $mission1->setExternalId($this->getLatestExternalId()); $mission1->setMissionTypeId($mission_type->getId()); $mission1->save(); $camp_passenger->setReturnAirportId(NULL); // this indicates that return airport id would be camp airport id $camp_passenger->setAirportId($airport->getId()); $camp_passenger->setMissionId($mission1->getId()); $camp_passenger->save(); $mission1_leg1 = new MissionLeg(); $mission1_leg1->setFromAirportId($airport->getId()); $mission1_leg1->setLegNumber(1); $mission1_leg1->setMissionId($mission1->getId()); if ($camp_location) { $mission1_leg1->setToAirportId($camp_location->getId()); } else { $mission1_leg1->setToAirportId(NULL); } $mission1_leg1->setCancelMissionLeg(1); $mission1_leg1->save(); // Mission 2 $mission2 = new Mission(); $mission2->setItineraryId($itinerary->getId()); $mission2->setCampId($camp->getId()); $mission2->setCancelMission(1); $mission2->setPassengerId($pass_id); $mission2->setMissionCount(2); // From treatment to hme $mission2->setDateRequested(time()); $mission2->setExternalId($this->getLatestExternalId()); $mission2->setMissionTypeId($mission_type->getId()); $mission2->save(); $camp_passenger2 = new CampPassenger(); $camp_passenger2->setCampId($camp_id); $camp_passenger2->setPassengerId($pass_id); $camp_passenger2->setMissionId($mission2->getId()); $camp_passenger2->setAirportId(NULL); // this indicates that return airport id would be camp airport id $camp_passenger2->setReturnAirportId($airport->getId()); $camp_passenger2->setNote($note); $camp_passenger2->save(); $mission2_leg2 = new MissionLeg(); if ($camp_location) { $mission2_leg2->setFromAirportId($camp_location->getId()); } else { $mission2_leg2->setFromAirportId(NULL); } $mission2_leg2->setLegNumber(1); $mission2_leg2->setMissionId($mission2->getId()); $mission2_leg2->setToAirportId($airport->getId()); $mission2_leg2->setCancelMissionLeg(1); $mission2_leg2->save(); return $this->redirect('camp/view?id=' . $camp->getId()); }
<!-- airport.php airport landing page Erich --> <?php require_once '../includes/Airport.php'; $airportID = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_NUMBER_INT); $airport = new Airport($airportID); ?> <!DOCTYPE html> <html> <?php include_once 'head.php'; ?> <body> <div id="airport" class="container"> <?php include_once 'header.php'; ?> <!-- page content --> <div class="content-wrap"> <div class="content-left"> <?php include_once 'nav-airport.php'; ?> </div>
public function ReadHeader($extBruType, $extFilePath) { $bruType = $extBruType; $file = $extFilePath; $Bru = new Bru(); $bruInfo = $Bru->GetBruInfo($bruType); $frameLength = $bruInfo['frameLength']; $stepLength = $bruInfo['stepLength']; $wordLength = $bruInfo['wordLength']; $headerLength = $bruInfo['headerLength']; $headerScr = $bruInfo['headerScr']; $frameSyncroCode = $bruInfo['frameSyncroCode']; unset($Bru); $flightInfo['bruType'] = $bruType; if ($headerScr != '' || $headerScr != null) { eval($headerScr); unset($Fl); if (isset($flightInfo['startCopyTime'])) { $startCopyTime = $flightInfo['startCopyTime']; $flightInfo['startCopyTime'] = date('H:i:s Y-m-d', $startCopyTime); $flightInfo['copyCreationTime'] = date('H:i:s', $startCopyTime); $flightInfo['copyCreationDate'] = date('Y-m-d', $startCopyTime); } $airport = new Airport(); if (isset($flightInfo['takeOffLat']) && isset($flightInfo['takeOffLong'])) { $lat = $flightInfo['takeOffLat']; $long = $flightInfo['takeOffLong']; $landingAirport = $airport->getAirportByLatAndLong($lat, $long); if (!empty($landingAirport)) { $flightInfo['departureAirport'] = $landingAirport['ICAO']; $flightInfo['departureAirportName'] = $landingAirport['name']; } } if (isset($flightInfo['landingLat']) && isset($flightInfo['landingLong'])) { $lat = $flightInfo['landingLat']; $long = $flightInfo['landingLong']; $landingAirport = $airport->getAirportByLatAndLong($lat, $long); if (!empty($landingAirport)) { $flightInfo['arrivalAirport'] = $landingAirport['ICAO']; $flightInfo['arrivalAirportName'] = $landingAirport['name']; } } unset($airport); } return $flightInfo; }