Jump to content

Recommended Posts

Posted

Good morning, here's the code.

Insert it in your frontpage_main.tpl

<?php
		 $flights = PIREPData::getRecentReportsByCount(10);																																	
		 $string = "";
		 foreach($flights as $flight)
		 {	
						 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
		 }																																	
?>
<img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=wls&MR=900&MX=720x360&PM=b:disc7%2b%25U" width="725 px" /><br />
Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.voegolv.net" target="_blank">Luiz Fernando </a>
<!--Start Table-->
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table width="725 px" border="1" bordercolor="#FFFFFF">
<thead>
	 <tr align="center" valign="middle" bgcolor="#7D95AF">
	 <th>Flight #</th>
	 <th>Departure</th>
	 <th>Arrival</th>
	 <th>Duration</th>
	 <th>Pilot</th>
	 <th>Landing Rate</th>
	 <th>Aircraft</th>
	 </tr>
</thead>
 <tbody>

<?php
if(count($pireps) > 0)
{
foreach ($pireps as $pirep)
{
 $pilotinfo = PilotData::getPilotData($pirep->pilotid);
 $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
 echo "<tr>";
 echo "<td align=center> $pirep->code $pirep->flightnum </td>";
 echo "<td align=center> $pirep->depicao </td>";
 echo "<td align=center> $pirep->arricao </td>";
 echo "<td align=center> $pirep->flighttime </td>";
 echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>";
 echo "<td align=center> $pirep->landingrate </td>";
 echo "<td align=center> $pirep->aircraft </td>";
 echo "</tr>";
}
}
else
{
 echo "<tr><td>There are no recent flights!</td></tr>";
}
?>
</table>
</td>

This you insert in your Profile_main.tpl,

it reports the last 10 flights each pilot and shows how many days lack to Prevent Them from being retired

<?php
 $flights = PIREPData::getLastReports($userinfo->pilotid, '10');
 $string = "";
 foreach($flights as $flight)
 {
 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
 }
 ?>
</p>
		 <p align="center"><img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=520x260&PM=pemr:disc10:red%2b%22%25I%22:white&PC=blue" /><br />
		 </p>
		 <div class="alert alert-info">
			 <?php $totaldays = Config::Get('PILOT_INACTIVE_TIME');


										 {
						 ?>
			 <?php
				 if ($userinfo->lastpirep == '0000-00-00 00:00:00') {
						 echo 'Voce não realizou ainda nenhum voo na Gol Virtual!';
				 }
				 else {
						 $datebefore1 = substr($userinfo->lastpirep, 0, 10);
						 $datetoday2 = date("Y-m-d");
						 $datebefore3 = strtotime($datebefore1);
						 $datetoday4 = strtotime($datetoday2);
						 $newdate = $datetoday4-$datebefore3;
						 $lastpirep = floor($newdate/(60*60*24));
						 $daysleft = $totaldays-$lastpirep;
						 echo 'your last flight was ';
								 if ($lastpirep == 0) { echo 'Today'; }
								 else if ($lastpirep == 1) { echo 'Yesterday'; }
								 else {
										 echo $lastpirep . ' day(s) ago.';
								 }
								 echo '&nbspVoce tem ';
								 if ($daysleft == 0) { echo 'Our system has identified the absence of flights within 30 days, carrying his status was changed to inactive!'; }
								 else {
										 echo $daysleft . '&nbspdays to make your flight and prevent your registration is changed to inactive.';
								 }


				 }
				 ?>
			 <?php
}
?>

GLO0004.png

Posted

Good morning, here's the code.

Insert it in your frontpage_main.tpl

<?php
		 $flights = PIREPData::getRecentReportsByCount(10);																																	
		 $string = "";
		 foreach($flights as $flight)
		 {	
						 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
		 }																																	
?>
<img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=wls&MR=900&MX=720x360&PM=b:disc7%2b%25U" width="725 px" /><br />
Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.voegolv.net" target="_blank">Luiz Fernando </a>
<!--Start Table-->
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table width="725 px" border="1" bordercolor="#FFFFFF">
<thead>
	 <tr align="center" valign="middle" bgcolor="#7D95AF">
	 <th>Flight #</th>
	 <th>Departure</th>
	 <th>Arrival</th>
	 <th>Duration</th>
	 <th>Pilot</th>
	 <th>Landing Rate</th>
	 <th>Aircraft</th>
	 </tr>
</thead>
 <tbody>

<?php
if(count($pireps) > 0)
{
foreach ($pireps as $pirep)
{
 $pilotinfo = PilotData::getPilotData($pirep->pilotid);
 $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
 echo "<tr>";
 echo "<td align=center> $pirep->code $pirep->flightnum </td>";
 echo "<td align=center> $pirep->depicao </td>";
 echo "<td align=center> $pirep->arricao </td>";
 echo "<td align=center> $pirep->flighttime </td>";
 echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>";
 echo "<td align=center> $pirep->landingrate </td>";
 echo "<td align=center> $pirep->aircraft </td>";
 echo "</tr>";
}
}
else
{
 echo "<tr><td>There are no recent flights!</td></tr>";
}
?>
</table>
</td>

This you insert in your Profile_main.tpl,

it reports the last 10 flights each pilot and shows how many days lack to Prevent Them from being retired

<?php
 $flights = PIREPData::getLastReports($userinfo->pilotid, '10');
 $string = "";
 foreach($flights as $flight)
 {
 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
 }
 ?>
</p>
		 <p align="center"><img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=520x260&PM=pemr:disc10:red%2b%22%25I%22:white&PC=blue" /><br />
		 </p>
		 <div class="alert alert-info">
			 <?php $totaldays = Config::Get('PILOT_INACTIVE_TIME');


										 {
						 ?>
			 <?php
				 if ($userinfo->lastpirep == '0000-00-00 00:00:00') {
						 echo 'Voce não realizou ainda nenhum voo na Gol Virtual!';
				 }
				 else {
						 $datebefore1 = substr($userinfo->lastpirep, 0, 10);
						 $datetoday2 = date("Y-m-d");
						 $datebefore3 = strtotime($datebefore1);
						 $datetoday4 = strtotime($datetoday2);
						 $newdate = $datetoday4-$datebefore3;
						 $lastpirep = floor($newdate/(60*60*24));
						 $daysleft = $totaldays-$lastpirep;
						 echo 'your last flight was ';
								 if ($lastpirep == 0) { echo 'Today'; }
								 else if ($lastpirep == 1) { echo 'Yesterday'; }
								 else {
										 echo $lastpirep . ' day(s) ago.';
								 }
								 echo '&nbspVoce tem ';
								 if ($daysleft == 0) { echo 'Our system has identified the absence of flights within 30 days, carrying his status was changed to inactive!'; }
								 else {
										 echo $daysleft . '&nbspdays to make your flight and prevent your registration is changed to inactive.';
								 }


				 }
				 ?>
			 <?php
}
?>

GLO0004.png

Thank you

  • 5 weeks later...
Posted

This looks great...however is the Great Circle Mapper site working OK? I added the code, but the map does not generate fully, only a small portion of top of map, then the graphics get funky, then nothing.

Any help would be greatly appreciated. I tried in Firefox and Internet Explorer.

EDIT - I found my error in the airport code. It shows up on 3 of my computers now, but the 4th computer still has en error, I assume it may be a Win7 issue or I need to update something within my browsers.

Posted

i keep getting this error

Warning: Invalid argument supplied for foreach() in /home/myphpvms/public_html/core/templates/profile_main.tpl on line 16

is that because i dont have any flights or why could it be telling me this!?!?!?

  • 4 weeks later...
Posted

This is a great code snipet!

The code for front page is based on "getRecentReportsByCount" and list last 10 flights for all pilots. How would I modify to list last 10 flight by pilots within a specific airline? So that in the end I can make one map with "Last 10 flights by Airline A" and then "Last 10 Flights by Airline B" etc. It seems like it should be simple....I know the basics of PHP and can usually hack together code but I am having a hard time following all the variables and classes and how they work.

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