Prepared by Sandy Nichols November 21, 2006 El Azteca
Download
Report
Transcript Prepared by Sandy Nichols November 21, 2006 El Azteca
Mexican Restaurant
Prepared by Sandy Nichols
November 21, 2006
1
Table of Contents
Executive Summary
Site Map
Database Structure
Menu Page
Flowchart
Pseudo Code
Admin Page
Flowchart
Pseudo Code
Edit Records
Flowchart
Pseudo Code
Delete Records
Flow Chart
Pseudo Code
3
4
5
6
7
8
9
10
11
12
13
2
Executive Summary
El Azteca Mexican Restaurant needs a website
that showcases their menu, provides directions,
and gives a general presence on the web.
This will be achieved by storing the menu in a
MySQL database and having PHP dynamically
write to the Menu page. The restaurant also
needs a way to periodically post specials
themselves. Advertised specials are by way of
coupons circulated throughout the community.
By building a photo gallery, they will be able to
frequently upload an image of the coupon directly
to their Home page. This approach preserves the
restaurant’s current marketing strategy while
providing another means of coupon distribution
through a web presence.
Current Coupon
The Definitions page will define what is in
popular Mexican dishes. If a person does not
know what a Chalupa is, they can go to the
page and read “flat tortilla with beans sprinkled
with cheese and topped with guacamole salad.”
Definitions will be taken from the current printed
menu. If restaurant is willing to have the food
photographed, this page could have an
accompanying photo with the definitions.
The about page will be a static page with some
light history about the company, coupled with
photos of beautiful people dining and drinking
on the outdoor patio and listening to the
Mariachi band. This page will be designed to
give an overall feel of the atmosphere. This
page may include pictures of long-term servers
willing to be photographed.
Currently the proposed site is five pages, but
should be considered scaleable if future needs
arise. Additions could be a feature on the many
brands of tequilla sold at the bar or a feature on
Mexican specialty drinks. Another enhancement
could be the ability to take online secured
orders for carry-out. Flash components could
add another level of interactivity, like make your
own virtual tacos game.
3
Site Map
Specials
Coupons
Dynamic
Photo Gallery
Dynamic
Definitions
of Mexican
food
History
Patio pics
Staff pics
Directions
Contact
Static
Static
Static
Database
4
Database Structure
MENU
P H O T O G A L L E R Y (for coupons)
5
Flowchart for Menu Page
Visit Menu page
Connect to
MySQL
Select db
to work with
Query DB by
Category
Store in variable
Store # of
records in
variable
stop
“No records”
Is # records
>0 ?
Fetch record
Echo
Record
stop
6
Pseudo Code for Menu Page
Visit Menu page
•
•
•
•
•
•
•
•
Connect to
MySQL
Select db
to work with
Query DB by
Category
Store in variable
OPEN DB ElAzteca
READ DB
SET results to a variable
SET # of results to variable
DOWHILE # >0
READ results from variable
WRITE results to page
CLOSE file
Store # of
records in
variable
stop
“No records”
Is # records
>0 ?
Fetch record
stop
Echo
Record
7
Flowchart for Admin Page
Visit Admin url
Successful
NO
login
YES
Admin
Page
Add/Edit/Delete
Photo
Gallery
Add/Edit/Delete
Add/Edit/Delete
Menu
Database
Stop
8
Pseudo Code for Admin Page
• DO login verification
Visit Admin url
Successful
NO
login
YES
Admin
Page
Add/Edit/Delete
Photo
Gallery
Add/Edit/Delete
Add/Edit/Delete
Menu
Database
Stop
9
Flowchart for Editing Records
start
NO
“Record does
not exist”
Is record
id set?
NO
stop
YES
Has form
Been submitted?
Show
form
Update Record
DB Where
id =$_GET[‘id’]
showForm()
stop
Connect to DB
NO
Start
Session
Select DB
Query DB
For record
Output form
With data
In elements
YES
Store success
Message in
Session Var
Redirect
To admin
page
Errors?
YES
“Query Error”
Output SQL
& Mysql_error()
stop
stop
End
showForm()
10
Pseudo Code for Editing Records
start
NO
“Record does
not exist”
Is record
id set?
NO
stop
showForm()
Show
form
stop
Connect to DB
Select DB
Query DB
For record
Output form
With data
In elements
• OPEN record id
• READ record id
YES
• IF id not set THEN WRITE error
• IF id set THEN continue
YES • READ record id
Has form
Been submitted?
• IF id not submitted THEN show form
Update Record
• IF id submitted THEN WRITE DB
DB Where
id =$_GET[‘id’]
• END-IF
• IF errors THEN WRITE error
NO
YES
Errors?• IF no errors THEN WRITE success
• END-IF
Start
Session
• OPEN
page
“QueryAdmin
Error”
Output SQL
•
CLOSE
&
Mysql_error()
Store success
Message in
Session Var
Redirect
To admin
page
stop
stop
End
showForm()
11
start
Flowchart for Deleting Records
NO
Is record id set?
“No such record”
YES
NO
stop
Delete Var Set?
Query DB
For Record
Delete Record
From DB Table
Where id=
$_GET[‘id’]
“Are you sure?”
Show Record
Delete?
NO
YES
YES
NO
Redirect
To admin
page
Start
Session
stop
Store success
Message in
Session Var
Redirect
To admin
page
stop
Errors?
YES
“Query Error”
Output SQL
& Mysql_error()
stop
12
start
Pseudo Code for Deleting Records
NO
• READ record id
“No such record”
• IF id not set THEN WRITE error
• IF id set THEN continue
stop
• END-IF
•IF delete not confirmed, THEN confirm
•IF delete confirmed THEN delete
• END-IF
• IF errors THEN WRITE error
Delete?
• IF no errors THEN WRITE success
• OPEN Admin page
NO
• END-IF
Redirect
To
admin
• CLOSE
page
stop
Is record id set?
YES
NO
Delete Var Set?
YES
Query DB
For Record
Delete Record
From DB Table
Where id=
$_GET[‘id’]
“Are you sure?”
Show Record
YES
NO
Start
Session
Store success
Message in
Session Var
Redirect
To admin
page
stop
Errors?
YES
“Query Error”
Output SQL
& Mysql_error()
stop
13
14