本文整理汇总了PHP中PilotData::UpdateFlightData方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::UpdateFlightData方法的具体用法?PHP PilotData::UpdateFlightData怎么用?PHP PilotData::UpdateFlightData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::UpdateFlightData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reject_pirep_post
/**
* Reject the report, and then send them the comment
* that was entered into the report
*/
protected function reject_pirep_post()
{
$pirepid = $this->post->pirepid;
$comment = $this->post->comment;
if ($pirepid == '' || $comment == '') {
return;
}
PIREPData::ChangePIREPStatus($pirepid, PIREP_REJECTED);
// 2 is rejected
$pirep_details = PIREPData::GetReportDetails($pirepid);
// If it was previously accepted, subtract the flight data
if (intval($pirep_details->accepted) == PIREP_ACCEPTED) {
PilotData::UpdateFlightData($pirep_details->pilotid, -1 * floatval($pirep->flighttime), -1);
}
//PilotData::UpdatePilotStats($pirep_details->pilotid);
RanksData::CalculateUpdatePilotRank($pirep_details->pilotid);
PilotData::resetPilotPay($pirep_details->pilotid);
StatsData::UpdateTotalHours();
// Send comment for rejection
if ($comment != '') {
$commenter = Auth::$userinfo->pilotid;
// The person logged in commented
PIREPData::AddComment($pirepid, $commenter, $comment);
// Send them an email
$this->set('firstname', $pirep_details->firstname);
$this->set('lastname', $pirep_details->lastname);
$this->set('pirepid', $pirepid);
$message = Template::GetTemplate('email_commentadded.tpl', true);
Util::SendEmail($pirep_details->email, 'Comment Added', $message);
}
LogData::addLog(Auth::$userinfo->pilotid, 'Rejected PIREP #' . $pirepid);
# Call the event
CodonEvent::Dispatch('pirep_rejected', 'PIREPAdmin', $pirep_details);
}
示例2: deleteFlightReport
public static function deleteFlightReport($pirepid)
{
$pirepid = intval($pirepid);
$pirep_details = self::getReportDetails($pirepid);
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'pireps
WHERE pirepid=' . $pirepid;
DB::query($sql);
# Delete any comments and fields
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'pirepcomments
WHERE pirepid=' . $pirepid;
DB::query($sql);
# Delete any custom field data
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'pirepvalues
WHERE pirepid=' . $pirepid;
DB::query($sql);
# Check if this was accepted report
# If it was, remove it from that pilot's stats
if ($pirep_details->accepted == PIREP_ACCEPTED) {
PilotData::UpdateFlightData($pirep_details->pilotid, $pirep_details->flighttime * -1, -1);
}
self::UpdatePIREPFeed();
}