Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Defines the custom question bank view used on the Edit quiz page.

Copyright: 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 280 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: custom_view  - X-Ref

Subclass to customise the view of the question bank for the quiz editing screen.

__construct($contexts, $pageurl, $course, $cm, $quiz)   X-Ref
Constructor

param: \question_edit_contexts $contexts
param: \moodle_url $pageurl
param: \stdClass $course course settings
param: \stdClass $cm activity settings.
param: \stdClass $quiz quiz settings.

wanted_columns()   X-Ref
No description

Class: question_bank_  - X-Ref

heading_column()   X-Ref
Specify the column heading

return: string Column name for the heading

default_sort()   X-Ref
No description

set_quiz_has_attempts($quizhasattempts)   X-Ref
Let the question bank display know whether the quiz has been attempted,
hence whether some bits of UI, like the add this question to the quiz icon,
should be displayed.

param: bool $quizhasattempts whether the quiz has attempts.

preview_question_url($question)   X-Ref
No description

add_to_quiz_url($questionid)   X-Ref
No description

render($tabname, $page, $perpage, $cat, $recurse, $showhidden,$showquestiontext, $tagids = [])   X-Ref
Renders the html question bank (same as display, but returns the result).

Note that you can only output this rendered result once per page, as
it contains IDs which must be unique.

return: string HTML code for the form

display_bottom_controls($totalnumber, $recurse, $category, \context $catcontext, array $addcontexts)   X-Ref
Display the controls at the bottom of the list of questions.

param: int       $totalnumber Total number of questions that might be shown (if it was not for paging).
param: bool      $recurse     Whether to include subcategories.
param: \stdClass $category    The question_category row from the database.
param: \context  $catcontext  The context of the category being displayed.
param: array     $addcontexts contexts where the user is allowed to add new questions.

print_choose_category_message($categoryandcontext)   X-Ref
Prints a form to choose categories.

param: string $categoryandcontext 'categoryID,contextID'.

display_options_form($showquestiontext, $scriptpath = '/mod/quiz/edit.php',$showtextoption = false)   X-Ref
No description

print_category_info($category)   X-Ref
No description

display_options($recurse, $showhidden, $showquestiontext)   X-Ref
No description

create_new_question_form($category, $canadd)   X-Ref
No description

display_question_bank_header()   X-Ref
Override the base implementation in \core_question\bank\view
because we don't want to print the headers in the fragment
for the modal.


init_sort_from_params()   X-Ref
Override the base implementation in \core_question\bank\view
because we don't want it to read from the $_POST global variables
for the sort parameters since they are not present in a fragment.

Unfortunately the best we can do is to look at the URL for
those parameters (only marginally better really).