Txmmy83 Posted April 19, 2013 Report Posted April 19, 2013 to let the schedule_results.tpl only show flights for enabled aircraft and hide all schedules of aircraft disabled in admin? Quote
Moderators Parkho Posted April 19, 2013 Moderators Report Posted April 19, 2013 yes it's possible. You need to get the route's aircraft, put it in a function to see if it's enabled. The results will be 0 for disabled or 1 for enabled then you say if the route's aircraft enabled is equal to 0 (disabled) then continue showing the next route meaning hiding the route from the results. Quote
Txmmy83 Posted April 19, 2013 Author Report Posted April 19, 2013 how does that function need to look? Quote
Txmmy83 Posted April 19, 2013 Author Report Posted April 19, 2013 if($aircraft->enabled == 1) { continue; } something like that for the if Quote
Moderators Parkho Posted April 19, 2013 Moderators Report Posted April 19, 2013 Try this: 1. In your OperationsData.class.php add the following function: public function get_aircraft_by_name($name) { $sql = "SELECT * FROM phpvms_aircraft WHERE name='$name'"; return DB::get_row($sql); } 2. In your schedule_results.tpl after "foreach" loop add the following: $enable = OperationsData::get_aircraft_by_name($route->aircraft); if($enable->enabled == "0") { continue; } I have not tested this so just give it a try and if it has an issue let me know. 1 Quote
Txmmy83 Posted April 19, 2013 Author Report Posted April 19, 2013 it works but I think I must get aircraft by registration since I have many 737-700 all activated except one that is nigeria registrated think I have to go over ID as it is in both which also show up! with that code any idea? Quote
Txmmy83 Posted April 20, 2013 Author Report Posted April 20, 2013 think I must lookup by ID if Aircraft is enabled? as that is Unique to every aircraft the ID's named differently in the tables of schedules and Aircraft Quote
Moderators Parkho Posted April 25, 2013 Moderators Report Posted April 25, 2013 The code is looking for all aircraft that has the same name and checks if they're enabled or disabled, so I think it should work just fine with aircraft name. Check if Nigeria aircraft has the same name as "B737-700" if not change it so that it works. 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.