Guest parkho Posted January 3, 2011 Report Posted January 3, 2011 Hi All I have a problem. I tried to uncomment out the code for filtering schedules down to the ones from last pirep accepted, so the pilots can only see schedules from their location. I'm not sure if the code works properly as I tried it and it didn't and still shows me the whole listings (my current location is EDDL and there is only one schedule from EDDL in DB whcih is the one I want only!). Please help me get this done. I appreciate your concern Thanks Parkho Quote
Administrators simpilot Posted January 4, 2011 Administrators Report Posted January 4, 2011 I just tried it in a clean install and it seems to work for me. Make sure you have the entire code uncommented. It should look like the snip below. if(Auth::LoggedIn()) { $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); // return only one if(is_object($reports)) { # IF the arrival airport doesn't match the departure airport if($reports->arricao != $route->depicao) { continue; } } } Quote
Guest parkho Posted January 4, 2011 Report Posted January 4, 2011 I just tried it in a clean install and it seems to work for me. Make sure you have the entire code uncommented. It should look like the snip below. if(Auth::LoggedIn()) { $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); // return only one if(is_object($reports)) { # IF the arrival airport doesn't match the departure airport if($reports->arricao != $route->depicao) { continue; } } } Hi Simpilot Thanks for the reply. I do have the exact same snip in schedules_results.tpl, is there somewhere else that needs this snip? because it's not working for me and still shows me the whole thing. Could that be the skin since I'm using the Crystal II skinning? Thanks Quote
Administrators simpilot Posted January 5, 2011 Administrators Report Posted January 5, 2011 Are you logged in when you are accessing the schedules? If not, it will skip the requirement. It should be working if it is completely uncommented. Make sure the commenst before the start of the script are closed prior to the snip itself. Quote
Guest parkho Posted January 5, 2011 Report Posted January 5, 2011 Are you logged in when you are accessing the schedules? If not, it will skip the requirement. It should be working if it is completely uncommented. Make sure the commenst before the start of the script are closed prior to the snip itself. hi simpilot The following is my entire code in schedule_result. Also I installed a fresh copy of the software and uncommented the code and still shows me the whole thing.By the way, I do all these when I'm logged in. Thanks: <?php if(!$allroutes) { echo '<p align="center">No routes have been found!</p>'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Flight Info</th> <th>Options</th> </tr> </thead> <tbody> <?php foreach($allroutes as $route) { // Uncomment this code if you want only schedules which are from the last PIREP that // if(Auth::LoggedIn()) { $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); // return only one if(is_object($reports)) { # IF the arrival airport doesn't match the departure airport if($reports->arricao != $route->depicao) { continue; } } } /* Skip over a route if it's not for this day of week Left this here, so it can be omitted if your VA doesn't use this. Comment out these two lines if you don't want to. */ /* Check if a 7 is being used for Sunday, since PHP thinks 0 is Sunday */ $route->daysofweek = str_replace('7', '0', $route->daysofweek); if(strpos($route->daysofweek, date('w')) === false) continue; /* END DAY OF WEEK CHECK */ /* This will skip over a schedule if it's been bid on This only runs if the below setting is enabled If you don't want it to skip, then comment out this code below by adding // in front of each line until the END DISABLE SCHEDULE comment below If you do that, and want to show some text when it's been bid on, see the comment below */ if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { continue; } /* END DISABLE SCHEDULE ON BID */ /* Skip any schedules which have aircraft that the pilot is not rated to fly (according to RANK), only skip them if they are logged in. */ if(Config::Get('RESTRICT_AIRCRAFT_RANKS') === true && Auth::LoggedIn()) { /* This means the aircraft rank level is higher than what the pilot's ranklevel, so just do "continue" and move onto the next route in the list */ if($route->aircraftlevel > Auth::$userinfo->ranklevel) { continue; } } /* THIS BEGINS ONE TABLE ROW */ ?> <tr> <td> <a href="<?php echo url('/schedules/details/'.$route->id);?>"><?php echo $route->code . $route->flightnum?> <?php echo '('.$route->depicao.' - '.$route->arricao.')'?> </a> <br /> <strong>Departure: </strong><?php echo $route->deptime;?> <strong>Arrival: </strong><?php echo $route->arrtime;?> <strong>Equipment: </strong><?php echo $route->aircraft; ?> (<?php echo $route->registration;?>) <strong>Distance: </strong><?php echo $route->distance . Config::Get('UNITS');?> <strong>Days Flown: </strong><?php echo Util::GetDaysCompact($route->daysofweek); ?> <br /> <strong>-----------------------------------------------------------------------------------------------------------------------------------</strong><br /> <?php echo ($route->route=='') ? '' : '<strong>Route: </strong>'.$route->route.'<br />' ?> <?php echo ($route->notes=='') ? '' : '<strong>Notes: </strong>'.html_entity_decode($route->notes).'<br />' ?> <?php # Note: this will only show if the above code to # skip the schedule is commented out if($route->bidid != 0) { echo 'This route has been bid on'; } ?> </td> <td nowrap> <a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a> <a href="<?php echo url('/schedules/brief/'.$route->id);?>">Pilot Brief</a> <?php # Don't allow overlapping bids and a bid exists if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo actionurl('/schedules/addbid');?>">Book Flight</a> <?php } else { if(Auth::LoggedIn()) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo url('/schedules/addbid');?>">Book Flight</a> <?php } } ?><br /> </td> </tr> <?php /* END OF ONE TABLE ROW */ } ?> </tbody> </table> <hr> Quote
Guest lorathon Posted January 5, 2011 Report Posted January 5, 2011 Have you filled a pirep? It looks for your last pirep to grab the arrival airport. Quote
piuozorio Posted February 15, 2011 Report Posted February 15, 2011 I have the same "problem", i just uncomment the code and nothing change. I try change the code and for now is working for me, is that a problem for system with my change? I just replace/comment $reports = PIREPData::findPIREPS($search, 1); // return only one with $reports = PIREPData::getLastReports(Auth::$userinfo->pilotid, 1, PIREP_ACCEPTED); Thanks Helder Duarte 1 Quote
Administrators Nabeel Posted February 16, 2011 Administrators Report Posted February 16, 2011 That show from the last PIREP code is incorrect. I just found that out moving the code around yesterday.... woops. This line here: if($route->aircraftlevel > Auth::$userinfo->ranklevel) Should be: if($route[0]->aircraftlevel > Auth::$userinfo->ranklevel) Quote
B737Pilot Posted April 20, 2011 Report Posted April 20, 2011 Sorry for bringing up an old topic but is there working code of it? I really need this option in my VA, i have seen some of the VA's from PHPvms has managed to do that Thanks in advice. Quote
B737Pilot Posted April 22, 2011 Report Posted April 22, 2011 Anyone?, i really need this one Thanks. 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.