mod_quiz/modal_quiz_question_bank

Description:
  • Contain the logic for the question bank modal.

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

Contain the logic for the question bank modal.

Methods

(inner) getAddOnPageId() → {int}

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

Source:
Returns:
Type
int

(inner) getContextId() → {int}

Description:
  • Retrieve the saved Moodle context id.

Source:
Returns:
Type
int

(inner) handleAddToQuizEvent(e, anchorElement)

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

Source:
Parameters:
Name Type Description
e event

A JavaScript event

anchorElement object

The anchor element that was triggered

(inner) handleDisplayOptionFormEvent(e)

Description:
  • 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.

Source:
Parameters:
Name Type Description
e event

A JavaScript event

(inner) handlePreviewContainerEvent(e, anchorElement)

Description:
  • Open a popup window to show the preview of the question.

Source:
Parameters:
Name Type Description
e event

A JavaScript event

anchorElement object

The anchor element that was triggered

(inner) registerDisplayOptionListeners()

Description:
  • 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

Source:

(inner) registerEventListeners()

Description:
  • Set up all of the event handling for the modal.

Source:

(inner) reloadBodyContent(queryString)

Description:
  • 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.

Source:
Parameters:
Name Type Description
queryString string

URL encoded string.

(inner) setAddOnPageId(id)

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

Source:
Parameters:
Name Type Description
id int

(inner) setContextId(id)

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

Source:
Parameters:
Name Type Description
id int

(inner) show() → {void}

Description:
  • 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.

Source:
Returns:
Type
void