faraz Posted January 29, 2010 Report Share Posted January 29, 2010 HI Now pilot roster show pilots by Hub , I want show pilots by Airline . I try to change pilot.php , but just show Airlines Name nad Code . "There are no pilots!" $allairlines = OperationsData::getAllAirlines($onlyenabled=false); if(!$allairlines) $allairline = 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'); } $noairlines = PilotData::findPilots(array('p.code'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } Tnx Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 29, 2010 Administrators Report Share Posted January 29, 2010 Instead of getAirlineByID() try getAllAirlines(). What is it outputting right now? And: $noAirline = PilotData::findPilots(array('p.Airline'=>'')); You want p.code => 'airline code', since that's how their airline is store Quote Link to comment Share on other sites More sharing options...
faraz Posted January 29, 2010 Author Report Share Posted January 29, 2010 please check below code : $allairlines = OperationsData::getAllAirlines(); if(!$allairlines) $allairline = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.Airline'=>$airline->code))); $this->render('pilots_list.tpl'); } $noAirline = PilotData::findPilots(array('p.Airline'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } and just show Airline name . Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 29, 2010 Administrators Report Share Posted January 29, 2010 Do p.airline (it might be case senstive). What's in your template? And what's it showing now? Quote Link to comment Share on other sites More sharing options...
faraz Posted January 29, 2010 Author Report Share Posted January 29, 2010 HI thank You nabel for help! still show Airlines name in Pilot roster . KLM : there are no pilot . { // Get all of our hubs, and list pilots by hub $allairlines = OperationsData::getAllAirlines(); if(!$allairlines) $allairline = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.airline'=>$airline->code))); $this->render('pilots_list.tpl'); } $noAirline = PilotData::findPilots(array('p.airline'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 29, 2010 Administrators Report Share Posted January 29, 2010 After $this->set('allpilots', PilotData::findPilots(array('p.airline'=>$airline->code))); put a DB::debug(), and show what that says Quote Link to comment Share on other sites More sharing options...
faraz Posted January 29, 2010 Author Report Share Posted January 29, 2010 it doesn't work . Parse error: syntax error, unexpected T_VARIABLE in /home/XXX/public_html/data4/core/modules/Pilots/Pilots.php on line 36 { $allairlines = OperationsData::getAllAirlines(); if(!$allairlines) $allairline = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.airline'=>$airline->code))); DB::debug() $this->render('pilots_list.tpl'); } $noAirline = PilotData::findPilots(array('p.airline'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 29, 2010 Administrators Report Share Posted January 29, 2010 You forgot the semi colon at the end of the DB::debug(); line Quote Link to comment Share on other sites More sharing options...
faraz Posted January 29, 2010 Author Report Share Posted January 29, 2010 Log : Caller: DB::write_debug->DB::query public function index() { $allairlines = OperationsData::getAllAirlines(); if(!$allairlines) $allairline = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.airline'=>$airline->code))); DB::debug(); $this->render('pilots_list.tpl'); } $noAirline = PilotData::findPilots(array('p.airline'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 29, 2010 Administrators Report Share Posted January 29, 2010 Look on that page, it will show what's returned there Quote Link to comment Share on other sites More sharing options...
faraz Posted January 30, 2010 Author Report Share Posted January 30, 2010 sorry I don't understand . what do you mean ? Quote Link to comment Share on other sites More sharing options...
faraz Posted February 2, 2010 Author Report Share Posted February 2, 2010 still show Airlines Name and show There are no pilots! pilots_list.tpl <h3><?php echo $title.'-'.$code?></h3> <thead> <table border="0.5" width="100%"><tr> <tr> <th bgcolor=#F2F2F2>Pilot ID</th> <th bgcolor=#F2F2F2>Name</th> <th bgcolor=#F2F2F2>Rank</th> <th bgcolor=#F2F2F2>Last Active</th> <th bgcolor=#F2F2F2>Location</th> <th bgcolor=#F2F2F2>IVAO VID</th> </thead> <tbody> <?php foreach($roster as $pilot) { /* To include a custom field, use the following example: <td> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?> </td> For instance, if you added a field called "IVAO Callsign": echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign'); */ ?> <tr> <td bgcolor=#FFFFFF width=10% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td bgcolor=#FFFFFF width=20% height=5 align=center> <?php echo $pilot->firstname.' '.$pilot->lastname?> (<?php echo PilotData::getFieldValue($pilot->pilotid,'VA Rank'); ?>) </td> <td bgcolor=#FFFFFF width=10% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td> </td> <td bgcolor=#FFFFFF width=10% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><?php echo $pilot->lastlogin?></td> <td bgcolor=#FFFFFF width=5% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><?php $last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED); if(!$last_location) echo $pilot->hub; else echo $last_location->arricao ; ?> </td> <td bgcolor=#FFFFFF width=5% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><?php $fieldvalue = PilotData :: getFieldValue ( $pilot-> pilotid , 'IVAO VID' ); if( $fieldvalue != '' ) { echo '<a href="http://www.ivao.aero/members/person/details.asp?ID='. $fieldvalue . '" target="_blank"><img src="http://status.ivao.aero/R/'.$fieldvalue.'.png" width="150" height="30" border="0" alt="IVAO VID"/></a>' ; } ?> </td> </td> <?php } ?> </tbody> </table> and pilot.php public function index() { $allairlines = OperationsData::getAllAirlines(); if(!$allairlines) $allairline = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.airline'=>$airline->code))); DB::debug(); $this->render('pilots_list.tpl'); } $noAirline = PilotData::findPilots(array('p.airline'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted February 2, 2010 Administrators Report Share Posted February 2, 2010 You never posted the output of what happens when you goto that page. Does any debug text show up? If not then it's not reaching that code, and you have to see why Quote Link to comment Share on other sites More sharing options...
faraz Posted February 2, 2010 Author Report Share Posted February 2, 2010 Please see below link : (pilot roster output ) and for Debug , you need Log ? Tnx Quote Link to comment Share on other sites More sharing options...
faraz Posted February 4, 2010 Author Report Share Posted February 4, 2010 Does anyone have any idea how i would do this? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted February 4, 2010 Administrators Report Share Posted February 4, 2010 After $allairlines = OperationsData::getAllAirlines(); Put a DB::debug(); and post the output Quote Link to comment Share on other sites More sharing options...
faraz Posted February 4, 2010 Author Report Share Posted February 4, 2010 I added DB::debug(); . public function index() { $allairlines = OperationsData::getAllAirlines(); DB::debug(); if(!$allairlines) $allairline = array(); foreach($allairlines as $airline) { $this->set('title', $airline->name); $this->set('code', $airline->code); $this->set('allpilots', PilotData::findPilots(array('p.airline'=>$airline->code))); $this->render('pilots_list.tpl'); } $noAirline = PilotData::findPilots(array('p.airline'=>'')); if(!$noairline) { return; } $this->set('title', 'No Airlines'); $this->set('code', ''); $this->set('allpilots', $noairlines); $this->render('pilots_list.tpl'); } and pilots_list <h3><?php echo $title.'-'.$code?></h3> <thead> <table border="0.5" width="100%"><tr> <tr> <th bgcolor=#F2F2F2>Pilot ID</th> <th bgcolor=#F2F2F2>Name</th> <th bgcolor=#F2F2F2>Rank</th> <th bgcolor=#F2F2F2>Location</th> <th bgcolor=#F2F2F2>IVAO VID</th> </thead> <tbody> <?php foreach($roster as $pilot) { /* To include a custom field, use the following example: <td> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?> </td> For instance, if you added a field called "IVAO Callsign": echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign'); */ ?> <tr> <td bgcolor=#FFFFFF width=10% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td bgcolor=#FFFFFF width=20% height=5 align=center> <?php echo $pilot->firstname.' '.$pilot->lastname?> (<?php echo PilotData::getFieldValue($pilot->pilotid,'VA Rank'); ?>) </td> <td bgcolor=#FFFFFF width=10% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td> </td> ?> <td bgcolor=#FFFFFF width=5% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><?php $last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED); if(!$last_location) echo $pilot->hub; else echo $last_location->arricao ; ?> </td> <td bgcolor=#FFFFFF width=5% height=5 align=center><font face=Tahoma color=#7E7E7E size=2><?php $fieldvalue = PilotData :: getFieldValue ( $pilot-> pilotid , 'IVAO VID' ); if( $fieldvalue != '' ) { echo '<a href="http://www.ivao.aero/members/person/details.asp?ID='. $fieldvalue . '" target="_blank"><img src="http://status.ivao.aero/R/'.$fieldvalue.'.png" width="150" height="30" border="0" alt="IVAO VID"/></a>' ; } ?> </td> </td> <?php } ?> </tbody> </table> and still show " There are no pilots!" , where can I found output for Debug ? Tnx Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted February 4, 2010 Administrators Report Share Posted February 4, 2010 It should be showing on the page. If it's not, then you are either looking in the wrong place or haven't called it Quote Link to comment Share on other sites More sharing options...
faraz Posted February 4, 2010 Author Report Share Posted February 4, 2010 HI are you sure this code is correct ? 'p.airline' and also I try 'p.code' , but those are not working . and I think below link doesn't exist in PilotData : PilotData::findPilots(array('p.airline'=>$airline->codes)); Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted February 5, 2010 Administrators Report Share Posted February 5, 2010 Yes I said back here: http://forum.phpvms.net/index.php?topic=2090.msg13145#msg13145 It's p.code. And it should be $airline->code Not codes Quote Link to comment Share on other sites More sharing options...
faraz Posted February 5, 2010 Author Report Share Posted February 5, 2010 Thank You very much nabeel After 3-4 days , Pilot roster fully work . Tnx Quote Link to comment Share on other sites More sharing options...
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.