View Hotels
<<Back to Main Menu
Description:
Displays a list of all hotels in the database
Accessible by:
Managers
Accessed from:
Main Menu
Delete Hotel Form if user decides not to delete the hotel.
Input parameters:
sortBy
ascending
Output
List of hotels, with links to Edit Hotel Form or Delete Hotel.
This list is part of a View Hotel Form, which allows the manager to sort the list in various ways, submitting to
Itself.
The sort options are to sort by name, country and city. The sort can be ascending or descending.
Pseudo Code:
get/create session
if ('usertype' param in session == 'm') {
get parameters from the form
get Hotel data from the database
if (there's no 'sortBy' variable) {
display the list in a View Hotels Form
}
else if (sortBy == 'name') {
sort the list by the hotel's name
if (ascending == 'yes') {
reverse the list
}
display the list in a View Hotels Form
}
else if (sortBy == 'city') {
sort the list by the city the hotel is in
if (ascending == 'yes') {
reverse the list
}
display the list in a View Hotels Form
}
else {
display an error message
}
}
else {
error message to say user must be a manager
}