mod_quiz/modal_add_random_question

Description:
  • Contain the logic for the add random question modal.

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

Contain the logic for the add random question modal.

Methods

(inner) getAddOnPageId() → {int}

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

Source:
Returns:
Type
int

(inner) getCMID() → {int}

Description:
  • Returns the course module id for the form.

Source:
Returns:
Type
int

(inner) getCategory() → {string}

Description:
  • Returns the saved category.

Source:
Returns:
Type
string

(inner) getContextId() → {int}

Description:
  • Retrieve the saved Moodle context id.

Source:
Returns:
Type
int

(inner) getReturnUrl() → {string}

Description:
  • Returns the return URL for the form.

Source:
Returns:
Type
string

(inner) loadForm() → {promise}

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

Source:
Returns:

Resolved with form HTML and JS.

Type
promise

(inner) moveCancelButtonToTabs(form)

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

Source:
Parameters:
Name Type Description
form jquey

The form element.

(inner) moveFormElementIntoTab(formElement, tabElement)

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

Source:
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)

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

Source:
Parameters:
Name Type Description
form jquery

The form element.

(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) setCMID(id)

Description:
  • Set the course module id for the form.

Source:
Parameters:
Name Type Description
id int

(inner) setCategory(category)

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

Source:
Parameters:
Name Type Description
category string

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

Description:
  • Set the return URL for the form.

Source:
Parameters:
Name Type Description
url string

(inner) show()

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

Source: