Jump to content

[SOLVED] Module Newest Pilots


Blu-Express VA

Recommended Posts

Better late than never B) , see if it is:

<h3>Roster</h3>
<p>
<table width="100%"> 	
<tr bgcolor="#FF0000" align="center">
<th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Callsign</font></th>
<th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Name</font></th>
<th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Total Flights</font></th>
<th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Total Hours</font></th>
<th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Rank</font></th>
<th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Hub</font></th>
</tr>
<?php 
$query="SELECT * FROM phpvms_pilots ORDER BY joindate DESC";
$list=DB::get_results($query);
foreach ($list as $pilot)
{
   $callsign = PilotData::GetPilotCode($pilot->code, $pilot->pilotid);
	echo '<tr bgcolor="#F5F5F5" align="center"><td height="25px">'.$callsign.'</td>
       <td height="25px">'.$pilot->firstname.' '.$pilot->lastname.'</td>
       <td height="25px">'.$pilot->totalflights.'</td>
       <td height="25px" >'.$pilot->totalhours.'</td>
       <td height="25px">'.$pilot->rank.'</td>
       <td height="25px" width="15%">'.$pilot->hub.'</td>
       </tr>';

}
echo '</table>'

?> 



Link to comment
Share on other sites

Well, it says Roster in the heading, so I am going to take a wild stab at it and say that it is the Pilots Roster which is not what you are after. I am guessing that you are wanting to change the Newest Pilots block that shows up on the front page. If that be the case, you need to edit the frontpage_recentpilots.tpl file.

And that part of the code that you just asked about, that would stay in the code as he gave to you IF you were editing your Roster. That is pretty much a call to the database looking for information. However, the way mine works is, the most recent pilot joined is on top with and it goes on down from there.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Ok, i modified my code with:

<?php 
$query="SELECT * FROM phpvms_pilots ORDER BY joindate DESC";
$list=DB::get_results($query);
foreach ($list as $pilot)
{
?>
<p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p>
<?php
}
?>

Thanks to Kairon and TAV1702 ;)

Link to comment
Share on other sites

Hi,

i've other problem, how to change the order from DESC to ASC?, because i change this:

$query="SELECT * FROM phpvms_pilots ORDER BY joindate DESC";

with:

$query="SELECT * FROM phpvms_pilots ORDER BY joindate ASC";

in my pilot list,

but the rank image no view!,

this is my code :

<h3><font color="#152F60"><?php echo $title?></h3></font>

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

<table width="98%" border="0" cellspacing="0">
<thead>
<tr>
<th id="sample">Pilot ID</th>
<th id="sample">Name</th>
<th id="sample">Rank</th>
<th id="sample">Flights</th>
<th id="sample">Hours</th>
       <th id="sample">Status</th>
   <th id="sample">IVAO</th>
   <th id="sample">VATSIM</th>

</tr>
</thead>
<tbody>
<?php
$query="SELECT * FROM phpvms_pilots ORDER BY joindate ASC";
$list=DB::get_results($query);
foreach ($list 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>
<td><div align="center"><?php
   If ($pilot->retired == 0)
         { echo '<img src="http://www.bluepanoramava.joomlafree.it/green-status.png" />'; }
   else
         { echo '<img src="http://www.bluepanoramava.joomlafree.it/red-status.png" />'; }
?></div></td>
<td><?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"><center><center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/yesvat.png" width="20" height="18" border="0" alt="IVAO ID" /></center></a>';
}
else
{
echo '<center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/novat.png" width="20" height="18" border="0"/></center></a>';
}
?>
</td>
<td><?php
$fieldvalue = PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID');
if($fieldvalue != '')
{
  echo '<a href="http://www.vataware.com/pilot.cfm?cid='.$fieldvalue.'" target="_blank"><center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/yesvat.png" width="20" height="18" border="0" alt="Vatsim ID" /></center></a>';
}
else
{
echo '<center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/novat.png" width="20" height="18" border="0"/></center></a>';
}
?>
<?php
?></td>
<?php
}

?>
</tbody>
</table>

Thanks in advance ;)

Link to comment
Share on other sites

  • 1 year later...

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