Curshad Posted June 18, 2014 Report Share Posted June 18, 2014 Hey guys in the Airline coloumn of my Live flight board on my home page @ http://skyabahamasvirtual.net I have and image there to display when a SBM flight is flown here is the code <table style="border:1px solid grey;" cellspacing="2" cellpadding="2" bgcolor="#171717"> <tr> <th align="center" style="background-color: #171717; width: 3.5%;"> </th> <th width="10%" align="center" style="background-color: #171717;">Airline</th> <th width="10%" align="center" style="background-color: #171717;">Flight</th> <th width="30%" align="center" style="background-color: #171717;">Departure</th> <th width="30%" align="center" style="background-color: #171717;">Arrival</th> <th width="5%" align="center" style="background-color: #171717;">Aircraft</th> <th width="18.5%" align="center" style="background-color: #171717;">Status</th> </tr> <?php $results = ACARSData::GetACARSData(); if (count($results) > 0) { foreach($results as $flight) { ?> <tr> <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src=''>"; } ?></td> <td align="center"><img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /></td> <td align="center"><?php echo $flight->flightnum;?></td> <td align="center"><?php echo $flight->depname;?></td> <td align="center"><?php echo $flight->arrname;?></td> <td align="center"><?php echo $flight->aircraftname;?></td> <td align="center"><?php if($flight->phasedetail != 'Paused') { echo $flight->phasedetail; } else { echo "Cruise"; }?></font></td> </tr> <?php } } else { ?> <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr> <?php } ?> </table> I have another airline added in the admin center of PHPVMS. That airline is Silver Airways. I want my flight board to display this image in the airline coloumn of the Live Flight Board when a SIL flight is flown. Would this be the correct coding do such a thing? Without removing SBM image? or in other words If i fly an SBM flight the airline colomun displays this image and if someone else flys a SIL flight the same time i Fly an SBM flight it displays both Sky Bahamas and Silver Airways image again is this the correct coding to do such a thing? <td align="center"><img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /><img src="http://www.juergenbaumbusch.de/wp-content/uploads/2013/06/silver-airways.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /></td> AND OR <td align="center"><img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /><img src="http://www.juergenbaumbusch.de/wp-content/uploads/2013/06/silver-airways.jpg" width="120" height="35" alt="Silver Airways" /></td> Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted June 18, 2014 Moderators Report Share Posted June 18, 2014 You should create a simple if statement: <?php if($flight->code == 'SIL') {echo 'the image you want to display for SIL flights';} elseif($flight->code == 'SBM') {echo 'the image you want to display for SBM flights';} ?> Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 18, 2014 Author Report Share Posted June 18, 2014 You should create a simple if statement: <?php if($flight->code == 'SIL') {echo 'the image you want to display for SIL flights';} elseif($flight->code == 'SBM') {echo 'the image you want to display for SBM flights';} ?> So now the Code should be: <table style="border:1px solid grey;" cellspacing="2" cellpadding="2" bgcolor="#171717"> <tr> <th align="center" style="background-color: #171717; width: 3.5%;"> </th> <th width="10%" align="center" style="background-color: #171717;">Airline</th> <th width="10%" align="center" style="background-color: #171717;">Flight</th> <th width="30%" align="center" style="background-color: #171717;">Departure</th> <th width="30%" align="center" style="background-color: #171717;">Arrival</th> <th width="5%" align="center" style="background-color: #171717;">Aircraft</th> <th width="18.5%" align="center" style="background-color: #171717;">Status</th> </tr> <?php $results = ACARSData::GetACARSData(); if (count($results) > 0) { foreach($results as $flight) { ?> <tr> <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src=''>"; } ?></td> <td align="center"><?php if($flight->code == 'SIL') {echo 'the image you want to display for SIL flights';} elseif($flight->code == 'SBM') {echo 'the image you want to display for SBM flights';} ?></td> <td align="center"><?php echo $flight->flightnum;?></td> <td align="center"><?php echo $flight->depname;?></td> <td align="center"><?php echo $flight->arrname;?></td> <td align="center"><?php echo $flight->aircraftname;?></td> <td align="center"><?php if($flight->phasedetail != 'Paused') { echo $flight->phasedetail; } else { echo "Cruise"; }?></font></td> </tr> <?php } } else { ?> <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr> <?php } ?> </table> Correct me if Im wrong. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted June 18, 2014 Moderators Report Share Posted June 18, 2014 Yes, i would suggest you to try this. Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 18, 2014 Author Report Share Posted June 18, 2014 Didnt notice any change. the Image loaded but no change in image.... <tr> <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src=''>"; } ?></td> <td align="center"><?php if($flight->code == 'SIL') {echo '<img src="http://www.juergenbaumbusch.de/wp-content/uploads/2013/06/silver-airways.jpg" width="120" height="35"/>';} elseif($flight->code == 'SBM') {echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';} ?></td> <td align="center"><?php echo $flight->flightnum;?></td> <td align="center"><?php echo $flight->depname;?></td> <td align="center"><?php echo $flight->arrname;?></td> <td align="center"><?php echo $flight->aircraftname;?></td> <td align="center"><?php if($flight->phasedetail != 'Paused') { echo $flight->phasedetail; } else { echo "Cruise"; }?></font></td> </tr> Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 18, 2014 Author Report Share Posted June 18, 2014 You know what my Pilot ID is SBM. i bet if it changed to SIL it would of shown up. I'll test it out.... Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 18, 2014 Author Report Share Posted June 18, 2014 No nothing worked. In my Flight Schedules and routes in admin center the Code is SIL and when i edit. SIL- Silver Airways for SBM is SBM - SkyBahamas Virtual I dont get why code doesnt work. i know i tried this and it worked <?php if($flight->flightnum == "SIL3983") {echo "<img src='http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg' width='120' height='35'/>";} elseif($flight->flightnum == "SBM850") {echo "<img src='http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg' width='120' height='35'/>";} ?> But that is not a legit fix.... Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 18, 2014 Administrators Report Share Posted June 18, 2014 The "getACARSData() function returns the pilot's code in the code object. The flight number is returned in whole as flightnum. you will have to trim the variable prior to matching it. Something like: <?php $fcode = substr($flight->flightnum, 0, 3); if($fcode == 'SIL') {echo 'the image you want to display for SIL flights';} elseif($fcode == 'SBM') {echo 'the image you want to display for SBM flights';} ?> The only catch is if you use another code that is not 3 digits, you would have to add another if loop to catch that. Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 19, 2014 Author Report Share Posted June 19, 2014 The "getACARSData() function returns the pilot's code in the code object. The flight number is returned in whole as flightnum. you will have to trim the variable prior to matching it. Something like: <?php $fcode = substr($flight->flightnum, 0, 3); if($fcode == 'SIL') {echo 'the image you want to display for SIL flights';} elseif($fcode == 'SBM') {echo 'the image you want to display for SBM flights';} ?> The only catch is if you use another code that is not 3 digits, you would have to add another if loop to catch that. I see so i would have to list all numbers that would probably fit a flight number? or i would have to list all available Flight # that are in my schedule? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 19, 2014 Administrators Report Share Posted June 19, 2014 It is only comparing the first three digits of the flightnum variable - which I am guessing is SIL or SBM. If you have more codes than that you will need an if for each one. Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 19, 2014 Author Report Share Posted June 19, 2014 Oh Ok. I will test it out. I apologise if i seem slow. I never really went to school specifically for coding so i am learning how coding and stuff works just by making website errors and google. I try to learn as much as i can. Quote Link to comment Share on other sites More sharing options...
Curshad Posted June 20, 2014 Author Report Share Posted June 20, 2014 YAYYY IT WORKED THANK YOU SOOOO MUCH! Quote Link to comment Share on other sites More sharing options...
poole3003 Posted August 20, 2014 Report Share Posted August 20, 2014 if i wanted to use the airline logos of my VA what would i need to change which peace of code Quote Link to comment Share on other sites More sharing options...
Curshad Posted November 4, 2014 Author Report Share Posted November 4, 2014 Hey simpilot myself and flyalaskava is have a touch time put this airline thing into the Latest flights board (for he pireps instead of live flights) It's been over 5hrs and I give I thought i was onto something but then i got stuck I did play around with it like i say and got the Airline image to load. Here's what i have: <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ocean_table"> <tr> <th>Airline</th> <th>Flight</th> <th>Pilot</th> <th>Departure</th> <th>Arrival</th> <th>Aircraft</th> <th>Duration</th> <th>V/S</th> <th>Info</th> </tr> <?php $results = ACARSData::GetACARSData(); if (count($results) > 0) { foreach($results as $pirep) { ?> <tr> <td align="center"><?php $fcode = substr($pirep->flightnum, 0, 3); if($fcode == 'SIL') {echo '<img src="http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg" width="120" height="35"/>';} elseif($fcode == 'SBM') {echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';} ?></td> <td align="center"><?php echo $pirep->flightnum;?></td> <td align="center"><?php echo $pirep->depname;?></td> <td align="center"><?php echo $pirep->arrname;?></td> <td align="center"><?php echo $pirep->aircraftname;?></td> <td align="center"><?php echo $pirep->landingrate;?>ft/m</td> <td align="center"><?php if($pirep->accepted == PIREP_ACCEPTED) echo '<td><span class="label label-important"><font color="green">Accepted</font></span></td>'; elseif($pirep->accepted == PIREP_REJECTED) echo '<td><span class="label label-important"><font color="red">Rejected</font></span></td>'; elseif($pirep->accepted == PIREP_PENDING) echo '<td><span class="label label-warning"><font color="orange">Pending</font></span></td>'; elseif($pirep->accepted == PIREP_INPROGRESS) echo '<td>On Progress</td>'?></td> </tr> <?php } } else { ?> <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr> <?php } ?> </tbody> </table> <div class="clear"></div> <div class="clear"></div> But thats not working 1. it doesnt show last 10 pireps 2. some info isnt displaying. (the airline info displays but other info.. *fart sound* Here is what i originally thought would work: <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ocean_table"> <tr> <th>Airline</th> <th>Flight</th> <th>Pilot</th> <th>Departure</th> <th>Arrival</th> <th>Aircraft</th> <th>Duration</th> <th>V/S</th> <th>Info</th> </tr> <?php if(count($pireps) > 0) { foreach ($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); $acrid = OperationsData::getAircraftByReg($pirep->registration); echo '<tr>'; echo '<td>' <?php $fcode = substr($flight->flightnum, 0, 3); if($fcode == 'SIL') {echo '<img src="http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg" width="120" height="35"/>';} elseif($fcode == 'SBM') {echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';} ?>'</td>' echo '<td><a href="'.SITE_URL.'/index.php/pireps/viewreport/'.$pirep->pirepid.'">'.$pirep->code.$pirep->flightnum.'</a></td>'; echo '<td><a href="'.SITE_URL.'/index.php/profile/view/'.$pilotinfo->pilotid.'">'.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</a></td>'; echo '<td>'.$pirep->depicao.'</td>'; echo '<td>'.$pirep->arricao.'</td>'; echo '<td>'.$pirep->aircraft.'</td>'; echo '<td>'.$pirep->flighttime.'</td>'; echo '<td>'.$pirep->landingrate.' ft/m</td>'; if($pirep->accepted == PIREP_ACCEPTED) echo '<td><span class="label label-important"><font color="green">Accepted</font></span></td>'; elseif($pirep->accepted == PIREP_REJECTED) echo '<td><span class="label label-important"><font color="red">Rejected</font></span></td>'; elseif($pirep->accepted == PIREP_PENDING) echo '<td><span class="label label-warning"><font color="orange">Pending</font></span></td>'; elseif($pirep->accepted == PIREP_INPROGRESS) echo '<td>On Progress</td>'; echo '</tr>'; } } else { echo '<tr><td>There are no recent flights!</td></tr>'; } ?> My results Quote Link to comment Share on other sites More sharing options...
Curshad Posted November 4, 2014 Author Report Share Posted November 4, 2014 I got all the info to work with this: <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ocean_table"> <tr> <th>Airline</th> <th>Flight</th> <th>Pilot</th> <th>Departure</th> <th>Arrival</th> <th>Aircraft</th> <th>Duration</th> <th>V/S</th> <th>Info</th> </tr> <?php $pirep = ACARSData::GetACARSData(); if (count($pirep) > 0) { foreach($pirep as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); $acrid = OperationsData::getAircraftByReg($pirep->registration); ?> <tr> <td align="center"><?php $fcode = substr($pirep->flightnum, 0, 3); if($fcode == 'SIL') {echo '<img src="http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg" width="120" height="35"/>';} elseif($fcode == 'SBM') {echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';} ?></td> <td align="center"><?php echo $pirep->flightnum;?></td> <td align="center"><?php echo '<a href="'.SITE_URL.'/index.php/profile/view/'.$pilotinfo->pilotid.'">'.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</a>';?></td> <td align="center"><?php echo $pirep->depname;?></td> <td align="center"><?php echo $pirep->arrname;?></td> <td align="center"><?php echo $pirep->aircraftname;?></td> <td align="center"><?php echo $pirep->flighttime;?></td> <td align="center"><?php echo $pirep->landingrate;?>ft/m</td> <td align="center"><?php if($pirep->accepted == PIREP_ACCEPTED) echo '<span class="label label-important"><font color="green">Accepted</font></span>'; elseif($pirep->accepted == PIREP_REJECTED) echo '<span class="label label-important"><font color="red">Rejected</font></span>'; elseif($pirep->accepted == PIREP_PENDING) echo '<span class="label label-warning"><font color="orange">Pending</font></span>'; elseif($pirep->accepted == PIREP_INPROGRESS) echo 'On Progress'?></td> </tr> <?php } } else { ?> <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr> <?php } ?> </tbody> </table> <div class="clear"></div> <div class="clear"></div> My only issue now is the new of pireps to show up currently only one is showing up. 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.