module:mod_quiz/modal_add_random_question

module:mod_quiz/modal_add_random_question

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

Description:
  • Constructor for the Modal.

Source:
Parameters:
Name Type Description
root object

The root jQuery element for the modal

Methods

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

Description:
  • Call web service function to add random questions

Source:
Parameters:
Name Type Description
quizcmid number

the course module id of the quiz to add questions to.

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}

Description:
  • Returns the saved category.

Source:
Returns:
Type
string

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

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