1
YUI.add('moodle-course-util-section', function (Y, NAME) {
4
* A collection of utility classes for use with course sections.
6
* @module moodle-course-util
7
* @submodule moodle-course-util-section
10
Y.namespace('Moodle.core_course.util.section');
13
* A collection of utility classes for use with course sections.
15
* @class Moodle.core_course.util.section
18
Y.Moodle.core_course.util.section = {
20
SECTIONIDPREFIX : 'section-'
24
* Determines the section ID for the provided section.
27
* @param section {Node} The section to find an ID for.
28
* @return {Number|false} The ID of the section in question or false if no ID was found.
30
getId: function(section) {
31
// We perform a simple substitution operation to get the ID.
32
var id = section.get('id').replace(
33
this.CONSTANTS.SECTIONIDPREFIX, '');
35
// Attempt to validate the ID.
36
id = parseInt(id, 10);
37
if (typeof id === 'number' && isFinite(id)) {
45
}, '@VERSION@', {"requires": ["node", "moodle-course-util-base"]});