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

Keeps track of the ITS screen state. More...

Public Member Functions

 __construct ($id, $term, $chapter_num, $tb_name, $tb_user, mysqli $mysqli)
 ITS_screen_mobile class construct. More...
 
 set_IDR ($del_index)
 Increments, decrements, or resets the review index array. More...
 
 get_SCREEN ($mode)
 Returns JSON array of the screen content based on the provided mode. More...
 
 record_QUESTION ($qid, $qtype, $answered, $event)
 Writes query to record user answer and permutation. More...
 

Data Fields

 $mysqli
 MYSQL database connection object.
 
 $id
 User id.
 
 $term
 Current ITS term.
 
 $chapter
 Current chapter number.
 
 $review_index = 0
 Index of current position in review array.
 
 $review_index_max = 0
 Maximum index of review array.
 
 $tb_name
 MYSQL table name of where the question info are stored.
 
 $tb_user
 Prefix of individual user tables.
 
 $time
 Time that user first sees questions.
 
 $qNum
 Current question number.
 
 $mc_answer_num
 Number of multiple choice answers.
 
 $m_L_field_num
 Number of left side values for matching questions.
 

Private Member Functions

 random_QNUM_from_CHAPTER ()
 Returns random question id number from current chapter. More...
 
 get_CATEGORY ($ch)
 Constructs the WHERE clause partial query that is used to query information about questions in a desired chapter. More...
 
 get_QUESTION_score ($qid, $qtype, $qanswer)
 Calculates question score. More...
 
 get_MC_statistics ($qid)
 Fetches array of percentages of all current term student answers for each answer in order. More...
 

Detailed Description

Keeps track of the ITS screen state.

Date
February 26, 2014
Author
Ricky Liou
Greg Krudysz
Todo:

Split into another class, such as ITS_submit_mobile class

Properly record skips

Constructor & Destructor Documentation

__construct (   $id,
  $term,
  $chapter_num,
  $tb_name,
  $tb_user,
mysqli  $mysqli 
)

ITS_screen_mobile class construct.

Parameters
[in]$idUser id
[in]$termCurrent ITS term
[in]$chapter_numCurrent chapter number
[in]$tb_nameMYSQL table name of where the question info are stored
[in]$tb_userPrefix of individual user tables
[in]$mysqliMYSQL database connection object

Member Function Documentation

get_CATEGORY (   $ch)
private

Constructs the WHERE clause partial query that is used to query information about questions in a desired chapter.

Parameters
[in]$chChapter number
Returns
The WHERE clause partial query that is used to query information about questions in a desired chapter
get_MC_statistics (   $qid)
private

Fetches array of percentages of all current term student answers for each answer in order.

Parameters
[in]$qidQuestion id number
Returns
array of percentages of all current term student answers for each answer in order
get_QUESTION_score (   $qid,
  $qtype,
  $qanswer 
)
private

Calculates question score.

Parameters
[in]$qidQuestion id number
[in]$qtypeQuestion type
[in]$qanswerUser answer to question
get_SCREEN (   $mode)

Returns JSON array of the screen content based on the provided mode.

Parameters
[in]$mode's' for score, 'q' for question, 'r' for review
Returns
JSON array of content, see ITS_ajax_mobile.php
random_QNUM_from_CHAPTER ( )
private

Returns random question id number from current chapter.

Returns
Random question id number from current chapter
record_QUESTION (   $qid,
  $qtype,
  $answered,
  $event 
)

Writes query to record user answer and permutation.

Parameters
[in]$qidQuestion id number
[in]$qtypeQuestion type
[in]$answeredUser answer to question
[in]$event1 = user submitted score, 0 = user skip
set_IDR (   $del_index)

Increments, decrements, or resets the review index array.

If the index tries to go out of bounds, the index will remain the same.

Parameters
[in]$del_index1 to increment index, -1 to in decrement index, 0 to set index to 0
[out]$end_reachedEqual to 1 when end of review index array has been reached, -1 when beginning has been reached, 0 otherwise

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