Returns ITS question data. More...
Public Member Functions | |
__construct ($student_id, $tb_name, mysqli $mysqli) | |
ITS_question_mobile class constructor. More... | |
render_QUESTION ($q_num, $mode) | |
Returns question data based on question id number and mode. More... | |
load_DATA_from_DB ($q_num) | |
Loads question data from the database into the class variables. More... | |
Data Fields | |
$tb_name | |
MYSQL table name of where the question info are stored. | |
$Q_type | |
Question type can take: |m|c|mc|. | |
$Q_num | |
Question ID number. | |
$Q_title | |
Question title. | |
$Q_question | |
Question string. | |
$Q_image | |
Question image number, if applicable. | |
$Q_answers | |
Number of total answers for a question. | |
$Q_category | |
Question category. | |
$Q_permutation | |
For matching, is the randomized order of right hand values. For calculated, are the randomized numbers. | |
$Q_answers_values = array() | |
Question answer choices. | |
Private Member Functions | |
calculated_STR_randomize () | |
For calculated questions replaces formula stored in $Q_question with the randomized numbers. More... | |
image_TO_path () | |
If question contains image, turn $Q_image into the appropriate file path name. More... | |
get_ANSWERS_data_from_DB () | |
Loads question answer choices into $Q_answers_values. More... | |
randomize_MATCHING () | |
For matching questions randomizes $Q_answers_values[1] (right hand answer choices) More... | |
Private Attributes | |
$id | |
ITS student ID. | |
$mysqli | |
Mysqli object that has MYSQL database connection. | |
$mode | |
Either question or review mode. | |
Returns ITS question data.
Example constructor:
Example of fetching question data for question mode:
Types: m | c | mc - | matching | calculated | multiple choice
__construct | ( | $student_id, | |
$tb_name, | |||
mysqli | $mysqli | ||
) |
ITS_question_mobile class constructor.
[in] | $student_id | User id number |
[in] | $tb_name | MYSQL table name of where the question info are stored |
[in] | $mysqli | mysqli object that contains the MYSQL database connection |
|
private |
For calculated questions replaces formula stored in $Q_question with the randomized numbers.
For calculated questions replaces formula stored in $Q_question with the randomized numbers.
|
private |
Loads question answer choices into $Q_answers_values.
Loads question answer choices into $Q_answers_values.
|
private |
If question contains image, turn $Q_image into the appropriate file path name.
If question contains image, turn $Q_image into the appropriate file path name.
load_DATA_from_DB | ( | $q_num | ) |
Loads question data from the database into the class variables.
$q_num | Question id number |
|
private |
For matching questions randomizes $Q_answers_values[1] (right hand answer choices)
For matching questions randomizes $Q_answers_values[1] (right hand answer choices)
render_QUESTION | ( | $q_num, | |
$mode | |||
) |
Returns question data based on question id number and mode.
$q_num | Question id number |
$mode | 'q' for question, 'r' for review |