Jump to content

Recommended Posts

Posted

hey guys,

I was wondering if any one can do or has a code for a mini schedule search in the sidebar..

An example that i found was flyuk.

http://www.flyuk.aero

If you look on the right side of the page, they have like a find a flight search and i was wondering if i could insert that into my sidebar.

Thanks

Posted

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.

Posted

I was able to get it on the side menu correctly, but somehow the Dep and Arr don't have the airport's name come up. If anyone has a solution that may solve this issue, please share.

Guest lorathon
Posted

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

Guest lorathon
Posted

I fixed the parse error in my other post. Recopy and insert and give it a try.

Guest lorathon
Posted

I removed the styling. You can now style it to fit. Does it return flights when searched?

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...