mod_quiz/modal_quiz_question_bank

Contain the logic for the question bank modal.

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

Methods

(inner) getAddOnPageId() → {int}

Source:

Returns the saved page id for the question to be added it.

Returns:
Type
int

(inner) getContextId() → {int}

Source:

Retrieve the saved Moodle context id.

Returns:
Type
int

(inner) handleAddToQuizEvent(e, anchorElement)

Source:

Update the URL of the anchor element that the user clicked on to make sure that the question is added to the correct page.

Parameters:
Name Type Description
e event

A JavaScript event

anchorElement object

The anchor element that was triggered

(inner) handleDisplayOptionFormEvent(e)

Source:

Reload the modal body with the new display options the user has selected.

A query string is built using the form elements to be used to generate the new body content.

Parameters:
Name Type Description
e event

A JavaScript event

(inner) handlePreviewContainerEvent(e, anchorElement)

Source:

Open a popup window to show the preview of the question.

Parameters:
Name Type Description
e event

A JavaScript event

anchorElement object

The anchor element that was triggered

(inner) registerDisplayOptionListeners()

Source:

Listen for changes to the display options form.

This handles the user changing: - The quiz category select box - The tags to filter by - Show/hide questions from sub categories - Show/hide old questions

(inner) registerEventListeners()

Source:

Set up all of the event handling for the modal.

(inner) reloadBodyContent(queryString)

Source:

Replaces the current body contents with a new version of the question bank.

The contents of the question bank are generated using the provided query string.

Parameters:
Name Type Description
queryString string

URL encoded string.

(inner) setAddOnPageId(id)

Source:

Set the id of the page that the question should be added to when the user clicks the add to quiz link.

Parameters:
Name Type Description
id int

(inner) setContextId(id)

Source:

Save the Moodle context id that the question bank is being rendered in.

Parameters:
Name Type Description
id int

(inner) show() → {void}

Source:

Override the parent show function.

Reload the body contents when the modal is shown. The current window URL is used to inform the new content that should be displayed.

Returns:
Type
void