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:
Your Hw2.zip folder should have a readme.txt file with all the names and ids for your group.
All pages produced by your app should be valid XHTML 5.
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.
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.
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.
The h1 tag with Promote-a-Cause in it on all pages should link back to the landing page.
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.
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.
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.
The Cancel button on the Add Cause Page should just go to the landing page without saving the cause.
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.
Cause titles on the landing should link to a Promote Page for that cause.
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.
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.
Clicking on the Return button on a Promote Page should return the user to the Landing Page.
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.
Clicking Confirm on a Delete Page should delete the corresponding info and return the user to the Landing Page.
Clicking Cancel on a Delete Page should return the user to the Landing Page without deleting the info.