|
home—lects—hws
D2L—breeze (snow day)
You are working for Lizard Entertainment, makers of the popular adventure game, .World of Wowcraft (“.W.o.W.”). In .W.o.W., players choose a type of character: either warrior, mage, priest, or rogue. Over the course of the game, their characters can learn various skills, depending on type: For example, the diplomacy skill (which is learnable only by rogues and priests), or the acrobatics skill (which is learnable only by rogues and warriors), etc.. Each skill is be tied to one of six built-in character traits: Strength, Intelligence, Wisdom, Dexterity, Constitution, and Charisma. Finally, each skill has a minimum-level (between 30 and 100 inclusive).
Your boss decides that a key feature of the game is that people can add their own skills to the game. Your job is to build a web-page that lets people enter new skills for the game to use. People will enter the name of the skill, a detailed description, which character-types can use it, what trait it's tied to, and their own name (to get the glory). When they submit their form, they will see a response page summarizing the information they entered.
An example of filling out the form | The result of the processing the form |
For this homework: Make a web-form at https://php.radford.edu/~yourUserName/itec325/hw03/skill-form.php which submits to skill-handle.php.
When printing values taken from the form, sanitize the HTML. A user should be able to enter (say) a description which includes characters like < and ' and newlines, and the resulting summary should show the same string as whas was entered, up to whitespace. (However, do show linebreaks, in the skill-description.)
Note that the checkboxes in skill-form.php should all have the same name attribute (and it should end in “[]”), so that you can retrieve it as an array in your form.
Your file
The page does need to contain (near the top) your name, a link to your skill-form, a link to this homework-assignment, and a “table of contents” — a list of links to later in the page, with the detailed information for each file.
TODO: Ian, show example.The source should be shown only if the current time is between 2014-Mar-07 23:59 and 2014-May-31 23:59; otherwise show a message along of the lines of “source code only available between 2014-Mar-07 23:59 and 2014-May-31 23:59.”
Call the function
(20pts) Write a function which takes in an array of strings (checkbox-descriptions) (and, a group-name), and returns a string that happens to be valid html for a series of checkboxes. The string should include newlines, and (if you want) each line might start with (say) 6 spaces, to serve as indentation.
For example, calling
Include at least two test cases;
you'll probably want to write a sample series of checkboxes by hand,
to serve as your expected-output.
Use label tags to group each checkbox with its adjacent text.
(10pts)
Include a function named (something like)
For example,
en | Hi |
de | 'Tag |
fr | 'Allo |
Include at least two test cases. I suggest first writing the raw html for the table, and then cutting/pasting that html in as the expected-result; this will help you decide what whitespace etc. you want your function to produce.
A function
No test cases required — this function prints, and does not return anything.
I am providing a file
utils.php
(and its tests utils-test.php)
which contains
a function
No test cases required — this function prints, and does not return anything.
I am providing a file
utils.php
(and its tests utils-test.php)
which contains
a function
I will visit the URL https://php.radford.edu/~yourUserName/itec325/hw03/index.php to grade your work. If that URL is not accessible, you will get a 0 for that portion of the grading!
Please run/check your program/html incrementally — don't write huge amounts of the assignment w/o even running it.
1the function to show-source a file is one of the few exceptions ↩
home—lects—hws
D2L—breeze (snow day)
©2014, Ian Barland, Radford University Last modified 2014.Mar.01 (Sat) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |