Connor1994 Posted August 6, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
mattia Posted August 6, 2012 Report Share Posted August 6, 2012 You want a page with only pirep accepted and a second page with only pirep rejected for pilot?? Quote Link to comment Share on other sites More sharing options...
James142 Posted August 6, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
Connor1994 Posted August 6, 2012 Author Report Share 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 Link to comment Share on other sites More sharing options...
Connor1994 Posted August 6, 2012 Author Report Share 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 Link to comment Share on other sites More sharing options...
Sava Posted August 6, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
Connor1994 Posted August 6, 2012 Author Report Share Posted August 6, 2012 Brilliant! Thank you guys! [sOLVED] Quote Link to comment Share on other sites More sharing options...
James142 Posted August 6, 2012 Report Share Posted August 6, 2012 My bad haha Glad its working. Quote Link to comment Share on other sites More sharing options...
Sava Posted August 6, 2012 Report Share Posted August 6, 2012 Glad I could help Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted August 6, 2012 Moderators Report Share Posted August 6, 2012 You could also use this if you want: Pirep List 1.0 Quote Link to comment Share on other sites More sharing options...
Connor1994 Posted August 7, 2012 Author Report Share Posted August 7, 2012 Thanks, I'll look into it Quote Link to comment Share on other sites More sharing options...
Colin Posted August 15, 2012 Report Share Posted August 15, 2012 I tried this code and it just says There are no recent flights! 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.