Homework 7


What to Submit

Please submit a zip file containing:

  1. The .php files stated below
  2. An abet.sql file that will create the relations you use in your database. You are free to modify the attribute names/number of attributes in the relations so long as they support the functionality that I have specified. Do not modify the relation names since we will need to run a "drop" script after testing your database that drops your tables. Please also include test data in your abet.sql file (i.e., a series of INSERT statements that insert data into the relations). We cannot provide that filler data because we are giving you the flexibility to change attribute names and the number of columns in the relations so we cannot provide filler data that will match everyone's database. If you have created a database and tested it, then you can use the mysqldump command to create a .sql file that the TA can use to re-create your database. For example:
    mysqldump -h dbs.eecs.utk.edu -u yourUserName -p YourDataBaseName > abet.sql
    
    You will be prompted for a password and then the database will be dumped to abet.sql by writing out appropriate CREATE TABLE and INSERT commands that can re-create the database.

In this homework assignment you will design the php backend for your ABET web-site and start to add some functionality to the front-end:

  1. Write the save.php file that is needed to save the assessment data to the appropriate relations when the user presses the save button.

  2. Have your form on the front-end call this save.php script. You can make this happen by specifying "save.php" as the value for the action attribute in the <form> tag and having an input widget of type "submit" in your form. You should enter some sample data into your form so that the browser can transmit this sample data to your save.php script, which in turn will save it into the database.

  3. Design the login.php script for handling the login authentication and make your front page, the authentication page, interact with this .php script. For this assignment have the .php script output either a "Login succeeded" message or a "Login failed" message. This message will overwrite the login page.

  4. Create a number of php scripts that you will use to support the front end in the next homework assignment. These scripts should take command line arguments as inputs and echo the data in JSON form to the console:

    1. courses.php: takes an instructor id as a command line argument. Returns the courses the instructor is currently teaching. If the instructor is teaching courses for two different majors, you will have to distinguish between them in a way that a person can understand (e.g., ECE 255-CpE and ECE 255-EE).
    2. outcomes.php: takes a course and major as command line arguments and returns the outcomes associated with that course. Course should be either the ECE or COSC prefix with the number appended (e.g., COSC402 or ECE255) and the major should be one of CS, CpE, or EE.
    3. results.php: takes an instructorId, course, major and outcome as command line arguments and returns any pre-existing outcome results, assessment plans, and narrative summaries for that course. Course and major should be specified as in outcomes.php. outcome will be either C1, C2, ... or E1, E2, ... where C/E denotes the computer science or engineering outcome and the number is the number of the outcome.
    4. assessmentPlans.php: Takes a course and a major as command line arguments and returns all sections, both current and historical, that have taught that course.
    5. rubrics.php: Takes a course, a major, and an outcome as command line arguments and returns all rubrics from sections of this course, both current and historical, used to assess that outcome.

  5. Your scripts must guard against malicious attacks and special characters in the input data, like double quotes (") and single quotes ('), so make sure that you type check data when necessary and that you use PHP commands like addslashes/stripslashes and htmlentities/html_entity_decode to avoid problems.