Jump to content

Help displaying Vatsim IDs


piper338

Recommended Posts

Could someone help me out please I am trying to get the vatsim id to be displayed here http://flyvva.org/index.php/pilots

The custom field is this Vatsim ID

and here is the .tpl I have

<h3><?php echo $title?></h3>

<?php
if(!$allpilots)
{
	echo 'There are no pilots!';
	return;
}
?>
<table width="100%" class="tablesorter" id="tabledlist">
<thead>
<tr>
<th>Pilot ID</th>
<th>Name</th>
<th>Vatsim ID</th>
<th>Rank</th>
<th>Flights</th>
    <th>Hours</th>
    </tr>
</thead>
<tbody>
<?php
foreach($allpilots as $pilot)
{
if($pilot->confirmed != 1)
    continue;
/* 
	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 width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
		<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>	</td>
<td>
	<img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
		alt="<?php echo Countries::getCountryName($pilot->location);?>" />

	<?php echo $pilot->firstname.' '.$pilot->lastname?>	</td>
<td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'Vatsim ID'); ?></td>

<td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<td><?php echo $pilot->totalflights?></td>
    <td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
    <?php
}
?>
</tbody>
</table>

Link to comment
Share on other sites

I too had an issue getting the Vatsim ID field to show.  Mine is named "vatsimid".  In the end I had to add an extra field into the Pilot table, manually add vatsim ids from their registration, and call it within the pilot roster - not a good workaround, but works nonetheless.

Link to comment
Share on other sites

Hi Piper,

you need also declare a new varible in the beginning:

<tr>

  <th>Pilot ID</th>

  <th>Name</th>

  <th>Vatsim ID</th>

  <th>Rank</th>

  <th>Flights</th>

    <th>Hours</th>

    <th>VATSIM ID</th>

    </tr>

it should work then.

But i have another question. I want to connect the vatsim id with the vataware website:

http://www.vataware.com/pilot.cfm?cid=

after the = there should be the vatsim id from the database.

Like i did it always in php it wouldn't work here.

Has anyone an idea how to link a variable to an URL.

Thanks alot.

Mark

Link to comment
Share on other sites

Hi Will,

i got it now running with this:

<td><a href="http://www.vataware.com/pilot.cfm?cid=<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID');?>" target=_blank><?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID');?></a></td>

and the standard custom fields.

Thanks alot for the hint.

Mark

Link to comment
Share on other sites

Hey guys thanks for trying to help me, but I still cant get it through my head what/Where I need to Edit the following.

I added

<td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'Vatsim ID')?></td>

as that is what is commented to do...

<h3><?php echo $title?></h3>

<?php
if(!$allpilots)
{
	echo 'There are no pilots!';
	return;
}
?>
<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Pilot ID</th>
<th>Name</th>
<th>Rank</th>
<th>Flights</th>
<th>Hours</th>
    <th>VATSIM ID</th>
</tr>
</thead>
<tbody>
<?php
foreach($allpilots 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 width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
		<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
</td>
<td>
	<img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
		alt="<?php echo Countries::getCountryName($pilot->location);?>" />

	<?php echo $pilot->firstname.' '.$pilot->lastname?>
</td>
<td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<td><?php echo $pilot->totalflights?></td>
<td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
    <td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'Vatsim ID')?></td>
    </tr>
<?php
}
?>
</tbody>
</table>

Link to comment
Share on other sites

<h3><?php echo $title?></h3>
<h5>O Piloto só aparecera na lista Abaixo, Após ter completado 01:00 Hs (UMA HORA) de voo na VA, dúvidas contate um Staff !!!<h5>
<h5>
  <?php
if(! $allpilots )
{
    echo 'There are no pilots!' ;
    return;
}
?>
</h5>
<table id="tabledlist" class="tablesorter" width="800">
<tbody>
  <tr>
    <td width="23%" height="0" colspan="2" align="CENTER"><table id="tabledlist2" class="tablesorter" width="800">
      <thead>
        <tr>
          <th width="60" align="center">Piloto ID</th>
          <th width="30" align="center">Pais</th>
          <th width="138" align="center">Nome</th>
          <th width="69" align="center">Rank</th>
          <th width="40" align="center">Voos</th>
          <th width="50" height="0" align="center">Horas</th>
          <th width="181" height="45" align="CENTER">IVAO ID</th>
          <th width="192" height="45" align="CENTER">VATSIM ID</th>
        </tr>
      </thead>
      <tbody>
        <?php
foreach( $allpilots as $pilot )
{
?>
        <tr>
          <td width="60" align="center" nowrap><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a></td>
          <td width="30" align="center"><img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
		alt="<?php echo Countries::getCountryName($pilot->location);?>" /></td>
          <td width="138" align="center"><?php echo $pilot->firstname.' '.$pilot->lastname?></td>
          <td width="69" align="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
          <td width="40" align="center"><?php echo $pilot->totalflights?></td>
          <td width="50" height="0" align="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
          <td width="181" height="45" align="CENTER"><?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'IVAO ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://www.ivao.aero/members/person/details.asp?ID='. $fieldvalue . '" target="_blank"><img src="http://status.ivao.aero/'. $fieldvalue .'.png" width="180" height="45" border="0" alt="Ivao ID" /></a>' ;
}
?>
            <div align="center"></div></td>
          <td width="192" height="45" align="CENTER"><?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'VATSIM ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://www.vataware.com/pilot.cfm?cid=' . $fieldvalue . '" target="_blank"><img src="http://online.vatsimindicators.net/'. $fieldvalue .'/3453.png" width="180" height="45" border="0" alt="Ivao ID" /></a></a>' ;
}
?>
            <?php
}
?></td>
          
        </tr>
      </tbody>
    </table>    
</tbody>
</table>

en

good luck

br

boa sorte

Link to comment
Share on other sites

VATSIM ID is how it is in the field, I changed it from Vatsim ID to VATSIM ID

<h3><?php echo $title?></h3>

<?php
if(!$allpilots)
{
	echo 'There are no pilots!';
	return;
}
?>

<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Pilot ID</th>
<th>Name</th>
<th>Rank</th>
<th>Flights</th>
<th>Hours</th>
    <th>Vatsim ID</th>
</tr>
</thead>
<tbody>
<?php
foreach($allpilots 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 width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
		<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
</td>
<td>
	<img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
		alt="<?php echo Countries::getCountryName($pilot->location);?>" />

	<?php echo $pilot->firstname.' '.$pilot->lastname?>
</td>
<td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<td><?php echo $pilot->totalflights?></td>
<td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
    <td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?></td>
<?php
}
?>
</tbody>
</table>

Link to comment
Share on other sites

Guys finally got it...just put one field in pilots database, in my example IVAO...Add that field also in admin panel...and add like in previous pilot_list.php everything only line in below shpuld look like this

<td><?php echo $pilot->IVAO?></td>

I have no knowledge of coding but after 2 hours trying, it was worth it ;)

I hope this helps somebody hehe...

Link to comment
Share on other sites

  • 10 years later...

Hi all,
I am trying to show cutom filed in Pending PIREPS,
using the following code, any help in foreach code ?
I got one issue where to put this and correct way to add it :
 

<?php
foreach($pilot_list as $pilot)
{

 

?>

<?php
}
?>
Because in pending PIREPs i call for : foreach ( pireps as pirep !

Thank you
 

<tbody>
<?php
foreach($pireps as $pirep)
{	
	if($pirep->accepted == PIREP_PENDING)
		$td_class = 'pending';
	else
		$td_class = '';
	
	$error = false;
?>
<tr class="<?php echo $class?> pirep_list" id="row<?php echo $pirep->pirepid;?>">
	<td align="center" valign="top" nowrap="nowrap" style="width: 27px;" class="<?php echo $td_class;?>">
		<img height="25px" width="25px" src="<?php echo PilotData::GetPilotAvatar($pirep->pilotid);?>" align="left" />
</td>

	<td align="left" valign="top" nowrap class="<?php echo $td_class;?>">
	<strong><a href="<?php echo SITE_URL?>/admin/index.php/pilotadmin/viewpilots?action=viewoptions&pilotid=<?php echo $pirep->pilotid;?>">
	<?php echo PilotData::GetPilotCode($pirep->pcode, $pirep->pilotid) . ' - ' .$pirep->firstname .' ' . $pirep->lastname;?></a>  
	<!-- Here i would like to show VATSIM or IVAO ID using the following code -->
     l <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM CID or IVAO VID'); ?>
	
	</strong>
	<strong>Flight:</strong> <?php echo $pirep->code . $pirep->flightnum; ?></div>
	<strong>Dep/Arr: </strong><?php echo $pirep->depicao; ?>/<?php echo $pirep->arricao; ?> 
	<strong>Flight Time: </strong><?php echo $pirep->flighttime; ?> <br />
	<strong>Submit Date: </strong><?php echo date(DATE_FORMAT, $pirep->submitdate); ?> 
<strong>Current Status:	</strong> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM CID or IVAO VID');?>
	<?php 
	
	if($pirep->accepted == PIREP_ACCEPTED)
		echo 'Accepted';
	elseif($pirep->accepted == PIREP_REJECTED)
		echo 'Rejected';
	elseif($pirep->accepted == PIREP_PENDING)
		echo 'Approval Pending';
	
	?>
	<?php
	# If there was an error, don't allow the PIREP to go through
	if($pirep->aircraft == '')
	{
		$error = true;
	}	
	?>
<table width="100%" style="border: none;">

 

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...