Jump to content

Schedule Search in sidebar


truemo9

Recommended Posts

First off, you'll need to go in your Admin Center an rename all your airports to something smaller in order to fit it in such a tight space. What I did was went in and renamed them to the Airport's city name (if Hartsfield-Jackson Atlanta International, then I just named it Atlanta) If you come across a city that has multiple airports (London Heathrow or London Gatwick) then name them London-LHR and London-LGW). This will save a huge headache trying to fit something that large in a small space.

Next you can see if this code will work. (I'm not sure because I don't have it coded like this on my site.

<form action="<?php echo url('/FrontSchedules');?>" method="post" enctype="multipart/form-data">
   <table align="left" border="0" width="100%">
       <tr>
           <td bgcolor="#05305D" border="1"><font color="#FFFFFF"><b>Departure</b></font></td>
           <td>
               <select class="search" name="depicao">
                   <option value="">All</option>
<?php if (Auth::LoggedIn()) {?>   
<?php $reports = PIREPData::getLastReports(Auth::$userinfo->pilotid, 1, PIREP_ACCEPTED);
if(is_object($reports))
       {echo '<option value="'.$reports->arricao.'">Your current location ('.$reports->arricao.')</option>';}
elseif(!$reports)
{echo '<option value="'.Auth::$userinfo->hub.'">Your current location ('.Auth::$userinfo->hub.')</option>';}}?>
<?php
foreach ($airports as $airport)
{
echo '<option value="'.$airport->icao.'">'.$airport->icao.' - '.$airport->name.'</option>';
}?>
               </select>
           </td>
       </tr>
           <td bgcolor="#05305D" border="1"><font color="#FFFFFF"><b>Arrival</b></font></td>
           <td>
               <select class="search" name="arricao">
                   <option value="">All</option>
                   <?php
                       foreach ($airports as $airport)
                           {echo '<option value="'.$airport->icao.'">'.$airport->icao.' - ('.$airport->name.')</option>';}
                   ?>
               </select>
           </td>
       </tr>
       <tr>
           <td>
               <input title="Click here to search for flights" type="hidden" name="action" value="findflight" />
               <input title="Click here to search for flights" type="submit" name="submit" value="Search" />
           </td>
       </tr>
   </table>
</form>

You are going to have to do some editing to remove some of the colors' codes I have in there.

Link to comment
Share on other sites

Guest lorathon

Try This

<form action="<?php echo url('/Schedules');?>" method="post" enctype="multipart/form-data">
   <table>
       <tr>
           <td>Departure</td>
           <td>
               <select name="depicao">
                   <option value="">All</option>
<?php 
if (Auth::LoggedIn()) {
   $report = PIREPData::getLastReports(Auth::$userinfo->pilotid, 1, PIREP_ACCEPTED);
   if($report) {
       echo '<option value="'.$report->arricao.'">Your current location ('.$report->arricao.')</option>';
   }
   else {
       echo '<option value="'.Auth::$userinfo->hub.'">Your current location ('.Auth::$userinfo->hub.')</option>';
   }
}

$airports = OperationsData::getAllAirports();
foreach ($airports as $airport) {
   echo '<option value="'.$airport->icao.'">'.$airport->icao.' - '.$airport->name.'</option>';
}?>
               </select>
           </td>
       </tr>
           <td>Arrival</td>
           <td>
               <select name="arricao">
                   <option value="">All</option>
                   <?php
                       foreach ($airports as $airport) {
                           echo '<option value="'.$airport->icao.'">'.$airport->icao.' - ('.$airport->name.')</option>';
                       }
                   ?>
               </select>
           </td>
       </tr>
       <tr>
           <td>
               <input type="hidden" name="action" value="findflight" />
               <input title="Click here to search for flights" type="submit" name="submit" value="Search" />
           </td>
       </tr>
   </table>
</form>

1. Changed the form target to the standard "Schedules" module.

2. Filled the $airports with the airport array

3. Cleaned up some of the php tags

Should work but NOT tested

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...