module:core_course/local/activitychooser/dialoguedom

module:core_course/local/activitychooser/dialoguedom

new (require("core_course/local/activitychooser/dialoguedom"))(dialogue, modal, exporter)

Description:
  • ChooserDialogueDOM constructor.

Source:
Parameters:
Name Type Description
dialogue Object

The dialogue object.

modal Modal

The modal object.

exporter Object

The exporter object to generate template data.

Methods

cleanSearchResults()

Description:
  • Clear the search results.

Source:

focusFirstChooserOption(current)

Description:
  • Move the focus to the first chooser option element.

Source:
Parameters:
Name Type Description
current HTMLElement

The current chooser option element

focusLastChooserOption(current)

Description:
  • Move the focus to the last chooser option element.

Source:
Parameters:
Name Type Description
current HTMLElement

The current chooser option element

focusNextChooserOption(current)

Description:
  • Move the focus to the previous chooser option element.

Source:
Parameters:
Name Type Description
current HTMLElement

The current chooser option element

focusPreviousChooserOption(current)

Description:
  • Move the focus to the previous chooser option element.

Source:
Parameters:
Name Type Description
current HTMLElement

The current chooser option element

getChooserOptionUrl(optionContainer) → {String}

Description:
  • Get the URL of a chooser option.

Source:
Parameters:
Name Type Description
optionContainer HTMLElement

The container of the chooser option.

Throws:

If the option container does not contain a link.

Type
Error
Returns:

The URL of the chooser option.

Type
String

getClosestChooserOption(element) → {HTMLElement|null}

Description:
  • Get the closest chooser option element.

Source:
Parameters:
Name Type Description
element HTMLElement
Returns:

element

Type
HTMLElement | null

getSearchInputElement() → {HTMLElement}

Description:
  • Get the search input element.

Source:
Returns:

The search input element.

Type
HTMLElement

hideModuleHelp(internal)

Description:
  • Hide the help section of the chooser.

Source:
Parameters:
Name Type Default Description
internal String | null null

The internal name of the module to return to, if any.

initActiveTabNavigation()

Description:
  • Initialise the active tab navigation.

Source:

initBootstrapComponents()

Description:
  • Initialise all Boostrap components.

Source:

isFavoutiteTabActive() → {Boolean}

Description:
  • Check if the search tab is active.

Source:
Returns:

True if the search tab is active, false otherwise.

Type
Boolean

markChooserOptionAsSelected(chooserOption)

Description:
  • Mark a chooser option as selected.

Source:
Parameters:
Name Type Description
chooserOption HTMLElement

The chooser option element to mark as selected.

(async) refreshFavouritesTabContent(mappedModules)

Description:
  • Refresh the favourite content.

Source:
Parameters:
Name Type Description
mappedModules Array

The modules to be displayed in the favourite tab.

(async) refreshSearchResults(searchResultsData)

Description:
  • Show the search results.

Source:
Parameters:
Name Type Description
searchResultsData Object

Data containing the module items that satisfy the search criteria

setBackButtonModuleData(moduleData)

Description:
  • Set the module data for the back button.

Source:
Parameters:
Name Type Description
moduleData Object

The module data to set for the back button.

toggleActiveFooter(show)

Description:
  • Toggle the visibility of the active footer.

Source:
Parameters:
Name Type Description
show Boolean

Whether to show or hide the active footer.

toggleAddButton(show)

Description:
  • Toggle the visibility of the "Add selected" button.

Source:
Parameters:
Name Type Description
show Boolean

Whether to show or hide the "Add selected" button.

toggleBackButton(show)

Description:
  • Toggle the visibility of the back button.

Source:
Parameters:
Name Type Description
show Boolean

Whether to show or hide the back button.

toggleFavouriteTabDisplay(displayed)

Description:
  • Toggle the display of the favourite tab.

    The favourite tab is only displayed when there are favourite modules or when it is the active tab.

Source:
Parameters:
Name Type Description
displayed Boolean

Whether we want to show or hide the favourite tab

unmarkAllChooserOptionAsSelected()

Description:
  • Unmark all chooser options as selected.

Source:

(inner) disableFocusAllChooserOptions(tabNav)

Description:
  • Disable the focus of all chooser options in a specific container (section).

Source:
Parameters:
Name Type Description
tabNav HTMLElement

The tab navigation element (from the shown.bs.ta event).

(inner) showAllActivitiesTab() → {HTMLElement}

Description:
  • Show the "All activities" tab.

Source:
Returns:

The "All activities" tab element.

Type
HTMLElement

(inner) showModuleHelp(moduleData)

Description:
  • Given an event from the main module 'page' navigate to it's help section via a carousel.

Source:
Parameters:
Name Type Description
moduleData Object

Data of the module to carousel to

(inner) updateItemStarredIcons(internal, favourite)

Description:
  • Update the starred icons in the chooser modal.

Source:
Parameters:
Name Type Description
internal String

The internal name of the module.

favourite Boolean

Whether the module is a favourite or not.