Moderators Parkho Posted June 14, 2011 Moderators Report Posted June 14, 2011 Hello All I have been trying to find a way to implement pilots restrictions on Arcraft into the great Front Schedules add on made by Simpilot. So far, I managed to change the frontscheduledata.class to show me only the schedules with the proper pilot ranking but it shows me one route per pilot meaning if I have 10 pilots it shows me the same route 10 times in the schedules results. Here is the original code: <?php //simpilotgroup addon module for phpVMS virtual airline system // //simpilotgroup addon modules are licenced under the following license: //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/ // //@author David Clark (simpilot) //@copyright Copyright (c) 2009-2010, David Clark //@license http://creativecommons.org/licenses/by-nc-sa/3.0/ class FrontSchedulesData extends CodonData { public function findschedules($arricao, $depicao, $airline, $aircraft) { $query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft, phpvms_aircraft.registration FROM phpvms_schedules, phpvms_aircraft WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_schedules.aircraft LIKE '$aircraft' AND phpvms_aircraft.id LIKE '$aircraft'"; return DB::get_results($query); } public function findschedule($arricao, $depicao, $airline) { $query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft, phpvms_aircraft.registration FROM phpvms_schedules, phpvms_aircraft WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_aircraft.id LIKE phpvms_schedules.aircraft"; return DB::get_results($query); } public function findaircrafttypes() { $query = "SELECT DISTINCT icao FROM phpvms_aircraft"; return DB::get_results($query); } public function findaircraft($aircraft) { $query = "SELECT id FROM phpvms_aircraft WHERE icao='$aircraft'"; return DB::get_results($query); } public function findcountries() { $query = "SELECT DISTINCT country FROM phpvms_airports"; return DB::get_results($query); } } And here is the part I changed: <?php //simpilotgroup addon module for phpVMS virtual airline system // //simpilotgroup addon modules are licenced under the following license: //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/ // //@author David Clark (simpilot) //@copyright Copyright (c) 2009-2010, David Clark //@license http://creativecommons.org/licenses/by-nc-sa/3.0/ class FrontSchedulesData extends CodonData { public function findschedules($arricao, $depicao, $airline, $aircraft) { $query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft,phpvms_aircraft.registration,phpvms_pilots.ranklevel //added this FROM phpvms_schedules, phpvms_aircraft,phpvms_pilots /added this WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_schedules.aircraft LIKE '$aircraft' AND phpvms_aircraft.ranklevel<=phpvms_pilots.ranklevel //added this line here AND phpvms_aircraft.id LIKE '$aircraft'"; return DB::get_results($query); } public function findschedule($arricao, $depicao, $airline) { $query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft, phpvms_aircraft.registration,phpvms_pilots.ranklevel //added this FROM phpvms_schedules, phpvms_aircraft,phpvms_pilots //added this WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_aircraft.ranklevel<=phpvms_pilots.ranklevel / added this line AND phpvms_aircraft.id LIKE phpvms_schedules.aircraft"; return DB::get_results($query); } public function findaircrafttypes() { $query = "SELECT DISTINCT icao FROM phpvms_aircraft"; return DB::get_results($query); } public function findaircraft($aircraft) { $query = "SELECT id,phpvms_pilots.ranklevel FROM phpvms_aircraft, phpvms_pilots WHERE icao='$aircraft' AND phpvms_aircraft.ranklevel<=phpvms_pilots.ranklevel"; //Added this. return DB::get_results($query); } public function findcountries() { $query = "SELECT DISTINCT country FROM phpvms_airports"; return DB::get_results($query); } } Now here is the results: Can anyone tell me where I'm wrong? Cheers Quote
CedGauche Posted August 25, 2014 Report Posted August 25, 2014 Hey Parkho, I have the same problem, I am also searching for a solution, because our pilots also uses Front Schedules and can bid on the whole flightplan, so their rank don't limit their schedule results. Because this topic is old, do you have solution for this problem today? Quote
freshJet Posted August 25, 2014 Report Posted August 25, 2014 It's easier just to loop through each aircraft and add this: if($aircraft->ranklevel < Auth::$userinfo->ranklevel){ continue; } Quote
CedGauche Posted August 26, 2014 Report Posted August 26, 2014 Ok thx, this is also a good solution. I'll try it.. Quote
Members Vangelis Posted August 26, 2014 Members Report Posted August 26, 2014 the query should be query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft,phpvms_aircraft.registration,Auth::$userinfo->ranklevel //added this FROM phpvms_schedules, phpvms_aircraft,phpvms_pilots /added this WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_schedules.aircraft LIKE '$aircraft' AND phpvms_aircraft.ranklevel<=Auth::$userinfo->ranklevel return DB::get_results($query); Quote
CFVA Posted November 1, 2014 Report Posted November 1, 2014 Hi, Could someone just post the full code for this please. Thanks Gary 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.