James142 Posted March 20, 2011 Report Posted March 20, 2011 Can I Have A Clean Code Of The Pilot Roster With No Hubs Thanks Dimtiri This is what I have: core>modules>Pilots>pilots.php <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Pilots extends CodonModule { public function index() { $this->set('allpilots', PilotData::getAllPilots()); $this->render('pilots_list.tpl'); } public function reports($pilotid='') { if($pilotid == '') { $this->set('message', 'No pilot specified!'); $this->render('core_error.tpl'); return; } $this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid)); $this->render('pireps_viewall.tpl'); } /* Stats stuff for charts */ public function statsdaysdata($pilotid) { $data = PIREPData::getIntervalDataByDays(array('p.pilotid'=>$pilotid), 30); $this->create_line_graph('Past 30 days PIREPs', $data); } public function statsmonthsdata($pilotid) { $data = PIREPData::getIntervalDataByMonth(array('p.pilotid'=>$pilotid), 3); $this->create_line_graph('Monthly Flight Stats', $data); } public function statsaircraftdata($pilotid) { $data = StatsData::PilotAircraftFlownCounts($pilotid); if(!$data) $data = array(); include CORE_LIB_PATH.'/php-ofc-library/open-flash-chart.php'; $d = array(); foreach($data as $ac) { OFCharts::add_data_set($ac->aircraft, floatval($ac->hours)); } echo OFCharts::create_pie_graph('Aircraft Flown'); } protected function create_line_graph($title, $data) { if(!$data) { $data = array(); } $bar_values = array(); $bar_titles = array(); foreach($data as $val) { $bar_titles[] = $val->ym; $bar_values[] = floatval($val->total); } OFCharts::add_data_set($bar_titles, $bar_values); echo OFCharts::create_area_graph($title); } public function RecentFrontPage($count = 5) { $this->set('pilots', PilotData::GetLatestPilots($count)); $this->render('frontpage_recentpilots.tpl'); } } That will get rid of the hubs. 5 Quote
TAV1702 Posted March 21, 2011 Report Posted March 21, 2011 That actually worked out real nice. Thanks for the share. +1 Hey West Jet, can you give him a +1 for sharing please? 1 Quote
James142 Posted March 21, 2011 Report Posted March 21, 2011 That actually worked out real nice. Thanks for the share. +1 Hey West Jet, can you give him a +1 for sharing please? thanks 1 Quote
TAV1702 Posted March 21, 2011 Report Posted March 21, 2011 thanks Not a problem. Thank you. I was meaing to do that for a while but never did until I saw this post. 1 Quote
Mark J Posted June 20, 2011 Report Posted June 20, 2011 well.. it worked for me on another site but now im getting the error: Notice: The template file "/home/ualvirtu/public_html//core/templates/Pilots_list.tpl" doesn't exist in /home/ualvirtu/public_html/core/classes/TemplateSet.class.php on line 248 Quote
James142 Posted June 20, 2011 Report Posted June 20, 2011 well.. it worked for me on another site but now im getting the error: Do you have the file Pilots_list.tpl in your core/templates file? That error code is telling you that it can't find the Pilots_list.tpl file.. Quote
Strider Posted June 20, 2011 Report Posted June 20, 2011 Download phpvms again, go to the core>templates folder, find the pilots_list.tpl file and upload it again, and that should fix that problem. If not run the checkinstall.php maybe something is corrupted. Quote
bunoire14 Posted October 2, 2011 Report Posted October 2, 2011 Hi Guys, Just a quick addition to this thread, I was looking for something Similar, however as I am running a Military Sqn System using multiple Airlines, I wanted to List the Rosters for each Airline in Turn. Heres what I changed in the Pilot.php index method to allow it. // Get all of our Airlines/Squadrons, and list pilots by Airline or Sqn $allairlines = OperationsData::GetAllAirlines(); if(!$allairlines) $allairlines = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.code'=>$airline->code))); $this->render('pilots_list.tpl'); } $noairline = PilotData::findPilots(array('p.code'=>'')); if(!$noairline) { return; } $this->set('title', 'Un-Assigned Pilots'); $this->set('code', ''); $this->set('allpilots', $noairline); $this->render('pilots_list.tpl'); Not sure if its good practice to modify the core classes really, I assume they would be overwritten on update? But its a quick fix for this. Hopefully this is useful for those looking for a similar way of displaying rosters, Apologies if this has been posted previously. All the best, 1 Quote
Moderators Kyle Posted October 2, 2011 Moderators Report Posted October 2, 2011 Nice Add! I agree it's a good idea to have those if you are running a military operations! Quote
StartVM Posted June 17, 2014 Report Posted June 17, 2014 I apologize for opening this old topic, but as I found it a very useful topic, I thought I would debug it. Fixed 2 errors, one with the pilots_list.tpl being Pilots_list.tpl thus rendering and error, and another with it screwing with the recent pilot function. http://pastebin.com/yFejJA7e Quote
poole3003 Posted September 16, 2014 Report Posted September 16, 2014 if i want to make it where i have all my pilots show up like in there airline and not by hub where would i insert the code and how would the code be something simular to bunoire14 Quote
livr517 Posted August 10, 2017 Report Posted August 10, 2017 On 3/20/2011 at 7:36 AM, James142 said: This is what I have: core>modules>Pilots>pilots.php <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Pilots extends CodonModule { public function index() { $this->set('allpilots', PilotData::getAllPilots()); $this->render('pilots_list.tpl'); } public function reports($pilotid='') { if($pilotid == '') { $this->set('message', 'No pilot specified!'); $this->render('core_error.tpl'); return; } $this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid)); $this->render('pireps_viewall.tpl'); } /* Stats stuff for charts */ public function statsdaysdata($pilotid) { $data = PIREPData::getIntervalDataByDays(array('p.pilotid'=>$pilotid), 30); $this->create_line_graph('Past 30 days PIREPs', $data); } public function statsmonthsdata($pilotid) { $data = PIREPData::getIntervalDataByMonth(array('p.pilotid'=>$pilotid), 3); $this->create_line_graph('Monthly Flight Stats', $data); } public function statsaircraftdata($pilotid) { $data = StatsData::PilotAircraftFlownCounts($pilotid); if(!$data) $data = array(); include CORE_LIB_PATH.'/php-ofc-library/open-flash-chart.php'; $d = array(); foreach($data as $ac) { OFCharts::add_data_set($ac->aircraft, floatval($ac->hours)); } echo OFCharts::create_pie_graph('Aircraft Flown'); } protected function create_line_graph($title, $data) { if(!$data) { $data = array(); } $bar_values = array(); $bar_titles = array(); foreach($data as $val) { $bar_titles[] = $val->ym; $bar_values[] = floatval($val->total); } OFCharts::add_data_set($bar_titles, $bar_values); echo OFCharts::create_area_graph($title); } public function RecentFrontPage($count = 5) { $this->set('pilots', PilotData::GetLatestPilots($count)); $this->render('frontpage_recentpilots.tpl'); } } That will get rid of the hubs. Im having a bit of a problem. Screenshot: http://prntscr.com/g6m58b Im using PHP version of crewcenter. I've removed all the .tpl's from use. I changed the .tpl sections of the code to .php. See copy below. Can someone please assist me? ========================================================================================================================================== <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Pilots extends CodonModule { public function index() { $this->set('allpilots', PilotData::getAllPilots()); $this->render('pilots_list.php'); } public function reports($pilotid='') { if($pilotid == '') { $this->set('message', 'No pilot specified!'); $this->render('core_error.php'); return; } $this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid)); $this->render('pireps_viewall.php'); } /* Stats stuff for charts */ public function statsdaysdata($pilotid) { $data = PIREPData::getIntervalDataByDays(array('p.pilotid'=>$pilotid), 30); $this->create_line_graph('Past 30 days PIREPs', $data); } public function statsmonthsdata($pilotid) { $data = PIREPData::getIntervalDataByMonth(array('p.pilotid'=>$pilotid), 3); $this->create_line_graph('Monthly Flight Stats', $data); } public function statsaircraftdata($pilotid) { $data = StatsData::PilotAircraftFlownCounts($pilotid); if(!$data) $data = array(); include CORE_LIB_PATH.'/php-ofc-library/open-flash-chart.php'; $d = array(); foreach($data as $ac) { OFCharts::add_data_set($ac->aircraft, floatval($ac->hours)); } echo OFCharts::create_pie_graph('Aircraft Flown'); } protected function create_line_graph($title, $data) { if(!$data) { $data = array(); } $bar_values = array(); $bar_titles = array(); foreach($data as $val) { $bar_titles[] = $val->ym; $bar_values[] = floatval($val->total); } OFCharts::add_data_set($bar_titles, $bar_values); echo OFCharts::create_area_graph($title); } public function RecentFrontPage($count = 5) { $this->set('pilots', PilotData::GetLatestPilots($count)); $this->render('frontpage_recentpilots.php'); } } Quote
web541 Posted August 11, 2017 Report Posted August 11, 2017 Try this <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Pilots extends CodonModule { public function index() { $this->set('allpilots', PilotData::getAllPilots()); $this->set('pilot_list', PilotData::getAllPilots()); $this->render('pilots_list.php'); } public function reports($pilotid='') { if($pilotid == '') { $this->set('message', 'No pilot specified!'); $this->render('core_error.php'); return; } $this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid)); $this->render('pireps_viewall.php'); } /* Stats stuff for charts */ public function statsdaysdata($pilotid) { $data = PIREPData::getIntervalDataByDays(array('p.pilotid'=>$pilotid), 30); $this->create_line_graph('Past 30 days PIREPs', $data); } public function statsmonthsdata($pilotid) { $data = PIREPData::getIntervalDataByMonth(array('p.pilotid'=>$pilotid), 3); $this->create_line_graph('Monthly Flight Stats', $data); } public function statsaircraftdata($pilotid) { $data = StatsData::PilotAircraftFlownCounts($pilotid); if(!$data) $data = array(); include CORE_LIB_PATH.'/php-ofc-library/open-flash-chart.php'; $d = array(); foreach($data as $ac) { OFCharts::add_data_set($ac->aircraft, floatval($ac->hours)); } echo OFCharts::create_pie_graph('Aircraft Flown'); } protected function create_line_graph($title, $data) { if(!$data) { $data = array(); } $bar_values = array(); $bar_titles = array(); foreach($data as $val) { $bar_titles[] = $val->ym; $bar_values[] = floatval($val->total); } OFCharts::add_data_set($bar_titles, $bar_values); echo OFCharts::create_area_graph($title); } public function RecentFrontPage($count = 5) { $this->set('pilots', PilotData::GetLatestPilots($count)); $this->render('frontpage_recentpilots.php'); } } Make sure the templates you are using match up with this repo Quote
AidasP Posted December 18, 2017 Report Posted December 18, 2017 Does not work at all completely no changes made Quote
Moderators shakamonkey88 Posted December 18, 2017 Moderators Report Posted December 18, 2017 16 minutes ago, AidasP said: Does not work at all completely no changes made It does work - you're doing something wrong. Where are you uploading this to? Quote
RedKingOne Posted December 18, 2017 Report Posted December 18, 2017 20 minutes ago, AidasP said: Does not work at all completely no changes made Note that the coding above works using phpvms 5.5 and runing php version 5.6 on my server. That's my config at least. Also r you using the .tpl or .php version of the crewcenter. That will change the formatting as shown above. Quote
AidasP Posted December 18, 2017 Report Posted December 18, 2017 1 hour ago, Shadesb181 said: Note that the coding above works using phpvms 5.5 and runing php version 5.6 on my server. That's my config at least. Also r you using the .tpl or .php version of the crewcenter. That will change the formatting as shown above. wait..............................................................I am using default 'Crew Center', well at least the one i made with bootstrap, the thing is, that (yes my version is 5.5.x, of phpvms), that the Module Pilots, is acting like its not even existing there, i can delete everything, i can keep everything, i can edit stuff, it just ignores my changes, i am really annoyed with the hubs, just like sitting here trying to fix it for like 2h30min, so yeah.. Quote
AidasP Posted December 18, 2017 Report Posted December 18, 2017 Just now, AidasP said: wait..............................................................I am using default 'Crew Center', well at least the one i made with bootstrap, the thing is, that (yes my version is 5.5.x, of phpvms), that the Module Pilots, is acting like its not even existing there, i can delete everything, i can keep everything, i can edit stuff, it just ignores my changes, i am really annoyed with the hubs, just like sitting here trying to fix it for like 2h30min, so yeah.. oh and yeah i move them to my skin folder, or edit it directly, still no luck Quote
Moderators shakamonkey88 Posted December 18, 2017 Moderators Report Posted December 18, 2017 Are you actually using CrewCenter? Have you got any links? Screenshots? Give us something to work with. Quote
AidasP Posted December 19, 2017 Report Posted December 19, 2017 (edited) Noo... I dont user the CrewCenter, i told that before, im using my own, which i made with bootstrap, any1 can give me a code with pilots list, without hubs, and with bootstrap would be appreciated a lot! i mean with bootstrap - bootstrap table Edited December 19, 2017 by AidasP Quote
Moderators shakamonkey88 Posted December 19, 2017 Moderators Report Posted December 19, 2017 Ok well you need to stop calling it crew center as people will automatically think you are using the crewcenter that many of us use. Why are you making these edits (ie file location)? What phpVMS version are you using? you can easily grab the default php file you need from a github repo Quote
web541 Posted December 19, 2017 Report Posted December 19, 2017 (edited) For phpvms 5.5.x, go into core/modules/Pilots/Pilot.php and find this public function index() { // Get all of our hubs, and list pilots by hub $allhubs = OperationsData::GetAllHubs(); if(!$allhubs) $allhubs = array(); foreach($allhubs as $hub) { $this->set('title', $hub->name); $this->set('icao', $hub->icao); $pilot_list = PilotData::findPilots(array('p.hub'=>$hub->icao)); $this->set('allpilots', $pilot_list); # deprecated $this->set('pilot_list', $pilot_list); $this->render('pilots_list.tpl'); } $nohub = PilotData::findPilots(array('p.hub'=>'')); if(!$nohub) { return; } $this->set('title', 'No Hub'); $this->set('icao', ''); $this->set('allpilots', $nohub); # deprecated $this->set('pilot_list', $nohub); $this->render('pilots_list.tpl'); } And replace it with this public function index() { $allpilots = PilotData::getAllPilots(); $this->set('allpilots', $allpilots); # deprecated $this->set('pilot_list', $allpilots); $this->render('pilots_list.tpl'); } Provided you haven't heavily modified the pilots_list.tpl/.php file, it should work. NOTE: This takes into account the nature of the post, to give a pilots list of every pilot in the database and order them by pilot id not by hub. If you want the default then do what shakamonkey88 said and go to the github repo and download the default file again. Edited December 19, 2017 by web541 Quote
AidasP Posted February 8, 2018 Report Posted February 8, 2018 On 12/19/2017 at 11:27 PM, web541 said: For phpvms 5.5.x, go into core/modules/Pilots/Pilot.php and find this public function index() { // Get all of our hubs, and list pilots by hub $allhubs = OperationsData::GetAllHubs(); if(!$allhubs) $allhubs = array(); foreach($allhubs as $hub) { $this->set('title', $hub->name); $this->set('icao', $hub->icao); $pilot_list = PilotData::findPilots(array('p.hub'=>$hub->icao)); $this->set('allpilots', $pilot_list); # deprecated $this->set('pilot_list', $pilot_list); $this->render('pilots_list.tpl'); } $nohub = PilotData::findPilots(array('p.hub'=>'')); if(!$nohub) { return; } $this->set('title', 'No Hub'); $this->set('icao', ''); $this->set('allpilots', $nohub); # deprecated $this->set('pilot_list', $nohub); $this->render('pilots_list.tpl'); } And replace it with this public function index() { $allpilots = PilotData::getAllPilots(); $this->set('allpilots', $allpilots); # deprecated $this->set('pilot_list', $allpilots); $this->render('pilots_list.tpl'); } Provided you haven't heavily modified the pilots_list.tpl/.php file, it should work. NOTE: This takes into account the nature of the post, to give a pilots list of every pilot in the database and order them by pilot id not by hub. If you want the default then do what shakamonkey88 said and go to the github repo and download the default file again. Okay, thanks! Sorry for late reply. But that really helps. Aidas 1 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.