michael Kraan Posted July 13, 2012 Report Share Posted July 13, 2012 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 1 Quote Link to comment Share on other sites More sharing options...
SouthwestVA Posted July 13, 2012 Report Share Posted July 13, 2012 $actualtime = $pirep->flighttime; $schedtime = $schedule->flighttime; if($actualtime < $schedtime){ echo '<td>Early</td>'; } elseif($actualtime > $schedtime){ echo '<td>Delayed</td>'; } else { echo '<td>On Time</td>'; } found that in code forums, might help you Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted July 13, 2012 Moderators Report Share Posted July 13, 2012 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! Quote Link to comment Share on other sites More sharing options...
michael Kraan Posted July 13, 2012 Author Report Share Posted July 13, 2012 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 Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 13, 2012 Report Share Posted July 13, 2012 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. Quote Link to comment Share on other sites More sharing options...
michael Kraan Posted July 13, 2012 Author Report Share Posted July 13, 2012 okay you see that i must first change the time? the schedules times? but than is one hour 60 minutes. but make the schedule than not 60 hours? Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 13, 2012 Report Share Posted July 13, 2012 you`ll have to explode the time first $flightime = explode(":", $schedule->flighttime); $flightmin = $flightime[0] * 60; $flightminutes = ($flightime[1] + $flightmin); something like that Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 13, 2012 Report Share Posted July 13, 2012 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"; } ?> Quote Link to comment Share on other sites More sharing options...
michael Kraan Posted July 15, 2012 Author Report Share Posted July 15, 2012 (edited) 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 July 15, 2012 by michael Kraan Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 15, 2012 Report Share Posted July 15, 2012 no only add the code to the pirep_viewreport.tpl .... that`s everything Quote Link to comment Share on other sites More sharing options...
michael Kraan Posted July 15, 2012 Author Report Share Posted July 15, 2012 okay thank you:) Quote Link to comment Share on other sites More sharing options...
Kapitan Posted March 8, 2014 Report Share Posted March 8, 2014 Quote Link to comment Share on other sites More sharing options...
AUZ Posted March 18, 2014 Report Share Posted March 18, 2014 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 Quote Link to comment Share on other sites More sharing options...
sunair Posted May 4, 2014 Report Share Posted May 4, 2014 You can add codes like this for your colors: echo "<b> Early</b>"; } elseif (($flminu + 15) < $actflminu) { echo "<font color=\"#FF0000\"><b> Delayed</b>"; } else { echo "<font color=\"#108a00\"><b> On time </b></font>"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.