[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/question/type/ -> edit_question_form.php (summary)

A base class for question editing forms.

Copyright: 2006 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 760 lines (32 kb)
Included or required:0 times
Referenced: 4 times
Includes or requires: 0 files

Defines 20 functions

  add_hidden_fields()
  __construct()
  definition()
  definition_inner()
  can_preview()
  get_per_answer_fields()
  add_per_answer_fields()
  get_more_choices_string()
  add_combined_feedback_fields()
  get_hint_fields()
  add_interactive_settings()
  set_data()
  data_preprocessing()
  data_preprocessing_answers()
  data_preprocessing_extra_answer_fields()
  data_preprocessing_extra_answer_field()
  data_preprocessing_combined_feedback()
  data_preprocessing_hints()
  validation()
  get_non_collabsible_editor_options()

Functions
Functions that are not part of a class:

add_hidden_fields()   X-Ref
Add all the hidden form fields used by question/question.php.


__construct($submiturl, $question, $category, $contexts, $formeditable = true)   X-Ref
No description

definition()   X-Ref
Build the form definition.

This adds all the form fields that the default question type supports.
If your question type does not support all these fields, then you can
override this method and remove the ones you don't want with $mform->removeElement().

definition_inner($mform)   X-Ref
Add any question-type specific form fields.

param: object $mform the form being built.

can_preview()   X-Ref
Is the question being edited in a state where it can be previewed?

return: bool whether to show the preview link.

get_per_answer_fields($mform, $label, $gradeoptions,&$repeatedoptions, &$answersoption)   X-Ref
Get the list of form elements to repeat, one for each answer.

param: object $mform the form being built.
param: $label the label to use for each option.
param: $gradeoptions the possible grades for each answer.
param: $repeatedoptions reference to array of repeated options to fill
param: $answersoption reference to return the name of $question->options
return: array of form fields.

add_per_answer_fields(&$mform, $label, $gradeoptions,$minoptions = QUESTION_NUMANS_START, $addoptions = QUESTION_NUMANS_ADD)   X-Ref
Add a set of form fields, obtained from get_per_answer_fields, to the form,
one for each existing answer, with some blanks for some new ones.

param: object $mform the form being built.
param: $label the label to use for each option.
param: $gradeoptions the possible grades for each answer.
param: $minoptions the minimum number of answer blanks to display.
param: $addoptions the number of answer blanks to add. Default QUESTION_NUMANS_ADD.

get_more_choices_string()   X-Ref
Language string to use for 'Add {no} more {whatever we call answers}'.


add_combined_feedback_fields($withshownumpartscorrect = false)   X-Ref
No description

get_hint_fields($withclearwrong = false, $withshownumpartscorrect = false)   X-Ref
Create the form elements required by one hint.

param: string $withclearwrong whether this quesiton type uses the 'Clear wrong' option on hints.
param: string $withshownumpartscorrect whether this quesiton type uses the 'Show num parts correct' option on hints.
return: array form field elements for one hint.

add_interactive_settings($withclearwrong = false,$withshownumpartscorrect = false)   X-Ref
No description

set_data($question)   X-Ref
No description

data_preprocessing($question)   X-Ref
Perform an preprocessing needed on the data passed to {@link set_data()}
before it is used to initialise the form.

param: object $question the data being passed to the form.
return: object $question the modified data.

data_preprocessing_answers($question, $withanswerfiles = false)   X-Ref
Perform the necessary preprocessing for the fields added by
{@link add_per_answer_fields()}.

param: object $question the data being passed to the form.
return: object $question the modified data.

data_preprocessing_extra_answer_fields($question, $extraanswerfields)   X-Ref
Perform the necessary preprocessing for the extra answer fields.

Questions that do something not trivial when editing extra answer fields
will want to override this.
param: object $question the data being passed to the form.
param: array $extraanswerfields extra answer fields (without table name).
return: object $question the modified data.

data_preprocessing_extra_answer_field($answer, $field)   X-Ref
Perfmorm preprocessing for particular extra answer field.

Questions with non-trivial DB - form element relationship will
want to override this.
param: object $answer an answer object to get extra field from.
param: string $field extra answer field name.
return: field value to be set to the form.

data_preprocessing_combined_feedback($question,$withshownumcorrect = false)   X-Ref
Perform the necessary preprocessing for the fields added by
{@link add_combined_feedback_fields()}.

param: object $question the data being passed to the form.
return: object $question the modified data.

data_preprocessing_hints($question, $withclearwrong = false,$withshownumpartscorrect = false)   X-Ref
Perform the necessary preprocessing for the hint fields.

param: object $question the data being passed to the form.
return: object $question the modified data.

validation($fromform, $files)   X-Ref
No description

get_non_collabsible_editor_options()   X-Ref
Returns an array of editor options with collapsed options turned off.

return: array



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1