Jump to content

pilot roster


faraz

Recommended Posts

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

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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');
}

Link to comment
Share on other sites

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');
}

Link to comment
Share on other sites

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');
}

Link to comment
Share on other sites

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');
   }

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...