本文整理汇总了PHP中PilotData::setPilotRetired方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::setPilotRetired方法的具体用法?PHP PilotData::setPilotRetired怎么用?PHP PilotData::setPilotRetired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::setPilotRetired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FilePIREP
/**
* 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;
}
示例2: SubmitPIREP
protected function SubmitPIREP()
{
$pilotid = Auth::$userinfo->pilotid;
if ($pilotid == '' || Auth::LoggedIn() == false) {
$this->set('message', 'You must be logged in to access this feature!!');
//$this->render('core_error.tpl');
return false;
}
if ($this->post->code == '' || $this->post->flightnum == '' || $this->post->depicao == '' || $this->post->arricao == '' || $this->post->aircraft == '' || $this->post->flighttime == '') {
$this->set('message', 'You must fill out all of the required fields!');
return false;
}
# Only allow for valid routes to be filed
$sched_data = SchedulesData::GetScheduleByFlight($this->post->code, $this->post->flightnum);
if (!$sched_data) {
$this->set('message', 'The flight code and number you entered is not a valid route!');
return false;
}
# See if they entered more than 59 in the minutes part of the flight time
$this->post->flighttime = str_replace(':', '.', $this->post->flighttime);
$parts = explode('.', $this->post->flighttime);
if ($parts[1] > 59) {
$this->set('message', 'You entered more than 60 minutes in the minutes');
return false;
}
/* Check the schedule and see if it's been bidded on */
if (Config::Get('DISABLE_SCHED_ON_BID') == true) {
$biddata = SchedulesData::GetBid($sched_data->bidid);
if ($biddata) {
if ($biddata->pilotid != $pilotid) {
$this->set('message', 'You are not the bidding pilot');
//$this->render('core_error.tpl');
return false;
}
}
}
/* Removed this check since maybe it's a training flight or something, who knows
if($this->post->depicao == $this->post->arricao)
{
$this->set('message', 'The departure airport is the same as the arrival airport!');
$this->render('core_error.tpl');
return false;
}*/
$this->post->flighttime = str_replace(':', '.', $this->post->flighttime);
if (!is_numeric($this->post->flighttime)) {
$this->set('message', 'The flight time has to be a number!');
return false;
}
# form the fields to submit
$this->pirepdata = array('pilotid' => $pilotid, 'code' => $this->post->code, 'flightnum' => $this->post->flightnum, 'depicao' => $this->post->depicao, 'arricao' => $this->post->arricao, 'aircraft' => $this->post->aircraft, 'flighttime' => $this->post->flighttime, 'route' => $this->post->route, 'submitdate' => 'NOW()', 'fuelused' => $this->post->fuelused, 'source' => 'manual', 'comment' => $this->post->comment);
CodonEvent::Dispatch('pirep_prefile', 'PIREPS');
if (CodonEvent::hasStop('pirepfile')) {
return false;
}
if (!PIREPData::FileReport($this->pirepdata)) {
$this->set('message', 'There was an error adding your PIREP : ' . PIREPData::$lasterror);
return false;
}
$pirepid = DB::$insert_id;
PIREPData::SaveFields($pirepid, $_POST);
# Remove the bid
$bidid = SchedulesData::GetBidWithRoute($pilotid, $this->post->code, $this->post->flightnum);
if ($bidid) {
SchedulesData::RemoveBid($bidid->bidid);
}
# Call the event
CodonEvent::Dispatch('pirep_filed', 'PIREPS');
# Set them as non-retired
PilotData::setPilotRetired($pilotid, 0);
# Delete the bid, if the value for it is set
if ($this->post->bid != '') {
SchedulesData::RemoveBid($this->post->bid);
}
return true;
}