ITS Mobile API  2
ITS API
 All Data Structures Files Functions Variables Pages
Public Member Functions | Data Fields | Private Member Functions | Private Attributes
ITS_question_mobile Class Reference

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.
 

Detailed Description

Returns ITS question data.

Date
February 22, 2014
Author
Ricky Liou
Greg Krudysz
Gordon Sulc
Todo:
Capablity to generate randomized decimal numbers for calculated questions

Example constructor:

Example of fetching question data for question mode:

$Q_data = $Q->render_QUESTION(1, 'q');

Types: m | c | mc - | matching | calculated | multiple choice

Constructor & Destructor Documentation

__construct (   $student_id,
  $tb_name,
mysqli  $mysqli 
)

ITS_question_mobile class constructor.

Parameters
[in]$student_idUser id number
[in]$tb_nameMYSQL table name of where the question info are stored
[in]$mysqlimysqli object that contains the MYSQL database connection

Member Function Documentation

calculated_STR_randomize ( )
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.

get_ANSWERS_data_from_DB ( )
private

Loads question answer choices into $Q_answers_values.

Loads question answer choices into $Q_answers_values.

image_TO_path ( )
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.

Parameters
$q_numQuestion id number
randomize_MATCHING ( )
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.

Parameters
$q_numQuestion id number
$mode'q' for question, 'r' for review
Returns
$Q_num, $Q_type, $Q_title, $Q_question, $Q_image, $Q_answers, $Q_answers_values, $Q_category

The documentation for this class was generated from the following file: