Jump to content

Recommended Posts

Posted

Hello everyone,

I'm trying to implement the pilot roster on a page via the admin control panel via phpVMS, but I can't figure out how to do this. The reason why I want to do this is so the roster can be displayed to the public. I tried using an iFrame, considering the whole phpVMS internal page system is made up of .htm files.

I'm not incredibly php-savvy, but I do know some stuff. Hopefully, with some help, I'll be able to get what I need done.

Thanks in advance,

  • Administrators
Posted

There is a pilot roster built in, if you goto the pilots link on the front-end.

Or are you trying something different?

Check out the add-ons forum as well

Posted

Thanks for the insight, Nabeel, but I don't think I fully understand what you're saying. More likely, I probably didn't explain what I'm trying to do clearly enough for you to understand.

I like the way you have the "pages" section of the system setup. I can log into my admin center and edit them, create new ones, etc. It works perfectly. But what I'm trying to do is create a page via the admin center which can display the pilot roster. I understand that I might have to edit the page by hand via an external file editor and I am perfectly comfortable with that, I just need to determine how can I can go about implementing that code.

Here is what I have so far:

<p>
<?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>
</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');		
 */

 // To skip a retired pilot, uncomment the next line:
 //if($pilot->retired == 1) { continue; }
?>
<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>
<?php
}
?>
</tbody>
</table>

</p>

The problem that I'm having is that, upon entering this code into a page, I receive the error message "There are no pilots!"

I checked my database (just to be sure) that I had pilots registered and I do, and I also surfed the addons forms and didn't exactly find what I was looking for.

Sorry to be a bother, but is there any other insight that you could provide me with? It would be much appreciated. Thanks in advance!

Posted

Thanks for the input, guys. But, for some reason, I'm still experiencing an issue. I'd be delighted to share my code with you as long you tell me what to share and I'll post it. The issue I'm experiencing is that, upon clicking on the link that would bring me to index.php/pilots, it appears to log out the user. But once the user wishes to return to the pilot center (to file PIREPs, etc.), they don't have to log in.

It's almost like the system claims the user isn't logged in or something when in reality, they are. Maybe I'm just missing a snippet of code or something.

Any ideas?

  • Moderators
Posted

Try this,

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
include '/PUT YOUR PATH HERE/public_html/core/codon.config.php';
$allpilots = PilotData::getAllPilots();
foreach($allpilots as $pilot)
{
}
?>
<h3>Pilot Hours Validation</h3>
<p>To Quick search name or pilot id hit Ctrl + F and and type in data.</p>
<?php

  if(!$allpilots)

  {

     echo 'There are no pilots!</div>';

     return;

  }

?>

<table width="380" cellspacing="1" cellpadding="5" border="1">
 <thead>
   <tr>
     <th width="60px">Pilot ID</th>
     <th width="200px">Name</th>
     <th width="55px">Hours</th>
     <th width="65px">Active/Inactive</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 SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">

        <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>

  </td>

  <td>

     <div align="left"><img src="<?php echo Countries::getCountryImage($pilot->location);?>" 

        alt="<?php echo Countries::getCountryName($pilot->location);?>" />
<?php echo $pilot->firstname.' '.$pilot->lastname?>
        </div></td>
  <td><div align="center"><?php echo $pilot->totalhours?></div></td>
<td><div align="center"><?php
   If ($pilot->retired == 0)
         { echo '<img src="/images/green-status.gif" />'; }
   else
         { echo '<img src="/images/red-status.gif" />'; }
?></div></td>
</div></td>
<td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?></td>
<?php

}

?>
</div>
</tbody>
</table>

You get the idea you can edit the thing to suite your needs, this is a php file that site in my root directory so Aerosoft can validate pilot hours.All you will need to update is your path to your codon config file.

Posted
1318713282[/url]' post='40881']

Try this,

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
include '/PUT YOUR PATH HERE/public_html/core/codon.config.php';
$allpilots = PilotData::getAllPilots();
foreach($allpilots as $pilot)
{
}
?>
<h3>Pilot Hours Validation</h3>
<p>To Quick search name or pilot id hit Ctrl + F and and type in data.</p>
<?php

  if(!$allpilots)

  {

     echo 'There are no pilots!</div>';

     return;

  }

?>

<table width="380" cellspacing="1" cellpadding="5" border="1">
 <thead>
   <tr>
     <th width="60px">Pilot ID</th>
     <th width="200px">Name</th>
     <th width="55px">Hours</th>
     <th width="65px">Active/Inactive</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 SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">

    	<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>

  </td>

  <td>

     <div align="left"><img src="<?php echo Countries::getCountryImage($pilot->location);?>" 

    	alt="<?php echo Countries::getCountryName($pilot->location);?>" />
<?php echo $pilot->firstname.' '.$pilot->lastname?>
    	</div></td>
  <td><div align="center"><?php echo $pilot->totalhours?></div></td>
<td><div align="center"><?php
   If ($pilot->retired == 0)
         { echo '<img src="/images/green-status.gif" />'; }
   else
         { echo '<img src="/images/red-status.gif" />'; }
?></div></td>
</div></td>
<td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?></td>
<?php

}

?>
</div>
</tbody>
</table>

You get the idea you can edit the thing to suite your needs, this is a php file that site in my root directory so Aerosoft can validate pilot hours.All you will need to update is your path to your codon config file.

Thanks, Mark! This worked out perfectly. All I have to do now is edit the styling of it and such.

@itrobb For some reason your php include code didn't work and it gave me errors, but it might just be because my server doesn't support php includes.

Either way, everything's working now. Thanks, all.

Posted

Hi,

I think it is pilots_list instead of pilot_list. That would explain the errors. And by the way, that basically sums up that huge big piece of code in one line so it is much more efficient.

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