Global

Members

(constant) addContextmenuItem

Source:

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

(constant) addMenubarItem

Source:

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

(constant) addQuickbarsToolbarItem

Source:

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

(constant) addToolbarButton

Source:

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

(constant) addToolbarButtons

Source:

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

(constant) addToolbarSection

Source:

Insert a new section into the toolbar.

(constant) byCategory

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

Source:

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

current :LoadingProcess

Source:

the current uploading process.

Type:

(constant) displayFilepicker

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

Source:

the courses pending to be updated.

Type:
  • Map

endTime

Source:
Properties:
Name Type Description
endTime Number

Timestamp at which time runs out.

(constant) ensureEditorIsValid

Source:

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

errorCallback :function

Source:

the error callback if any.

Type:
  • function

extraData :Object

Source:

any extra process information to store.

Type:
  • Object

finishedCallback :function

Source:

the finished callback if any.

Type:
  • function
Source:

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

(constant) getImagePath

Source:

Get the image path for the specified image.

(constant) getPluginMetadata

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

Source:

Initialise all of the modules for the overview block.

(constant) init

Source:

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

(constant) init

Source:

Intialise the courses list and cards views on page load.

(constant) init

Source:

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

isEditing

Source:

Return the current edit mode.

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

isLoggerSet :boolean

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

Source:

Set the lock value and locks or unlocks the element.

locked

Source:

Get the current locked value from the element.

manager :ProcessMonitorManager

Source:

the page monitor.

Type:
  • ProcessMonitorManager

pending :Array

Source:

the pending queue.

Type:
  • Array

prepare

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.

removedCallback :function

Source:

the removed callback if any.

Type:
  • function

(constant) removeMenubarItem

Source:

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

(constant) removeMenubarItems

Source:

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

(constant) removeSubmenuItem

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

Source:

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

(constant) removeToolbarButtons

Source:

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

(constant) reset

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

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

Source:

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

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.

state

Source:

Return the current state.

stop

Source:

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

StorageWrapper :Object

Source:

Wraps browsers localStorage object

Type:
  • Object

supportComponents

Source:

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

The :string

Source:

placeholder character used for standard strings (unclean)

Type:
  • string

The :string

Source:

placeholder character used for cleaned strings

Type:
  • string

timeoutId

Source:
Properties:
Name Type Description
timeoutId Number

ID of the timeout that updates the clock.

timer

Source:
Properties:
Name Type Description
timer Element

The timer element.

(constant) updateEditorState

Source:

Updates the state of the editor.

Methods

_activityAnchor(event)

Source:

The activity anchor event.

Parameters:
Name Type Description
event Event

_addEventTotalMovement(event)

Source:

Add the total amout of movement to a mouse event.

Parameters:
Name Type Description
event MouseEvent

_addIdsToSelection(stateManager, typeName, ids)

Source:

Add some ids to the current bulk selection.

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)

Source:

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.

Parameters:
Name Type Description
event Event

the triggered event

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

Source:

Private method to call core_courseformat_update_course webservice.

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)

Source:

Convenient method for calling parent component functions if present.

Parameters:
Name Type Description
methodname string

the name of the method

dropdata Object

the current drop data object

event Event

the original event

_cancelBulk()

Source:

Cancel bulk handler.

_cancelDebouncedReloadCm(cmId)

Source:

Cancel the active reload CM debounced function, if any.

Parameters:
Name Type Description
cmId Number

_checkSectionlist(detail)

Source:

Check the section list and disable some options if needed.

Parameters:
Name Type Description
detail Object

the update details.

Properties
Name Type Description
state Object

the state object.

_closeMonitor()

Source:

Close the monitor.

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

Source:

Execute a basic course module state action.

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)

Source:

Activity manual completion listener.

Parameters:
Name Type Description
event Event

the custom ecent

_completionHandler(event)

Source:

Activity manual completion listener.

Parameters:
Name Type Description
event Event

the custom event

Properties
Name Type Description
detail object

the event details

_containsOnlyFiles(event) → {boolean}

Source:

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.

Parameters:
Name Type Description
event Event

the original event.

Returns:

if the drag dataTransfers contains files.

Type
boolean

(async) _createCm(param)

Source:

Create a newcm instance.

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

_createCmItem(container, cmid) → {Element}

Source:

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.

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)

Source:

Create a monitor item.

Parameters:
Name Type Description
args object

the watcher arguments

Properties
Name Type Description
element object

the item state data

(async) _createSection(details)

Source:

Create a new section instance.

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}

Source:

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.

Parameters:
Name Type Description
container Element

the container element (section)

sectionid Number

the course-module ID

Returns:

the created element

Type
Element

_deleteCm(param)

Source:

Remove a cm from the list.

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

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

_deleteSection(details)

Source:

Remove a section from the list.

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

Parameters:
Name Type Description
details Object

the update details.

Properties
Name Type Description
element Object

the element data.

_destroyModal(modal, element)

Source:

Hide and later destroy a modal.

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

Parameters:
Name Type Description
modal Modal
element HTMLElement

the dom element to focus on.

Source:

Replace an element with a copy with a different tag name.

Parameters:
Name Type Description
element Element

the original element

_dragEnd(event)

Source:

Drag end event handler.

Parameters:
Name Type Description
event Event

the event.

_dragEnter(event)

Source:

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.

Parameters:
Name Type Description
event Event

the event.

_dragLeave(event)

Source:

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.

Parameters:
Name Type Description
event Event

the event.

_dragOver(event)

Source:

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.

Parameters:
Name Type Description
event Event

the event.

_dragStart(event)

Source:

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.

Parameters:
Name Type Description
event Event

the event.

_drop(event)

Source:

Drop event handler.

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

Parameters:
Name Type Description
event Event

the event.

_enableBulk()

Source:

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.

_expandSectionNode(element, forceValue)

Source:

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.

Parameters:
Name Type Description
element Object

the course module state element

forceValue boolean

optional forced expanded value

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

Source:

Fix/reorder the section or cms order.

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)

Source:

Fix/reorder the section or cms order.

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}

Source:

Get the closest actions menu toggler to an action element.

Parameters:
Name Type Description
element HTMLElement

the action link element

Returns:
Type
HTMLElement | undefined

_getDebouncedReloadCm(cmId) → {function}

Source:

Generate or get a reload CM debounced function.

Parameters:
Name Type Description
cmId Number
Returns:

the debounced reload function

Type
function

_getDraggableData() → {Object}

Source:

Get the draggable data of this component.

Returns:

exported course module drop data

Type
Object

_getDropData(event) → {Object|undefined}

Source:

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

Source:

Get log entry for the current action.

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>}

Source:

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.

Parameters:
Name Type Description
target HTMLElement
Returns:

array of Ids

Type
Array.<Number>

_handleUnselectAll()

Source:

Process unselect all elements.

_indexContents()

Source:

Regenerate content indexes.

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

_isCmBulkEnabled(bulk) → {Boolean}

Source:

Check if cm bulk selection is available.

Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_isSectionBulkEditable() → {Boolean}

Source:

Check if the section is bulk editable.

Returns:
Type
Boolean

_isSectionBulkEnabled(bulk) → {Boolean}

Source:

Check if cm bulk selection is available.

Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_isSelected(bulk) → {Boolean}

Source:

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

Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_isSelected(bulk) → {Boolean}

Source:

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

Parameters:
Name Type Description
bulk Object

the current state bulk attribute

Returns:
Type
Boolean

_loadFileHandlers()

Source:

Load the file hanlders promise.

_modalBodyRenderedPromise(ModalClass, modalParams) → {Promise}

Source:

Render a modal and return a body ready promise.

Parameters:
Name Type Description
ModalClass Modal

the modal class

modalParams object

the modal params

Returns:

the modal body ready promise

Type
Promise

_mouseLeave()

Source:

Mouse leave handler.

_mouseOver()

Source:

Mouse over handle.

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

Source:

Add default values to state elements.

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

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}

Source:

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

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

Source:

Internal method to publish events.

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

_refreshActions(param)

Source:

Refresh the visible action buttons depending on the selection type.

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

the affected element (bulk in this case).

_refreshActivityCard(bulk, selected)

Source:

Update the activity card depending on the bulk selection.

Parameters:
Name Type Description
bulk Object

the current bulk state data

selected Boolean

if the activity is selected.

_refreshAllSectionsToggler(state)

Source:

Refresh the collapse/expand all sections element.

Parameters:
Name Type Description
state Object

The state data

_refreshBulk(param)

Source:

Update the bulk editing interface.

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

the state data

_refreshBulk(param)

Source:

Update a bulk options.

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

the state data

_refreshCm(param)

Source:

Update a course index cm using the state information.

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

details the update details.

_refreshCm(param)

Source:

Update a course index cm using the state information.

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

details the update details.

_refreshCmName(param)

Source:

Update a course module name on the whole page.

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

details the update details.

(async) _refreshCompletion(details)

Source:

Update the activity completion icon.

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)

Source:

Refresh the section list.

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

the full state object.

_refreshCourseSectionlist(param)

Source:

Refresh the section list.

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

_refreshEnabled(param)

Source:

Hide and show the bulk edit tools.

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

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

(async) _refreshItem(args)

Source:

Create a monitor item.

Parameters:
Name Type Description
args object

the watcher arguments

Properties
Name Type Description
element object

the item state data

_refreshPageItem(details)

Source:

Handle a page item update.

Parameters:
Name Type Description
details Object

the update details

Properties
Name Type Description
element Object

the course state data.

_refreshPageItem(details)

Source:

Handle a page item update.

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)

Source:

Handle a page item update.

Parameters:
Name Type Description
details Object

the update details

Properties
Name Type Description
state Object

the state data.

element Object

the course state data.

_refreshSection(param)

Source:

Update a content section using the state information.

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

details the update details.

_refreshSection(param)

Source:

Update a course index section using the state information.

Parameters:
Name Type Description
param Object

details the update details.

Properties
Name Type Description
element Object

the section element

(async) _refreshSectionBulkSelector(param)

Source:

Update the bulk checkbox when the section name changes.

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

the section info

_refreshSectionCmlist(param)

Source:

Refresh a section cm list.

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

details the update details.

_refreshSectionCmlist(param)

Source:

Refresh a section cm list.

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

_refreshSectionCollapsed(args)

Source:

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.

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

The state data

element Object

The element to update

_refreshSectionCollapsed(args)

Source:

Update section collapsed.

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

The leement to be expanded

_refreshSectionNumber(param)

Source:

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.

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

details the update details.

_refreshSectionTitle(param)

Source:

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.

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

the section info

_refreshSelectAll(param)

Source:

Refresh the select all element.

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

the affected element (bulk in this case).

(async) _refreshSelectCount(param)

Source:

Refresh the selection count.

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

the affected element (bulk in this case).

_refreshToggler(param)

Source:

Update a content section using the state information.

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

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

_refreshTools(param)

Source:

Refresh the tools depending on the current selection.

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)

Source:

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.

Parameters:
Name Type Description
param0 object

the watcher details

Properties
Name Type Description
element object

the state object

_reloadSection(param0)

Source:

Reload a course section contents.

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

Parameters:
Name Type Description
param0 details

the watcher details

Properties
Name Type Description
element object

the state object

_removeIdsFromSelection(stateManager, typeName, ids)

Source:

Remove some ids to the current bulk selection.

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

Parameters:
Name Type Description
stateManager StateManager

the current state manager

typeName String

the type name (section/cm)

ids array

the list of ids

_removeProcess()

Source:

Close the process.

(async) _requestAddSection(target, event)

Source:

Handle a create section request.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestCmAvailability(target)

Source:

Handle a cm availability change request.

Parameters:
Name Type Description
target Element

the dispatch action element

(async) _requestCmDelete(target, event)

Source:

Handle a delete cm request.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestCmDuplicate(target, event)

Source:

Handle a course module duplicate request.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestDeleteSection(target, event)

Source:

Handle a delete section request.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestMoveCm(target, event)

Source:

Handle a move cm request.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestMoveSection(target, event)

Source:

Handle a move section request.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestMutationAction(target, event, mutationName)

Source:

Basic mutation action helper.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

mutationName string

the mutation name

(async) _requestSectionAvailability(target)

Source:

Handle a section availability change request.

Parameters:
Name Type Description
target Element

the dispatch action element

(async) _requestToggleSelectionCm(target, event)

Source:

Handle a toggle cm selection.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

(async) _requestToggleSelectionSection(target, event)

Source:

Handle a toggle section selection.

Parameters:
Name Type Description
target Element

the dispatch action element

event Event

the triggered event

_scanIndex(selector, index, creationhandler)

Source:

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

This method is used internally by _indexContents.

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

_scrollHandler()

Source:

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

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

Source:

Execute a basic section state action.

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)

Source:

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.

Parameters:
Name Type Description
event Event

the triggered event

_sectionTogglers(event)

Source:

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.

Parameters:
Name Type Description
event Event

the triggered event

_selectAllClick(event)

Source:

Handle special select all cases.

Parameters:
Name Type Description
event Event

_setAddSectionLocked(locked)

Source:

Disable all add sections actions.

Parameters:
Name Type Description
locked boolean

the new locked value.

_setCheckboxValue(checked, disabled)

Source:

Modify the checkbox element.

Parameters:
Name Type Description
checked Boolean

the new checked value

disabled Boolean

the new disabled value

_setCheckboxValue(checked, disabled)

Source:

Modify the checkbox element.

Parameters:
Name Type Description
checked Boolean

the new checked value

disabled Boolean

the new disabled value

_setupMutationRadioButtonModal(modal, ids)

Source:

Add events to a mutation selector radio buttons modal.

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

the section or cm ids to apply the mutation

_startProcessing()

Source:

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.

(async) _updateActionsMenu(section)

Source:

Update a section action menus.

Parameters:
Name Type Description
section object

the section state.

_updateBadges(section)

Source:

Update a section badges using the state information.

Parameters:
Name Type Description
section object

the section state.

_updateMonitor(args)

Source:

Create a monitor item.

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}

Source:

Private batch update for a section preference attribute.

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)

Source:

Change the searching icon to its' active state.

Parameters:
Name Type Description
clearIcon HTMLElement

Our closing icon to manipulate.

activeSearchState(clearSearchIcon, timelineViewRoot)

Source:

Show the clear search icon.

Parameters:
Name Type Description
clearSearchIcon object

Clear search icon element.

timelineViewRoot object

The root element for the timeline view

addActions(actions)

Source:

Add extra actions to the module.

Parameters:
Name Type Description
actions array

array of methods to execute

addClickHandler(handler)

Source:

Add a click handler to the list of handlers.

Parameters:
Name Type Description
handler function

A handler to call on a click event

addEventListener(target, type, listener)

Source:

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.

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)

Source:

Add a new log entry into the reactive logger.

Parameters:
Name Type Description
entry LoggerEntry

addMutations(newFunctions)

Source:

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.

Parameters:
Name Type Description
newFunctions Object

an object with new mutation functions.

(async) addOverlay(definition, target)

Source:

Adds an overlay to a specific page element.

Parameters:
Name Type Description
definition Object

the overlay definition.

Properties
Name Type Description
content String

an optional overlay content.

classes String

an optional CSS classes

target Element

optional parent object (this.element will be used if none provided)

(async) addSection(stateManager, targetSectionId)

Source:

Add a new section to a specific course location.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

targetSectionId number

optional the target section id

addSelectors(newSelectors)

Source:

Add or update the component selectors.

Parameters:
Name Type Description
newSelectors Object

an object of new selectors.

addToFavourites(root, courseId)

Source:

Add course to favourites

Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

addUpdateTypes(newFunctions)

Source:

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

Parameters:
Name Type Description
newFunctions Object

the new update types functions.

allItemsArray(state) → {Array}

Source:

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

Parameters:
Name Type Description
state Object

the current state.

Returns:

all sections and cms items in the state.

Type
Array

(async) allSectionsIndexCollapsed(stateManager, collapsed)

Source:

Update the course index collapsed attribute of all sections.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

collapsed boolean

the new collapsed value

bulkEnable(stateManager, enabled)

Source:

Enable/disable bulk editing.

Note: reenabling the bulk will clean the current selection.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

enabled Boolean

the new bulk state.

bulkReset(stateManager)

Source:

Reset the current selection.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

callWatchersHandler(event)

Source:

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.

Parameters:
Name Type Description
event CustomEvent

canUseStealth(state, cmIds) → {Boolean}

Source:

Check is some activities of a list can be stealth.

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}

Source:

Check if all possible elements are selected.

Parameters:
Name Type Description
courseEditor CourseEditor
Returns:

if all elements of the current type are selected.

Type
Boolean

checkImage() → {Node}

Source:

Check accessiblity issue only for img type.

Returns:

A complete list of all warnings and problems.

Type
Node

checkTableCaption() → {Node}

Source:

Look for any table without a caption.

Returns:

A complete list of all warnings and problems.

Type
Node

clearSearchState(clearSearchIcon, timelineViewRoot)

Source:

Hide the clear search icon.

Parameters:
Name Type Description
clearSearchIcon object

Clear search icon element.

timelineViewRoot object

The root element for the timeline view

cm(state, cminfo) → {Object}

Source:

Generate a cm export data from the state.

Parameters:
Name Type Description
state Object

the current state.

cminfo Object

the course module state data.

Returns:
Type
Object

cmCompletion(state, cminfo) → {Object}

Source:

Generate a completion export data from the cm element.

Parameters:
Name Type Description
state Object

the current state.

cminfo Object

the course module state data.

Returns:
Type
Object

cmCompletion(stateManager, cmIds, complete)

Source:

Mark or unmark course modules as complete.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of course modules ids

complete bool

the new completion value

(async) cmDelete(stateManager, cmIds)

Source:

Delete cms.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of section ids

cmDrag(stateManager, cmIds, dragValue)

Source:

Mark or unmark course modules as dragging.

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}

Source:

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.

Parameters:
Name Type Description
state *

the state object

cmid *

the cours emodule id

Returns:
Type
Object | null

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

Source:

Duplicate course modules

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)

Source:

Hide cms.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmLock(stateManager, cmIds, lockValue)

Source:

Lock or unlock course modules.

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)

Source:

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

Source:

Move cms to the left: indent = 0.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmMoveRight(stateManager, cmIds)

Source:

Move cms to the right: indent = 1.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmNoGroups(stateManager, cmIds)

Source:

Set cms group mode to NOGROUPS.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmSelect(stateManager, cmIds)

Source:

Select a list of cms.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmSeparateGroups(stateManager, cmIds)

Source:

Set cms group mode to SEPARATEGROUPS.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmShow(stateManager, cmIds)

Source:

Show cms.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmState(stateManager, cmids)

Source:

Get updated state data related to some cm ids.

Parameters:
Name Type Description
stateManager StateManager

the current state

cmids array

the list of cm ids to update

(async) cmStealth(stateManager, cmIds)

Source:

Stealth cms.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

cmUnselect(stateManager, cmIds)

Source:

Unselect a list of cms.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

(async) cmVisibleGroups(stateManager, cmIds)

Source:

Set cms group mode to VISIBLEGROUPS.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

cmIds array

the list of cm ids

collapseGroup(item)

Source:

Collpase a group item.

Parameters:
Name Type Description
item JQuery

the jQuery object

configDragDrop(cmid)

Source:

Configure the component drag and drop.

Parameters:
Name Type Description
cmid number

course module id

configDragDrop(sectionitem)

Source:

Register state values and the drag and drop subcomponent.

Parameters:
Name Type Description
sectionitem BaseComponent

section item component

configDragDrop(sectionid, state, fullregion)

Source:

Initial state ready method.

Parameters:
Name Type Description
sectionid number

the section id

state Object

the initial state

fullregion Element

the complete section region to mark as dragged

configState(state)

Source:

Save some values form the state.

Parameters:
Name Type Description
state Object

the current state

count(args) → {Promise}

Source:

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

Parameters:
Name Type Description
args Object

Search parameters

Returns:

Promise that will be resolved when the ajax call returns.

Type
Promise

course(state) → {Object}

Source:

Generate the course export data from the state.

Parameters:
Name Type Description
state Object

the current state.

Returns:
Type
Object

(async) courseState(stateManager)

Source:

Get the full updated state data of the course.

Parameters:
Name Type Description
stateManager StateManager

the current state

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

Source:

Generate the data that describes the issues found.

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)

Source:

Process a create state message.

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)

Source:

Process a delete state message.

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)

Source:

Process an override state message.

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}

Source:

Prepare fields for processing.

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

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)

Source:

Process a put state message.

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)

Source:

Process a remove state message.

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)

Source:

Process a update state message.

Parameters:
Name Type Description
stateManager Object

the state manager

updateName String

the state element to update

fields Object

the new data

destroy()

Source:

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.

destroy()

Source:

Remove all subcomponents dependencies.

destroy()

Source:

Remove all subcomponents dependencies.

destroy()

Source:

Remove all subcomponents dependencies.

dispatch(actionName, params)

Source:

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.

Parameters:
Name Type Description
actionName string

the action name (usually the mutation name)

params mixed

any number of params the mutation needs.

dispatch(args)

Source:

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.

Parameters:
Name Type Description
args mixed

any number of params the mutation needs.

dispatchRegistrationFail()

Source:

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.

dispatchRegistrationSuccess()

Source:

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.

dragEnd(dropdata)

Source:

The element drop end hook.

Parameters:
Name Type Description
dropdata Object

the dropdata

dragEnd(dropdata)

Source:

The element drop end hook.

Parameters:
Name Type Description
dropdata Object

the dropdata

dragEnd(dropdata)

Source:

The element end start hook.

Parameters:
Name Type Description
dropdata Object

the dropdata

dragStart(dropdata)

Source:

The element drop start hook.

Parameters:
Name Type Description
dropdata Object

the dropdata

dragStart(dropdata)

Source:

The element drop start hook.

Parameters:
Name Type Description
dropdata Object

the dropdata

dragStart(dropdata)

Source:

The element drop start hook.

Parameters:
Name Type Description
dropdata Object

the dropdata

drop(dropdata, event)

Source:

Drop event handler.

Parameters:
Name Type Description
dropdata Object

the accepted drop data

event Event

the drop event

drop(dropdata, event)

Source:

Drop event handler.

Parameters:
Name Type Description
dropdata Object

the accepted drop data

event Event

the drop event

drop(dropdata, event)

Source:

Drop event handler.

Parameters:
Name Type Description
dropdata Object

the accepted drop data

event Event

the drop event

enterCallback(jQueryItem)

Source:

Handle enter key on a collpasible node.

Parameters:
Name Type Description
jQueryItem JQuery

the jQuery object

expandAllGroups()

Source:

Expand all groups.

expandGroup(item)

Source:

Expand a group item.

Parameters:
Name Type Description
item JQuery

the jQuery object

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

Source:

Generate a file draggable structure.

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

Parameters:
Name Type Description
state *

the state object

dataTransfer *

the current data tranfer data

Returns:
Type
Object | null

formatSeconds(secs) → {String}

Source:

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

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(key) → {boolean|string}

Source:

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

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(type) → {object}

Source:

Get a registered type of modal.

Parameters:
Name Type Description
type string

The type of modal to get

Returns:

The registered config for the modal

Type
object

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

Source:

Get state data.

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

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

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

Source:

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.

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

getActiveItem() → {Element|undefined}

Source:

Return the current active node.

Returns:

the active item if any

Type
Element | undefined

getAddFavouriteMenuItem(root, courseId) → {Object}

Source:

Get the action menu item

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}

Source:

Return the component drag and drop CSS classes.

Returns:

the dragdrop css classes

Type
Object

getContent() → {object}

Source:

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.

Returns:

jQuery object currently visible content contianer

Type
object

getCourseId(root) → {Number}

Source:

Get the course id from a favourite element.

Parameters:
Name Type Description
root Object

The favourite icon container element.

Returns:

Course id.

Type
Number

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

Source:

Return the dialogue content.

Returns:

A template promise containing the rendered dialogue content.

Type
Promise.<Array>

getDraggableData() → {Object}

Source:

Get the draggable data of this component.

Returns:

exported course module drop data

Type
Object

getElementLocked(target) → {boolean}

Source:

Get the current locked value from the element.

Parameters:
Name Type Description
target Element

the event target

Returns:
Type
boolean

getElements(query, dataId) → {NodeList}

Source:

Get the all subelement that match a query selector.

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}

Source:

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.

Returns:

the component events.

Type
Object

getExporter() → {Exporter}

Source:

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

Returns:

the exporter class

Type
Exporter

getFavouriteIconContainer(root, courseId) → {Object}

Source:

Get the container element for the favourite icon.

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}

Source:

Return the course file handlers promise.

Returns:

the promise for file handlers.

Type
Promise

getFilesDraggableData(dataTransfer) → {Array}

Source:

Convert a file dragging event into a proper dragging file list.

Parameters:
Name Type Description
dataTransfer DataTransfer

the event to convert

Returns:

of file list info.

Type
Array

getFilterValues(root) → {filters}

Source:

Get filter values from DOM.

Parameters:
Name Type Description
root object

The root element for the courses view.

Returns:

Set filters.

Type
filters

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

Source:

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.

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}

Source:

Get the action menu item

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}

Source:

Get all element ids from the given state.

Parameters:
Name Type Description
name String

the state object name

Returns:

the element ids.

Type
Array

getInitialPromise() → {Promise}

Source:

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.

Returns:

the resulting promise

Type
Promise

getLastCm() → {element|null}

Source:

Get the last CM element of that section.

Returns:
Type
element | null

getLastCm() → {element|null}

Source:

Get the last CM element of that section.

Returns:

the las course module element of the section.

Type
element | null

getLastCm() → {element|null}

Source:

Get the last CM element of that section.

Returns:
Type
element | null

getMyCourses(filters, limit) → {promise}

Source:

Get enrolled courses from backend.

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}

Source:

Find the notification element for the given id.

Parameters:
Name Type Description
id int
Returns:

The notification element

Type
object | null

getOffset() → {int}

Source:

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

Returns:

current offset

Type
int

getPagedContentContainer(root, index) → {Object}

Source:

Get the paged content container element.

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}

Source:

Get the action menu item

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}

Source:

Search for enrolled courses from backend.

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}

Source:

Return a component selector.

Parameters:
Name Type Description
selectorName string

the selector name

Returns:

the query selector

Type
string | undefined

(async) getServerCourseState() → {Object}

Source:

Load the current course state from the server.

Returns:

the current course state

Type
Object

getShowCourseMenuItem(root, courseId) → {Object}

Source:

Get the action menu item

Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id.

Returns:

The show course menu item.

Type
Object

getState() → {Promise}

Source:

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.

Returns:
Type
Promise

getStorageValue(key) → {boolean|string}

Source:

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.

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}

Source:

Get the table root from an event.

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

getWarnings() → {Array.<ProblemDetail>}

Source:

Find all problems with the content editable region.

Returns:

A complete list of all warnings and problems.

Type
Array.<ProblemDetail>

getWatchers() → {Array}

Source:

Return the component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Return the component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {array}

Source:

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.

Returns:

array of watchers.

Type
array

getWatchers() → {Array}

Source:

Return the component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Return the component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

getWatchers() → {Array}

Source:

Component watchers.

Returns:

of watchers

Type
Array

(async) handleBlockProtectToggle(tableRoot, e)

Source:

Handle toggling of block protection.

Parameters:
Name Type Description
tableRoot HTMLElement
e Event

handleItemClick(event, jQueryItem)

Source:

Handle an item click.

Parameters:
Name Type Description
event Event

the click event

jQueryItem jQuery

the item clicked

(async) handleStateToggle(tableRoot, e)

Source:

Handle state toggling.

Parameters:
Name Type Description
tableRoot HTMLElement
e Event

hasDoneInitialLoad() → {bool}

Source:

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

Returns:

true if first notification loaded, false otherwise

Type
bool

hasLoadedAllContent() → {bool}

Source:

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

Returns:

true if all notifications loaded, false otherwise

Type
bool

hideCourse(root, courseId)

Source:

Hide course

Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

hideDropZone()

Source:

Hide the component dropzone.

hideDropZone()

Source:

Hide the component dropzone.

hideDropZone()

Source:

Hide the component dropzone.

hideElement(root, id)

Source:

Reset the loadedPages dataset to take into account the hidden element

Parameters:
Name Type Description
root Object

The course overview container

id Number

The course id number

hideFavouriteIcon(root, courseId)

Source:

Hide the favourite icon.

Parameters:
Name Type Description
root Object

The favourite icon container element.

courseId Number

Course id number.

hideUnreadCount()

Source:

Hide the unread notification count badge on the menu toggle.

incrementOffset()

Source:

Increment the offset for the current state, if required.

init()

Source:

Initialize the page.

init(timerId)

Source:

Set up the submission timer.

Parameters:
Name Type Description
timerId Number

Unique ID of the timer element.

initializePagedContent(root, promiseFunction, inputValue)

Source:

Initialise the courses list and cards views on page load.

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}

Source:

Return the current drop-zone visible of the element.

Returns:

if the dropzone should be visible or not

Type
boolean

isGroupCollapsed(jQueryItem) → {boolean}

Source:

Check if a gorup item is collapsed.

Parameters:
Name Type Description
jQueryItem JQuery

the jQuery object

Returns:

if the element is collapsed

Type
boolean

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

Source:

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

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>

listedSectionIds(state) → {Array.<Number>}

Source:

Get the IDs of the sections that are listed as regular sections.

Parameters:
Name Type Description
state Object

the current state.

Returns:

the list of section ids that are listed.

Type
Array.<Number>

(async) loadCourse(courseId, serverStateKey)

Source:

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)
Parameters:
Name Type Description
courseId number

course id

serverStateKey string

the current backend course cache reference

loadMoreNotifications() → {object}

Source:

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.

Returns:

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

Type
object

loadStaticContent() → {boolean}

Source:

Load the course index from the session storage if any.

Returns:

true if the static version is loaded form the session

Type
boolean

(async) loadTemplateContent(state)

Source:

Load the course index template.

Parameters:
Name Type Description
state Object

the initial state

markAllAsRead() → {Promise}

Source:

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

Returns:
Type
Promise

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

Source:

Initialise the emoji auto complete.

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)

Source:

Initialise the emoji picker.

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)

Source:

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

Parameters:
Name Type Description
elementRoot HTMLElement

The menu to add handlers upon.

module:core/moremenu(menu)

Source:

Initialise the more menus.

Parameters:
Name Type Description
menu HTMLElement

The navbar moremenu.

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

Source:

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.

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}

Source:

Create a new user picker.

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}

Source:

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

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)

Source:

Mutates and controls the loadedPages array and handles the bootstrapping.

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)

Source:

Process a single state update.

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

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)

Source:

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.

Parameters:
Name Type Description
updates array
updateTypes Object

optional functions to override the default update types.

query(args) → {Promise}

Source:

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

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)

Source:

Register a modal with the registry.

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)

Source:

Register a child component into the reactive instance.

Parameters:
Name Type Description
component self

the component to register.

registerComponent(component) → {object}

Source:

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.

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

Source:

Register event listeners for the default_notification_preferences page.

registerEventListeners()

Source:

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

registerEventListeners(root, page)

Source:

Listen to, and handle events for the myoverview block.

Parameters:
Name Type Description
root Object

The myoverview block container element.

page HTMLElement

The whole HTMLElement for our block.

registerPagedEventHandlers(root, namespace)

Source:

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

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)

Source:

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

Parameters:
Name Type Description
root object

The root element for the timeline block

timelineViewRoot object

The root element for the timeline view

registerSelector(root)

Source:

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

Parameters:
Name Type Description
root object

The root element for the overview block

registerStateAction(field, prop, action, data)

Source:

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

Source:

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

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)

Source:

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.

Parameters:
Name Type Description
root object

The root element for the timeline block

timelineViewRoot object

The root element for the timeline view

remove()

Source:

Remove a previously rendered component instance.

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

removeAllEventListeners()

Source:

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.

removeAllOverlays()

Source:

Remove all page overlais.

removeEventListener(target, type, listener)

Source:

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.

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)

Source:

Remove course from favourites

Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

removeOverlay()

Source:

Remove the current overlay.

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

Source:

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.

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}

Source:

Render the dashboard courses.

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}

Source:

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

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

Source:

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

resetGlobals()

Source:

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

searchFunctionalityCurry() → {function}

Source:

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

Returns:
Type
function

section(state, sectioninfo) → {Object}

Source:

Generate a section export data from the state.

Parameters:
Name Type Description
state Object

the current state.

sectioninfo Object

the section state data.

Returns:
Type
Object

(async) sectionContentCollapsed(stateManager, sectionIds, collapsed)

Source:

Update the course content collapsed attribute of some sections.

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)

Source:

Delete sections.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of course modules ids

sectionDrag(stateManager, sectionIds, dragValue)

Source:

Mark or unmark course sections as dragging.

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}

Source:

Generate a dragable cm data structure.

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

Parameters:
Name Type Description
state *

the state object

sectionid *

the cours section id

Returns:
Type
Object | null

(async) sectionHide(stateManager, sectionIds)

Source:

Hides sections.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids

(async) sectionIndexCollapsed(stateManager, sectionIds, collapsed)

Source:

Update the course index collapsed attribute of some sections.

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)

Source:

Lock or unlock course sections.

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)

Source:
Deprecated:
  • since Moodle 4.4 MDL-77038.
To Do:
  • MDL-80116 This will be deleted in Moodle 4.8.

Move course modules to specific course location.

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)

Source:

Move course modules after a specific course location.

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)

Source:

Select a list of sections.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of cm ids

(async) sectionShow(stateManager, sectionIds)

Source:

Show sections.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of section ids

sectionState(stateManager, sectionIds)

Source:

Get updated state data related to some section ids.

Parameters:
Name Type Description
stateManager StateManager

the current state

sectionIds array

the list of section ids to update

sectionUnselect(stateManager, sectionIds)

Source:

Unselect a list of sections.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

sectionIds array

the list of cm ids

selectAllBulk(courseEditor, value)

Source:

Select/unselect all element of the selected type.

Parameters:
Name Type Description
courseEditor CourseEditor
value Boolean

if the elements must be selected or unselected.

selectAndScroll(node)

Source:

Set the selection and scroll to the selected element.

Parameters:
Name Type Description
node node

set(key, value) → {boolean}

Source:

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

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}

Source:

Set the block protection state.

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

setCourseFavouriteState(courseId, status) → {Promise}

Source:

Set the courses favourite status and push to repository

Parameters:
Name Type Description
courseId Number

Course id to favourite.

status boolean

new favourite status.

Returns:

Repository promise.

Type
Promise

setCourseHiddenState(courseId, status) → {Promise}

Source:

Set the courses hidden status and push to repository

Parameters:
Name Type Description
courseId Number

Course id to favourite.

status Boolean

new hidden status.

Returns:

Repository promise.

Type
Promise

setDraggable(value)

Source:

Enable or disable the draggable property.

Parameters:
Name Type Description
value bool

the new draggable value

setDraggable(value)

Source:

Enable or disable the draggable property.

Parameters:
Name Type Description
value bool

the new draggable value

setDraggable(value)

Source:

Enable or disable the draggable property.

Parameters:
Name Type Description
value bool

the new draggable value

setDragImage() → {HTMLElement}

Source:

Return the custom activity card drag shadow image.

The element returned will be used when the user drags the card.

Returns:
Type
HTMLElement

setElementLocked(target, locked)

Source:

Lock/unlock an element.

Parameters:
Name Type Description
target Element

the event target

locked boolean

the new locked value

setInitialState(stateData)

Source:

Set the initial state.

Parameters:
Name Type Description
stateData object

the initial state data.

setInitialState(initialState)

Source:

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.

Parameters:
Name Type Description
initialState object

setLimit(root) → {function}

Source:

Return the callback to be passed to the subscribe event

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)

Source:

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

Parameters:
Name Type Description
val bool

True if all content is loaded, false otherwise

setLogger(logger)

Source:

Set the logger class instance.

Reactive instances can provide alternative loggers to provide advanced logging.

Parameters:
Name Type Description
logger Logger

setMutations(manager)

Source:

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.

Parameters:
Name Type Description
manager object

the new mutations intance

setPageItem(stateManager, type, id, isStatic)

Source:

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.

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}

Source:

Set the plugin state (enabled or disabled)

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)

Source:

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.

Parameters:
Name Type Description
readonly bool

if the state is in read only mode enabled

setStorageValue(key, value) → {boolean}

Source:

Stores a value into the course editor static storage if available

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)

Source:

Show course

Parameters:
Name Type Description
root Object

The course overview container

courseId Number

Course id number

showDropZone(dropdata)

Source:

Display the component dropzone.

Parameters:
Name Type Description
dropdata Object

the accepted drop data

showDropZone(dropdata)

Source:

Display the component dropzone.

Parameters:
Name Type Description
dropdata Object

the accepted drop data

showDropZone()

Source:

Display the component dropzone.

showFavouriteIcon(root, courseId)

Source:

Show the favourite icon.

Parameters:
Name Type Description
root Object

The course overview container.

courseId Number

Course id number.

standardFunctionalityCurry() → {function}

Source:

The default functionality of fetching paginated courses without special handling.

Returns:
Type
function

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the initial state

stateReady()

Source:

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.

stateReady()

Source:

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.

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the state data

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the state data.

stateReady()

Source:

Initial state ready method.

stateReady()

Source:

Initial state ready method.

stateReady()

Source:

Initial state ready method.

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the state data

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the course state.

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the state data

(async) stateReady(state)

Source:

Initial state ready method.

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

Parameters:
Name Type Description
state object

the initial state

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the initial state

stateReady(state)

Source:

Initial state ready method.

Parameters:
Name Type Description
state Object

the initial state

stop()

Source:

Stop the timer, if it is running.

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

Source:

Submit the form data for the question tags form.

Parameters:
Name Type Description
questionId Number
contextId Number
formdata string

The URL encoded values from the form

Returns:
Type
promise

switchBulkSelection(courseEditor)

Source:

Switch the current bulk selection.

Parameters:
Name Type Description
courseEditor CourseEditor

toggleBulkSelectionAction(courseEditor, target, event, elementType)

Source:

Process a bulk selection toggle action.

Parameters:
Name Type Description
courseEditor CourseEditor
target HTMLElement

the action element

event Event
elementType String

cm or section

toggleGroup(item)

Source:

Toggle a group item.

Parameters:
Name Type Description
item JQuery

the jQuery object

unlockAll(stateManager)

Source:

Unlock all course elements.

Parameters:
Name Type Description
stateManager StateManager

the current state manager

unregister()

Source:

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.

unregisterComponent(component) → {object}

Source:

Unregister a component and its watchers.

Parameters:
Name Type Description
component object

the object instance to unregister

Returns:

the deleted component

Type
object

update()

Source:

Function to update the clock with the current time left.

updateButtonAriaLabel()

Source:

Set the correct aria label on the menu toggle button to be read out by screen readers. The message will indicate the state of the unread notifications.

updatePreferences(filter, value) → {Promise}

Source:

Update the user preference for the block.

Parameters:
Name Type Description
filter String

The type of filter: display/sort/grouping.

value String

The current preferred value.

Returns:
Type
Promise

uploadFiles(sectionId, sectionNum, files) → {Promise}

Source:

Upload a file list to the course.

This method is a wrapper to the course file uploader.

Parameters:
Name Type Description
sectionId number

the section id

sectionNum number

the section number

files Array

and array of files

Returns:

the file queue promise

Type
Promise

validateDropData(dropdata) → {boolean}

Source:

Validate if the drop data can be dropped over the component.

Parameters:
Name Type Description
dropdata Object

the exported drop data.

Returns:
Type
boolean

validateDropData(dropdata) → {boolean}

Source:

Validate if the drop data can be dropped over the component.

Parameters:
Name Type Description
dropdata Object

the exported drop data.

Returns:
Type
boolean

validateDropData(dropdata) → {boolean}

Source:

Validate if the drop data can be dropped over the component.

Parameters:
Name Type Description
dropdata Object

the exported drop data.

Returns:
Type
boolean

validateDropData(dropdata) → {boolean}

Source:

Validate if the drop data can be dropped over the component.

Parameters:
Name Type Description
dropdata Object

the exported drop data.

Returns:
Type
boolean

Type Definitions

description

Source:
Properties:
Name Type Attributes Description
eventName string

the custom event name used for state changed events

eventDispatch function

the state update event dispatch function

target Element <optional>

the target of the event dispatch. If not passed a fake element will be created

mutations Object <optional>

an object with state mutations functions

state Object <optional>

an object to initialize the state.

The component descriptor data structure.

Type:
  • object

descriptor

Source:
Properties:
Name Type Attributes Description
reactive Reactive

an optional reactive module to register in

element DOMElement

all components needs an element to anchor events

selectors object <optional>

an optional object to override query selectors

The component descriptor data structure.

This structure is used by any component and init method to define the way the component will interact with the interface and whith reactive instance operates. The logic behind this object is to avoid unnecessary dependancies between the final interface and the state logic.

Any component interacts with a single main DOM element (description.element) but it can use internal selector to select elements within this main element (descriptor.selectors). By default each component will provide it's own default selectors, but those can be overridden by the "descriptor.selectors" property in case the mustache wants to reuse the same component logic but with a different interface.

Type:
  • object

LoggerEntry

Source:
Properties:
Name Type Description
feedbackMessage string

Feedback message.

Logger entry structure.

Type:
  • object

LoggerEntry

Source:
Properties:
Name Type Description
feedbackMessage string

Feedback message.

Logger entry structure.

Type:
  • object

ProblemDetail

Source:
Type:
  • object

ProblemNode

Source:
Type:
  • object