Advertisement
Guest User

Untitled

a guest
Jan 6th, 2014
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.24 KB | None | 0 0
  1. <?php
  2. if(!$allroutes)
  3. {
  4.     echo '<p align="center">No routes have been found!</p>';
  5.     return;
  6. }
  7. ?>
  8.  
  9.         <script type="text/javascript">
  10. $(document).ready(function() {
  11.         $('#tabledlist').dataTable( {
  12.                 "sPaginationType": "full_numbers"
  13.         } );
  14. } );
  15.                 </script>  
  16.                
  17.  
  18.                
  19. <div>              
  20. <table id="tabledlist" class="display">
  21. <thead>
  22. <tr>
  23.     <th>Flight Info</th>
  24.     <th>Options</th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. <?php
  29. foreach($allroutes as $route)
  30. {
  31.    
  32.     /* Uncomment this code if you want only schedules which are from the last PIREP that
  33.         pilot filed */
  34.     /*if(Auth::LoggedIn())
  35.     {
  36.         $search = array(
  37.             'p.pilotid' => Auth::$userinfo->pilotid,
  38.             'p.accepted' => PIREP_ACCEPTED
  39.         );
  40.        
  41.         $reports = PIREPData::findPIREPS($search, 1); // return only one
  42.        
  43.         if(is_object($reports))
  44.         {
  45.             # IF the arrival airport doesn't match the departure airport
  46.             if($reports->arricao != $route->depicao)
  47.             {
  48.                 continue;
  49.             }
  50.         }
  51.     }*/
  52.    
  53.     /*
  54.     Skip over a route if it's not for this day of week
  55.     Left this here, so it can be omitted if your VA
  56.      doesn't use this.
  57.      
  58.     Comment out these two lines if you don't want to.
  59.     */
  60.    
  61.     /*  Check if a 7 is being used for Sunday, since PHP
  62.         thinks 0 is Sunday */
  63.     $route->daysofweek = str_replace('7', '0', $route->daysofweek);
  64.    
  65.     if(strpos($route->daysofweek, date('w')) === false)
  66.         continue;
  67.        
  68.     /* END DAY OF WEEK CHECK */
  69.    
  70.        
  71.    
  72.     /*
  73.     This will skip over a schedule if it's been bid on
  74.     This only runs if the below setting is enabled
  75.    
  76.     If you don't want it to skip, then comment out
  77.     this code below by adding // in front of each
  78.     line until the END DISABLE SCHEDULE comment below
  79.    
  80.     If you do that, and want to show some text when
  81.     it's been bid on, see the comment below
  82.     */
  83.     if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0)
  84.     {
  85.         continue;
  86.     }
  87.     /* END DISABLE SCHEDULE ON BID */
  88.    
  89.    
  90.     /*  Skip any schedules which have aircraft that the pilot
  91.         is not rated to fly (according to RANK), only skip them if
  92.         they are logged in. */
  93.     if(Config::Get('RESTRICT_AIRCRAFT_RANKS') === true && Auth::LoggedIn())
  94.     {
  95.         /*  This means the aircraft rank level is higher than
  96.             what the pilot's ranklevel, so just do "continue"
  97.             and move onto the next route in the list
  98.          */
  99.         if($route->aircraftlevel > Auth::$userinfo->ranklevel)
  100.         {
  101.             continue;
  102.         }
  103.     }
  104.    
  105.     /* THIS BEGINS ONE TABLE ROW */
  106. ?>
  107. <tr>
  108.     <td>
  109.         <a href="<?php echo url('/schedules/details/'.$route->id);?>"><?php echo $route->code . $route->flightnum?>
  110.             <?php echo '('.$route->depicao.' - '.$route->arricao.')'?>
  111.         </a>
  112.         <br />
  113.        
  114.         <strong>Departure: </strong><?php echo $route->deptime;?> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>Arrival: </strong><?php echo $route->arrtime;?><br />
  115.         <strong>Equipment: </strong><?php echo $route->aircraft; ?> (<?php echo $route->registration;?>)  <strong>Distance: </strong><?php echo $route->distance . Config::Get('UNITS');?>
  116.         <br />
  117.         <strong>Days Flown: </strong><?php echo Util::GetDaysCompact($route->daysofweek); ?><br />
  118.         <?php echo ($route->route=='') ? '' : '<strong>Route: </strong>'.$route->route.'<br />' ?>
  119.         <?php echo ($route->notes=='') ? '' : '<strong>Notes: </strong>'.html_entity_decode($route->notes).'<br />' ?>
  120.         <?php
  121.         # Note: this will only show if the above code to
  122.         #   skip the schedule is commented out
  123.         if($route->bidid != 0)
  124.         {
  125.             echo 'This route has been bid on';
  126.         }
  127.         ?>
  128.     </td>
  129.     <td nowrap>
  130.         <a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a><br />
  131.         <a href="<?php echo url('/schedules/brief/'.$route->id);?>">Pilot Brief</a><br />
  132.        
  133.         <?php
  134.         # Don't allow overlapping bids and a bid exists
  135.         if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0)
  136.         {
  137.         ?>
  138.             <a id="<?php echo $route->id; ?>" class="addbid"
  139.                 href="<?php echo actionurl('/schedules/addbid');?>">Add to Bid</a>
  140.         <?php
  141.         }
  142.         else
  143.         {
  144.             if(Auth::LoggedIn())
  145.             {
  146.              ?>
  147.                 <a id="<?php echo $route->id; ?>" class="addbid"
  148.                     href="<?php echo url('/schedules/addbid');?>">Add to Bid</a>
  149.             <?php            
  150.             }
  151.         }      
  152.         ?>
  153.     </td>
  154. </tr>
  155. <?php
  156.  /* END OF ONE TABLE ROW */
  157. }
  158. ?>
  159. </tbody>
  160. </table>
  161. </div>
  162.  
  163. <hr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement