Virtualei Posted September 2, 2012 Report Posted September 2, 2012 Hi , I have searched the forum but cant seem to find anything on this. I would like to be able to give abonus payment to pilots for their landing rate and if they complete a long haul flight online. Has anyone any idea how I would do this. Would a module have to be created or could I change a bit of coding somewhere. Thanks in advance Quote
MBrown Posted September 2, 2012 Report Posted September 2, 2012 Would it not be as simple as going to the admin center, and editing the pirep that has a good landing rate or was long haul and adjusting the pilot pay on that flight? That would give them more cash Quote
Virtualei Posted September 2, 2012 Author Report Posted September 2, 2012 It could be done that way but it would be better if it was done automatically and would save on the admin. It is also a better incentive if a pilot actually sees the bonus . Thanks for the reply anyhow Quote
Moderators Parkho Posted September 3, 2012 Moderators Report Posted September 3, 2012 It could be done automatically, so you need to specify on which condition the bonus should be paid to the pilot and simply update their profile using some codings . Quote
Virtualei Posted September 3, 2012 Author Report Posted September 3, 2012 Hi Parko, Thanks for the reply. I would like to pay a bonus if a pilots landing rate is below -50fpm . I would also like to give a bonus if a pilot completes a flight over 8 hours. Then maybe add a bonus earned section in the pilot profile section where it can be viewed. Cheers mate Quote
Moderators Parkho Posted September 3, 2012 Moderators Report Posted September 3, 2012 Sounds like a plan. First add a column to your phpvms_pilots in your DB as "bonus" the type must be "float" and set default to "0" then add this to your profile_main.tpl. It's not tested, so give it a try and let me know: <?php $pilot = PilotData::getPilotData(Auth::$userinfo->pilotdid); $pirep = PIREPData::getLastReports($pilot,1); $pilotbonus = "500"; if($pirep->landingrate < 50) { $bonus = $pilotbonus + $pilot->totalpay ; $fields = array ( 'bonus' => $bonus, ); PilotData::updateProfile($pilot, $fields); } ?> <li><strong>Total Bonus: </strong><?php echo FinanceData::FormatMoney($userinfo->bonus) ?></li> Use the same code for the total hours like this: if($pirep->flighttime > 8) { $bonus = $pilotbonus +$pilot->totalpay; $fields = array( 'bonus' =>$bonus, ) PilotData::updateProfile($pilot, $fields); } Quote
Moderators Parkho Posted September 3, 2012 Moderators Report Posted September 3, 2012 Ok I got it working. First off forget the last post, so add a column into your phpvms_pilots in your DB as "bonus" the type must be "float" and set default az "0". Then open the following: Admin/modules/PIREPadmin/PIREPAdmin.php go down to line 298 and find the function called : approve_pirep_post(). Now go to the end of it and add the following: After this: # Call the event CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details); Add this: # Give Bonus to good pilots $pilotbonus = "500"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate < 50 OR $pirep_details->flighttime > 8) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } then go to your profile_main.tpl and after this: <li><strong>Total Money: </strong><?php echo FinanceData::FormatMoney($userinfo->totalpay) ?></li> Add this: <li><strong>Total Bonus: </strong><?php echo FinanceData::FormatMoney($userinfo->bonus) ?></li> Then you should be home safe . Cheers 3 Quote
Virtualei Posted September 3, 2012 Author Report Posted September 3, 2012 Parko , That works a treat. Thank you very much once again. I wouldn't have known where to start. I am indebted to you mate. 1 Quote
Moderators Parkho Posted September 3, 2012 Moderators Report Posted September 3, 2012 No worries man. I'm glad I could help. Also, how's the tour system working out for you? I'm actually working on a tour system pretty much from scratch, so just wanted to get some opinions. I really would appreciate it if you liked my last post. Thanks Quote
Virtualei Posted September 3, 2012 Author Report Posted September 3, 2012 The tour system(or as I am using it for events) is fantastic. It is just what i needed. No issues at all Quote
Industrialshadow Posted September 16, 2012 Report Posted September 16, 2012 hi its not solved i become a syntax error Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /www/htdocs/w00dac26/lausitzair/admin/modules/PIREPAdmin/PIREPAdmin.php on line 295 and on the line 295 is $pilotbonus = "500"; i become this failure when i click on my admincenter Quote
Moderators Parkho Posted September 17, 2012 Moderators Report Posted September 17, 2012 hi its not solved i become a syntax error Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /www/htdocs/w00dac26/lausitzair/admin/modules/PIREPAdmin/PIREPAdmin.php on line 295 and on the line 295 is $pilotbonus = "500"; i become this failure when i click on my admincenter Look to see if you inserted the code correctly. Your error is mostly from missing a closing argument like "?>" or <?php . Quote
Melli Posted December 19, 2016 Report Posted December 19, 2016 i got this error if i click admincenter: Parse error: syntax error, unexpected T_PROTECTED in /home/990/217990/public_html/admin/modules/PIREPAdmin/PIREPAdmin.php on line 328 in lin 328: protected function delete_pirep_post() { i hope i correct my PIREPAdmin.php right see here: ....... /** * Approve the PIREP, and then update * the pilot's data */ protected function approve_pirep_post() { $pirepid = $this->post->id; if ($pirepid == '') return; $pirep_details = PIREPData::getReportDetails($pirepid); $this->set('pirep', $pirep_details); # See if it's already been accepted if (intval($pirep_details->accepted) == PIREP_ACCEPTED) return; # Update pilot stats PIREPData::ChangePIREPStatus($pirepid, PIREP_ACCEPTED); // 1 is accepted LogData::addLog(Auth::$userinfo->pilotid, 'Approved PIREP #' . $pirepid); # Call the event CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details); # Give Bonus to good pilots $pilotbonus = "10"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate > -500 OR $pirep_details->flighttime > 3) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } /** * Delete a PIREP */ protected function delete_pirep_post() { $pirepid = $this->post->id; if ($pirepid == '') return; # Call the event CodonEvent::Dispatch('pirep_deleted', 'PIREPAdmin', $pirepid); PIREPData::deleteFlightReport($pirepid); StatsData::UpdateTotalHours(); } ...... Quote
Melli Posted December 20, 2016 Report Posted December 20, 2016 i solved the problem by myself...thx. now its working. thx Quote
Melli Posted December 20, 2016 Report Posted December 20, 2016 now a new question.... how i can add a penalty for badlandings. for good landing a bonus - for bad landing a penalty that would be great Quote
TAV1702 Posted December 20, 2016 Report Posted December 20, 2016 Is this going to take back the bonus on recalculations like it has always done in the past with the pilot pay adjust? Quote
GKT001 Posted December 22, 2019 Report Posted December 22, 2019 Can you add plugin for points system? I couldn't run it this way Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.