View Airports

<<Back to Main Menu

Description:
This lists all the airports in the database. Each has an associated link to 'View Airport' (for more information). There are options to sort the list in various ways.

Accessible by:
Managers and customers

Accessed from:
Main Menu

Input parameters:
sortBy
ascending

Output
List of Airports with links to View Airport. This list is part of a View Airports Form, which allows the manager to sort the list in various ways, submitting to Itself.
The options are to sort by code, name, city, revenue (both gross and average), number of routes.
These can be sorted ascending or descending.
Customers are shown all non-revenue and cannot sort the data.

Pseudo Code:

get/create session
if ('username' param in the session is set) {
   get parameters from the form
   get airports data from the database

   if (there's no 'sortBy' variable) {
      display the list
   }
   else if (sortBy == 'name') {
      sort the list by 'name'
   }
   else if ((sortBy == 'code') OR ('usertype' param in the sesion == 'c'){
      sort the list by 'code'
   }
   else if (sortBy == 'city') {
      sort the list by 'city'
   }
   else if (sortBy == 'GrossRev') {
      sort the list by revenue generated by each airport
   }
   else if (sortBy == 'AvgRev') {
      sort the list by the average revenue per day generated by each airport
   }
   else if (sortBy == 'route') {
      sort the list by the number of routes servicing it
   }
   if (ascending == 'yes') {
      reverse the list
   }
   if ('usertype' param in the session == 'c') {
      for each list item {
         display airport code, name and city, with links to View Airport
      }
   }
   else {
      for each list item {
         display airport, code, name, city and revenue information, with links to View Airport
      }
   }
}
else {
   error message to say user must be logged in
}