Chris Pollett> Old Classses >
CS174

( Print View )

Student Corner:
[Final Exam-PDF]

[Submit Sec1]
[Grades Sec1]

[Lecture Notes]
[Discussion Board]

Course Info:
[Texts & Links]
[Description]
[Course Outcomes]
[Outcomes Matrix]
[Course Schedule]
[Grading]
[Requirements/HW/Quizzes]
[Class Protocols]
[Exam Info]
[Regrades]
[University Policies]
[Announcements]

HW Assignments:
[Hw1] [Hw2] [Hw3]
[Hw4] [Hw5] [Quizzes]

Practice Exams:
[Midterm] [Final]

HW#3 --- last modified October 12 2020 16:56:05.

Solution set.

Due date: Oct 30

Files to be submitted:
  Hw3.zip

Purpose:To write an application that uses databases and uses the MVA design pattern

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO3 -- Write server-side scripts that process HTML forms.

CLO5 -- Develop and deploy web applications that involve components, web services, and databases.

Specification:

For this homework you will write an app Movie-Reviews a website that allows users to post and read movie reviews. Here are some mock-ups of how the site should look:

Landing Page

Movie Reviews/Horror

Reviews

A Genre Page.

Movie Reviews

Add Genre Page.

Movie Reviews/Horror

Add Review

:
Add Review Page.

Movie Reviews/Horror

Review: The Stuff

Yuppies eating stuff that oozes from the ground - what could possibly go wrong?
Display Review Page
Here are the requirements for your project:
  1. Your Hw3.zip folder has a readme.txt file with all the names and ids for your group.
  2. All the web pages you output validate as XHTML 5.
  3. Your project is written using namespaces. You only create variables, arrays, objects, define new classes, etc. in the namespace cool_name_for_your_group\hw3 and subnamespaces thereof.
  4. Your project directory structure and urls that are linked to by your project are as follows:
    index.php -- entry point into your project. No other file in your project is directly linked-to.
        All urls used as links by your project are in the format (including links to images):
        BASE_URL/index.php?c=name_of_controller&m=name_of_method&arg1=value_for_arg1& ...&argn=value_for_argn 
    src
     |-configs |- Config.php contains a class with constants for things like 
     |         |       database user, password, host, port, etc. Basically, 
     |         |       it should have anything you think the grader might need
     |         |       to get your program running on the grader's machine.
     |         |- CreateDB.php can be run from the command-line to make a good initial
     |                database.
     |-controllers -- contains all the controller classes you write, one per file
     |-models -- contains all the model classes you write, one per file
     |-resources -- contains any resources used by your app such as images
     |-styles -- has any external stylesheets you need
     |-views -- contains all the view classes you write, one per file
          |-elements -- contains all the element classes you write, one per file
          |-helpers -- contains all the helper classes you write, one per file
          |-layouts -- contains all the helper classes you write, one per file    
    
  5. Typing php CreateDb.php while in a shell in the configs folder creates an initial Mysql Database with tables created in BCNF. The tables' schemas is reasonable for storing and retrieving any data similar to that given in the mock-up views above.
  6. Your project defines base classes: Controller, Model, View, Element, and Helper. The namespaces for these and their subclasses should be respectively: cool_name_for_your_group\hw3\controllers, cool_name_for_your_group\hw3\models, cool_name_for_your_group\hw3\views, cool_name_for_your_group\hw3\views\elements, and cool_name_for_your_group\hw3\views\helpers.
  7. Your project uses the Model View Adapter pattern that we have discussed in class. This item is for overall how well you succeeded at this. What this means for particular classes will be described in the next several points.
  8. Only controller classes directly handle request/form data. Controllers use this information to invoke model methods that make database calls to get/set/update info in the database, then choose a view, instantiate it, and call its render() method to display a web page back to the requesting browser.
  9. Only subclasses of Model interact with the database. The base Model class has methods for performing the initial connection to the database. Model classes have methods to marshal a particular kind of object from one or more tables, and to take already created objects and unmarshal them persistently into the database.
  10. Only subclasses of View, Element, Helper, Layout are allowed to render HTML. Each view is used to render a particular kind of whole web page. Elements are used to render a particular portion of a web page that might occur on several kinds of web pages (for example, a navigation block). Helpers have methods which make it easy to output the HTML for particular kinds of widgets (say a method that takes an array and uses it to output the HTML for a dropdown with the elements coming from the array). Layouts are used to output common header and footer HTML that might be used by several views.
  11. On the Landing page and genre page, genre links take one to the page of the appropriate genre.
  12. Review links take one to the appropriate Display Review page.
  13. Next to a review link is the date on which that review was written.
  14. The main landing page corresponds to viewing all genres. The landing page displays the most recently added reviews in any genre.
  15. [-] links next to a genre only appear on the landing page and indicate the genre currently doesn't have reviews. Clicking the link deletes that genre. [-] links next to a review link only appear on genre pages. Clicking this link deletes theh review. As [-] by itself doesn't say whhat this link does, you should implement some way of making these links WAI compliant.
  16. Links on each pages main heading take one to the appropriate genre or the landing page. I.e., in Movie Reviews/Horror, the Movie Reviews link takes one to the landing page, the Horror link takes one to the Horror genre page.
  17. Reviews are listed from newest to oldest, genres are listed in alphabetical order. Sorting is done at the database query level, not after the data is retrieved.
  18. The link to the Add Genre page is only on the landing page. The Add Genre page allows a new genre to be added to the list of current movie genres. If the name is blank, or sanitizes using filter_var to blank no new genre is added. In both cases, after the action is performed the current landing page is shown.
  19. The Add Review page allows a new review to be added to the current genre. The link to an Add Review page does not appear on the landing page, but does appear on every genre page. If either field is blank, or sanitizes using filter_var to blank no new review is added. In both cases, after the action is performed the current genre page is shown.
  20. The Display Review page shows a previously created review as illustrated in the mock-ups above.
Point Breakdown
Items (a)-(t) are each worth (1/2pt). If an item involves several sentences, then all of the sentences must be accomplished to receive the 1/2 pt. 10pts
Total10pts