Moodle  2.2.1
http://www.collinsharper.com
qtype_numerical_edit_form Class Reference
Inheritance diagram for qtype_numerical_edit_form:
Collaboration diagram for qtype_numerical_edit_form:

Public Member Functions

 validation ($data, $files)
 qtype ()

Protected Member Functions

 definition_inner ($mform)
 get_per_answer_fields ($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption)
 add_unit_options ($mform)
 add_unit_fields ($mform)
 data_preprocessing ($question)
 data_preprocessing_answers ($question)
 data_preprocessing_units ($question)
 data_preprocessing_unit_options ($question)
 validate_answers ($data, $errors)
 is_valid_answer ($answer, $data)
 is_valid_number ($x)
 valid_answer_message ($answer)
 validate_numerical_options ($data, $errors)

Protected Attributes

 $ap = null

Detailed Description

numerical editing form definition.

Definition at line 39 of file edit_numerical_form.php.


Member Function Documentation

add_unit_fields ( mform) [protected]

Add the input areas for each unit.

Parameters:
object$mformthe form being built.

Definition at line 131 of file edit_numerical_form.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_unit_options ( mform) [protected]

Add the unit handling options to the form.

Parameters:
object$mformthe form being built.

Definition at line 70 of file edit_numerical_form.php.

Here is the caller graph for this function:

data_preprocessing ( question) [protected]

Perform an preprocessing needed on the data passed to set_data() before it is used to initialise the form.

Parameters:
object$questionthe data being passed to the form.
Returns:
object $question the modified data.

Reimplemented from question_edit_form.

Reimplemented in qtype_calculatedsimple_edit_form, and qtype_calculated_edit_form.

Definition at line 168 of file edit_numerical_form.php.

Here is the call graph for this function:

data_preprocessing_answers ( question) [protected]

Reimplemented in qtype_calculated_edit_form.

Definition at line 177 of file edit_numerical_form.php.

Here is the caller graph for this function:

data_preprocessing_unit_options ( question) [protected]

Perform the necessary preprocessing for the fields added by add_unit_options().

Parameters:
object$questionthe data being passed to the form.
Returns:
object $question the modified data.

Definition at line 220 of file edit_numerical_form.php.

Here is the caller graph for this function:

data_preprocessing_units ( question) [protected]

Perform the necessary preprocessing for the fields added by add_unit_fields().

Parameters:
object$questionthe data being passed to the form.
Returns:
object $question the modified data.

Definition at line 201 of file edit_numerical_form.php.

Here is the caller graph for this function:

definition_inner ( mform) [protected]

Add any question-type specific form fields.

Parameters:
object$mformthe form being built.

Reimplemented from question_edit_form.

Reimplemented in qtype_calculatedsimple_edit_form, and qtype_calculated_edit_form.

Definition at line 42 of file edit_numerical_form.php.

Here is the call graph for this function:

get_per_answer_fields ( mform,
label,
gradeoptions,
&$  repeatedoptions,
&$  answersoption 
) [protected]

Get the list of form elements to repeat, one for each answer.

Parameters:
object$mformthe form being built.
$labelthe label to use for each option.
$gradeoptionsthe possible grades for each answer.
$repeatedoptionsreference to array of repeated options to fill
$answersoptionreference to return the name of $question->options field holding an array of answers
Returns:
array of form fields.

Reimplemented from question_edit_form.

Reimplemented in qtype_calculated_edit_form.

Definition at line 51 of file edit_numerical_form.php.

is_valid_answer ( answer,
data 
) [protected]

Validate a particular answer.

Parameters:
string$answeran answer to validate. Known to be non-blank and already trimmed.
array$datathe submitted data.
Returns:
bool whether this is a valid answer.

Reimplemented in qtype_calculated_edit_form.

Definition at line 293 of file edit_numerical_form.php.

Here is the call graph for this function:

Here is the caller graph for this function:

is_valid_number ( x) [protected]

Validate that a string is a nubmer formatted correctly for the current locale.

Parameters:
string$xa string
Returns:
bool whether $x is a number that the numerical question type can interpret.

Reimplemented in test_qtype_numerical_edit_form.

Definition at line 302 of file edit_numerical_form.php.

Here is the caller graph for this function:

qtype ( )

Override this in the subclass to question type name.

Returns:
the question type name, should be the same as the name() method in the question type class.

Reimplemented from question_edit_form.

Reimplemented in qtype_calculatedsimple_edit_form, and qtype_calculated_edit_form.

Definition at line 375 of file edit_numerical_form.php.

valid_answer_message ( answer) [protected]
Returns:
string erre describing what an answer should be.

Reimplemented in qtype_calculated_edit_form.

Definition at line 315 of file edit_numerical_form.php.

Here is the caller graph for this function:

validate_answers ( data,
errors 
) [protected]

Validate the answers.

Parameters:
array$datathe submitted data.
array$errorsthe errors array to add to.
Returns:
array the updated errors array.

Definition at line 252 of file edit_numerical_form.php.

Here is the call graph for this function:

Here is the caller graph for this function:

validate_numerical_options ( data,
errors 
) [protected]

Validate the answers.

Parameters:
array$datathe submitted data.
array$errorsthe errors array to add to.
Returns:
array the updated errors array.

Definition at line 325 of file edit_numerical_form.php.

Here is the caller graph for this function:

validation ( data,
files 
)

Dummy stub method - override if you needed to perform some extra validation. If there are errors return array of errors ("fieldname"=>"error message"), otherwise true if ok.

Server side rules do not work for uploaded files, implement serverside rules here if needed.

Parameters:
array$dataarray of ("fieldname"=>value) of submitted data
array$filesarray of uploaded files "element_name"=>tmp_file_path
Returns:
array of "element_name"=>"error_description" if there are errors, or an empty array if everything is OK (true allowed for backwards compatibility too).

Reimplemented from question_edit_form.

Reimplemented in qtype_calculatedsimple_edit_form, and qtype_calculated_edit_form.

Definition at line 239 of file edit_numerical_form.php.

Here is the call graph for this function:


Field Documentation

$ap = null [protected]

Definition at line 40 of file edit_numerical_form.php.


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