Example #1
0
 /**
  * File a PIREP from an ACARS program
  *
  * @param mixed $pilotid The pilot ID of the pilot filing the PIREP
  * @param mixed $data This is the data structure with the PIREP info
  * @return bool true/false
  *
  */
 public static function FilePIREP($pilotid, $data)
 {
     if (!is_array($data)) {
         self::$lasterror = 'PIREP data must be array';
         return false;
     }
     # Call the pre-file event
     #
     if (CodonEvent::Dispatch('pirep_prefile', 'PIREPS', $_POST) == false) {
         return false;
     }
     # File the PIREP report
     #
     $ret = PIREPData::FileReport($data);
     # Set them as non-retired
     PilotData::setPilotRetired($pilotid, 0);
     if (!$ret) {
         return false;
     }
     self::$pirepid = DB::$insert_id;
     # Call the event
     #
     CodonEvent::Dispatch('pirep_filed', 'PIREPS', $_POST);
     # Close out a bid if it exists
     #
     $bidid = SchedulesData::GetBidWithRoute($pilotid, $data['code'], $data['flightnum']);
     if ($bidid) {
         SchedulesData::RemoveBid($bidid->bidid);
     }
     return true;
 }