Represents a single course within a program: a directory resource whose children are the course's module folders. Exposed to Velocity templates and JS as a bean property resource, it reports the current user's enrolment, completion and progress across its modules, and enforces level-based sequencing so a course only becomes startable once the prior level's courses in the program are complete.

Group: Resources

Extends: DirectoryResource

Implements: LevelResource


Properties

PropertyReturnsDescription
availablebooleanWhether this course is available to the current user, meaning they have an enrolement covering it, either viewable or completable. Being available does not necessarily mean the user can start modules inside the course, as they might not have met its pre-requisites.
availablebooleanAlias for isAvailable, provided for templates that prefer a getX-style property name.
availProgramsList<ProgramFolder>Programs available to the current user in the programs folder that owns this course, delegating to that folder's own availability logic.
briefStringShort description of the course, taken from the body content of the course's index file. Returns an empty string if the course has no index file.
completablebooleanAlias for isCompleteable, provided for spelling consistency in templates.
completebooleanWhether every module folder in this course is complete for the current user. A course with no modules is not considered complete.
completeablebooleanWhether this course is completable by the current user, meaning there is a completable enrolement for them. The user may not yet have completed any pre-requisites; use isStartable to check whether they can begin the course.
completedModulesResourceListModule folders in this course that the current user has completed. Only children which are module folders and report themselves as complete are included.
currentCourseLevelintThe current level reached within this course's program, computed from which of the program's courses are complete at each level. The result is cached after first access.
inProgressbooleanWhether this course is in progress for the current user: at least one of its modules is started or completed, but the course as a whole is not yet complete.
learningTimeMinsintTotal estimated learning time for this course, in minutes, summed across all of its module folders.
levelIntegerLevel number configured for this course, parsed from its "level" parameter. Courses at the same level in a program become startable together once the prior level is complete.
moduleCodesList<String>Names (codes) of every module folder in this course, in the same order as getModuleFolders.
moduleFoldersList<ModuleFolder>All module folders that are direct children of this course, ordered by their "order" field.
numberCompletionslongCount of module status records for this course, across all users, that are marked complete.
numberIncompletelongCount of module status records for this course, across all users, that are not marked complete.
numberStartedlongCount of module status records for this course, across all users, regardless of completion state.
numModulesintNumber of module folders that are direct children of this course.
orderIntegerDisplay order configured for this course within its program, parsed from its "order" parameter.
orgModuleStatsOrgModulesStatsModule completion statistics for this course scoped to the current principal's primary organisation, lazily computed and cached on first access. Returns null if there is no current principal or the principal has no primary membership.
percentCompleteIntegerOverall completion percentage for this course, averaged across its modules: complete modules count as 100 percent and incomplete modules contribute their own percent-complete value.
programProgramFolderThe program folder that owns this course.
programCodeStringName (code) of the program folder that owns this course.
publicbooleanWhether this course is publicly accessible without authentication. Course folders are never public.
startablebooleanWhether the current user has satisfied the requirements to begin this course: its level must be less than or equal to the current course level reached in the program. The result is cached after first access.
startedModulesResourceListModule folders in this course that are currently in progress for the current user. Only children which are module folders and report themselves as in progress are included.
thumbStringThumbnail image for this course, currently taken from the first module folder's own thumbnail.
titleStringDisplay title for this course: the title of the course's index file if it has one and it is not blank, otherwise the course's name. HTML entities in the result are encoded for direct use in markup.

Inherited from DirectoryResource

Properties

PropertyReturnsDescription
bodyStringBody content of this directory's index page, or an empty string if it has no index page.
branchBranchThe branch this directory belongs to, delegated to from its parent resource.
childrenResourceList<CommonResource>The child files and folders of this directory, including any browseable application pages registered by ApplicationManager. Built lazily on first access and cached for the lifetime of this resource.
contentManagedPermissionsbooleanWhether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource.
dirbooleanWhether this resource is a directory. Always true.
directoryNodeDirectoryNodeThe underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist.
filesList<ContentResource>Files (not folders) that are direct children of this directory.
hashStringContent hash of this directory's underlying directory node, or null if the node has not been created.
indexRenderFileResourceThe index.html page of this directory, if one has already been created, otherwise null.
itemTypeStringThe "itemType" template parameter of this directory's index page, used to classify the folder for search.
paramNamesList<String>Names of the template parameters set on this directory's index page.
pathFromBranchPathThis directory's path relative to the root of its branch, built from its parent's path plus its own name.
searchCategoryStringThe "category" template parameter of this directory's index page, used to classify the folder for search.
searchTagsStringThe "tags" template parameter of this directory's index page, used to tag the folder for search.
subFoldersList<ContentDirectoryResource>Subfolders of this directory, excluding the reserved ".mil" metadata folder.

Methods

getChildren() · createDirectoryResource(String newName) · save() · isDir() · getDirectoryNode() · getIndex() · getHtmlPage(String name, boolean autocreate) · getBody() · getParam(String name) · getParamNames() · doSaveHtml() · getBranch() · getHash() · getSubFolders() · getFiles() · isContentManagedPermissions() · getItemType() · getSearchCategory() · getSearchTags() · getPathFromBranch()

getChildren()

Returns: ResourceList<CommonResource>

The child files and folders of this directory, including any browseable application pages registered by ApplicationManager. Built lazily on first access and cached for the lifetime of this resource.

createDirectoryResource(String newName)

Returns: DirectoryResource

Creates a new subdirectory of this directory with the given name and saves the change. Fails if a resource with that name already exists.

ParameterDescription
newNamethe name of the subdirectory to create

save()

Returns: void

Persists this directory by delegating to its parent's save method. Requires a logged-in user.

isDir()

Returns: boolean

Whether this resource is a directory. Always true.

getDirectoryNode()

Returns: DirectoryNode

The underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist.

getIndex()

Returns: RenderFileResource

The index.html page of this directory, if one has already been created, otherwise null.

getHtmlPage(String name, boolean autocreate)

Returns: RenderFileResource

Finds a named HTML page among this directory's children, parsing it for templating, or creates a new one if autocreate is true and no page with that name exists.

ParameterDescription
namethe name of the HTML page to find or create
autocreateif true, creates and returns a new page when none exists; otherwise returns null

getBody()

Returns: String

Body content of this directory's index page, or an empty string if it has no index page.

getParam(String name)

Returns: String

Reads a named template parameter from this directory's index page.

ParameterDescription
namethe name of the parameter to read

getParamNames()

Returns: List<String>

Names of the template parameters set on this directory's index page.

doSaveHtml()

Returns: void

Saves the index page if any of its title, body or parameters have been changed via this resource. Does nothing if nothing has been changed, or if there is no index page to save.

getBranch()

Returns: Branch

The branch this directory belongs to, delegated to from its parent resource.

getHash()

Returns: String

Content hash of this directory's underlying directory node, or null if the node has not been created.

getSubFolders()

Returns: List<ContentDirectoryResource>

Subfolders of this directory, excluding the reserved ".mil" metadata folder.

getFiles()

Returns: List<ContentResource>

Files (not folders) that are direct children of this directory.

isContentManagedPermissions()

Returns: boolean

Whether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource.

getItemType()

Returns: String

The "itemType" template parameter of this directory's index page, used to classify the folder for search.

getSearchCategory()

Returns: String

The "category" template parameter of this directory's index page, used to classify the folder for search.

getSearchTags()

Returns: String

The "tags" template parameter of this directory's index page, used to tag the folder for search.

getPathFromBranch()

Returns: Path

This directory's path relative to the root of its branch, built from its parent's path plus its own name.


Methods

getBrief() · getNumModules() · getCompletedModules() · getStartedModules() · getTitle() · getLearningTimeMins() · is(String type) · getModuleFolders() · isPublic() · getAvailPrograms() · getProgram() · isCompleteable(Profile user) · isCompleteable() · isCompletable() · isAvailable() · isAvailable(Profile user) · getThumb() · getOrgModuleStats() · isEnroled(Group g) · findEnrolement(Group group) · getModuleCodes() · getModuleFolder(String moduleCode) · getPercentComplete() · isComplete() · isStartable() · getCurrentCourseLevel() · isInProgress() · getLevel() · getOrder() · getAvailable() · getProgramCode() · getNumberCompletions() · getNumberStarted() · getNumberIncomplete()

getBrief()

Returns: String

Short description of the course, taken from the body content of the course's index file. Returns an empty string if the course has no index file.

getNumModules()

Returns: int

Number of module folders that are direct children of this course.

getCompletedModules()

Returns: ResourceList

Module folders in this course that the current user has completed. Only children which are module folders and report themselves as complete are included.

getStartedModules()

Returns: ResourceList

Module folders in this course that are currently in progress for the current user. Only children which are module folders and report themselves as in progress are included.

getTitle()

Returns: String

Display title for this course: the title of the course's index file if it has one and it is not blank, otherwise the course's name. HTML entities in the result are encoded for direct use in markup.

getLearningTimeMins()

Returns: int

Total estimated learning time for this course, in minutes, summed across all of its module folders.

is(String type)

Returns: boolean

Checks whether this resource matches the given resource type. Always true for the type "course", and otherwise delegates to the superclass's own type checks.

ParameterDescription
typethe resource type name to check against, for example "course"

getModuleFolders()

Returns: List<ModuleFolder>

All module folders that are direct children of this course, ordered by their "order" field.

isPublic()

Returns: boolean

Whether this course is publicly accessible without authentication. Course folders are never public.

getAvailPrograms()

Returns: List<ProgramFolder>

Programs available to the current user in the programs folder that owns this course, delegating to that folder's own availability logic.

getProgram()

Returns: ProgramFolder

The program folder that owns this course.

isCompleteable(Profile user)

Returns: boolean

Checks whether the given user is in a group with a completable enrolement in this course or its parent program. A course-level enrolement takes precedence over a program-level one when both are present.

ParameterDescription
userthe profile whose enrolements are checked

isCompleteable()

Returns: boolean

Whether this course is completable by the current user, meaning there is a completable enrolement for them. The user may not yet have completed any pre-requisites; use isStartable to check whether they can begin the course.

isCompletable()

Returns: boolean

Alias for isCompleteable, provided for spelling consistency in templates.

isAvailable()

Returns: boolean

Whether this course is available to the current user, meaning they have an enrolement covering it, either viewable or completable. Being available does not necessarily mean the user can start modules inside the course, as they might not have met its pre-requisites.

isAvailable(Profile user)

Returns: boolean

Checks whether the given user has an enrolement, at either program or course level, covering this course.

ParameterDescription
userthe profile whose enrolements are checked

getThumb()

Returns: String

Thumbnail image for this course, currently taken from the first module folder's own thumbnail.

getOrgModuleStats()

Returns: OrgModulesStats

Module completion statistics for this course scoped to the current principal's primary organisation, lazily computed and cached on first access. Returns null if there is no current principal or the principal has no primary membership.

isEnroled(Group g)

Returns: boolean

Checks whether the given group has an enrolement covering this course or its parent program.

ParameterDescription
gthe group to check

findEnrolement(Group group)

Returns: Enrolement

Looks up the enrolement, if any, that covers this course for the given group, either at course level or at the parent program's level.

ParameterDescription
groupthe group whose enrolements are searched

getModuleCodes()

Returns: List<String>

Names (codes) of every module folder in this course, in the same order as getModuleFolders.

getModuleFolder(String moduleCode)

Returns: ModuleFolder

Looks up a direct child module folder of this course by its name.

ParameterDescription
moduleCodethe name of the module folder to find

getPercentComplete()

Returns: Integer

Overall completion percentage for this course, averaged across its modules: complete modules count as 100 percent and incomplete modules contribute their own percent-complete value.

isComplete()

Returns: boolean

Whether every module folder in this course is complete for the current user. A course with no modules is not considered complete.

isStartable()

Returns: boolean

Whether the current user has satisfied the requirements to begin this course: its level must be less than or equal to the current course level reached in the program. The result is cached after first access.

getCurrentCourseLevel()

Returns: int

The current level reached within this course's program, computed from which of the program's courses are complete at each level. The result is cached after first access.

isInProgress()

Returns: boolean

Whether this course is in progress for the current user: at least one of its modules is started or completed, but the course as a whole is not yet complete.

getLevel()

Returns: Integer

Level number configured for this course, parsed from its "level" parameter. Courses at the same level in a program become startable together once the prior level is complete.

getOrder()

Returns: Integer

Display order configured for this course within its program, parsed from its "order" parameter.

getAvailable()

Returns: boolean

Alias for isAvailable, provided for templates that prefer a getX-style property name.

getProgramCode()

Returns: String

Name (code) of the program folder that owns this course.

getNumberCompletions()

Returns: long

Count of module status records for this course, across all users, that are marked complete.

getNumberStarted()

Returns: long

Count of module status records for this course, across all users, regardless of completion state.

getNumberIncomplete()

Returns: long

Count of module status records for this course, across all users, that are not marked complete.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.