core_courseformat/local/activitychooser/repository

Description:
  • A javascript module to handle user AJAX actions.

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

A javascript module to handle user AJAX actions.

Methods

(static) getModalFooterData(courseId, sectionNum) → {Promise.<Object>}

Description:
  • Fetch the footer data for a specific section.

Source:
Parameters:
Name Type Description
courseId Number

Course ID.

sectionNum Number

Section number.

Returns:

Promise resolved with the footer data.

Type
Promise.<Object>

(inner) activityModules(courseid, sectionnum) → {object}

Description:
  • Fetch all the information on modules we'll need in the activity chooser.

Source:
Deprecated:
  • since Moodle 5.1
To Do:
  • Remove in Moodle 6.0 (MDL-86310)
Parameters:
Name Type Description
courseid Number

What course to fetch the modules for

sectionnum Number

What course section to fetch the modules for

Returns:

jQuery promise

Type
object

(inner) favouriteModule(modName, modID) → {object}

Description:
  • Given a module name, module ID & the current course we want to specify that the module is a users' favourite.

Source:
Parameters:
Name Type Description
modName String

Frankenstyle name of the component to add favourite

modID int

ID of the module. Mainly for LTI cases where they have same / similar names

Returns:

jQuery promise

Type
object

(inner) fetchFooterData(courseid, sectionid) → {object}

Description:
  • Fetch all the information on modules we'll need in the activity chooser.

Source:
Parameters:
Name Type Description
courseid Number

What course to fetch the data for

sectionid Number

What section to fetch the data for

Returns:

jQuery promise

Type
object

(inner) fetchSectionModules(courseId, sectionNum, sectionReturnNum, beforeMod) → {Object}

Description:
  • Legacy method to fetch all the information on modules using section number.

Source:
Deprecated:
  • since Moodle 5.1
To Do:
  • Remove in Moodle 6.0 (MDL-86310)
Parameters:
Name Type Description
courseId Number

Course ID.

sectionNum Number

Section number.

sectionReturnNum Number

Section return.

beforeMod Number

Before module number to be used in the module.

Returns:

Tab data.

Type
Object

(inner) fetchSectionModules(courseId, sectionId, sectionReturnNum, beforeMod) → {Object}

Description:
  • Fetch all the information on modules we'll need in the activity chooser.

Source:
Parameters:
Name Type Description
courseId Number

Course ID.

sectionId Number

Section ID.

sectionReturnNum Number

Section return.

beforeMod Number

Before module number to be used in the module.

Returns:

Tab data.

Type
Object

(inner) sectionActivityModules(courseId, sectionId) → {object}

Description:
  • Fetch all the information on modules that can be added to a section.

Source:
Parameters:
Name Type Description
courseId Number

What course to fetch the modules for

sectionId Number

What course section to fetch the modules for

Returns:

jQuery promise

Type
object

(inner) sectionMapper(webServiceData, sectionId, sectionReturnNum, beforeMod, legacySectionNum) → {Array}

Description:
  • Given the web service data and an ID we want to make a deep copy of the WS data then add on the section num to the addoption URL

Source:
To Do:
  • remove legacySectionNum param in Moodle 6.0 (MDL-86310)
Parameters:
Name Type Description
webServiceData Object

Our original data from the Web service call

sectionId Number

The number of the section we need to append to the links

sectionReturnNum Number | null

The number of the section return we need to append to the links

beforeMod Number | null

The ID of the cm we need to append to the links

legacySectionNum Number | null

The legacy section number to append to the links

Returns:

[modules] with URL's built

Type
Array

(inner) unfavouriteModule(modName, modID) → {object}

Description:
  • Given a module name, module ID & the current course we want to specify that the module is no longer a users' favourite.

Source:
Parameters:
Name Type Description
modName String

Frankenstyle name of the component to add favourite

modID int

ID of the module. Mainly for LTI cases where they have same / similar names

Returns:

jQuery promise

Type
object