Chris Pollett> Old Classses >
CS174

( Print View )

Student Corner:
[Final-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#2 --- last modified March 21 2021 21:41:19.

Solution set.

Due date: Mar 17

Files to be submitted:
  Hw2.zip

Purpose: To write a server-side application using PHP.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO1 -- Write HTML documents containing standard HTML elements including forms, tables, client-side scripts, and server-side scripts.

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

Description: For this homework you will develop a web app in PHP that allows users to find out about causes and up-vote the ones they like.

Promote-a-Cause

Current Campaigns

Thumbs UpTopicActions
802Save the Comma!
651Baby Shark Needs to be Heard
236Bring Back Secret Squirrel
Landing Page

Promote-a-Cause

:
Add Cause Page

Promote-a-Cause

Are you sure you want to delete the cause: Save the Comma! ?

Delete Page

Promote-a-Cause

Save the Comma!

Would you rather find inspiration in cooking, your family, and your pet or in cooking your family and your pet?

Promote Page
Here are the requirements for your project:
  1. Your Hw2.zip folder should have a readme.txt file with all the names and ids for your group.
  2. All pages produced by your app should be valid XHTML 5.
  3. Your app should work regardless of what folder under DOCUMENT_ROOT the grader chooses to grade it. If you have variables/constants that need to be set to ensure this, they should be in a file config.php which is require_once'd by your index.php file.
  4. All urls used by your app (for links, form data, etc) should be of one of the following forms:
    (1) index.php
    (2) index.php?a=some_activity&arg1=some_argument1
    (3) index.php?a=some_activity&arg1=some_argument1&arg2=some_argument2
    Here allowed activities are: landing, addCause, thumbsUp, and confirm. An example possible use of the arg1 variable might be to hold a cause title.
  5. Your index.php should have at least four functions: landingView, addCauseView, deleteView, and promoteView. These are supposed to draw the Landing Page, the Add Cause Page, the Delete Page, and the Promote Page, respectively, according to the mock-ups shown above. The only HTML that is output by your code, must be output in one of these four methods.
  6. The h1 tag with Promote-a-Cause in it on all pages should link back to the landing page.
  7. On the landing page, if a using clicks on the ⊞ link, they will be taken to the Add Cause Page which should render as in the example above.
  8. Clicking the Save button on the Add Cause Page should save the text in the title and the textarea fields as a new sub-array element of an array which is json_encode'd as a string and stored in a causes.txt in your web application's folder.
  9. Besides having the title and description of a cause a sub-array element should also have a count of thumbs up for that cause which should be initially zero when the cause is first created.
  10. The Cancel button on the Add Cause Page should just go to the landing page without saving the cause.
  11. The Landing Page should list the titles of all causes that have been saved to causes.txt in descending order of thumbs up as shown in the Landing Page figure above.
  12. Cause titles on the landing should link to a Promote Page for that cause.
  13. The Promote Page for a cause should display the title and description of that cause in way to similar to that shown in the example figure above.
  14. Clicking on the Thumbs Up button on a Promote Page should increment that causes thumbs up count in its sub-array in causes.txt. Then is should return the user to the Landing Page.
  15. Clicking on the Return button on a Promote Page should return the user to the Landing Page.
  16. If a Delete button on the Landing Page is clicked, the user should be taken to a Delete Page. This should have the text as in the mock-up above except that the name of the title should correspond to the Delete button clicked.
  17. Clicking Confirm on a Delete Page should delete the corresponding info and return the user to the Landing Page.
  18. Clicking Cancel on a Delete Page should return the user to the Landing Page without deleting the info.
Point Breakdown
Items (e), and (h) above are all worth 1pt4pts
All other items above are worth a 1/2pt6pts
Total10pts