Global

Members

StorageWrapper :Object

Description:
  • Wraps browsers localStorage object

Source:

Wraps browsers localStorage object

Type:
  • Object

The :string

Description:
  • placeholder character used for standard strings (unclean)

Source:

placeholder character used for standard strings (unclean)

Type:
  • string

The :string

Description:
  • placeholder character used for cleaned strings

Source:

placeholder character used for cleaned strings

Type:
  • string

(constant) addContextmenuItem

Description:
  • Given a TinyMCE contextmenu configuration, add the specified button to the end.

Source:

Given a TinyMCE contextmenu configuration, add the specified button to the end.

(constant) addMenubarItem

Description:
  • Given a TinyMCE Menubar configuration, add the specified button to the named section.

Source:

Given a TinyMCE Menubar configuration, add the specified button to the named section.

(constant) addQuickbarsToolbarItem

Description:
  • Given a TinyMCE quickbars configuration, add items to the menu.

Source:

Given a TinyMCE quickbars configuration, add items to the menu.

(constant) addToolbarButton

Description:
  • Given a TinyMCE Toolbar configuration, add the specified button to the named section.

Source:

Given a TinyMCE Toolbar configuration, add the specified button to the named section.

(constant) addToolbarButtons

Description:
  • Given a TinyMCE Toolbar configuration, add the specified buttons to the named section.

Source:

Given a TinyMCE Toolbar configuration, add the specified buttons to the named section.

(constant) addToolbarSection

Description:
  • Insert a new section into the toolbar.

Source:

Insert a new section into the toolbar.

(constant) byCategory

Description:
  • Emoji data based on the data available from https://github.com/iamcal/emoji-data.

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

Emoji data based on the data available from https://github.com/iamcal/emoji-data.

(constant) clearSearch

Description:
  • Reset the search icon and trigger the init for the block.

Source:

Reset the search icon and trigger the init for the block.

current :LoadingProcess

Description:
  • the current uploading process.

Source:

the current uploading process.

Type:

(constant) displayFilepicker

Description:
  • Helper to display a filepicker and return a Promise.

    The Promise will resolve when a file is selected, or reject if the file type is not found.

Source:

Helper to display a filepicker and return a Promise.

The Promise will resolve when a file is selected, or reject if the file type is not found.

editorUpdates :Map

Description:
  • the courses pending to be updated.

Source:

the courses pending to be updated.

Type:
  • Map

endTime

Description:
  • Timestamp at which time runs out.

Source:
Properties:
Name Type Description
endTime Number

Timestamp at which time runs out.

(constant) ensureEditorIsValid

Description:
  • Ensure that the editor is still in the DOM, removing it if it is not.

Source:

Ensure that the editor is still in the DOM, removing it if it is not.

errorCallback :function

Description:
  • the error callback if any.

Source:

the error callback if any.

Type:
  • function

extraData :Object

Description:
  • any extra process information to store.

Source:

any extra process information to store.

Type:
  • Object

finishedCallback :function

Description:
  • the finished callback if any.

Source:

the finished callback if any.

Type:
  • function
Description:
  • Get the link to the user documentation for the named plugin.

Source:

Get the link to the user documentation for the named plugin.

(constant) getImagePath

Description:
  • Get the image path for the specified image.

Source:

Get the image path for the specified image.

(constant) getPluginMetadata

Description:
  • Get the default plugin metadata for the named plugin. If no URL is provided, then a URL is generated pointing to the standard Moodle Documentation.

Source:

Get the default plugin metadata for the named plugin. If no URL is provided, then a URL is generated pointing to the standard Moodle Documentation.

(constant) init

Description:
  • Initialise the timeline view navigation by adding event listeners to the navigation elements.

Source:

Initialise the timeline view navigation by adding event listeners to the navigation elements.

(constant) init

Description:
  • Initialise the timeline view navigation by adding event listeners to the navigation elements.

Source:

Initialise the timeline view navigation by adding event listeners to the navigation elements.

(constant) init

Description:
  • Intialise the courses list and cards views on page load.

Source:

Intialise the courses list and cards views on page load.

(constant) init

Description:
  • Initialise all of the modules for the overview block.

Source:

Initialise all of the modules for the overview block.

isEditing

Description:
  • Return the current edit mode.

    Components should use this method to check if edit mode is active.

Source:

Return the current edit mode.

Components should use this method to check if edit mode is active.

isLoggerSet :boolean

Description:
  • Flag to determine whether the screen reader-only logger has already been set, so we only need to set it once.

Source:

Flag to determine whether the screen reader-only logger has already been set, so we only need to set it once.

Type:
  • boolean

locked

Description:
  • Set the lock value and locks or unlocks the element.

Source:

Set the lock value and locks or unlocks the element.

locked

Description:
  • Get the current locked value from the element.

Source:

Get the current locked value from the element.

manager :ProcessMonitorManager

Description:
  • the page monitor.

Source:

the page monitor.

Type:
  • ProcessMonitorManager

pending :Array

Description:
  • the pending queue.

Source:

the pending queue.

Type:
  • Array

prepare

Description:
  • Prepares to begin a drag operation - call with a mousedown or touchstart event.

    If the returned object has 'start' true, then you can set up a drag proxy, and call start. This function will call preventDefault automatically regardless of whether starting or not.

Source:

Prepares to begin a drag operation - call with a mousedown or touchstart event.

If the returned object has 'start' true, then you can set up a drag proxy, and call start. This function will call preventDefault automatically regardless of whether starting or not.

(constant) removeMenubarItem

Description:
  • Given a TinyMCE Menubar configuration, remove the specified menu from the named section.

Source:

Given a TinyMCE Menubar configuration, remove the specified menu from the named section.

(constant) removeMenubarItems

Description:
  • Given a TinyMCE Menubar configuration, remove the specified menu from the named section.

Source:

Given a TinyMCE Menubar configuration, remove the specified menu from the named section.

(constant) removeSubmenuItem

Description:
  • Remove the specified sub-menu item from the named section. Recreate a menu with the same sub-menu items but remove the specified item.

Source:

Remove the specified sub-menu item from the named section. Recreate a menu with the same sub-menu items but remove the specified item.

(constant) removeToolbarButton

Description:
  • Given a TinyMCE Toolbar configuration, remove the specified button from the named section.

Source:

Given a TinyMCE Toolbar configuration, remove the specified button from the named section.

(constant) removeToolbarButtons

Description:
  • Given a TinyMCE Toolbar configuration, remove the specified buttons from the named section.

Source:

Given a TinyMCE Toolbar configuration, remove the specified buttons from the named section.

removedCallback :function

Description:
  • the removed callback if any.

Source:

the removed callback if any.

Type:
  • function

(constant) reset

Description:
  • Reset the courses views to their original state on first page load.courseOffset

    This is called when configuration has changed for the event lists to cause them to reload their data.

Source:

Reset the courses views to their original state on first page load.courseOffset

This is called when configuration has changed for the event lists to cause them to reload their data.

(constant) serialize

Description:
  • Serialize form values into a string.

    This must be used instead of URLSearchParams, which does not correctly encode nested values such as arrays.

Source:

Serialize form values into a string.

This must be used instead of URLSearchParams, which does not correctly encode nested values such as arrays.

start

Description:
  • Call to start a drag operation, in response to a mouse down or touch start event. Normally call this after calling prepare and receiving start true (you can probably skip prepare if only supporting drag not touch).

    Note: The caller is responsible for creating a 'drag proxy' which is the thing that actually gets dragged. At present, this doesn't really work properly unless it is added directly within the body tag.

    You also need to ensure that there is CSS so the proxy is absolutely positioned, and styled to look like it is floating.

    You also need to absolutely position the proxy where you want it to start.

Source:

Call to start a drag operation, in response to a mouse down or touch start event. Normally call this after calling prepare and receiving start true (you can probably skip prepare if only supporting drag not touch).

Note: The caller is responsible for creating a 'drag proxy' which is the thing that actually gets dragged. At present, this doesn't really work properly unless it is added directly within the body tag.

You also need to ensure that there is CSS so the proxy is absolutely positioned, and styled to look like it is floating.

You also need to absolutely position the proxy where you want it to start.

start

Description:
  • Starts automatic scrolling if user moves near edge of window. This should be called in response to mouse down or touch start.

Source:

Starts automatic scrolling if user moves near edge of window. This should be called in response to mouse down or touch start.

state

Description:
  • Return the current state.

Source:

Return the current state.

stop

Description:
  • Stops automatic scrolling. This should be called in response to mouse up or touch end.

Source:

Stops automatic scrolling. This should be called in response to mouse up or touch end.

supportComponents

Description:
  • Return if the current course support components to refresh the content.

Source:

Return if the current course support components to refresh the content.

timeoutId

Description:
  • ID of the timeout that updates the clock.

Source:
Properties:
Name Type Description
timeoutId Number

ID of the timeout that updates the clock.

timer

Description:
  • The timer element.

Source:
Properties:
Name Type Description
timer Element

The timer element.

(constant) updateEditorState

Description:
  • Updates the state of the editor.

Source:

Updates the state of the editor.

Methods

_activityAnchor(event)

Description:
  • The activity anchor event.

Source:
Parameters:
Name Type Description
event Event

_addEventTotalMovement(event)

Description:
  • Add the total amout of movement to a mouse event.

Source:
Parameters:
Name Type Description
event MouseEvent

_addIdsToSelection(stateManager, typeName, ids)

Description:
  • Add some ids to the current bulk selection.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

typeName String

the type name (section/cm)

ids array

the list of ids

_allSectionToggler(event)

Description:
  • Handle the collapse/expand all sections button.

    Toggler click is delegated to the main course content element because new sections can appear at any moment and this way we prevent accidental double bindings.

Source:
Parameters:
Name Type Description
event Event

the triggered event

_callEditWebservice(action, courseId, ids, targetSectionId, targetCmId)

Description:
  • Private method to call core_courseformat_update_course webservice.

Source:
Parameters:
Name Type Description
action string
courseId number
ids array
targetSectionId number

optional target section id (for moving actions)

targetCmId number

optional target cm id (for moving actions)

_callParentMethod(methodname, dropdata, event)

Description:
  • Convenient method for calling parent component functions if present.

Source:
Parameters:
Name Type Description
methodname string

the name of the method

dropdata Object

the current drop data object

event Event

the original event

_cancelBulk()

Description:
  • Cancel bulk handler.

Source:

_cancelDebouncedReloadCm(cmId)

Description:
  • Cancel the active reload CM debounced function, if any.

Source:
Parameters:
Name Type Description
cmId Number

_checkSectionlist(detail)

Description:
  • Check the section list and disable some options if needed.

Source:
Parameters:
Name Type Description
detail Object

the update details.

Properties
Name Type Description
state Object

the state object.

_closeMonitor()

Description:
  • Close the monitor.

Source:

(async) _cmBasicAction(stateManager, action, cmIds, targetSectionId, targetCmId)

Description:
  • Execute a basic course module state action.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

action string

the action name

cmIds array

the cm ids

targetSectionId number

optional target section id (for moving actions)

targetCmId number

optional target cm id (for moving actions)

_completionHandler(event)

Description:
  • Activity manual completion listener.

Source:
Parameters:
Name Type Description
event Event

the custom ecent

_completionHandler(event)

Description:
  • Activity manual completion listener.

Source:
Parameters:
Name Type Description
event Event

the custom event

Properties
Name Type Description
detail object

the event details

_containsOnlyFiles(event) → {boolean}

Description:
  • Check if the dragged event contains only files.

    Files dragging does not generate drop data because they came from outside the page and the component must check it before validating the event.

    Some browsers like Firefox add extra types to file dragging. To discard the false positives a double check is necessary.

Source:
Parameters:
Name Type Description
event Event

the original event.

Returns:

if the drag dataTransfers contains files.

Type
boolean

(async) _createCm(param)

Description:
  • Create a newcm instance.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
state Object
element Object

_createCmItem(container, cmid) → {Element}

Description:
  • Create a new course module item in a section.

    Thos method will append a fake item in the container and trigger an ajax request to replace the fake element by the real content.

Source:
Parameters:
Name Type Description
container Element

the container element (section)

cmid Number

the course-module ID

Returns:

the created element

Type
Element

(async) _createListItem(args)

Description:
  • Create a monitor item.

Source:
Parameters:
Name Type Description
args object

the watcher arguments

Properties
Name Type Description
element object

the item state data

(async) _createSection(details)

Description:
  • Create a new section instance.

Source:
Parameters:
Name Type Description
details Object

the update details.

Properties
Name Type Description
state Object

the state data.

element Object

the element data.

_createSectionItem(container, sectionid) → {Element}

Description:
  • Create a new section item.

    This method will append a fake item in the container and trigger an ajax request to replace the fake element by the real content.

Source:
Parameters:
Name Type Description
container Element

the container element (section)

sectionid Number

the course-module ID

Returns:

the created element

Type
Element

_deleteCm(param)

Description:
  • Remove a cm from the list.

    The actual DOM element removal is delegated to the cm component.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

_deleteSection(details)

Description:
  • Remove a section from the list.

    The actual DOM element removal is delegated to the section component.

Source:
Parameters:
Name Type Description
details Object

the update details.

Properties
Name Type Description
element Object

the element data.

_destroyModal(modal, element)

Description:
  • Hide and later destroy a modal.

    Behat will fail if we remove the modal while some boostrap collapse is executing.

Source:
Parameters:
Name Type Description
modal Modal
element HTMLElement

the dom element to focus on.

Description:
  • Replace an element with a copy with a different tag name.

Source:
Parameters:
Name Type Description
element Element

the original element

_dragEnd(event)

Description:
  • Drag end event handler.

Source:
Parameters:
Name Type Description
event Event

the event.

_dragEnter(event)

Description:
  • Drag enter event handler.

    The JS drag&drop API triggers several dragenter events on the same element because it bubbles the child events as well. To prevent this form affecting the dropzones display, this methods use "entercount" to determine if it's one extra child event or a valid one.

Source:
Parameters:
Name Type Description
event Event

the event.

_dragLeave(event)

Description:
  • Drag over leave handler.

    The JS drag&drop API triggers several dragleave events on the same element because it bubbles the child events as well. To prevent this form affecting the dropzones display, this methods use "entercount" to determine if it's one extra child event or a valid one.

Source:
Parameters:
Name Type Description
event Event

the event.

_dragOver(event)

Description:
  • Drag over event handler.

    We only use dragover event when a draggable action starts inside a valid dropzone. In those cases the API won't trigger any dragEnter because the dragged alement was already there. We use the dropzonevisible to determine if the component needs to display the dropzones or not.

Source:
Parameters:
Name Type Description
event Event

the event.

_dragStart(event)

Description:
  • Drag start event handler.

    This method will generate the current dropable data. This data is the one used to determine if a droparea accepts the dropping or not.

Source:
Parameters:
Name Type Description
event Event

the event.

_drop(event)

Description:
  • Drop event handler.

    This method will call both hideDropZones and drop methods on the parent component.

Source:
Parameters:
Name Type Description
event Event

the event.

_enableBulk()

Description:
  • Dispatch the enable bulk mutation.

    The enable bulk button is outside of the course content main div. Because content/actions captures click events only in the course content, this button needs to trigger the enable bulk mutation by itself.

Source:

_expandSectionNode(element, forceValue)

Description:
  • Expand a section node.

    By default the method will use element.indexcollapsed to decide if the section is opened or closed. However, using forceValue it is possible to open or close a section independant from the indexcollapsed attribute.

Source:
Parameters:
Name Type Description
element Object

the course module state element

forceValue boolean

optional forced expanded value

(async) _fixOrder(container, neworder, selector, dettachedelements, createMethod)

Description:
  • Fix/reorder the section or cms order.

Source:
Parameters:
Name Type Description
container Element

the HTML element to reorder.

neworder Array

an array with the ids order

selector string

the element selector

dettachedelements Object

a list of dettached elements

createMethod function

method to create missing elements

_fixOrder(container, neworder, allitems)

Description:
  • Fix/reorder the section or cms order.

Source:
Parameters:
Name Type Description
container Element

the HTML element to reorder.

neworder Array

an array with the ids order

allitems Array

the list of html elements that can be placed in the container

_getClosestActionMenuToogler(element) → {HTMLElement|undefined}

Description:
  • Get the closest actions menu toggler to an action element.

Source:
Parameters:
Name Type Description
element HTMLElement

the action link element

Returns:
Type
HTMLElement | undefined

_getDebouncedReloadCm(cmId) → {function}

Description:
  • Generate or get a reload CM debounced function.

Source:
Parameters:
Name Type Description
cmId Number
Returns:

the debounced reload function

Type
function

_getDraggableData() → {Object}

Description:
  • Get the draggable data of this component.

Source:
Returns:

exported course module drop data

Type
Object

_getDropData(event) → {Object|undefined}

Description:
  • Get the current dropdata for a specific event.

    The browser can generate drag&drop events related to several user interactions:

    • Drag a page elements: this case is registered in the activeDropData map
    • Drag some HTML selections: ignored for now
    • Drag a file over the browser: file drag may appear in the future but for now they are ignored.
Source:
Parameters:
Name Type Description
event Event

the original event.

Returns:

with the dragged data (or undefined if none)

Type
Object | undefined

(async) _getLoggerEntry(stateManager, action, itemIds, data) → {Object}

Description:
  • Get log entry for the current action.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

action string

the action name

itemIds Array.<int> | null

the element ids

data Object | undefined

extra params for the log entry

Properties
Name Type Description
itemType string | undefined

the element type (will be taken from action if none)

targetSectionId int | null | undefined

the target section id

targetCmId int | null | undefined

the target cm id

component String | null | undefined

optional component (for format plugins)

Returns:

the log entry

Type
Object

_getTargetIds(target) → {Array.<Number>}

Description:
  • Return the ids represented by this element.

    Depending on the dataset attributes the action could represent a single id or a bulk actions with all the current selected ids.

Source:
Parameters:
Name Type Description
target HTMLElement
Returns:

array of Ids

Type
Array.<Number>

_handleUnselectAll()

Description:
  • Process unselect all elements.

Source:

_indexContents()

Description:
  • Regenerate content indexes.

    This method is used when a legacy action refresh some content element.

Source:

_isCmBulkEnabled(bulk) → {Boolean}

Description:
  • Check if cm bulk selection is available.

Source:
Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_isSectionBulkEditable() → {Boolean}

Description:
  • Check if the section is bulk editable.

Source:
Returns:
Type
Boolean

_isSectionBulkEnabled(bulk) → {Boolean}

Description:
  • Check if cm bulk selection is available.

Source:
Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_isSelected(bulk) → {Boolean}

Description:
  • Check if the cm id is part of the current bulk selection.

Source:
Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_isSelected(bulk) → {Boolean}

Description:
  • Check if the cm id is part of the current bulk selection.

Source:
Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_loadFileHandlers()

Description:
  • Load the file hanlders promise.

Source:

_modalBodyRenderedPromise(ModalClass, modalParams) → {Promise}

Description:
  • Render a modal and return a body ready promise.

Source:
Parameters:
Name Type Description
ModalClass Modal

the modal class

modalParams object

the modal params

Returns:

the modal body ready promise

Type
Promise

_mouseLeave()

Description:
  • Mouse leave handler.

Source:

_mouseOver()

Description:
  • Mouse over handle.

Source:

(async) _openSectionIfNecessary()

Description:
  • Open the section if the anchored activity is inside.

Source:

_prepareFields(stateManager, updateName, fields) → {Object}

Description:
  • Add default values to state elements.

    This method is called every time a webservice returns a update state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

Returns:

final fields data

Type
Object

_processEvent(event) → {Object|false}

Description:
  • Process a drag and drop event and delegate logic to the parent component.

Source:
Parameters:
Name Type Description
event Event

the drag and drop event

Returns:

the dropdata or null if the event should not be processed

Type
Object | false

_publishEvents()

Description:
  • Internal method to publish events.

    This is a private method, it will be invoked when the state is set back to read only mode.

Source:

_refreshActions(param)

Description:
  • Refresh the visible action buttons depending on the selection type.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

the affected element (bulk in this case).

_refreshActivityCard(bulk, selected)

Description:
  • Update the activity card depending on the bulk selection.

Source:
Parameters:
Name Type Description
bulk Object

the current bulk state data

selected Boolean

if the activity is selected.

_refreshAllSectionsToggler(state)

Description:
  • Refresh the collapse/expand all sections element.

Source:
Parameters:
Name Type Description
state Object

The state data

_refreshBulk(param)

Description:
  • Update a bulk options.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
state Object

the state data

_refreshBulk(param)

Description:
  • Update the bulk editing interface.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
state Object

the state data

_refreshCm(param)

Description:
  • Update a course index cm using the state information.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

details the update details.

_refreshCm(param)

Description:
  • Update a course index cm using the state information.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

details the update details.

_refreshCmName(param)

Description:
  • Update a course module name on the whole page.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

details the update details.

(async) _refreshCompletion(details)

Description:
  • Update the activity completion icon.

Source:
Parameters:
Name Type Description
details Object

the update details

Properties
Name Type Description
state Object

the state data

element Object

the element data

_refreshCourseSectionlist(param)

Description:
  • Refresh the section list.

Source:
Parameters:
Name Type Description
param Object
Properties
Name Type Description
element Object

details the update details.

_refreshCourseSectionlist(param)

Description:
  • Refresh the section list.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

_refreshEnabled(param)

Description:
  • Hide and show the bulk edit tools.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

details the update details (state.bulk in this case).

(async) _refreshItem(args)

Description:
  • Create a monitor item.

Source:
Parameters:
Name Type Description
args object

the watcher arguments

Properties
Name Type Description
element object

the item state data

_refreshPageItem(details)

Description:
  • Handle a page item update.

Source:
Parameters:
Name Type Description
details Object

the update details

Properties
Name Type Description
state Object

the state data.

element Object

the course state data.

_refreshPageItem(details)

Description:
  • Handle a page item update.

Source:
Parameters:
Name Type Description
details Object

the update details

Properties
Name Type Description
state Object

the state data.

element Object

the course state data.

_refreshPageItem(details)

Description:
  • Handle a page item update.

Source:
Parameters:
Name Type Description
details Object

the update details

Properties
Name Type Description
element Object

the course state data.

_refreshSection(param)

Description:
  • Update a course index section using the state information.

Source:
Parameters:
Name Type Description
param Object

details the update details.

Properties
Name Type Description
element Object

the section element

_refreshSection(param)

Description:
  • Update a content section using the state information.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

details the update details.

(async) _refreshSectionBulkSelector(param)

Description:
  • Update the bulk checkbox when the section name changes.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

the section info

_refreshSectionCmlist(param)

Description:
  • Refresh a section cm list.

Source:
Parameters:
Name Type Description
param Object
Properties
Name Type Description
element Object

details the update details.

_refreshSectionCmlist(param)

Description:
  • Refresh a section cm list.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

_refreshSectionCollapsed(args)

Description:
  • Update section collapsed state via bootstrap 4 if necessary.

    Formats that do not use bootstrap 4 must override this method in order to keep the section toggling working.

Source:
Parameters:
Name Type Description
args object
Properties
Name Type Description
state Object

The state data

element Object

The element to update

_refreshSectionCollapsed(args)

Description:
  • Update section collapsed.

Source:
Parameters:
Name Type Description
args object
Properties
Name Type Description
element object

The leement to be expanded

_refreshSectionNumber(param)

Description:
  • Update a course section when the section number changes.

    The courseActions module used for most course section tools still depends on css classes and section numbers (not id). To prevent inconsistencies when a section is moved, we need to refresh the

    Course formats can override the section title rendering so the frontend depends heavily on backend rendering. Luckily in edit mode we can trigger a title update using the inplace_editable module.

Source:
Parameters:
Name Type Description
param Object
Properties
Name Type Description
element Object

details the update details.

_refreshSectionTitle(param)

Description:
  • Update the section when the section name changes.

    The section header have several HTML that uses the section name for accessibility and behat tests. This method updates them all.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

the section info

_refreshSelectAll(param)

Description:
  • Refresh the select all element.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

the affected element (bulk in this case).

(async) _refreshSelectCount(param)

Description:
  • Refresh the selection count.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

the affected element (bulk in this case).

_refreshToggler(param)

Description:
  • Update a content section using the state information.

Source:
Parameters:
Name Type Description
param object
Properties
Name Type Description
element Object

details the update details (state.bulk in this case).

_refreshTools(param)

Description:
  • Refresh the tools depending on the current selection.

Source:
Parameters:
Name Type Description
param object

the state watcher information

Properties
Name Type Description
state Object

the full state data.

element Object

the affected element (bulk in this case).

_reloadCm(param0)

Description:
  • Reload a course module contents.

    Most course module HTML is still strongly backend dependant. Some changes require to get a new version of the module.

Source:
Parameters:
Name Type Description
param0 object

the watcher details

Properties
Name Type Description
element object

the state object

_reloadSection(param0)

Description:
  • Reload a course section contents.

    Section HTML is still strongly backend dependant. Some changes require to get a new version of the section.

Source:
Parameters:
Name Type Description
param0 details

the watcher details

Properties
Name Type Description
element object

the state object

_removeIdsFromSelection(stateManager, typeName, ids)

Description:
  • Remove some ids to the current bulk selection.

    The method resets the selection type if the current selection is empty.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

typeName String

the type name (section/cm)

ids array

the list of ids

_removeProcess()

Description:
  • Close the process.

Source:

(async) _requestAddSection(target, event)

Description:
  • Handle a create section request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestCmAvailability(target)

Description:
  • Handle a cm availability change request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

(async) _requestCmDelete(target, event)

Description:
  • Handle a delete cm request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestCmDuplicate(target, event)

Description:
  • Handle a course module duplicate request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestDeleteSection(target, event)

Description:
  • Handle a delete section request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestMoveCm(target, event)

Description:
  • Handle a move cm request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestMoveSection(target, event)

Description:
  • Handle a move section request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestMutationAction(target, event, mutationName)

Description:
  • Basic mutation action helper.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

mutationName string

the mutation name

(async) _requestSectionAvailability(target)

Description:
  • Handle a section availability change request.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

(async) _requestToggleSelectionCm(target, event)

Description:
  • Handle a toggle cm selection.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestToggleSelectionSection(target, event)

Description:
  • Handle a toggle section selection.

Source:
Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

_scanIndex(selector, index, creationhandler)

Description:
  • Reindex a content (section or cm) of the course content.

    This method is used internally by _indexContents.

Source:
Parameters:
Name Type Description
selector string

the DOM selector to scan

index *

the index attribute to update

creationhandler *

method to create a new indexed element

_scanPageAnchorCmInfo() → {Object|null}

Description:
  • Calculate the cm info from the current page anchor.

Source:
Returns:

the cm info or null if not found.

Type
Object | null

_scrollHandler()

Description:
  • Check the current page scroll and update the active element if necessary.

Source:

(async) _sectionBasicAction(stateManager, action, sectionIds, targetSectionId, targetCmId)

Description:
  • Execute a basic section state action.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

action string

the action name

sectionIds array

the section ids

targetSectionId number

optional target section id (for moving actions)

targetCmId number

optional target cm id (for moving actions)

_sectionTogglers(event)

Description:
  • Setup sections toggler.

    Toggler click is delegated to the main course content element because new sections can appear at any moment and this way we prevent accidental double bindings.

Source:
Parameters:
Name Type Description
event Event

the triggered event

_sectionTogglers(event)

Description:
  • Setup sections toggler.

    Toggler click is delegated to the main course index element because new sections can appear at any moment and this way we prevent accidental double bindings.

Source:
Parameters:
Name Type Description
event Event

the triggered event

_selectAllClick(event)

Description:
  • Handle special select all cases.

Source:
Parameters:
Name Type Description
event Event

_setAddSectionLocked(locked)

Description:
  • Disable all add sections actions.

Source:
Parameters:
Name Type Description
locked boolean

the new locked value.

_setCheckboxValue(checked, disabled)

Description:
  • Modify the checkbox element.

Source:
Parameters:
Name Type Description
checked Boolean

the new checked value

disabled Boolean

the new disabled value

_setCheckboxValue(checked, disabled)

Description:
  • Modify the checkbox element.

Source:
Parameters:
Name Type Description
checked Boolean

the new checked value

disabled Boolean

the new disabled value

_setupMutationRadioButtonModal(modal, ids)

Description:
  • Add events to a mutation selector radio buttons modal.

Source:
Parameters:
Name Type Description
modal Modal
ids Array.<Number>

the section or cm ids to apply the mutation

_startProcessing()

Description:
  • Setup the component to start a transaction.

    Some of the course actions replaces the current DOM element with a new one before updating the course state. This means the component cannot preload any index properly until the transaction starts.

Source:

(async) _updateActionsMenu(section)

Description:
  • Update a section action menus.

Source:
Parameters:
Name Type Description
section object

the section state.

_updateBadges(section)

Description:
  • Update a section badges using the state information.

Source:
Parameters:
Name Type Description
section object

the section state.

_updateMonitor(args)

Description:
  • Create a monitor item.

Source:
Parameters:
Name Type Description
args object

the watcher arguments

Properties
Name Type Description
element object

the display state data

_updateStateSectionPreference(stateManager, preferenceName, sectionIds, preferenceValue) → {Array.<Number>|null}

Description:
  • Private batch update for a section preference attribute.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

preferenceName string

the preference name

sectionIds array

the affected section ids

preferenceValue boolean

the new preferenceValue value

Returns:

sections ids with the preference value true or null if no update is required

Type
Array.<Number> | null

activeSearch(clearIcon)

Description:
  • Change the searching icon to its' active state.

Source:
Parameters:
Name Type Description
clearIcon HTMLElement

Our closing icon to manipulate.

activeSearchState(clearSearchIcon, timelineViewRoot)

Description:
  • Show the clear search icon.

Source:
Parameters:
Name Type Description
clearSearchIcon object

Clear search icon element.

timelineViewRoot object

The root element for the timeline view

addActions(actions)

Description:
  • Add extra actions to the module.

Source:
Parameters:
Name Type Description
actions array

array of methods to execute

addClickHandler(handler)

Description:
  • Add a click handler to the list of handlers.

Source:
Parameters:
Name Type Description
handler function

A handler to call on a click event

addEventListener(target, type, listener)

Description:
  • Add and bind an event listener to a target and keep track of all event listeners.

    The native element.addEventListener method is not object oriented friently as the "this" represents the element that triggers the event and not the listener class. As components can be unregister and removed at any time, the BaseComponent provides this method to keep track of all component listeners and do all of the bind stuff.

Source:
Parameters:
Name Type Description
target Element

the event target

type string

the event name

listener function

the class method that recieve the event

addLoggerEntry(entry)

Description:
  • Add a new log entry into the reactive logger.

Source:
Parameters:
Name Type Description
entry LoggerEntry

addMutations(newFunctions)

Description:
  • Add individual functions to the mutations.

    Note new mutations will be added to the existing ones. To replace the full mutation object with a new one, use setMutations method.

Source:
Parameters:
Name Type Description
newFunctions Object

an object with new mutation functions.

(async) addSection(stateManager, targetSectionId)

Description:
  • Add a new section to a specific course location.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

targetSectionId number

optional the target section id

addSelectors(newSelectors)

Description:
  • Add or update the component selectors.

Source:
Parameters:
Name Type Description
newSelectors Object

an object of new selectors.

addToFavourites(root, courseId)

Description:
  • Add course to favourites

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

addUpdateTypes(newFunctions)

Description:
  • Add methods to process update state messages.

    The state manager provide a default update, create and delete methods. However, some applications may require to override the default methods or even add new ones like "refresh" or "error".

Source:
Parameters:
Name Type Description
newFunctions Object

the new update types functions.

allItemsArray(state) → {Array}

Description:
  • Return a sorted list of all sections and cms items in the state.

Source:
Parameters:
Name Type Description
state Object

the current state.

Returns:

all sections and cms items in the state.

Type
Array

(async) allSectionsIndexCollapsed(stateManager, collapsed)

Description:
  • Update the course index collapsed attribute of all sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

collapsed boolean

the new collapsed value

bulkEnable(stateManager, enabled)

Description:
  • Enable/disable bulk editing.

    Note: reenabling the bulk will clean the current selection.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

enabled Boolean

the new bulk state.

bulkReset(stateManager)

Description:
  • Reset the current selection.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

callWatchersHandler(event)

Description:
  • State changed listener.

    This function take any state change and send it to the proper watchers.

    To prevent internal state changes from colliding with other reactive instances, only the general "state changed" is triggered at document level. All the internal changes are triggered at private target level without bubbling. This way any reactive instance can alert only its own watchers.

Source:
Parameters:
Name Type Description
event CustomEvent

canUseStealth(state, cmIds) → {Boolean}

Description:
  • Check is some activities of a list can be stealth.

Source:
Parameters:
Name Type Description
state Object

the current state.

cmIds Array.<Number>

the module ids to check

Returns:

if any of the activities can be stealth.

Type
Boolean

checkAllBulkSelected(courseEditor) → {Boolean}

Description:
  • Check if all possible elements are selected.

Source:
Parameters:
Name Type Description
courseEditor CourseEditor
Returns:

if all elements of the current type are selected.

Type
Boolean

checkImage() → {Node}

Description:
  • Check accessiblity issue only for img type.

Source:
Returns:

A complete list of all warnings and problems.

Type
Node

checkTableCaption() → {Node}

Description:
  • Look for any table without a caption.

Source:
Returns:

A complete list of all warnings and problems.

Type
Node

clean()

Description:
  • Clean local storage

Source:

clearSearchState(clearSearchIcon, timelineViewRoot)

Description:
  • Hide the clear search icon.

Source:
Parameters:
Name Type Description
clearSearchIcon object

Clear search icon element.

timelineViewRoot object

The root element for the timeline view

cm(state, cminfo) → {Object}

Description:
  • Generate a cm export data from the state.

Source:
Parameters:
Name Type Description
state Object

the current state.

cminfo Object

the course module state data.

Returns:
Type
Object

cmCompletion(stateManager, cmIds, complete)

Description:
  • Mark or unmark course modules as complete.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of course modules ids

complete bool

the new completion value

cmCompletion(state, cminfo) → {Object}

Description:
  • Generate a completion export data from the cm element.

Source:
Parameters:
Name Type Description
state Object

the current state.

cminfo Object

the course module state data.

Returns:
Type
Object

(async) cmDelete(stateManager, cmIds)

Description:
  • Delete cms.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of section ids

cmDrag(stateManager, cmIds, dragValue)

Description:
  • Mark or unmark course modules as dragging.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of course modules ids

dragValue bool

the new dragging value

cmDraggableData(state, cmid) → {Object|null}

Description:
  • Generate a dragable cm data structure.

    This method is used by any draggable course module element to generate drop data for its reactive/dragdrop instance.

Source:
Parameters:
Name Type Description
state *

the state object

cmid *

the cours emodule id

Returns:
Type
Object | null

(async) cmDuplicate(stateManager, cmIds, targetSectionId, targetCmId)

Description:
  • Duplicate course modules

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of course modules ids

targetSectionId number | undefined

the optional target sectionId

targetCmId number | undefined

the target course module id

(async) cmHide(stateManager, cmIds)

Description:
  • Hide cms.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmLock(stateManager, cmIds, lockValue)

Description:
  • Lock or unlock course modules.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of course modules ids

lockValue bool

the new locked value

(async) cmMove(stateManager, cmids, targetSectionId, targetCmId)

Description:
  • Move course modules to specific course location.

    Note that one of targetSectionId or targetCmId should be provided in order to identify the new location:

    • targetCmId: the activities will be located avobe the target cm. The targetSectionId value will be ignored in this case.
    • targetSectionId: the activities will be appended to the section. In this case targetSectionId should not be present.
Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmids array

the list of cm ids to move

targetSectionId number

the target section id

targetCmId number

the target course module id

(async) cmMoveLeft(stateManager, cmIds)

Description:
  • Move cms to the left: indent = 0.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmMoveRight(stateManager, cmIds)

Description:
  • Move cms to the right: indent = 1.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmNoGroups(stateManager, cmIds)

Description:
  • Set cms group mode to NOGROUPS.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmSelect(stateManager, cmIds)

Description:
  • Select a list of cms.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmSeparateGroups(stateManager, cmIds)

Description:
  • Set cms group mode to SEPARATEGROUPS.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmShow(stateManager, cmIds)

Description:
  • Show cms.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmState(stateManager, cmids)

Description:
  • Get updated state data related to some cm ids.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state

cmids array

the list of cm ids to update

(async) cmStealth(stateManager, cmIds)

Description:
  • Stealth cms.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmUnselect(stateManager, cmIds)

Description:
  • Unselect a list of cms.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmVisibleGroups(stateManager, cmIds)

Description:
  • Set cms group mode to VISIBLEGROUPS.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

collapseGroup(item)

Description:
  • Collpase a group item.

Source:
Parameters:
Name Type Description
item JQuery

the jQuery object

configDragDrop(sectionid, state, fullregion)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
sectionid number

the section id

state Object

the initial state

fullregion Element

the complete section region to mark as dragged

configDragDrop(sectionitem)

Description:
  • Register state values and the drag and drop subcomponent.

Source:
Parameters:
Name Type Description
sectionitem BaseComponent

section item component

configDragDrop(cmid)

Description:
  • Configure the component drag and drop.

Source:
Parameters:
Name Type Description
cmid number

course module id

configState(state)

Description:
  • Save some values form the state.

Source:
Parameters:
Name Type Description
state Object

the current state

count(args) → {Promise}

Description:
  • Get a count of LTI tool types and tool proxies from Moodle for the given search args.

    See also: mod/lti/classes/external.php get_tool_types_and_proxies_count()

Source:
Parameters:
Name Type Description
args Object

Search parameters

Returns:

Promise that will be resolved when the ajax call returns.

Type
Promise

course(state) → {Object}

Description:
  • Generate the course export data from the state.

Source:
Parameters:
Name Type Description
state Object

the current state.

Returns:
Type
Object

(async) courseState(stateManager)

Description:
  • Get the full updated state data of the course.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state

createWarnings(description, nodes, isImageType) → {Array.<ProblemDetail>}

Description:
  • Generate the data that describes the issues found.

Source:
Parameters:
Name Type Description
description String

Description of this failure.

nodes Array.<HTMLElement>

An array of failing nodes.

isImageType boolean

Whether the warnings are related to image type checks

Returns:

A set of problem details

Type
Array.<ProblemDetail>

defaultCreate(stateManager, updateName, fields)

Description:
  • Process a create state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

defaultDelete(stateManager, updateName, fields)

Description:
  • Process a delete state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

defaultOverride(stateManager, updateName, fields)

Description:
  • Process an override state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

defaultPrepareFields(stateManager, updateName, fields) → {Object}

Description:
  • Prepare fields for processing.

    This method is used to add default values or calculations from the frontend side.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

Returns:

final fields data

Type
Object

defaultPut(stateManager, updateName, fields)

Description:
  • Process a put state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

defaultRemove(stateManager, updateName, fields)

Description:
  • Process a remove state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

defaultUpdate(stateManager, updateName, fields)

Description:
  • Process a update state message.

Source:
Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

destroy()

Description:
  • Component destroy hook.

    BaseComponent call this method when a component is unregistered or removed.

    Components may override this method to clean the HTML or do some action when the component is unregistered or removed.

Source:

destroy()

Description:
  • Remove all subcomponents dependencies.

Source:

destroy()

Description:
  • Remove all subcomponents dependencies.

Source:

destroy()

Description:
  • Remove all subcomponents dependencies.

Source:

dispatch(actionName, params)

Description:
  • Dispatch a change in the state.

    This method is the only way for components to alter the state. Watchers will receive a read only state to prevent illegal changes. If some user action require a state change, the component should dispatch a mutation to trigger all the necessary logic to alter the state.

Source:
Parameters:
Name Type Description
actionName string

the action name (usually the mutation name)

params mixed

any number of params the mutation needs.

dispatch(args)

Description:
  • Dispatch a change in the state.

    Usually reactive modules throw an error directly to the components when something goes wrong. However, course editor can directly display a notification.

Source:
Parameters:
Name Type Description
args mixed

any number of params the mutation needs.

dispatchRegistrationFail()

Description:
  • Dispatch a component registration fail event to inform the parent node.

    As dispatchRegistrationSuccess, this method will communicate the registration fail to the parent node to inform the possible parent component.

Source:

dispatchRegistrationSuccess()

Description:
  • Dispatch a component registration event to inform the parent node.

    The registration event is different from the rest of the component events because is the only way in which components can communicate its existence to a possible parent. Most components will be created by including a mustache file, child components must emit a registration event to the parent DOM element to alert about the registration.

Source:

dragEnd(dropdata)

Description:
  • The element end start hook.

Source:
Parameters:
Name Type Description
dropdata Object

the dropdata

dragEnd(dropdata)

Description:
  • The element drop end hook.

Source:
Parameters:
Name Type Description
dropdata Object

the dropdata

dragEnd(dropdata)

Description:
  • The element drop end hook.

Source:
Parameters:
Name Type Description
dropdata Object

the dropdata

dragStart(dropdata)

Description:
  • The element drop start hook.

Source:
Parameters:
Name Type Description
dropdata Object

the dropdata

dragStart(dropdata)

Description:
  • The element drop start hook.

Source:
Parameters:
Name Type Description
dropdata Object

the dropdata

dragStart(dropdata)

Description:
  • The element drop start hook.

Source:
Parameters:
Name Type Description
dropdata Object

the dropdata

drop(dropdata, event)

Description:
  • Drop event handler.

Source:
Parameters:
Name Type Description
dropdata Object

the accepted drop data

event Event

the drop event

drop(dropdata, event)

Description:
  • Drop event handler.

Source:
Parameters:
Name Type Description
dropdata Object

the accepted drop data

event Event

the drop event

drop(dropdata, event)

Description:
  • Drop event handler.

Source:
Parameters:
Name Type Description
dropdata Object

the accepted drop data

event Event

the drop event

enterCallback(jQueryItem)

Description:
  • Handle enter key on a collpasible node.

Source:
Parameters:
Name Type Description
jQueryItem JQuery

the jQuery object

expandAllGroups()

Description:
  • Expand all groups.

Source:

expandGroup(item)

Description:
  • Expand a group item.

Source:
Parameters:
Name Type Description
item JQuery

the jQuery object

fileDraggableData(state, dataTransfer) → {Object|null}

Description:
  • Generate a file draggable structure.

    This method is used when files are dragged on the browser.

Source:
Parameters:
Name Type Description
state *

the state object

dataTransfer *

the current data tranfer data

Returns:
Type
Object | null

formatSeconds(secs) → {String}

Description:
  • Helper method to convert time remaining in seconds into HH:MM:SS format.

Source:
Parameters:
Name Type Description
secs Number

Time remaining in seconds to get value for.

Returns:

Time remaining in HH:MM:SS format.

Type
String

get(type) → {object}

Description:
  • Get a registered type of modal.

Source:
Parameters:
Name Type Description
type string

The type of modal to get

Returns:

The registered config for the modal

Type
object

get(key) → {boolean|string}

Description:
  • Get a value from local storage. Remember - all values must be strings.

Source:
Parameters:
Name Type Description
key string

The cache key to check.

Returns:

False if the value is not in the cache, or some other error - a string otherwise.

Type
boolean | string

get(name, id) → {Object|undefined}

Description:
  • Get an element from the state or form an alternative state object.

    The altstate param is used by external update functions that gets the current state as param.

Source:
Parameters:
Name Type Description
name String

the state object name

id *

and object id for state maps.

Returns:

the state object found

Type
Object | undefined

get(name, id) → {Object|undefined}

Description:
  • Get state data.

    Components access the state frequently. This convenience method is a shortcut to this.reactive.state.stateManager.get() method.

Source:
Parameters:
Name Type Description
name String

the state object name

id *

an optional object id for state maps.

Returns:

the state object found

Type
Object | undefined

getActiveItem() → {Element|undefined}

Description:
  • Return the current active node.

Source:
Returns:

the active item if any

Type
Element | undefined

getAddFavouriteMenuItem(root, courseId) → {Object}

Description:
  • Get the action menu item

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id.

Returns:

The add to favourite menu item.

Type
Object

getClasses() → {Object}

Description:
  • Return the component drag and drop CSS classes.

Source:
Returns:

the dragdrop css classes

Type
Object

getContent() → {object}

Description:
  • Return the jQuery element with the content. This will return either the unread notification container or the all notification container depending on which is currently visible.

Source:
Returns:

jQuery object currently visible content contianer

Type
object

getCourseId(root) → {Number}

Description:
  • Get the course id from a favourite element.

Source:
Parameters:
Name Type Description
root Object

The favourite icon container element.

Returns:

Course id.

Type
Number

(async) getDialogueContent() → {Promise.<Array>}

Description:
  • Return the dialogue content.

Source:
Returns:

A template promise containing the rendered dialogue content.

Type
Promise.<Array>

getDraggableData() → {Object}

Description:
  • Get the draggable data of this component.

Source:
Returns:

exported course module drop data

Type
Object

getElementLocked(target) → {boolean}

Description:
  • Get the current locked value from the element.

Source:
Parameters:
Name Type Description
target Element

the event target

Returns:
Type
boolean

getElements(query, dataId) → {NodeList}

Description:
  • Get the all subelement that match a query selector.

Source:
Parameters:
Name Type Description
query string | undefined

optional subelement query

dataId string | undefined

optional data-id value

Returns:

the DOM elements

Type
NodeList

getEvents() → {Object}

Description:
  • Return the component custom event names.

    Components may override this method to provide their own events.

    Component custom events is an important part of component reusability. This function is static because is part of the component definition and should be accessible from outsite the instances. However, values will be available at instance level in the this.events object.

Source:
Returns:

the component events.

Type
Object

getExporter() → {Exporter}

Description:
  • Return a data exporter to transform state part into mustache contexts.

Source:
Returns:

the exporter class

Type
Exporter

getFavouriteIconContainer(root, courseId) → {Object}

Description:
  • Get the container element for the favourite icon.

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

Returns:

The favourite icon container

Type
Object

(async) getFileHandlersPromise() → {Promise}

Description:
  • Return the course file handlers promise.

Source:
Returns:

the promise for file handlers.

Type
Promise

getFilesDraggableData(dataTransfer) → {Array}

Description:
  • Convert a file dragging event into a proper dragging file list.

Source:
Parameters:
Name Type Description
dataTransfer DataTransfer

the event to convert

Returns:

of file list info.

Type
Array

getFilterValues(root) → {filters}

Description:
  • Get filter values from DOM.

Source:
Parameters:
Name Type Description
root object

The root element for the courses view.

Returns:

Set filters.

Type
filters

getFormatString(key, param) → {Promise.<String>}

Description:
  • Execute a get string for a possible format overriden editor string.

    Return the proper getString promise for an editor string using the core_courseformat of the format_PLUGINNAME compoment depending on the current view format setup.

Source:
Parameters:
Name Type Description
key String

the string key

param string | undefined

The param for variable expansion in the string.

Returns:

a getString promise

Type
Promise.<String>

getHideCourseMenuItem(root, courseId) → {Object}

Description:
  • Get the action menu item

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id.

Returns:

The hide course menu item.

Type
Object

getIds(name) → {Array}

Description:
  • Get all element ids from the given state.

Source:
Parameters:
Name Type Description
name String

the state object name

Returns:

the element ids.

Type
Array

getInitialPromise() → {Promise}

Description:
  • Generate a promise that will be resolved when the initial state is loaded.

    In most cases the final state will be loaded using an ajax call. This is the reason why states manager are created unlocked and won't be reactive until the initial state is set.

Source:
Returns:

the resulting promise

Type
Promise

getLastCm() → {element|null}

Description:
  • Get the last CM element of that section.

Source:
Returns:
Type
element | null

getLastCm() → {element|null}

Description:
  • Get the last CM element of that section.

Source:
Returns:

the las course module element of the section.

Type
element | null

getLastCm() → {element|null}

Description:
  • Get the last CM element of that section.

Source:
Returns:
Type
element | null

getMyCourses(filters, limit) → {promise}

Description:
  • Get enrolled courses from backend.

Source:
Parameters:
Name Type Description
filters object

The filters for this view.

limit int

The number of courses to show.

Returns:

Resolved with an array of courses.

Type
promise

getNotificationElement(id) → {object|null}

Description:
  • Find the notification element for the given id.

Source:
Parameters:
Name Type Description
id int
Returns:

The notification element

Type
object | null

getOffset() → {int}

Description:
  • Get the offset value for the current state of the popover in order to sent to the backend to correctly paginate the notifications.

Source:
Returns:

current offset

Type
int

getPageAnchorCmInfo()

Description:
  • Return the current page anchor cm info.

Source:

getPagedContentContainer(root, index) → {Object}

Description:
  • Get the paged content container element.

Source:
Parameters:
Name Type Description
root Object

The course overview container

index Number

Rendered page index.

Returns:

The rendered paged container.

Type
Object

getRemoveFavouriteMenuItem(root, courseId) → {Object}

Description:
  • Get the action menu item

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id.

Returns:

The remove from favourites menu item.

Type
Object

getSearchMyCourses(filters, limit, searchValue) → {promise}

Description:
  • Search for enrolled courses from backend.

Source:
Parameters:
Name Type Description
filters object

The filters for this view.

limit int

The number of courses to show.

searchValue string

What does the user want to search within their courses.

Returns:

Resolved with an array of courses.

Type
promise

getSelector(selectorName) → {string|undefined}

Description:
  • Return a component selector.

Source:
Parameters:
Name Type Description
selectorName string

the selector name

Returns:

the query selector

Type
string | undefined

(async) getServerCourseState() → {Object}

Description:
  • Load the current course state from the server.

Source:
Returns:

the current course state

Type
Object

getShowCourseMenuItem(root, courseId) → {Object}

Description:
  • Get the action menu item

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id.

Returns:

The show course menu item.

Type
Object

getState() → {Promise}

Description:
  • Return the initial state promise.

    Typically, components do not require to use this promise because registerComponent will trigger their stateReady method automatically. But it could be useful for complex components that require to combine state, template and string loadings.

Source:
Returns:
Type
Promise

getStorageValue(key) → {boolean|string}

Description:
  • Get a value from the course editor static storage if any.

    The course editor static storage uses the sessionStorage to store values from the components. This is used to prevent unnecesary template loadings on every page. However, the storage does not work if no sessionStorage can be used (in debug mode for example), if the page is in editing mode or if the initial state change from the last page.

Source:
Parameters:
Name Type Description
key string

the key to get

Returns:

the storage value or false if cannot be loaded

Type
boolean | string

getTableRoot(e) → {HTMLElement|bool}

Description:
  • Get the table root from an event.

Source:
Parameters:
Name Type Description
e Event
Returns:
Type
HTMLElement | bool

getWarnings() → {Array.<ProblemDetail>}

Description:
  • Find all problems with the content editable region.

Source:
Returns:

A complete list of all warnings and problems.

Type
Array.<ProblemDetail>

getWatchers() → {array}

Description:
  • Return the list of watchers that component has.

    Each watcher is represented by an object with two attributes:

    • watch (string) the specific state event to watch. Example 'section.visible:updated'
    • handler (function) the function to call when the watching state change happens

    Any component shoudl override this method to define their state watchers.

Source:
Returns:

array of watchers.

Type
array

getWatchers() → {Array}

Description:
  • Return the component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Return the component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Return the component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Return the component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

getWatchers() → {Array}

Description:
  • Component watchers.

Source:
Returns:

of watchers

Type
Array

(async) handleBlockProtectToggle(tableRoot, e)

Description:
  • Handle toggling of block protection.

Source:
Parameters:
Name Type Description
tableRoot HTMLElement
e Event

handleItemClick(event, jQueryItem)

Description:
  • Handle an item click.

Source:
Parameters:
Name Type Description
event Event

the click event

jQueryItem jQuery

the item clicked

(async) handleStateToggle(tableRoot, e)

Description:
  • Handle state toggling.

Source:
Parameters:
Name Type Description
tableRoot HTMLElement
e Event

hasDoneInitialLoad() → {bool}

Description:
  • Check if the first load of notification has been triggered for the current state of the popover.

Source:
Returns:

true if first notification loaded, false otherwise

Type
bool

hasLoadedAllContent() → {bool}

Description:
  • Check if we've loaded all of the notifications for the current popover state.

Source:
Returns:

true if all notifications loaded, false otherwise

Type
bool

hideCourse(root, courseId)

Description:
  • Hide course

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

hideDropZone()

Description:
  • Hide the component dropzone.

Source:

hideDropZone()

Description:
  • Hide the component dropzone.

Source:

hideDropZone()

Description:
  • Hide the component dropzone.

Source:

hideElement(root, id)

Description:
  • Reset the loadedPages dataset to take into account the hidden element

Source:
Parameters:
Name Type Description
root Object

The course overview container

id Number

The course id number

hideFavouriteIcon(root, courseId)

Description:
  • Hide the favourite icon.

Source:
Parameters:
Name Type Description
root Object

The favourite icon container element.

courseId Number

Course id number.

hideUnreadCount()

Description:
  • Hide the unread notification count badge on the menu toggle.

Source:

incrementOffset()

Description:
  • Increment the offset for the current state, if required.

Source:

init()

Description:
  • Initialize the page.

Source:

init(timerId)

Description:
  • Set up the submission timer.

Source:
Parameters:
Name Type Description
timerId Number

Unique ID of the timer element.

initializePagedContent(root, promiseFunction, inputValue)

Description:
  • Initialise the courses list and cards views on page load.

Source:
Parameters:
Name Type Default Description
root object

The root element for the courses view.

promiseFunction function

How do we fetch the courses and what do we do with them?

inputValue null | string null

What to search for

isDropzoneVisible() → {boolean}

Description:
  • Return the current drop-zone visible of the element.

Source:
Returns:

if the dropzone should be visible or not

Type
boolean

isGroupCollapsed(jQueryItem) → {boolean}

Description:
  • Check if a gorup item is collapsed.

Source:
Parameters:
Name Type Description
jQueryItem JQuery

the jQuery object

Returns:

if the element is collapsed

Type
boolean

itemsPerPageFunc(pagingLimit, root) → {Array.<Number>}

Description:
  • Figure out how many items are going to be allowed to be rendered in the block.

Source:
Parameters:
Name Type Description
pagingLimit Number

How many courses to display

root Object

The course overview container

Returns:

How many courses will be rendered

Type
Array.<Number>

(async) loadCourse(courseId, serverStateKey)

Description:
  • Set up the course editor when the page is ready.

    The course can only be loaded once per instance. Otherwise an error is thrown.

    The backend can inform the module of the current state key. This key changes every time some update in the course affect the current user state. Some examples are:

    • The course content has been edited
    • The user marks some activity as completed
    • The user collapses or uncollapses a section (it is stored as a user preference)
Source:
Parameters:
Name Type Description
courseId number

course id

serverStateKey string

the current backend course cache reference

loadMoreNotifications() → {object}

Description:
  • Send a request for more notifications from the server, if we aren't already loading some and haven't already loaded all of them.

    Takes into account the current mode of the popover and will request only unread notifications if required.

    All notifications are marked as read by the server when they are returned.

Source:
Returns:

jQuery promise that is resolved when notifications have been retrieved and added to the DOM

Type
object

loadStaticContent() → {boolean}

Description:
  • Load the course index from the session storage if any.

Source:
Returns:

true if the static version is loaded form the session

Type
boolean

(async) loadTemplateContent(state)

Description:
  • Load the course index template.

Source:
Parameters:
Name Type Description
state Object

the initial state

markAllAsRead() → {Promise}

Description:
  • Send a request to the server to mark all unread notifications as read and update the unread count and unread notification elements appropriately.

Source:
Returns:
Type
Promise

module:core/emoji/auto_complete(root, textArea, hasSuggestionCallback, selectCallback)

Description:
  • Initialise the emoji auto complete.

Source:
Parameters:
Name Type Description
root Element

The root container element for the auto complete

textArea Element

The text area element to monitor for auto complete

hasSuggestionCallback function

Callback for when there are auto-complete suggestions

selectCallback function

Callback for when the user selects an emoji

module:core/emoji/picker(root, selectCallback)

Description:
  • Initialise the emoji picker.

Source:
Parameters:
Name Type Description
root Element

The root element for the picker

selectCallback function

Callback for when the user selects an emoji

module:core/menu_navigation(elementRoot)

Description:
  • The initial entry point that a given module can pass a HTMLElement.

Source:
Parameters:
Name Type Description
elementRoot HTMLElement

The menu to add handlers upon.

module:core/moremenu(menu)

Description:
  • Initialise the more menus.

Source:
Parameters:
Name Type Description
menu HTMLElement

The navbar moremenu.

module:mod_forum/local/grades/local/grader/gradingpanel(component, context, gradingComponent, gradingSubtype, itemName) → {Object}

Description:
  • Get the grade panel setter and getter for the current component. This function dynamically pulls the relevant gradingpanel JS file defined in the grading method. We do this because we do not know until execution time what the grading type is and we do not want to import unused files.

Source:
Parameters:
Name Type Description
component String

The component being graded

context Number

The contextid of the thing being graded

gradingComponent String

The thing providing the grading type

gradingSubtype String

The subtype fo the grading component

itemName String

The name of the thing being graded

Returns:
Type
Object

module:mod_forum/local/grades/local/grader/user_picker(users, showUserCallback, preChangeUserCallback, currentUserIDopt) → {UserPicker}

Description:
  • Create a new user picker.

Source:
Parameters:
Name Type Attributes Description
users Array

The list of users

showUserCallback function

The function to call to show a specific user

preChangeUserCallback function

The fucntion to call to save the grade for the current user

currentUserID Number <optional>

The userid of the current user

Returns:
Type
UserPicker

noCoursesRender(root) → {promise}

Description:
  • Given there are no courses to render provide the rendered template.

Source:
Parameters:
Name Type Description
root object

The root element for the courses view.

Returns:

jQuery promise resolved after rendering is complete.

Type
promise

pageBuilder(coursesData, currentPage, pageData, actions, activeSearch)

Description:
  • Mutates and controls the loadedPages array and handles the bootstrapping.

Source:
Parameters:
Name Type Default Description
coursesData Array | Object

Array of all of the courses to start building the page from

currentPage Number

What page are we currently on?

pageData Object

Any current page information

actions Object

Paged content helper

activeSearch null | boolean null

Are we currently actively searching and building up search results?

processUpdate(updateName, action, fields, updateTypes)

Description:
  • Process a single state update.

    Note this method will not lock or unlock the state by itself.

Source:
Parameters:
Name Type Description
updateName string

the state element to update

action string

to action to perform

fields object

the new data

updateTypes Object

optional functions to override the default update types.

processUpdates(updates, updateTypes)

Description:
  • Process a state updates array and do all the necessary changes.

    Note this method unlocks the state while it is executing and relocks it when finishes.

Source:
Parameters:
Name Type Description
updates array
updateTypes Object

optional functions to override the default update types.

query(args) → {Promise}

Description:
  • Get a list of LTI tool types and tool proxies from Moodle for the given search args.

    See also: mod/lti/classes/external.php get_tool_types_and_proxies()

Source:
Parameters:
Name Type Description
args Object

Search parameters

Returns:

Promise that will be resolved when the ajax call returns.

Type
Promise

register(type, module, template)

Description:
  • Register a modal with the registry.

Source:
Parameters:
Name Type Description
type string

The type of modal (must be unique)

module function

The modal module (must be a constructor function of type core/modal)

template string

The template name of the modal

registerChildComponent(component)

Description:
  • Register a child component into the reactive instance.

Source:
Parameters:
Name Type Description
component self

the component to register.

registerComponent(component) → {object}

Description:
  • Register a new component.

    Component can provide some optional functions to the reactive module:

    • getWatchers: returns an array of watchers
    • stateReady: a method to call when the initial state is loaded

    It can also provide some optional attributes:

    • name: the component name (default value: "Unkown component") to customize debug messages.

    The method will also use dispatchRegistrationSuccess and dispatchRegistrationFail. Those are BaseComponent methods to inform parent components of the registration status. Components should not override those methods.

Source:
Parameters:
Name Type Description
component object

the new component

Properties
Name Type Attributes Description
name string <optional>

the component name to display in warnings and errors.

dispatchRegistrationSuccess function <optional>

method to notify registration success

dispatchRegistrationFail function <optional>

method to notify registration fail

getWatchers function <optional>

getter of the component watchers

stateReady function <optional>

method to call when the state is ready

Returns:

the registered component

Type
object

registerEventListeners()

Description:
  • Register event listeners for the default_notification_preferences page.

Source:

registerEventListeners()

Description:
  • Add all of the required event listeners for this notification popover.

Source:

registerEventListeners(root, page)

Description:
  • Listen to, and handle events for the myoverview block.

Source:
Parameters:
Name Type Description
root Object

The myoverview block container element.

page HTMLElement

The whole HTMLElement for our block.

registerPagedEventHandlers(root, namespace)

Description:
  • Intialise the paged list and cards views on page load. Returns an array of paged contents that we would like to handle here

Source:
Parameters:
Name Type Description
root object

The root element for the courses view

namespace string

The namespace for all the events attached

registerSearch(root, timelineViewRoot)

Description:
  • Event listener for the "search" input field in the timeline navigation that allows for searching the activity name, course name and activity type.

Source:
Parameters:
Name Type Description
root object

The root element for the timeline block

timelineViewRoot object

The root element for the timeline view

registerSelector(root)

Description:
  • Event listener for the Display filter (cards, list).

Source:
Parameters:
Name Type Description
root object

The root element for the overview block

registerStateAction(field, prop, action, data)

Description:
  • Register a state modification and generate the necessary events.

    This method is used mainly by proxy helpers to dispatch state change event. However, mutations can use it to inform components about non reactive changes in the state (only the two first levels of the state are reactive).

    Each action can produce several events:

    • The specific attribute updated, created or deleter (example: "cm.visible:updated")
    • The general state object updated, created or deleted (example: "cm:updated")
    • If the element has an ID attribute, the specific event with id (example: "cm[42].visible:updated")
    • If the element has an ID attribute, the general event with id (example: "cm[42]:updated")
    • A generic state update event "state:update"
Source:
Parameters:
Name Type Description
field string

the affected state field name

prop string | null

the affecter field property (null if affect the full object)

action string

the action done (created/updated/deleted)

data *

the affected data

registerTimelineDaySelector(root, timelineViewRoot)

Description:
  • Event listener for the day selector ("Next 7 days", "Next 30 days", etc).

Source:
Parameters:
Name Type Description
root object

The root element for the timeline block

timelineViewRoot object

The root element for the timeline view

registerViewSelector(root, timelineViewRoot)

Description:
  • Event listener for the "sort" button in the timeline navigation that allows for changing between the timeline dates and courses views.

    On a view change we tell the timeline view module that the view has been shown so that it can handle how to display the appropriate view.

Source:
Parameters:
Name Type Description
root object

The root element for the timeline block

timelineViewRoot object

The root element for the timeline view

remove()

Description:
  • Remove a previously rendered component instance.

    This method will remove the component HTML and unregister it from the reactive module.

Source:

removeAllEventListeners()

Description:
  • Remove all event listeners from this component.

    This method is called also when the component is unregistered or removed.

    Note that only listeners registered with the addEventListener method will be removed. Other manual listeners will keep active.

Source:

removeEventListener(target, type, listener)

Description:
  • Remove an event listener from a component.

    This method allows components to remove listeners without keeping track of the listeners bind versions of the method. Both addEventListener and removeEventListener keeps internally the relation between the original class method and the bind one.

Source:
Parameters:
Name Type Description
target Element

the event target

type string

the event name

listener function

the class method that recieve the event

removeFromFavourites(root, courseId)

Description:
  • Remove course from favourites

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

renderComponent(target, file, data) → {Promise}

Description:
  • Render a new Component using a mustache file.

    It is important to note that this method should NOT be used for loading regular mustache files as it returns a Promise that will only be resolved if the mustache registers a component instance.

Source:
Parameters:
Name Type Description
target element

the DOM element that contains the component

file string

the component mustache file to render

data *

the mustache data

Returns:

a promise of the resulting component instance

Type
Promise

renderCourses(root, coursesData) → {promise}

Description:
  • Render the dashboard courses.

Source:
Parameters:
Name Type Description
root object

The root element for the courses view.

coursesData array

containing array of returned courses.

Returns:

jQuery promise resolved after rendering is complete.

Type
promise

renderNotifications(notifications, container) → {object}

Description:
  • Render the notification data with the appropriate template and add it to the DOM.

Source:
Parameters:
Name Type Description
notifications array

Notification data

container object

jQuery object the container to append the rendered notifications

Returns:

jQuery promise that is resolved when all notifications have been rendered and added to the DOM

Type
object

renderUnreadCount()

Description:
  • Show the unread notification count badge on the menu toggle if there are unread notifications, otherwise hide it.

Source:

resetGlobals()

Description:
  • In cases when switching between regular rendering and search rendering we need to reset some variables.

Source:

searchFunctionalityCurry() → {function}

Description:
  • Initialize the searching functionality so we can call it when required.

Source:
Returns:
Type
function

section(state, sectioninfo) → {Object}

Description:
  • Generate a section export data from the state.

Source:
Parameters:
Name Type Description
state Object

the current state.

sectioninfo Object

the section state data.

Returns:
Type
Object

(async) sectionContentCollapsed(stateManager, sectionIds, collapsed)

Description:
  • Update the course content collapsed attribute of some sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the affected section ids

collapsed boolean

the new collapsed value

(async) sectionDelete(stateManager, sectionIds)

Description:
  • Delete sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of course modules ids

sectionDrag(stateManager, sectionIds, dragValue)

Description:
  • Mark or unmark course sections as dragging.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids

dragValue bool

the new dragging value

sectionDraggableData(state, sectionid) → {Object|null}

Description:
  • Generate a dragable cm data structure.

    This method is used by any draggable section element to generate drop data for its reactive/dragdrop instance.

Source:
Parameters:
Name Type Description
state *

the state object

sectionid *

the cours section id

Returns:
Type
Object | null

(async) sectionHide(stateManager, sectionIds)

Description:
  • Hides sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids

(async) sectionIndexCollapsed(stateManager, sectionIds, collapsed)

Description:
  • Update the course index collapsed attribute of some sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the affected section ids

collapsed boolean

the new collapsed value

sectionLock(stateManager, sectionIds, lockValue)

Description:
  • Lock or unlock course sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids

lockValue bool

the new locked value

(async) sectionMove(stateManager, sectionIds, targetSectionId)

Description:
  • Move course modules to specific course location.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids to move

targetSectionId number

the target section id

(async) sectionMoveAfter(stateManager, sectionIds, targetSectionId)

Description:
  • Move course modules after a specific course location.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids to move

targetSectionId number

the target section id

sectionSelect(stateManager, sectionIds)

Description:
  • Select a list of sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of cm ids

(async) sectionShow(stateManager, sectionIds)

Description:
  • Show sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids

sectionState(stateManager, sectionIds)

Description:
  • Get updated state data related to some section ids.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state

sectionIds array

the list of section ids to update

sectionUnselect(stateManager, sectionIds)

Description:
  • Unselect a list of sections.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of cm ids

selectAllBulk(courseEditor, value)

Description:
  • Select/unselect all element of the selected type.

Source:
Parameters:
Name Type Description
courseEditor CourseEditor
value Boolean

if the elements must be selected or unselected.

selectAndScroll(node)

Description:
  • Set the selection and scroll to the selected element.

Source:
Parameters:
Name Type Description
node node

set(key, value) → {boolean}

Description:
  • Set a value to local storage. Remember - all values must be strings.

Source:
Parameters:
Name Type Description
key string

The cache key to set.

value string

The value to set.

Returns:

False if the value can't be saved in the cache, or some other error - true otherwise.

Type
boolean

setBlockProtectState(plugin, state) → {Promise}

Description:
  • Set the block protection state.

Source:
Parameters:
Name Type Description
plugin string
state number
Returns:
Type
Promise

setCourseFavouriteState(courseId, status) → {Promise}

Description:
  • Set the courses favourite status and push to repository

Source:
Parameters:
Name Type Description
courseId Number

Course id to favourite.

status boolean

new favourite status.

Returns:

Repository promise.

Type
Promise

setCourseHiddenState(courseId, status) → {Promise}

Description:
  • Set the courses hidden status and push to repository

Source:
Parameters:
Name Type Description
courseId Number

Course id to favourite.

status Boolean

new hidden status.

Returns:

Repository promise.

Type
Promise

setDraggable(value)

Description:
  • Enable or disable the draggable property.

Source:
Parameters:
Name Type Description
value bool

the new draggable value

setDraggable(value)

Description:
  • Enable or disable the draggable property.

Source:
Parameters:
Name Type Description
value bool

the new draggable value

setDraggable(value)

Description:
  • Enable or disable the draggable property.

Source:
Parameters:
Name Type Description
value bool

the new draggable value

setElementLocked(target, locked)

Description:
  • Lock/unlock an element.

Source:
Parameters:
Name Type Description
target Element

the event target

locked boolean

the new locked value

setInitialState(initialState)

Description:
  • Loads the initial state.

    Note this method will trigger a state changed event with "state:loaded" actionname.

    The state mode will be set to read only when the initial state is loaded.

Source:
Parameters:
Name Type Description
initialState object

setInitialState(stateData)

Description:
  • Set the initial state.

Source:
Parameters:
Name Type Description
stateData object

the initial state data.

setLimit(root) → {function}

Description:
  • Return the callback to be passed to the subscribe event

Source:
Parameters:
Name Type Description
root object

The root element for the courses view

Returns:

Partially applied function that'll execute when passed a limit

Type
function

setLoadedAllContent(val)

Description:
  • Set the state of the loaded all content property for the current state of the popover.

Source:
Parameters:
Name Type Description
val bool

True if all content is loaded, false otherwise

setLogger(logger)

Description:
  • Set the logger class instance.

    Reactive instances can provide alternative loggers to provide advanced logging.

Source:
Parameters:
Name Type Description
logger Logger

setMutations(manager)

Description:
  • Replace the current mutations with a new object.

    This method is designed to override the full mutations class, for example by extending the original one. To add some individual mutations, use addMutations instead.

Source:
Parameters:
Name Type Description
manager object

the new mutations intance

setPageItem(stateManager, type, id, isStatic)

Description:
  • Set the page current item.

    Only one element of the course state can be the page item at a time.

    There are several actions that can alter the page current item. For example, when the user is in an activity page, the page item is always the activity one. However, in a course page, when the user scrolls to an element, this element get the page item.

    If the page item is static means that it is not meant to change. This is important because static page items has some special logic. For example, if a cm is the static page item and it is inside a collapsed section, the course index will expand the section to make it visible.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

type String | undefined

the element type (section or cm). Undefined will remove the current page item.

id Number | undefined

the element id

isStatic boolean | undefined

if the page item is static

setPluginState(methodname, plugin, state) → {Promise}

Description:
  • Set the plugin state (enabled or disabled)

Source:
Parameters:
Name Type Description
methodname string

The web service to call

plugin string

The name of the plugin to set the state for

state number

The state to set

Returns:
Type
Promise

setReadOnly(readonly)

Description:
  • Locks or unlocks the state to prevent illegal updates.

    Mutations use this method to modify the state. Once the state is updated, they must block again the state.

    All changes done while the state is writable will be registered using registerStateAction. When the state is set again to read only the method will trigger _publishEvents to communicate changes to all watchers.

Source:
Parameters:
Name Type Description
readonly bool

if the state is in read only mode enabled

setStorageValue(key, value) → {boolean}

Description:
  • Stores a value into the course editor static storage if available

Source:
Parameters:
Name Type Description
key String

the key to store

value *

the value to store (must be compatible with JSON,stringify)

Returns:

true if the value is stored

Type
boolean

showCourse(root, courseId)

Description:
  • Show course

Source:
Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

showDropZone()

Description:
  • Display the component dropzone.

Source:

showDropZone(dropdata)

Description:
  • Display the component dropzone.

Source:
Parameters:
Name Type Description
dropdata Object

the accepted drop data

showDropZone(dropdata)

Description:
  • Display the component dropzone.

Source:
Parameters:
Name Type Description
dropdata Object

the accepted drop data

showFavouriteIcon(root, courseId)

Description:
  • Show the favourite icon.

Source:
Parameters:
Name Type Description
root Object

The course overview container.

courseId Number

Course id number.

standardFunctionalityCurry() → {function}

Description:
  • The default functionality of fetching paginated courses without special handling.

Source:
Returns:
Type
function

stateReady()

Description:
  • Initial state ready method.

    This method will add all the necessary event listeners to the component depending on the parent methods.

    • Add drop events to the element if the parent component has validateDropData method.
    • Configure the elements draggable if the parent component has getDraggableData method.
Source:

stateReady()

Description:
  • Reactive module will call this method when the state is ready.

    Component can override this method to update/load the component HTML or to bind listeners to HTML entities.

Source:

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the state data

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the initial state

(async) stateReady(state)

Description:
  • Initial state ready method.

    This stateReady to be async because it loads the real courseindex.

Source:
Parameters:
Name Type Description
state object

the initial state

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the state data

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the course state.

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the initial state

stateReady()

Description:
  • Initial state ready method.

Source:

stateReady()

Description:
  • Initial state ready method.

Source:

stateReady()

Description:
  • Initial state ready method.

Source:

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the state data.

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Description:
  • Initial state ready method.

Source:
Parameters:
Name Type Description
state Object

the state data

stop()

Description:
  • Stop the timer, if it is running.

Source:

submitTagCreateUpdateForm(questionId, contextId, formdata) → {promise}

Description:
  • Submit the form data for the question tags form.

Source:
Parameters:
Name Type Description
questionId Number
contextId Number
formdata string

The URL encoded values from the form

Returns:
Type
promise

switchBulkSelection(courseEditor)

Description:
  • Switch the current bulk selection.

Source:
Parameters:
Name Type Description
courseEditor CourseEditor

toggleBulkSelectionAction(courseEditor, target, event, elementType)

Description:
  • Process a bulk selection toggle action.

Source:
Parameters:
Name Type Description
courseEditor CourseEditor
target HTMLElement

the action element

event Event
elementType String

cm or section

toggleGroup(item)

Description:
  • Toggle a group item.

Source:
Parameters:
Name Type Description
item JQuery

the jQuery object

unlockAll(stateManager)

Description:
  • Unlock all course elements.

Source:
Parameters:
Name Type Description
stateManager StateManager

the current state manager

unregister()

Description:
  • Unregister the component from the reactive module.

    This method will disable the component logic, event listeners and watchers but it won't remove any HTML created by the component. However, it will trigger the destroy hook to allow the component to clean parts of the interface.

Source:

unregisterComponent(component) → {object}

Description: