ukmil Posted June 20, 2011 Report Posted June 20, 2011 Hi, is there anyway to show on my Fleet page if an aircraft is enabled? my knowledge of coding is poor, so would not know where to start. I see in the DB, that there is a '1' against aircaft that are enabled. So, in my FLEET page, is there a code i can enter which would look at the DB, and if it finds a '1' shows the words 'AVAILABLE', and if it finds a '0' it shows the words 'UNDER MAINTENANCE- UNAVAILABLE' thanks in advance Iknow a maintenance script has been requested but this surely is an easy way of doing it. Quote
ukmil Posted June 26, 2011 Author Report Posted June 26, 2011 ok, since no one helped, I have tried to do this alone. I know NO PHP coding, but managed to get this to work I use the FLEET TABLE script on this site, and i have managed to get the table to show what I want now I added this code into the table <td><?php If($aircraft->enabled==1){echo "AVAILABLE";} else {echo "UNDER MAINTENANCE";}?></td> so now on my FLEET page, i get this So my aircraft are now listed as AVAILABLE or UNDER MAINT. This is controlled by the AIRCRAFT ENABLED TICK selection in the aircraft maintenance area But this is where my skills end What I would like, is to split the table into two tables. I would like to show ONLY the available aircraft in the first table., then the UNDER MAINT aircraft in a separate table underneath I am sure this is possible using some PHP IF/ELSe coding etc but i have no idea how anyone help? Quote
Industrialshadow Posted June 27, 2011 Report Posted June 27, 2011 can you post your codes to us. So can another people use it. Thats are very friendly ;) and im interested to make it also...have you change in the database ???? or have you only put your codes in the fleet.table? Cheers Quote
scajolly Posted June 27, 2011 Report Posted June 27, 2011 Yes, please feel free to post your methods here. =) A lot of threads on the forum fail to provide methods, either because the matter is dealt with between the VA admin and a VMS person, or because the VA admin works it out on his own. Quote
ukmil Posted June 27, 2011 Author Report Posted June 27, 2011 no problems, I will post my code later i have amended it even further, and now have split the table into three sections. The top section shows current flying aircraft, the next section only shows AVAILABLE aircraft, and the lower, all unavailable. I am learing this PHP stuff every day. I have also changed the Pilots page, which i will post in another thread, which splits active/inactive crews. Quote
ukmil Posted June 28, 2011 Author Report Posted June 28, 2011 ok, here is what I did first, you need the FLEET TABLE code from here http://forum.phpvms.net/topic/1522-fleet-table/ install that, then replace the code in the Fleet_table.tpl with the one attatched. [backup your original one first, as this one is heavily customised to suit me, and may not suit you] This code will give you a SPLIT table on your page. At the top, you will have any aircraft listed as AVAILABLE via the ADMIN menu underneath, any aircraft you have unticked as enabled. THey will be listed as UNDER MAINT. it also uses a customised version of the LIVE FLIGHTBOARD here http://forum.phpvms.net/topic/4650-flightboard/page__view__findpost__p__34526__hl__liveboard__fromsearch__1 it places a smaller version at the top, so you can see any aircraft in use. fleet_table.zip Quote
ukmil Posted June 28, 2011 Author Report Posted June 28, 2011 I am now testing this a stage further I have manged to get it, so if an aircraft has ACARS data currently against it, so it appears in the top flying box, it will list it as IN USE in the Fleet table Quote
ukmil Posted June 28, 2011 Author Report Posted June 28, 2011 Next stage is I have HIDDEN any aircraft in the table that are currently in the acars list as being active. Quote
Industrialshadow Posted June 28, 2011 Report Posted June 28, 2011 Hello i have a Problem with this. Can you help me Skin : Obsess Blue Site http://www.lausitz-aircargo.de/index.php/Fleet thx Quote
ukmil Posted June 28, 2011 Author Report Posted June 28, 2011 Unfortunatly no, as far as skinning, I have no idea. the Code I have done is working on my site, and I see it is working on yours. you simply have a layout issue, which I have no idea how to fix Quote
Industrialshadow Posted June 28, 2011 Report Posted June 28, 2011 ok i hope another person has an idea to solve it. Yeah its working fine thanks for this. Great stuff Cheers Quote
ukmil Posted June 28, 2011 Author Report Posted June 28, 2011 I will also post later, the newset code I am running, which as per the last pic, does not just change the status of the available aircraft when acars data is active, but actually hides it in the list. However, what I have also done, is changed the ACARS timing from the defauly 720 minutes, to 20 minutes. This is becuase even after you are completed, and filed the Pirep, Acars will still show 'arrived' in the liveboard, and will not place the aircraft back in the list. Changing it to 20 mins, means 20 mins after to file the Pirep, the aircraft will be placed back in the list for use. Quote
Jeff Posted June 29, 2011 Report Posted June 29, 2011 If you're talking about the footer being half-way up the page, then yes... Add a </div> to the bottom of your code. If it won't go down, just keep adding one at a time until it goes back to it's correct position. Quote
Industrialshadow Posted June 29, 2011 Report Posted June 29, 2011 where i put the </div> in. in my fleet table? or antoher tpl? i dont know Quote
ukmil Posted June 29, 2011 Author Report Posted June 29, 2011 here is my latest revision TPL. this one will remove the aircraft totally from the Availalbe list, if acars data exists against it. As i said though, beware, that for 12 hours after the aircraft has 'arrived' it will remain hidden. I suggest you alter your acars time in the Config fleet_table.zip Quote
Jeff Posted June 29, 2011 Report Posted June 29, 2011 where i put the </div> in. in my fleet table? or antoher tpl? i dont know If it's only doing that on that one page, then place it with all the other </div> at the bottom of the fleet_table.tpl (or however it is named). Try to add it after this code and see how that works for you. </tbody> </table> So it looks like this... </tbody> </table> </div> If it doesn't move down, just try adding one at a time so it does, but I think it should only need one. Quote
Industrialshadow Posted July 1, 2011 Report Posted July 1, 2011 Hi I dont know were i must put in this is my fleet_table <style type="text/css"> <!-- th { color: #ff8710; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-weight: bolder; font-size: 14px; } td { color: #000000; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-size: 14px; font-weight: normal; } --> </style> <h1><center><?php echo SITE_NAME?> Fleet Availability</center></h1> <!-- Fleet Table Version 2.0.- - fleet_table.tpl - By Mitchell W http://forum.phpvms.net/topic/1522-fleet-table/ CHANGES FROM 1.1: Added image Added download --> <td align="center"> <h2><center>AIRCRAFT CURRENTLY FLYING</center></h2></td> <table align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border:1px solid grey;"> <tr> <th align="center" style="background-color: #006699; width: 3.5%;"> </th> <th width="20%" align="center" style="background-color: #006699;">Aircraft</th> <th width="5%" align="center" style="background-color: #006699;">Reg</th> <th width="18.5%" align="center" style="background-color: #006699;">Status</th> </tr> <?php $results = ACARSData::GetACARSData(); if (count($results) > 0) { foreach($results as $flight) { ?> <tr> <td></td> <td align="center"><?php echo $flight->aircraftname;?></td> <td style="font-weight: bolder;"><?php echo $flight->aircraft; ?></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: #ff961e;">No Aircraft Currently Flying</td></tr> <?php } ?> </table> <p></p> <table border="0"> <thead> <tr> <td align="center"> <table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border:1px solid grey;"> <tr> <th width="10%" align="center" style="background-color: #006699;">Image</th> <th width="15%" align="center" style="background-color: #006699;">Type</th> <th width="5%" align="center" style="background-color: #006699;">Reg</th> <th width="10%" align="center" style="background-color: #006699;">Hours used</th> <th width="5%" align="center" style="background-color: #006699;">Flights</th> <th width="20.5%" align="center" style="background-color: #006699;">Location</th> <th width="28.5%" align="center" style="background-color: #006699;">Status</th> <th width="15.5%" align="center" style="background-color: #006699;">Download Link</th> </tr> <tbody> <?php foreach ($fleet as $aircraft) If($aircraft->enabled==1) {if($aircraft->registration=="-") { continue; } ?> <tr> <td bgcolor="#006699"><img src="<?php echo $aircraft->imagelink; ?>"></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->name; ?></font></center> </td> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $aircraft->registration; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->totaltime; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->routesflown; ?></font></center></td><?php $params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED)); $pirep = PIREPData::findPIREPS($params); $current_location2 = $pirep[0]->arrname; ?> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $current_location.''.$current_location2; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php If($aircraft->enabled==1){echo "AVAILABLE";} else {echo "UNDER MAINTENANCE";}?></font></center></td> <td bgcolor="#006699"><a href="<?php echo $aircraft->downloadlink; ?>"><center><font color=#FFFFFF>Click</font></center></td> </tr> <?php } ?> </table> <p></p> <table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#006699" style="border:1px solid grey;"> <th><font color=#FFFFFF>Unavailable Aircrafts</font></th> </table> <table border="0"> <p></p> <p></p> <thead> <tr> <td align="center"> <table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border:1px solid grey;"> <tr> <th width="10%" align="center" style="background-color: #006699;">Image</th> <th width="15%" align="center" style="background-color: #006699;">Type</th> <th width="5%" align="center" style="background-color: #006699;">Reg</th> <th width="10%" align="center" style="background-color: #006699;">Hours used</th> <th width="5%" align="center" style="background-color: #006699;">Sorties</th> <th width="20.5%" align="center" style="background-color: #006699;">Location</th> <th width="28.5%" align="center" style="background-color: #006699;">Status</th> <th width="15.5%" align="center" style="background-color: #006699;">Download Link</th> </tr> <?php foreach ($fleet as $aircraft) If($aircraft->enabled==0) { ?> <tr> <td bgcolor="#006699"><img src="<?php echo $aircraft->imagelink; ?>"></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->name; ?></font></center> </td> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $aircraft->registration; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->totaltime; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->routesflown; ?></font></center></td> <?php $params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED)); $pirep = PIREPData::findPIREPS($params); $current_location2 = $pirep[0]->arrname; ?> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $current_location.''.$current_location2; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FF0000><?php If($aircraft->enabled==1){echo "AVAILABLE";} else {echo "UNDER MAINTENANCE";}?></font></center></td> <td bgcolor="#006699"><a href="<?php echo $aircraft->downloadlink; ?>"><center><font color=#FFFFFF>Click</font></center></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> <br /> Quote
ukmil Posted July 2, 2011 Author Report Posted July 2, 2011 I have now tidied mine upa bit, so the unavailable ones take less space Quote
ukmil Posted July 2, 2011 Author Report Posted July 2, 2011 ok, found a problem with my code, told you I was never that good at this the part in the AVAILABLE list, which either hides, or places 'in use' against it has an error it only works on one aircraft. So if you only have one aircraft in flight, it works, which is how tested it BUT, if you have multiple aircraft, the code only seems to pick on the last aircraft listed in the IN FLIGHT table, and uses that data in the AVAILABLE table. sO no matter how many aircraft are flying, you will only ever see one hidden, or listed as in use does any coder know where I have gone wrong, and a way to fix it? I suspect it is this if($flight->aircraft==$aircraft->registration){continue;} since the first bit of code in the tpl, takes each aircraft in turn , and puts it in the IN FLIGHLT board, the one aircraft 'left in memory' when it moves into the top table, is the one it hides how can i force the table to check every aircraft in the acars data? Quote
Industrialshadow Posted July 3, 2011 Report Posted July 3, 2011 If it's only doing that on that one page, then place it with all the other </div> at the bottom of the fleet_table.tpl (or however it is named). Try to add it after this code and see how that works for you. </tbody> </table> So it looks like this... </tbody> </table> </div> If it doesn't move down, just try adding one at a time so it does, but I think it should only need one. Hi it doesnt work. Any Idea here is my code again <style type="text/css"> <!-- th { color: #ff8710; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-weight: bolder; font-size: 14px; } td { color: #000000; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-size: 14px; font-weight: normal; } --> </style> <h1><center><?php echo SITE_NAME?> Fleet Availability</center></h1> <!-- Fleet Table Version 2.0.- - fleet_table.tpl - By Mitchell W http://forum.phpvms.net/topic/1522-fleet-table/ CHANGES FROM 1.1: Added image Added download --> <td align="center"> <h2><center>AIRCRAFT CURRENTLY FLYING</center></h2></td> <table align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border:1px solid grey;"> <tr> <th align="center" style="background-color: #006699; width: 3.5%;"> </th> <th width="20%" align="center" style="background-color: #006699;">Aircraft</th> <th width="5%" align="center" style="background-color: #006699;">Reg</th> <th width="18.5%" align="center" style="background-color: #006699;">Status</th> </tr> <?php $results = ACARSData::GetACARSData(); if (count($results) > 0) { foreach($results as $flight) { ?> <tr> <td></td> <td align="center"><?php echo $flight->aircraftname;?></td> <td style="font-weight: bolder;"><?php echo $flight->aircraft; ?></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: #ff961e;">No Aircraft Currently Flying</td></tr> <?php } ?> </table> <p></p> <table border="0"> <thead> <tr> <td align="center"> <table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border:1px solid grey;"> <tr> <th width="10%" align="center" style="background-color: #006699;">Image</th> <th width="15%" align="center" style="background-color: #006699;">Type</th> <th width="5%" align="center" style="background-color: #006699;">Reg</th> <th width="10%" align="center" style="background-color: #006699;">Hours used</th> <th width="5%" align="center" style="background-color: #006699;">Flights</th> <th width="20.5%" align="center" style="background-color: #006699;">Location</th> <th width="28.5%" align="center" style="background-color: #006699;">Status</th> <th width="15.5%" align="center" style="background-color: #006699;">Download Link</th> </tr> <tbody> <?php foreach ($fleet as $aircraft) If($aircraft->enabled==1) {if($aircraft->registration=="-") { continue; } ?> <tr> <td bgcolor="#006699"><img src="<?php echo $aircraft->imagelink; ?>"></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->name; ?></font></center> </td> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $aircraft->registration; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->totaltime; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->routesflown; ?></font></center></td><?php $params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED)); $pirep = PIREPData::findPIREPS($params); $current_location2 = $pirep[0]->arrname; ?> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $current_location.''.$current_location2; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php If($aircraft->enabled==1){echo "AVAILABLE";} else {echo "UNDER MAINTENANCE";}?></font></center></td> <td bgcolor="#006699"><a href="<?php echo $aircraft->downloadlink; ?>"><center><font color=#FFFFFF>Click</font></center></td> </tr> <?php } ?> </table> <p></p> <table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#006699" style="border:1px solid grey;"> <th><font color=#FFFFFF>Unavailable Aircrafts</font></th> </table> <table border="0"> <p></p> <thead> <tr> <td align="center"> <table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border:1px solid grey;"> <tr> <th width="10%" align="center" style="background-color: #006699;">Image</th> <th width="15%" align="center" style="background-color: #006699;">Type</th> <th width="5%" align="center" style="background-color: #006699;">Reg</th> <th width="10%" align="center" style="background-color: #006699;">Hours used</th> <th width="5%" align="center" style="background-color: #006699;">Sorties</th> <th width="20.5%" align="center" style="background-color: #006699;">Location</th> <th width="28.5%" align="center" style="background-color: #006699;">Status</th> <th width="15.5%" align="center" style="background-color: #006699;">Download Link</th> </tr> <?php foreach ($fleet as $aircraft) If($aircraft->enabled==0) { ?> <tr> <td bgcolor="#006699"><img src="<?php echo $aircraft->imagelink; ?>"></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->name; ?></font></center> </td> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $aircraft->registration; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->totaltime; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FFFFFF><?php echo $aircraft->routesflown; ?></font></center></td> <?php $params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED)); $pirep = PIREPData::findPIREPS($params); $current_location2 = $pirep[0]->arrname; ?> <td bgcolor="#006699" style="font-weight: bolder;"><center><font color=#FFFFFF><?php echo $current_location.''.$current_location2; ?></font></center></td> <td bgcolor="#006699"><center><font color=#FF0000><?php If($aircraft->enabled==1){echo "AVAILABLE";} else {echo "UNDER MAINTENANCE";}?></font></center></td> <td bgcolor="#006699"><a href="<?php echo $aircraft->downloadlink; ?>"><center><font color=#FFFFFF>Click</font></center></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> <br /> Quote
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.