ITS_Solution Class


Files used:

MySQL Tables:


==================================================================

solutions.php

Main page where all solution actions take place.



classes/ITS_solution.php

Main class file
     __construct($id)
     //=============================================================//
     // Constructor function which takes in the user.id() of the person logged on.
     //=============================================================//


     showIndex()
     //=============================================================//
     // Show Index
     // Description: Shows the Index for the Solutions page by showing
     // The dropdown list of questions with solutions and showing the
     // form to insert solutions
     //
     // Similar to the old index.php
     //=============================================================//


     viewSolution($QNUMVAR)
     //=============================================================//
     // View solution of a question
     // Description: Given an input of the id of the question, this function
     // displays the question with which is the followed by the
     // Hints/Solutions/Detailed solutions with their corresponding ratings
     // and verifications
     //
     // Similar to the old demo2.php
     //=============================================================//


     enteredFromIndex($QNUMVAL, $HintVAL, $SolutionVAL, $DetailedVAL)
     //=============================================================//
     // Parse solutions entered from showIndex()
     // Description: Given the question number, the hint, the solution,
     // and the detailed solution, this function inserts each of the
     // Hint/Solution/Detailed into the database.
     //
     // Similar to the old Entered.php
     //=============================================================//


     solutionEditor($qNumVAL, $NumVAL, $stypeVAL, $IDVAL, $addVAL)
     //=============================================================//
     // Edit menu for a Hint/Solution/Detailed
     // Description: Given the question number, the hint/sol/det number,
     // the type of solution, the id, and an add variable, this function displays
     // an editor for the given Hint/Solution/Detailed.
     //
     // NOTE* add variable is not needed if JUST editing a question. It
     // is used for adding a solution coming from the viewSolution Page.
     //
     // Similar to the old Editor.php
     //=============================================================//


     enteredFromEditor($idNumVAL, $qNumVAL, $stypeVAL, $DelVAL, $textVAL)
     //=============================================================//
     // Parse solutions edited from solutionEditor()
     // Description: Given the id Number (in solutions table), the question number,
     // the solution type, a delete variable, and the text, this function parses through
     // whatever was edited and then either DELETES, UPDATES, or ADDS the question
     // to the database
     //
     // Similar to to the old Edited.php
     //=============================================================//


     enterRatings($newRatingVAR, $IDVAR, $qNumVAR, $VerVAR)
     //=============================================================//
     // Parse ratings coming from viewSolution()
     // Description: Given the new rating, the ID of the solution,
     // the question number, and a verification variable, this function
     // parses the rating and either verifies the solution or inserts/updates
     // the rating in the database.
     //
     // Similar to the old Rating.php
     //=============================================================//


     addHint($QNUMVAL, $HintVAL)
     //=============================================================//
     // Add a hint to a question ID
     // Description: Given an input of a question_id and the text, this function
     // inserts the hint to the database.
     //
     //=============================================================//


     addSolution($QNUMVAL, $SolutionVAL)
     //=============================================================//
     // Add a solution to a question ID
     // Description: Given an input of a question_id and the text, this function
     // inserts the solution to the database.
     //
     //=============================================================//


     addDetailed($QNUMVAL, $DetailedVAL)
     //=============================================================//
     // Add a Detailed Solution to a question ID
     // Description: Given an input of a question_id and the text, this function
     // inserts the detailed solution to the database.
     //
     //=============================================================//


     deleteSol($idNum)
     //=============================================================//
     // Delete a Hint/Solution/Detailed from the database
     // Description: Given the id of the hint/sol/det *NOT question_id*,
     // this function deletes the hint/sol/det from the database
     //
     //=============================================================//


     addGeneralSol($qNum, $stype, $textVAL)
     //=============================================================//
     // Adds a Hint/Sol/Det to the database
     // Description: Given the question_id, the stype, and the text,
     // this function inserts the hint/sol/det into the database.
     //
     // *NOTE* stype NEEDS to be either Hint, Sol, or Det. <--Case sensitive
     //
     //=============================================================//


     updateSol($qNum, $idNum, $stype, $textVAL)
     //=============================================================//
     // Updates a Hint/Sol/Det in the database
     // Description: Given the question_id, the id, the stype, and the text,
     // this function updates the hint/sol/det in the database at location id.
     //
     // *NOTE* id is the ID in the solutions table
     // *NOTE* stype NEEDS to be either Hint, Sol, or Det. <--Case sensitive
     //
     //=============================================================//



classes/ITS_Solution_question.php

Helper class for viewing solutions



classes/ITS_Solution_table.php

Helper class for viewing solutions



css/ITS_Solution_solution.css

Main css file used.



css/ITS_Solution_warmup.css

Additional css file used.



css/ITS_Solution_pagestyles.css

Additional css file used. Might not be used.



solutions

MySQL Table which holds the current solutions to a question.
     id
     //=============================================================//
     // Auto-incrementing id
     // int() Primary Key
     //=============================================================//


     question_id
     //=============================================================//
     // ID of the question
     // int(11)
     //=============================================================//


     stype
     //=============================================================//
     // Hint/Sol/Det
     // varchar(11)
     //=============================================================//


     text
     //=============================================================//
     // Text of the Hint/Sol/Det
     // varchar(4096)
     //=============================================================//


     rating
     //=============================================================//
     // Current rating
     // float
     //=============================================================//


     numratings
     //=============================================================//
     // Number of ratings
     // int(11)
     //=============================================================//


     verified
     //=============================================================//
     // 0 or 1
     // 0 for unverified, 1 for verified
     // int(1)
     //=============================================================//


     users_id
     //=============================================================//
     // user.id() obtained from the session
     // int(11)
     //=============================================================//



solutionsLog

MySQL Table which holds the log of the solutions. It can log Adding, Updating, Deleting, Rating.
     id
     //=============================================================//
     // Auto-incrementing id
     // int(11) Primary Key
     //=============================================================//


     question_id
     //=============================================================//
     // ID of the question
     // int(11)
     //=============================================================//


     stype
     //=============================================================//
     // Hint/Sol/Det
     // varchar(11)
     //=============================================================//


     text
     //=============================================================//
     // Text of the Hint/Sol/Det
     // varchar(4096)
     //=============================================================//


     author
     //=============================================================//
     // user.id() obtained from the session.
     // varchar(11)
     //=============================================================//


     timestamp
     //=============================================================//
     // time()
     // varchar(30)
     //=============================================================//


     actionTaken
     //=============================================================//
     // Added, Updated, Deleted, Rated #
     // varchar(30)
     //=============================================================//