コード例 #1
0
 public function savepro()
 {
     if ($this->post->firstname == '' || $this->post->lastname == '') {
         $this->set('message', 'The first or lastname cannot be blank!');
         $this->render('core_error.tpl');
         return;
     }
     $params = array('firstname' => $this->post->firstname, 'lastname' => $this->post->lastname, 'email' => $this->post->email, 'hub' => $this->post->hub, 'retired' => $this->post->retired, 'totalflights' => $this->post->totalflights, 'totalpay' => floatval($this->post->totalpay), 'transferhours' => $this->post->transferhours);
     PilotData::updateProfile($this->post->pilotid, $params);
     PilotData::SaveFields($this->post->pilotid, $_POST);
     /* Don't calculate a pilot's rank if this is set */
     if (Config::Get('RANKS_AUTOCALCULATE') == false) {
         PilotData::changePilotRank($this->post->pilotid, $this->post->rank);
     } else {
         RanksData::calculateUpdatePilotRank($this->post->pilotid);
     }
     StatsData::UpdateTotalHours();
     $this->set('message', 'Profile updated successfully');
     $this->render('core_success.tpl');
     $this->set('pilots', PilotData::getAllPilots());
     $this->render('/pm/pilot_manager.php');
     if ($this->post->resend_email == 'true') {
         $this->post->id = $this->post->pilotid;
         $this->resendemail(false);
     }
     $pilot = PilotData::getPilotData($this->post->pilotid);
     LogData::addLog(Auth::$userinfo->pilotid, 'Updated profile for ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname);
     return;
     break;
 }
コード例 #2
0
ファイル: VACentral.php プロジェクト: deanstalker/phpVMS
 public function sendpireps()
 {
     echo '<h3>Sending all PIREPS</h3>';
     $within_timelimit = CronData::check_hoursdiff('update_pireps', CentralData::$limits['update_pireps']);
     if ($within_timelimit == true) {
         echo '<p>You can only export PIREPs every ' . CentralData::$limits['update_pireps'] . ' hours</p>';
         return false;
     }
     $ret = CentralData::send_all_pireps();
     $this->parse_response($ret);
     LogData::addLog(Auth::$userinfo->pilotid, 'vaCentral - PIREPS sent');
 }
コード例 #3
0
ファイル: MassMailer.php プロジェクト: phpmods/phpvms_5.5.x
 public function sendmail()
 {
     $this->checkPermission(EMAIL_PILOTS);
     echo '<h3>Sending email</h3>';
     if ($this->post->subject == '' || trim($this->post->message) == '') {
         $this->set('message', 'You must enter a subject and message!');
         $this->render('core_error.php');
         return;
     }
     if (count($this->post->groups) == 0) {
         $this->set('message', 'You must select groups to send to!');
         $this->render('core_error.php');
         return;
     }
     echo 'Sending email...<br />';
     $pilotarray = array();
     //Begin the nice long assembly of e-mail addresses
     foreach ($this->post->groups as $groupid) {
         if ($groupid == 'all') {
             $all_pilots = PilotData::findPilots(array());
             foreach ($all_pilots as $pilot) {
                 $pilotarray[$pilot->pilotid] = $pilot;
             }
             break;
         } else {
             $tmp = PilotGroups::getUsersInGroup($groupid);
             if (count($tmp) == 0 || !is_array($tmp)) {
                 continue;
             }
             foreach ($tmp as $pilot) {
                 $pilotarray[$pilot->pilotid] = $pilot;
             }
         }
     }
     $subject = DB::escape($this->post->subject);
     $message = stripslashes($this->post->message) . PHP_EOL . PHP_EOL;
     # Do some quick fixing of obvious formatting errors
     $message = str_replace('<br>', '<br />', $message);
     foreach ($pilotarray as $pilot) {
         echo 'Sending for ' . $pilot->firstname . ' ' . $pilot->lastname . '<br />';
         # Variable replacements
         $send_message = str_replace('{PILOT_FNAME}', $pilot->firstname, $message);
         $send_message = str_replace('{PILOT_LNAME}', $pilot->lastname, $send_message);
         $send_message = str_replace('{PILOT_ID}', PilotData::GetPilotCode($pilot->code, $pilot->pilotid), $send_message);
         $send_message = utf8_encode($send_message);
         Util::SendEmail($pilot->email, $subject, $send_message);
     }
     echo 'Complete!';
     LogData::addLog(Auth::$userinfo->pilotid, 'Sent pass mail');
     return;
 }
コード例 #4
0
ファイル: Settings.php プロジェクト: Galihom/phpVMS
 protected function PIREP_DeleteField()
 {
     $id = DB::escape($this->post->id);
     $ret = PIREPData::DeleteField($id);
     if (DB::errno() != 0) {
         $this->set('message', 'There was an error deleting the field: ' . DB::$err);
         $this->render('core_error.tpl');
     } else {
         LogData::addLog(Auth::$userinfo->pilotid, 'Deleted PIREP field');
         $this->set('message', 'The field was deleted');
         $this->render('core_success.tpl');
     }
 }
コード例 #5
0
ファイル: PIREPAdmin.php プロジェクト: ryanunderwood/phpVMS
 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;
 }
コード例 #6
0
ファイル: Finance.php プロジェクト: deanstalker/phpVMS
 public function processExpense()
 {
     if ($this->post->name == '' || $this->post->cost == '') {
         $this->set('message', 'Name and cost must be entered');
         $this->render('core_error.tpl');
         return;
     }
     if (!is_numeric($this->post->cost)) {
         $this->set('message', 'Cost must be a numeric amount, no symbols');
         $this->render('core_error.tpl');
         return;
     }
     if ($this->post->action == 'addexpense') {
         # Make sure it doesn't exist
         if (FinanceData::GetExpenseByName($this->post->name)) {
             $this->set('message', 'Expense already exists!');
             $this->render('core_error.tpl');
             return;
         }
         $ret = FinanceData::AddExpense($this->post->name, $this->post->cost, $this->post->type);
         $this->set('message', 'The expense "' . $this->post->name . '" has been added');
         FinanceData::setExpensesforMonth(time());
         LogData::addLog(Auth::$userinfo->pilotid, 'Added expense "' . $this->post->name . '"');
     } elseif ($this->post->action == 'editexpense') {
         $ret = FinanceData::EditExpense($this->post->id, $this->post->name, $this->post->cost, $this->post->type);
         $this->set('message', 'The expense "' . $this->post->name . '" has been edited');
         FinanceData::setExpensesforMonth(time());
         LogData::addLog(Auth::$userinfo->pilotid, 'Edited expense "' . $this->post->name . '"');
     }
     if (!$ret) {
         $this->set('message', 'Error: ' . DB::error());
         $this->render('core_error.tpl');
         return;
     }
     $this->render('core_success.tpl');
 }
コード例 #7
0
ファイル: Operations.php プロジェクト: ryanunderwood/phpVMS
 protected function delete_schedule_post()
 {
     $schedule = SchedulesData::findSchedules(array('s.id' => $this->post->id));
     SchedulesData::DeleteSchedule($this->post->id);
     $params = array();
     if (DB::errno() != 0) {
         $params['status'] = 'There was an error deleting the schedule';
         $params['error'] = DB::error();
         echo json_encode($params);
         return;
     }
     $params['status'] = 'ok';
     echo json_encode($params);
     LogData::addLog(Auth::$userinfo->pilotid, 'Deleted schedule "' . $schedule->code . $schedule->flightnum . '"');
 }
コード例 #8
0
ファイル: PilotRanking.php プロジェクト: Galihom/phpVMS
 protected function edit_award_post()
 {
     if ($this->post->name == '' || $this->post->image == '') {
         $this->set('message', 'The name and image must be entered');
         $this->render('core_error.tpl');
         return;
     }
     $ret = AwardsData::EditAward($this->post->awardid, $this->post->name, $this->post->descrip, $this->post->image);
     $this->set('message', 'Award Added!');
     $this->render('core_success.tpl');
     LogData::addLog(Auth::$userinfo->pilotid, 'Edited the award "' . $this->post->name . '"');
 }
コード例 #9
0
ファイル: Maintenance.php プロジェクト: phpmods/phpvms_5.5.x
    /**
     * Maintenance::resetpireproute()
     * 
     * @return
     */
    public function resetpireproute()
    {
        CodonModule::checkPermission(MAINTENANCE);
        echo '<h3>Reset cached PIREP routes</h3> 
				Resetting... <br />';
        PIREPData::deleteAllRouteDetails();
        echo 'Completed!';
        LogData::addLog(Auth::$userinfo->pilotid, 'Reset cached pirep route details');
    }
コード例 #10
0
ファイル: Maintenance.php プロジェクト: ryanunderwood/phpVMS
    public function resetpireproute()
    {
        echo '<h3>Reset cached PIREP routes</h3> 
				Resetting... <br />';
        PIREPData::deleteAllRouteDetails();
        echo 'Completed!';
        LogData::addLog(Auth::$userinfo->pilotid, 'Reset cached pirep route details');
    }
コード例 #11
0
ファイル: SiteCMS.php プロジェクト: phpmods/phpvms_5.5.x
 protected function DeleteNewsItem()
 {
     $this->checkPermission(EDIT_NEWS);
     if (!SiteData::DeleteItem($this->post->id)) {
         $this->set('message', Lang::gs('news.delete.error'));
         $this->render('core_error.php');
         return;
     }
     $this->set('message', Lang::gs('news.item.deleted'));
     $this->render('core_success.php');
     LogData::addLog(Auth::$userinfo->pilotid, 'Deleted news ' . $this->post->id);
 }
コード例 #12
0
ファイル: PilotAdmin.php プロジェクト: rallin/phpVMS
 protected function AddAward()
 {
     if ($this->post->awardid == '' || $this->post->pilotid == '') {
         return;
     }
     # Check if they already have this award
     $award = AwardsData::GetPilotAward($this->post->pilotid, $this->post->awardid);
     if ($award) {
         $this->set('message', Lang::gs('award.exists'));
         $this->render('core_error.tpl');
         return;
     }
     AwardsData::AddAwardToPilot($this->post->pilotid, $this->post->awardid);
     $pilot = PilotData::getPilotData($this->post->pilotid);
     LogData::addLog(Auth::$userinfo->pilotid, 'Added and award to ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname);
 }