mod_quiz/modal_add_random_question

Contain the logic for the add random question 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 to.

Returns:
Type
int

(inner) getCategory() → {string}

Source:

Returns the saved category.

Returns:
Type
string

(inner) getCMID() → {int}

Source:

Returns the course module id for the form.

Returns:
Type
int

(inner) getContextId() → {int}

Source:

Retrieve the saved Moodle context id.

Returns:
Type
int

(inner) getReturnUrl() → {string}

Source:

Returns the return URL for the form.

Returns:
Type
string

(inner) loadForm() → {promise}

Source:

Load the add random question form in a fragement and perform some transformation on the HTML to convert it into tabs for rendering in the modal.

Returns:

Resolved with form HTML and JS.

Type
promise

(inner) moveCancelButtonToTabs(form)

Source:

Make sure all of the tabs have a cancel button in their fotter to sit along side the submit button.

Parameters:
Name Type Description
form jquey

The form element.

(inner) moveFormElementIntoTab(formElement, tabElement)

Source:

Moves a given form element inside (a child of) a given tab element.

Hides the 'legend' (e.g. header) element of the form element because the tab has the name.

Moves the submit button into a footer element at the bottom of the form element for styling purposes.

Parameters:
Name Type Description
formElement jquery

The form element to move into the tab.

tabElement jquey

The tab element for the form element to move into.

(inner) moveTabsIntoTabContent(form)

Source:

Empty the tab content container and move all tabs from the form into the tab container element.

Parameters:
Name Type Description
form jquery

The form element.

(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) setCategory(category)

Source:

Set the category for this form. The category is a comma separated category id and category context id.

Parameters:
Name Type Description
category string

(inner) setCMID(id)

Source:

Set the course module id for the form.

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) setReturnUrl(url)

Source:

Set the return URL for the form.

Parameters:
Name Type Description
url string

(inner) show()

Source:

Override the modal show function to load the form when this modal is first shown.