Represents a single learning program: a directory resource holding a set of course folders, plus enrolment and completion information for the current user or a given profile. Appears as a child of a website's ProgramsFolder in the WebDAV/URL tree, one resource per program directory. It is used to check whether a profile or group has an enrolement in the program, to list its courses, and to summarise completion progress across those courses.
Group: Resources
Extends: DirectoryResource
Properties
| Property | Returns | Description |
|---|---|---|
| availCourses | List<CourseFolder> | The courses in this program that the current user has a viewable or completable enrolement for. |
| courseFolders | List<CourseFolder> | The course folders that are direct children of this program, in their natural child order. |
| firstCourse | CourseFolder | The first course in this program which is available to the current user, in child listing order. |
| mostRecentModule | ModuleFolder | The module the current user was most recently working on across all courses in this program, determined by comparing the modified dates of in-progress module statuses. |
| numberCompletions | long | The number of module status records across all users, on this website, for this program that are complete. |
| numberIncomplete | long | The number of module status records across all users, on this website, for this program that are not yet complete. |
| numberStarted | long | The number of module status records across all users, on this website, for this program, whether complete or not. |
| order | Integer | The "order" request parameter, used to control the display order of this program relative to its siblings. |
| orgModuleStats | OrgModulesStats | Module completion statistics, scoped to this program, for the current principal's primary organisation. Computed on first access and cached for the lifetime of this instance. |
| percentComplete | Integer | The average percent complete across the courses in this program: the sum of each course's percent complete divided by the number of courses. |
| public | boolean | Always false: program folders are never served as public content, regardless of the repository's isPublicContent setting. |
| sortedCourseFolders | List<CourseFolder> | The course folders that are direct children of this program, sorted by their "order" field. |
Inherited from DirectoryResource
Properties
| Property | Returns | Description |
|---|---|---|
| body | String | Body content of this directory's index page, or an empty string if it has no index page. |
| branch | Branch | The branch this directory belongs to, delegated to from its parent resource. |
| children | 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. |
| contentManagedPermissions | boolean | Whether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource. |
| dir | boolean | Whether this resource is a directory. Always true. |
| directoryNode | 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. |
| files | List<ContentResource> | Files (not folders) that are direct children of this directory. |
| hash | String | Content hash of this directory's underlying directory node, or null if the node has not been created. |
| index | RenderFileResource | The index.html page of this directory, if one has already been created, otherwise null. |
| itemType | String | The "itemType" template parameter of this directory's index page, used to classify the folder for search. |
| paramNames | List<String> | Names of the template parameters set on this directory's index page. |
| pathFromBranch | Path | This directory's path relative to the root of its branch, built from its parent's path plus its own name. |
| searchCategory | String | The "category" template parameter of this directory's index page, used to classify the folder for search. |
| searchTags | String | The "tags" template parameter of this directory's index page, used to tag the folder for search. |
| subFolders | List<ContentDirectoryResource> | Subfolders of this directory, excluding the reserved ".mil" metadata folder. |
| title | String | Title of the directory: the title attribute of its index page if one exists and has a title, otherwise the directory's name. |
Methods
getChildren() · createDirectoryResource(String newName) · save() · isDir() · getDirectoryNode() · getIndex() · getHtmlPage(String name, boolean autocreate) · getTitle() · getBody() · getParam(String name) · getParamNames() · doSaveHtml() · is(String type) · 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.
| Parameter | Description |
|---|---|
newName | the 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.
| Parameter | Description |
|---|---|
name | the name of the HTML page to find or create |
autocreate | if true, creates and returns a new page when none exists; otherwise returns null |
getTitle()
Returns: String
Title of the directory: the title attribute of its index page if one exists and has a title, otherwise the directory's name.
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.
| Parameter | Description |
|---|---|
name | the 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.
is(String type)
Returns: boolean
Returns true for "folder", "physicalFolder" and "directory" (but not for a directory whose name starts with a full stop, ie a hidden directory), and for "html" because folders generate a HTML representation when accessed over the web.
| Parameter | Description |
|---|---|
type | the resource type to test |
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
getFirstCourse() · enrol(Group pharmacyAssistants, boolean completable) · findEnrolement(Group group) · isCompletable(Profile user) · isAvailable(Profile user) · getCourseFolders() · getSortedCourseFolders() · getAvailCourses() · isEnroled(Group g) · isPublic() · getMostRecentModule() · getOrgModuleStats() · getCourse(String courseCode) · getPercentComplete() · getNumberCompletions() · getNumberStarted() · getNumberIncomplete() · getOrder()
getFirstCourse()
Returns: CourseFolder
The first course in this program which is available to the current user, in child listing order.
enrol(Group pharmacyAssistants, boolean completable)
Returns: void
Enrols the given group in this program, optionally marking the enrolement as completable.
| Parameter | Description |
|---|---|
pharmacyAssistants | the group to enrol in this program |
completable | true if members of the group should be able to complete the program, false for view-only |
findEnrolement(Group group)
Returns: Enrolement
Looks up the given group's enrolement in this program, on this website.
| Parameter | Description |
|---|---|
group | the group to find an enrolement for |
isCompletable(Profile user)
Returns: boolean
True if the given user has a completable enrolement in this program, on this website.
| Parameter | Description |
|---|---|
user | the profile to check for a completable enrolement |
isAvailable(Profile user)
Returns: boolean
True if the given user has an enrolement for this program, whether the enrolement allows only viewing or also completion.
| Parameter | Description |
|---|---|
user | the profile to check for an enrolement |
getCourseFolders()
Returns: List<CourseFolder>
The course folders that are direct children of this program, in their natural child order.
getSortedCourseFolders()
Returns: List<CourseFolder>
The course folders that are direct children of this program, sorted by their "order" field.
getAvailCourses()
Returns: List<CourseFolder>
The courses in this program that the current user has a viewable or completable enrolement for.
isEnroled(Group g)
Returns: boolean
True if the given group has any enrolement in this program.
| Parameter | Description |
|---|---|
g | the group to check |
isPublic()
Returns: boolean
Always false: program folders are never served as public content, regardless of the repository's isPublicContent setting.
getMostRecentModule()
Returns: ModuleFolder
The module the current user was most recently working on across all courses in this program, determined by comparing the modified dates of in-progress module statuses.
getOrgModuleStats()
Returns: OrgModulesStats
Module completion statistics, scoped to this program, for the current principal's primary organisation. Computed on first access and cached for the lifetime of this instance.
getCourse(String courseCode)
Returns: CourseFolder
Looks up the course folder in this program with the given course code. Returns null if no child resource is found with that name, or if one is found but it is not a course folder.
| Parameter | Description |
|---|---|
courseCode | the course code, ie the child resource name, to look up |
getPercentComplete()
Returns: Integer
The average percent complete across the courses in this program: the sum of each course's percent complete divided by the number of courses.
getNumberCompletions()
Returns: long
The number of module status records across all users, on this website, for this program that are complete.
getNumberStarted()
Returns: long
The number of module status records across all users, on this website, for this program, whether complete or not.
getNumberIncomplete()
Returns: long
The number of module status records across all users, on this website, for this program that are not yet complete.
getOrder()
Returns: Integer
The "order" request parameter, used to control the display order of this program relative to its siblings.