当前位置: 首页>>代码示例>>PHP>>正文


PHP PilotData::updatePilotStats方法代码示例

本文整理汇总了PHP中PilotData::updatePilotStats方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::updatePilotStats方法的具体用法?PHP PilotData::updatePilotStats怎么用?PHP PilotData::updatePilotStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PilotData的用法示例。


在下文中一共展示了PilotData::updatePilotStats方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
  * 
  * @param int $pirepid The PIREP ID of status to change
  * @param int $status Use consts: PIREP_PENDING, PIREP_ACCEPTED, PIREP_REJECTED,PIREP_INPROGRESS
  * @return bool
  */
 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) {
             self::calculatePIREPPayment($pirepid);
             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) {
             LedgerData::deletePaymentByPIREP($pirep_details->pirepid);
             PilotData::resetPilotPay($pirep_details->pilotpay);
             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;
 }
开发者ID:Galihom,项目名称:phpVMS,代码行数:43,代码来源:PIREPData.class.php

示例2: edit_pirep_post

 protected function edit_pirep_post()
 {
     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!');
         $this->render('core_error.tpl');
         return false;
     }
     $pirepInfo = PIREPData::getReportDetails($this->post_action->pirepid);
     if (!$pirepInfo) {
         $this->set('message', 'Invalid PIREP!');
         $this->render('core_error.tpl');
         return false;
     }
     $this->post->fuelused = str_replace(' ', '', $this->post->fuelused);
     $this->post->fuelused = str_replace(',', '', $this->post->fuelused);
     $fuelcost = $this->post->fuelused * $this->post->fuelunitcost;
     # form the fields to submit
     $data = array('pirepid' => $this->post->pirepid, 'code' => $this->post->code, 'flightnum' => $this->post->flightnum, 'leg' => $this->post->leg, 'depicao' => $this->post->depicao, 'arricao' => $this->post->arricao, 'aircraft' => $this->post->aircraft, 'flighttime' => $this->post->flighttime, 'load' => $this->post->load, 'price' => $this->post->price, 'pilotpay' => $this->post->pilotpay, 'fuelused' => $this->post->fuelused, 'fuelunitcost' => $this->post->fuelunitcost, 'fuelprice' => $fuelcost, 'expenses' => $this->post->expenses);
     if (!PIREPData::UpdateFlightReport($this->post->pirepid, $data)) {
         $this->set('message', 'There was an error editing your PIREP');
         $this->render('core_error.tpl');
         return false;
     }
     PIREPData::SaveFields($this->post->pirepid, $_POST);
     //Accept or reject?
     $this->post->id = $this->post->pirepid;
     $submit = strtolower($this->post->submit_pirep);
     // Add a comment
     if (trim($this->post->comment) != '' && $submit != 'reject pirep') {
         PIREPData::AddComment($this->post->pirepid, Auth::$userinfo->pilotid, $this->post->comment);
     }
     if ($submit == 'accept pirep') {
         $this->approve_pirep_post();
     } elseif ($submit == 'reject pirep') {
         $this->reject_pirep_post();
     }
     StatsData::UpdateTotalHours();
     # Update a pilot's stats
     PilotData::updatePilotStats($pirepInfo->pilotid);
     LogData::addLog(Auth::$userinfo->pilotid, 'Edited PIREP #' . $this->post->id);
     return true;
 }
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:42,代码来源:PIREPAdmin.php

示例3: 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;
 }
开发者ID:rallin,项目名称:phpVMS,代码行数:53,代码来源:PIREPData.class.php


注:本文中的PilotData::updatePilotStats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。