CS637 Homework 3 Pizza Project and PHP, more SQL

1. Page flows--UI analysis. Read about the Pizza Project,. This is the running example for cs636 (in Java) as well as the project for cs637 (in PHP). The last version, "pizza3", is the final web app, already implemented in Java so we can see how it is supposed to work. See pizzaUI for images of the 8 major pages of the web app. Study the pages and see how a user can navigate among them. Read pp. 463-464 in Duckett about the related topic of wireframes. Draw a page flow graph of the pages as navigated, with arrows showing use of links or buttons to get from one page to another. Each page is drawn as a rectangle with its links drawn as line segments and buttons as little boxes. Text inputs show as narrow rectangles. Radio buttons and check boxes also show. In other words, show all user input controls, plus important data tables, but don't worry about representing the lines of text of the static HTML. Draw the arrow from the link or button to the outer rectangle representing the other page, or back to this page. For an example, see Chapter 4 product manager page flow. There are 9 major pages in this pizza app: Home, Manage Toppings, Add Topping, Manage Sizes, Add Size, Manage Orders, Manage Days, Student Welcome, Pizza Order Form, so there should be 9 nodes (rectangles) in your graph, with arrows between them as appropriate.

2. Guitar Shop DB

Study the script for building my_guitar_shop2 on pp 568-571 and online in book_apps/_create_db. The online version has inserts as well as create tables.

  1. Find all the foreign keys (FKs) and list them in order seen in this file, by table and column. Note that they do not have FK constraints.
  2. Analyze the relationships in this database as 1-1, N-1, or N-N (one to one, many to one, or many to many). If it is N-1, say which side is the "many" side, and what foreign key expresses the relationship.
    1. orders and orderItems
    2. orders and customers
    3. orders and products
    4. products and categories
    5. customers and addresses

3. SQL. Load both textbook databases into your mysql using _create_db/create_db.sql if you haven’t already. Write queries on my_guitar_shop2 as follows and show the queries and their output in your hw paper. You can use phpMyAdmin to try out the queries, or write a .sql file and use mysql at the command line. For queries, report the SQL and results, if any.

  1. Find all customerIDs with email addresses ending with "gmail.com".
  2. Find all order-items of order 2 (orderID = 2) and list their product id and quantity.
  3. List all order ids and order dates for the customer with email christineb@solarone.com.
  4. Find all product ids purchased by the customer with email christineb@solarone.com (i.e., find the orderitems)
  5. Find all products (product codes) where the purchase preceded product’s date-added (to check data consistency). Avoid duplicates in the result.
  6. Find the product that was bought the highest number of times.
4.  Pizza1-setup.
  1. Download pizza1_setup.zip and unzip it, then copy it to your htdocs/cs637/xxxx/pizza1 for development, where xxxx is your topcat username. This way you won't have to edit it to get it to work on topcat when you deliver it there. Alternatively, put it elsewhere and get Netbeans to copy it to this place for deployment.
  2. Use pizza1’s database/dev_setup.sql and database/createdb.sql to load you own mysql pizzadb. Report your commands and success or problems. Show the resulting output of showdb.sql.
  3. In pizza1, edit database.php to replace xxxx with your cs.umb.edu username. (This will be used for executions on topcat.) Browse to localhost/cs637/xxxx/pizza1 to try it out.success or problems. It should be able to list the toppings, but not much else.
  4. Set up an Netbeans projects for pizza1-setup and pizza1.  Then show the edit of database.php done in c. as a file “diff”.by selecting both file versions in Projects, right-clicking and using Tools>Diff.  Report on success or problems. Also run the project from Netbeans and report on success or problems.

5.  A Little start on pizza1. pizza1_setup has a start on the toppings manager. Finish this part of the project by adding the capability of adding a new topping. Follow the implementation of adding a product to ch05_guitar_shop: add a function add_topping to topping_db.php.  See product_db.php, listed on pg. 171. Then call add_topping from topping/index.php, just as add_product is called from product_manager/index.php, shown on pg. 173. Show topping_db.php and topping/index.php in your homework paper.

By midnight, Tuesday, March 7, deliver your project to your Apache directory on topcat.cs.umb.edu. User joe has /var/www/html/cs637/joe, a private directory in the web server’s site, which is rooted at /var/www/html. Also, run createdb.sql on your mysql database (joedb for user joe, etc.) on topcat to set up for the app.  Note that you don’t need a tunnel to access your web app because Apache uses port 80, an open port on topcat, so just browse to http://topcat.cs.umb.edu/cs637/joe/pizza1, for user joe. Once it’s running, add another topping of your choice. See http://topcat.cs.umb.edu/cs637/eoneil/pizza1 for pizza1_setup deployed using eoneil1's mysql database.If you have trouble with the delivery, please see me during office hours Wednesday, March 8. 

Make sure that your directory structure looks like this:
/var/www/html/cs637/joe   –top level directory for user joe
/var/www/html/cs637/joe/pizza1 – top of pizza1 project
/var/www/html/cs637/joe/pizza1/topping/index.php  one of the project files
… all the other files of pizza1