本文整理匯總了PHP中PilotData::updatePilotPay方法的典型用法代碼示例。如果您正苦於以下問題:PHP PilotData::updatePilotPay方法的具體用法?PHP PilotData::updatePilotPay怎麽用?PHP PilotData::updatePilotPay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PilotData
的用法示例。
在下文中一共展示了PilotData::updatePilotPay方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: changePIREPStatus
/**
* Change the status of a PIREP. For the status, use the constants:
* PIREP_PENDING, PIREP_ACCEPTED, PIREP_REJECTED,PIREP_INPROGRESS
*
* Also handle paying the pilot, and handle PIREP rejection, etc
*
* @deprecated Use editPIREPFields instead
*/
public static function changePIREPStatus($pirepid, $status)
{
# Look up the status of the PIREP of previous
$pirep_details = PIREPData::getReportDetails($pirepid);
if (!$pirep_details) {
return false;
}
if ($pirep_details->accepted == $status) {
return true;
}
$ret = self::editPIREPFields($pirepid, array('accepted' => $status));
# Do something if the PIREP was previously marked as pending
if ($pirep_details->accepted == PIREP_PENDING) {
if ($status == PIREP_ACCEPTED) {
# Pay per-schedule
if (!empty($pirep_details->payforflight)) {
$sql = 'UPDATE ' . TABLE_PREFIX . "pilots \n \t\t\t\tSET totalpay=totalpay+{$pirep_details->payforflight} \n \t\t\t\tWHERE pilotid={$pirep_details->pilotid}";
DB::query($sql);
} else {
# Pay by hour
PilotData::updatePilotPay($pirep_details->pilotid, $pirep_details->flighttime, true);
}
SchedulesData::changeFlownCount($pirep_details->code, $pirep_details->flightnum, '+1');
} elseif ($status == PIREP_REJECTED) {
// Do nothing, since nothing in the PIREP was actually counted
}
} elseif ($pirep_details->accepted == PIREP_ACCEPTED) {
# If already accepted
if ($status == PIREP_REJECTED) {
# Subtract their pay for the rejected flight
if (!empty($pirep_details->payforflight)) {
$sql = 'UPDATE ' . TABLE_PREFIX . "pilots \n \t\t\t\tSET totalpay=totalpay-{$pirep_details->payforflight} \n \t\t\t\tWHERE pilotid={$pirep_details->pilotid}";
DB::query($sql);
} else {
PilotData::updatePilotPay($pirep_details->pilotid, $pirep_details->flighttime, false);
}
SchedulesData::changeFlownCount($pirep_details->code, $pirep_details->flightnum, '-1');
}
}
PilotData::updatePilotStats($pirep_details->pilotid);
RanksData::calculateUpdatePilotRank($pirep_details->pilotid);
PilotData::generateSignature($pirep_details->pilotid);
StatsData::updateTotalHours();
return $ret;
}