Stealthbird97 Posted August 3, 2012 Report Posted August 3, 2012 Hey guys, I'm looking to getting into coding a module for my Virtual airlines and need a little bit off help. I want to create a module that shows things like Pilots information such as Last Flight, Hub, Hours, ranks and things like that. Is there a list of all of the variables and arrays that phpVMS used to store information about pilots, if there is I should be able to work out the things I need. If there is one, can someone post a link to it. Thanks in advance! Quote
Stealthbird97 Posted August 3, 2012 Author Report Posted August 3, 2012 Never mind, I found it. If i can't figure anything out, I'l ask through this topic Quote
Stealthbird97 Posted August 3, 2012 Author Report Posted August 3, 2012 Can someone tell me how I can get a list of all pilots, Not by Hub. Like the Pilots List, but without the hub separators, I want one large table. Quote
James142 Posted August 3, 2012 Report Posted August 3, 2012 Try replacing the pilots.php file (core/modules/pilots.php) with following code: <?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'); } } Kindest Regards, James 1 Quote
Stealthbird97 Posted August 3, 2012 Author Report Posted August 3, 2012 Works a Treat. What about pireps, what code do i need to echo the last filed pirep by Flight Numner? Quote
Stealthbird97 Posted August 6, 2012 Author Report Posted August 6, 2012 Can anyone tell me how I can get the information of a pilot to be displayed. I have tried adding <?php echo $pilotcode.'-'.$userinfo->firstname.' '.$userinfo->lastname; ?> But it only shows the - inbetween $pilotcode and firstname. Do I need any extra code to make this work. Quote
James142 Posted August 6, 2012 Report Posted August 6, 2012 Can anyone tell me how I can get the information of a pilot to be displayed. I have tried adding <?php echo $pilotcode.'-'.$userinfo->firstname.' '.$userinfo->lastname; ?> But it only shows the - inbetween $pilotcode and firstname. Do I need any extra code to make this work. Maybe try <?php echo Auth::$userinfo->firstname.' '.Auth::$userinfo->lastname; ?> Kindest Regards, James. 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.