Connor1994 Posted August 6, 2012 Report Posted August 6, 2012 Hi All, How would I go about listing a pilots PIREPs whether they've been accepted or not in a table so I can show it on their profile? Cheers, CS Quote
mattia Posted August 6, 2012 Report Posted August 6, 2012 You want a page with only pirep accepted and a second page with only pirep rejected for pilot?? Quote
James142 Posted August 6, 2012 Report Posted August 6, 2012 Try putting this into your profile.php file $this->set('pireps', PIREPData::GetLastReports(Auth::$userinfo->pilotid, '10')); Then in your profile_main.tpl file, add this table: <table align="center" border="0" width="100%"> <thead> <tr border="0"> <th align="center">Flight</th> <th align="center">Depart</th> <th align="center">Arrival</th> <th align="center">Time</th> <th align="center">Landing Rate</th> </tr> </thead> <tbody> <?php if(count($pireps) > 0) { foreach($pireps as $flight) { echo '<tr><th>'.$flight->flightnum.'</th> <th>'.$flight->depicao.'</th> <th>'.$flight->arricao.'</th> <th>'.date(DATE_FORMAT, strtotime($flight->submitdate)).'</th> <th>'.$flight->landingrate.'</th> </tr>'; } else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> </tbody> </table> This hasn't being tested so I am not 100% certain if it will work or not. Hope this help! Kindest Regards, James Quote
Connor1994 Posted August 6, 2012 Author Report Posted August 6, 2012 Try putting this into your profile.php file $this->set('pireps', PIREPData::GetLastReports(Auth::$userinfo->pilotid, '10')); Then in your profile_main.tpl file, add this table: <table align="center" border="0" width="100%"> <thead> <tr border="0"> <th align="center">Flight</th> <th align="center">Depart</th> <th align="center">Arrival</th> <th align="center">Time</th> <th align="center">Landing Rate</th> </tr> </thead> <tbody> <?php if(count($pireps) > 0) { foreach($pireps as $flight) { echo '<tr><th>'.$flight->flightnum.'</th> <th>'.$flight->depicao.'</th> <th>'.$flight->arricao.'</th> <th>'.date(DATE_FORMAT, strtotime($flight->submitdate)).'</th> <th>'.$flight->landingrate.'</th> </tr>'; } else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> </tbody> </table> This hasn't being tested so I am not 100% certain if it will work or not. Hope this help! Kindest Regards, James I'll let you know. You want a page with only pirep accepted and a second page with only pirep rejected for pilot?? I'm not bothered, either or Quote
Connor1994 Posted August 6, 2012 Author Report Posted August 6, 2012 James, I get this error message: Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs\dev\vms\lib\skins\###\profile_main.tpl on line 236 <?php if(count($pireps) > 0) { foreach($pireps as $flight) { echo '<tr><th>'.$flight->flightnum.'</th> <th>'.$flight->depicao.'</th> <th>'.$flight->arricao.'</th> <th>'.date(DATE_FORMAT, strtotime($flight->submitdate)).'</th> <th>'.$flight->landingrate.'</th> </tr>'; } else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> Quote
Sava Posted August 6, 2012 Report Posted August 6, 2012 There is one } missing from the code. <?php if(count($pireps) > 0) { foreach($pireps as $flight) { echo '<tr><th>'.$flight->flightnum.'</th> <th>'.$flight->depicao.'</th> <th>'.$flight->arricao.'</th> <th>'.date(DATE_FORMAT, strtotime($flight->submitdate)).'</th> <th>'.$flight->landingrate.'</th> </tr>'; } } //<- this one else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> Quote
Connor1994 Posted August 6, 2012 Author Report Posted August 6, 2012 Brilliant! Thank you guys! [sOLVED] Quote
Moderators Parkho Posted August 6, 2012 Moderators Report Posted August 6, 2012 You could also use this if you want: Pirep List 1.0 Quote
Colin Posted August 15, 2012 Report Posted August 15, 2012 I tried this code and it just says There are no recent flights! 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.