Jump to content

flight delay or to early


michael Kraan

Recommended Posts

Hi everyone,

i search for a code, example:

This is the schedule info

Depp: EHAM 12:00 PM

Arrivel: EGLL 13:00 PM

This is the flight info

Depp: EHAM 12:00 PM

Arrivel: EGLL 14:00 PM and my arrivel time is 1 hour delay.

Is it possible that pirep(view) than say delay and than the hours or to early and the hours? ( that after 15 minutes or later, he say in the pirep delay or 15 earlier or more say to early?

its more realistic. i don't know of that possible is.

Greets

Michael Kraan

  • Like 1
Link to comment
Share on other sites

  • Moderators

SouthwestVA,

Next time please put the code between the code tags so it would be easier for people to copy. On the icon when you reply, look for the icon with <> and it'll work.

Thanks!

Link to comment
Share on other sites

Hi thank you for the respons, but where can i past that?

<h3>Flight <?php echo $pirep->code . $pirep->flightnum; ?></h3>
<table width="100%">
<tr>
<td width="50%">
<ul>
<li><strong>Submitted By: </strong><a href="<?php echo SITE_URL.'/index.php/profile/view/'.$pirep->pilotid?>">
  <?php echo $pirep->firstname.' '.$pirep->lastname?></a></li>
<li><strong>Departure Airport: </strong><?php echo $pirep->depname?> (<?php echo $pirep->depicao; ?>)</li>
<li><strong>Arrival Airport: </strong><?php echo $pirep->arrname?> (<?php echo $pirep->arricao; ?>)</li>
<li><strong>Aircraft: </strong><?php echo $pirep->aircraft . " ($pirep->registration)"?></li>
<li><strong>Flight Time: </strong> <?php echo $pirep->flighttime; ?></li>
<li><strong>Date Submitted: </strong> <?php echo date(DATE_FORMAT, $pirep->submitdate);?></li>
<?php
if($pirep->route != '')
{
 echo "<li><strong>Route: </strong>{$pirep->route}</li>";
}
?>
<li><strong>Status: </strong>
 <?php
 if($pirep->accepted == PIREP_ACCEPTED)
  echo 'Accepted';
 elseif($pirep->accepted == PIREP_REJECTED)
  echo 'Rejected';
 elseif($pirep->accepted == PIREP_PENDING)
  echo 'Approval Pending';
 elseif($pirep->accepted == PIREP_INPROGRESS)
  echo 'Flight in Progress';
 ?>
</li>
</ul>
</td>
<td width="50%" valign="top" align="right">
<table class="balancesheet" cellpadding="0" cellspacing="0" width="100%">
<tr class="balancesheet_header">
 <td align="" colspan="2">Flight Details</td>
</tr>
<tr>
 <td align="right">Gross Revenue: <br />
  (<?php echo $pirep->load;?> load / <?php echo FinanceData::FormatMoney($pirep->price);?> per unit  <br />
 <td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->load * $pirep->price);?></td>
</tr>
<tr>
 <td align="right">Fuel Cost: <br />
  (<?php echo $pirep->fuelused;?> fuel used @ <?php echo $pirep->fuelunitcost?> / unit)<br />
 <td align="right" valign="top"><?php echo FinanceData::FormatMoney($pirep->fuelused * $pirep->fuelunitcost);?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
if($fields)
{
?>
<h3>Flight Details</h3>  
<ul>
<?php
foreach ($fields as $field)
{
 if($field->value == '')
 {
  $field->value = '-';
 }
?>
 <li><strong><?php echo $field->title ?>: </strong><?php echo $field->value ?></li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
if($pirep->log != '')
{
?>
<h3>Additional Log Information:</h3>
<p>
<?php
/* If it's FSFK, don't show the toggle. We want all the details and pretty
 images showing up by default */
if($pirep->source != 'fsfk')
{
 ?>
<p><a href="#" onclick="$('#log').toggle(); return false;">View Log</a></p>
<p id="log" style="display: none;">
<?php
}
else
{
 echo '<p>';
}
?>
 <div>
 <?php
 # Simple, each line of the log ends with *
 # Just explode and loop.
 $log = explode('*', $pirep->log);
 foreach($log as $line)
 {
  echo $line .'<br />';
 }
 ?>
 </div>
</p>
</p>
<?php
}
?>
<?php
if($comments)
{
echo '<h3>Comments</h3>
<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Commenter</th>
<th>Comment</th>
</tr>
</thead>
<tbody>';
foreach($comments as $comment)
{
?>
<tr>
<td width="15%" nowrap><?php echo $comment->firstname . ' ' .$comment->lastname?></td>
<td align="left"><?php echo $comment->comment?></td>
</tr>
<?php
}
echo '</tbody></table>';
}
?>

i look for that code and i see that the code is use for a flight board. and i need it for the pirep view hihi :)

greets

Michael Kraan

Link to comment
Share on other sites

it won`t work too well if you use that because you won`t have a margin for the On Time Display. You should convert the times to minutes first and then maybe do something like

if(($scheduledminutes - 20) > $actualminutes) {
		  echo "Early"; } elseif (($scheduledminutes + 15) < $actualminutes) {
		  echo "Delayed"; } else {
		  echo "On Time"; }
		  ?>

but remember that is not the whole code... you`ll have to convert the times to minutes first. I don`t have the time to look at it now but for sure someone can help you.

Link to comment
Share on other sites

this works on my site

<?php
		  $schedule = SchedulesData::getScheduleByFlight($pirep->code,$pirep->flightnum);
		  $fltime = explode(".", $schedule->flighttime);
		  $minstar = substr($fltime[1],0,1);
		  $minstarmin = substr($fltime[1],1,2);
		  $flmin = $minstar * 10;
		  $flhou = $fltime[0] * 60;
		  $flminu = $flhou + $flmin + $minstarmin;

		  $actfltime = explode(".", $pirep->flighttime);
		  $actminstar = substr($actfltime[1],0,1);
		  $actminstarmin = substr($actfltime[1],1,2);
		  $actflmin = $actminstar * 10;
		  $actflhou = $actfltime[0] * 60;
		  $actflminu = $actflhou + $actflmin + $actminstarmin;

		  if(($flminu - 20) > $actflminu) {
		  echo "Early";
		  } elseif (($flminu + 15) < $actflminu) {
		  echo "Delayed";
		  } else {
		  echo "On Time"; }
		  ?>

Link to comment
Share on other sites

Thank you very much.

i add the code and is now working. i change nothing. only add the code to my pirep_viewreport.

and when the schedule is delayd. say the pirep delayd! really nice!

Greets

Michael Kraan

i have one other question. i add the code,, en that is all? or must i change something? (schedule times or in local config?)

Edited by michael Kraan
Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...

this works on my site

<?php
		 $schedule = SchedulesData::getScheduleByFlight($pirep->code,$pirep->flightnum);
		 $fltime = explode(".", $schedule->flighttime);
		 $minstar = substr($fltime[1],0,1);
		 $minstarmin = substr($fltime[1],1,2);
		 $flmin = $minstar * 10;
		 $flhou = $fltime[0] * 60;
		 $flminu = $flhou + $flmin + $minstarmin;

		 $actfltime = explode(".", $pirep->flighttime);
		 $actminstar = substr($actfltime[1],0,1);
		 $actminstarmin = substr($actfltime[1],1,2);
		 $actflmin = $actminstar * 10;
		 $actflhou = $actfltime[0] * 60;
		 $actflminu = $actflhou + $actflmin + $actminstarmin;

		 if(($flminu - 20) > $actflminu) {
		 echo "Early";
		 } elseif (($flminu + 15) < $actflminu) {
		 echo "Delayed";
		 } else {
		 echo "On Time"; }
		 ?>

Hello mseiwald,

Would you or any of the others reading this post know or can tell me how I can have the out put display in different colors ?

Something like

Red - Delayed

Green - On Time

Orage - Early

I have tried myself but because its an echo statement, I can't seem to get it right.

Any assistance would be most appreciated.

Thanks

AJ

Link to comment
Share on other sites

  • 1 month 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...