Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
qtype_ordering_test_helper Class Reference

Test helper for the ordering question type. More...

Inheritance diagram for qtype_ordering_test_helper:
question_test_helper

Public Member Functions

 get_ordering_question_data_moodle ()
 Get the raw data that corresponds an ordering question.
 
 get_ordering_question_form_data_moodle ()
 Get the form data that corresponds an ordering question.
 
 get_test_questions ()
 Get the question types that this helper can handle.
 
 make_answer (int $id, string $text, int $textformat, int $order, bool $addmd5=false)
 Create an answer record to use in a test question.
 
 make_ordering_question_moodle ()
 Makes an ordering question to sort the words Modular Object Oriented Dynamic Learning Environment.
 

Static Public Member Functions

static get_question_editing_form ($cat, $questiondata)
 Set up a form to create a question in $cat.
 
static get_response (question_definition $question, array $items)
 Return an array of answer codes in the order of given response.
 

Detailed Description

Test helper for the ordering question type.

The class has code to generate question data structures for sample ordering questions.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_ordering_question_data_moodle()

qtype_ordering_test_helper::get_ordering_question_data_moodle ( )

Get the raw data that corresponds an ordering question.

The question is to sort the words Modular Object Oriented Dynamic Learning Environment.

Return values
stdClasssimulated question form data.

◆ get_ordering_question_form_data_moodle()

qtype_ordering_test_helper::get_ordering_question_form_data_moodle ( )

Get the form data that corresponds an ordering question.

The question is to sort the words Modular Object Oriented Dynamic Learning Environment.

Return values
stdClasssimulated question form data.

◆ get_question_editing_form()

static question_test_helper::get_question_editing_form ( $cat,
$questiondata )
staticinherited

Set up a form to create a question in $cat.

This method also sets cat and contextid on $questiondata object.

Parameters
object$catthe category
object$questiondataform initialisation requires question data.
Return values
moodleform

◆ get_response()

static qtype_ordering_test_helper::get_response ( question_definition $question,
array $items )
static

Return an array of answer codes in the order of given response.

Parameters
question_definition$questionThe question object.
array$itemsThe array of input items.
Return values
arrayThe array of answer codes in the order of given response.

◆ get_test_questions()

qtype_ordering_test_helper::get_test_questions ( )

Get the question types that this helper can handle.

Return values
arraythe question types.

Reimplemented from question_test_helper.

◆ make_answer()

qtype_ordering_test_helper::make_answer ( int $id,
string $text,
int $textformat,
int $order,
bool $addmd5 = false )

Create an answer record to use in a test question.

Parameters
int$idthe id to set.
string$text
int$textformatone of the FORMAT_... constants.
int$orderthe position in order, numbered from 1.
bool$addmd5whether to add the md5key property.
Return values
stdClassthe answer.

◆ make_ordering_question_moodle()

qtype_ordering_test_helper::make_ordering_question_moodle ( )

Makes an ordering question to sort the words Modular Object Oriented Dynamic Learning Environment.

Return values
qtype_ordering_questionthe question instance.

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