Moodle  2.2.1
http://www.collinsharper.com
question_flags Class Reference

Static Public Member Functions

static get_postdata (question_attempt $qa)
static update_flag ($qubaid, $questionid, $qaid, $slot, $checksum, $newstate)
static initialise_js ()

Static Protected Member Functions

static get_toggle_checksum ($qubaid, $questionid, $qaid, $slot, $user=null)

Detailed Description

Contains the logic for handling question flags.

Definition at line 556 of file lib.php.


Member Function Documentation

static get_postdata ( question_attempt qa) [static]

Get the postdata that needs to be sent to question/toggleflag.php to change the flag state. You need to append &newstate=0/1 to this.

Returns:
the post data to send.

Definition at line 579 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_toggle_checksum ( qubaid,
questionid,
qaid,
slot,
user = null 
) [static, protected]

Get the checksum that validates that a toggle request is valid.

Parameters:
int$qubaidthe question usage id.
int$questionidthe question id.
int$sessionidthe question_attempt id.
object$userthe user. If null, defaults to $USER.
Returns:
string that needs to be sent to question/toggleflag.php for it to work.

Definition at line 565 of file lib.php.

Here is the caller graph for this function:

static initialise_js ( ) [static]

Definition at line 613 of file lib.php.

static update_flag ( qubaid,
questionid,
qaid,
slot,
checksum,
newstate 
) [static]

If the request seems valid, update the flag state of a question attempt. Throws exceptions if this is not a valid update request.

Parameters:
int$qubaidthe question usage id.
int$questionidthe question id.
int$sessionidthe question_attempt id.
string$checksumchecksum, as computed by get_toggle_checksum() corresponding to the last three arguments.
bool$newstatethe new state of the flag. true = flagged.

Definition at line 599 of file lib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations