module:mod_quiz/modal_add_random_question

module:mod_quiz/modal_add_random_question

new (require("mod_quiz/modal_add_random_question"))(root)

Source:

Constructor for the Modal.

Parameters:
Name Type Description
root object

The root jQuery element for the modal

Methods

(async) addQuestions(cmid, addonpage, randomcount, filtercondition, newcategory, parentcategory)

Source:

Call web service function to add random questions

Parameters:
Name Type Description
cmid number

course module id

addonpage number

the page where random questions will be added to

randomcount number

Number of random questions

filtercondition string

Filter condition

newcategory string

add new category

parentcategory string

parent category of new category

(inner) getCategory() → {string}

Source:

Returns the saved category.

Returns:
Type
string

(inner) getCMID() → {Number}

Source:

Returns the course module id for the form.

Returns:
Type
Number

(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) moveContentIntoTab(tabContent, 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
tabContent 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 Number

(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.