Skip to main content
Version: Latest
Technical ManualLooking for step-by-step instructions? In the User Manual: CoursesEnrollmentsLearner pages

Learning

The Learning module (CrestApps.OrchardCore.Learning, with Learning.Abstractions and Learning.Core) turns Orchard Core content into courses that people enroll in, work through and complete. A course and its lessons are content items, so they get versions, localization, the media library and every content feature for free; Learning adds what content does not have: who may open a lesson, what a learner has done, and when a course counts as complete.

The admin screens and learner pages are described in the User Manual: Courses, Enrollments and Learner pages.

Features​

FeatureIdDepends on
LearningCrestApps.OrchardCore.LearningContents, Lists, Title, Html, Autoroute, Media, Content Fields, Roles, CrestApps Users, CrestApps Resources
Learner PagesCrestApps.OrchardCore.Learning.LearnerPagesLearning
Self EnrollmentCrestApps.OrchardCore.Learning.SelfEnrollmentLearner Pages
Course CategoriesCrestApps.OrchardCore.Learning.CourseCategoriesLearning, Taxonomies, Taxonomies Contents List Filters
Enrollment by CohortCrestApps.OrchardCore.Learning.CohortsLearning, Cohorts (Users)

It works with other features when they are on:

Feature onWhat it adds
Secure MediaFiles attached to a lesson are served only to people who may open the lesson.
WorkflowsEight events and six tasks (see below).
Data PipelinesThe Learning data source and the Enroll learners destination step.
ReportsThe Course completion, Learner transcript and Inactive learners reports.
NotificationsEnrolled (also when a request is approved), Enrollment request declined, Course due soon, Course overdue, Completion needs review and Enrollment request to approve notices, each a registered notification type a person can switch off or send by e-mail or text message, also on the site's notification preferences page (/notifications/preferences) of the Users module. A request to enroll (LearningConstants.NotificationTypes.EnrollmentRequested) goes to the course's instructors and assistants, or, for a course without them, to the users of the roles that grant Manage enrollments and of the Administrator role. Learners who don't use the admin read them on the site: the bell of the Notifications module in the site's navbar, and the Notifications page (/notifications, in the user menu) of the Users module. Each notice links to its record with a ~/ URL.
Audit TrailChanges people make to enrollments by hand, with their reason, and every export of learner records.
Webhookslearning.enrollment.created and learning.course.completed.
StaffThe Instructor capability, a Learning section on the staff profile and My learning on a staff member's page.
Users (My Account)My learning and My transcript in the account menu of the Users My Account area (/account, feature CrestApps.OrchardCore.Users.Account, registered by Learner Pages through LearningAccountMenu). No store is needed: without the account area, the learner pages stand alone.
Personal DataExport and erasure of a person's enrollments and progress. Learning records belong to user accounts, so a request that knows only an e-mail address (such as erasing a customer added by hand on the Customers page) reaches the records of the account with that address.
Recipes, DeploymentThe LearningEnrollments recipe step and deployment step, with their schemas.

Content types​

The migration creates these types. Each lesson type has the Course item part; change its settings to set the kind and the default way an item is completed.

TypeParts and fieldsKind
CourseTitle, Autoroute (courses/{title}), Html body, Cover media field, Course, Course outline, List (of the lesson types)
PageLessonTitle, Html body, Attachments media fieldPage
VideoLessonTitle, Html body, Video (MP4 or WebM files) and Captions (WebVTT files) media fields, YouTube field, Video lessonVideo
FileLessonTitle, Html body, Files media fieldFile
LinkLessonTitle, Html body, Url link fieldLink
AcknowledgementTitle, Html body, Acknowledgement (the statement to confirm)Acknowledgement
TextBlockTitle, Html bodyText

Text items (a Moodle label) are text, pictures and video embeds shown in place. Their kind is Inline (CourseItemKindDescriptor.Inline): the outline reader (DefaultCourseStructureService) marks their entries CourseOutlineEntry.Inline and never Required, whatever the outline says; CourseOutline.RequiredEntries and the progress percent leave them out; the progress service refuses them (LearningRefusals.NotTracked); the completion snapshot (transcript) and the Learning AI reader skip them. The course page renders their HTML in place in its outline (the HTML body is sanitized when it is saved, as Orchard's HTML body does). The player's outline is navigation, so it leaves text out (LearnerOutlineViewModel.Navigation); the player shows the text that comes just before an item in its section above the item (PlayerViewModel.TextBefore), and text that ends a section under the section's last item (TextAfter); Previous and Next step over text. On the course page, text with release rules waits for the player, which knows the release decision. The kind has no completion mode, so its editor shows a note instead of the completion and grade fields.

Lessons are contained in their course through Orchard's List part, so New on the course's list creates a lesson in it. The Course outline card orders them into sections; an item that is in the course but not in a section is listed under the outline as not yet placed.

Course part​

Code, Summary, Level, EstimatedMinutes, NeverCompletes (a course without completion criteria: it never completes, while the progress is kept), EnrollmentMode (Closed, Open, Key, Approval), the enrollment key (stored as a salted hash outside the content item, in LearningSecretStore, never shown again; five wrong keys for one course within 15 minutes lock that person out of it for 15 minutes), AccessDays (how long a self enrollment gives access, counted from the day the learner enrolls; empty for no end; other enrollments, such as those made by staff or by an order, keep the access end their source gives, if any), PassMark, GradeCategories (gradebook categories with a weight and a number of lowest scores to drop; see Learning Assessments), Prerequisites (other courses to complete first), CompletionCriteria and Staff (a user and a role: Instructor, Assistant, Grader or Observer).

The admin's course pickers (the prerequisites, the courses of a learning path set, the courses of a Learning workflow event and the course of a learning product's grant row) use the ItemSelector component with the course search /Admin/learning/course-picker/search?query=&exceptId= (route LearningCourseSearch, CoursePickerController, backed by CourseLookup.SearchCoursesAsync): the latest version of each course whose title contains the text, 50 at most, titles only. It needs Manage the courses you teach, View enrollments or View learning reports. The editors render only the chosen courses, so a site with hundreds of courses never lists them all.

Course item part​

CompletionMode (Viewed, MarkedDone, MinimumTime, Watched, Acknowledged, and the modes other kinds add, such as MinimumScore for learning packages: the score reaches the pass mark whatever the package reports about passing), MinimumMinutes, EstimatedMinutes, Gradable, Weight, GradeCategoryId (the gradebook category of its course), PassMark, FreePreview (anyone may open it), AllowSelfReported and ReleaseRules.

Records​

All live in the Learning YesSql collection.

  • Enrollment: UserId, CourseId, OfferingId, Status, Number (E000001), Cycle and PreviousEnrollmentId (a person who takes a course again gets a new enrollment and the old one stays), StartedUtc, AccessEndsUtc, DueUtc, CompletedUtc, LastActivityUtc, ProgressPercent, Grade, Passed, Grants, History (every status change with who and why) and Completion (a snapshot taken at completion: the course title and version, the items and how each was completed, so the record still reads correctly after the course changes).
  • EnrollmentGrant: why a person has access, Source and SourceId (Manual, Self, Key, Pipeline, Workflow, or a source another module adds). Revoking the last grant withdraws the enrollment.
  • EnrollmentProgress: one document per enrollment with an entry per course item: state, first and last access, seconds spent, share watched, score, attempts, when it was completed, by whom and why, and the statement confirmed for an acknowledgement.

Each has its own index table (EnrollmentIndex, EnrollmentGrantIndex, EnrollmentProgressIndex, CourseItemProgressIndex); course staff are indexed in CourseStaffIndex.

Enrollment states​

FromTo
PendingActive, Withdrawn (rejected)
ActiveCompleted, Suspended, Expired, Withdrawn
SuspendedActive, Withdrawn
Completed, Expired, Withdrawn(a new enrollment, the next cycle)

IEnrollmentService does every change under a distributed lock per person and course. Completing by hand, suspending, withdrawing and changing dates need a reason, which is kept in the history and the Audit Trail. A person has at most one open enrollment per course and offering, so enrolling twice from the same source changes nothing.

Progress and completion​

ILearnerProgressService records what a learner does: opening an item, time spent (a heartbeat from the player when the item opens, every half minute while the page is visible, and once more with navigator.sendBeacon when the learner leaves the item or hides the page, so a visit shorter than the half minute counts; the quiz attempt page sends it for the quiz; at most 60 seconds a call, and never more than the time since the enrollment's last access), the share of a video watched, marking an item done and confirming an acknowledgement. A staff member with the right to manage enrollments can complete an item by hand with a reason.

An item is complete when its completion mode is met. The course is complete when every required item is complete and every completion criterion passes: MinimumGrade, MinimumTime, ItemPassed and StaffApproval. A course marked NeverCompletes never completes. Another module adds a criterion with AddCourseCompletionCriterion<T>().

StaffApproval takes an optional Role value, a course staff role (the course editor's Who approves). With a role, only the course's staff in that role may approve (CompletionApprovers.MayApprove); the progress service refuses anyone else with NotApprover, and the enrollment page offers Approve the completion only to them. Without a role, anyone who manages the enrollment may approve, as before. With or without a role, the approver needs Manage enrollments on the enrollment (EnrollmentsController checks it before MayApprove), which LearningRecordAuthorizationHandler gives course staff only to Instructors and Assistants holding Manage the courses you teach: a Grader or Observer named as the approving role approves only when a role also grants Manage enrollments.

Release rules decide when an item opens: ItemCompleted (after another item), Date, DaysAfterEnrollment and People. Add one with AddCourseItemReleaseRule<T>(). The course setting Learners take the items in order (CoursePart.ItemsInOrder) is checked by CourseReleaseEvaluator before the rules: an item waits for every required, non-inline item before it in the outline, so every path that asks the evaluator (the player, the progress service, package launch and runtime, surveys, coursework and quiz start) refuses it alike. A decision that waits for another item names it in ReleaseDecision.BlockingItemId (and CourseItemAccess.BlockingItemId), which the player and the course page use to show Complete "…" first and a button to that item; ItemCompleted sets it too.

People (PeopleReleaseRule, the course item editor's Who can open it card) opens an item only to the people it names (UserIds, chosen with the user picker) and to the members of a user audience (Audience) of the Users module, which is where rule-based groups, such as people with a profile value, are defined. Without the User Audiences feature an audience opens the item to nobody. The locked item says Restricted; course staff and course managers still open it.

Reviews after completion​

A completed enrollment is a record and does not change: its status, completion date, percent, grade and completion snapshot stay as they were completed, and no observer hears of later work. Work on an item that was not completed yet (the end-of-course survey, an optional lesson, an acknowledgement, a viewed page) is still recorded on the item's progress while the learner may review the course (the enrollment has a grant and its access has not ended), so the item reads Done; an item already completed is never changed, and the player tracks the open item for a completed enrollment too. Quiz attempts, coursework submissions and package runs still refuse a completed enrollment (a package runs in review mode), as before. When a result it rests on changes afterwards, such as a final exam attempt voided for cheating or regraded below the pass mark, RecordResultAsync keeps the enrollment completed and sets Enrollment.Review (the item, the old and new score, when), once while the review is open. Observers hear ReviewNeededAsync after the commit, the course's instructors get a Completion needs review notification, and the enrollment list filters by Needs review. A person who manages the enrollment clears the review with a note of what they decided (IEnrollmentService.ClearReviewAsync). A certification module revokes a certificate from this review; nothing is un-completed on its own.

Clearing a review raises IEnrollmentObserver.ReviewClearedAsync once, after the commit. What is issued on a completion checks it again there, since a completion under review supported nothing when it happened: the course credential (CredentialEnrollmentObserver), the course education credits (EducationCreditEnrollmentObserver), learning paths (ProgramsEnrollmentObserver) and certification paths (CertificationEnrollmentObserver). Each check is idempotent, so a completion awarded before it was flagged is not awarded again; an observer you add for something issued on a completion must be too.

Writes, locks and commits​

Every change to an enrollment or its progress runs under one distributed lock per enrollment (EnrollmentWriteGate): the enrollment is read again inside the lock, the session is committed before the lock is let go, and the enrollment observers run after the commit, only for what the call changed. Enrolling takes a lock per learner and course and commits the new enrollment inside it, so two requests never create two enrollments; adding a grant to an open enrollment goes through the enrollment's own lock. The daily upkeep raises its notices the same way. A call that cannot get the lock in time returns Busy and changes nothing.

The commit is the whole session's, not only the enrollment's. Code that calls the enrollment or progress services in the middle of a larger unit of work should finish its own writes first, or accept that they are committed with the enrollment:

CallerEffect of the commit
Player, learner pages, enrollment adminThe request has no other pending writes.
Workflow tasks (Enroll user, Approve, Reject, Change status, Extend, Mark item complete)Writes made earlier in the same workflow run are committed with the enrollment. A later failure in the run does not undo them.
Enroll learners pipeline stepEach row is committed as it is enrolled, so a run that fails part way keeps the rows already done; the step reports each row's result.
LearningEnrollments recipe stepDoes not use the gate; the recipe's own transaction applies.
An order or payment handler (another module)Enroll after the order itself is saved, never inside the order's own save.

Observers that send something out (webhooks, notifications, workflow events) queue their work as deferred tasks, so it runs after the request. They log and swallow their own failures: an event can be lost after a committed change. A consumer that must not miss one, such as certificate issue, must be idempotent and have a catch-up that finds what was missed.

Who may open what​

Two authorization handlers keep lessons from people who should not see them:

  • The content access handler answers Orchard's ViewContent for course items: allowed for course staff, people who manage courses, free previews, and learners with an active or completed enrollment whose item is released; refused for everyone else. Because the display route, the content API, GraphQL, the content data source and Secure Media all ask ViewContent, they all follow it.
  • The record handler answers for enrollments and progress: a learner sees their own, a manager sees everyone's, a course's staff see their course's.

A course's Instructors and Assistants who hold Manage the courses you teach may edit, publish and preview that course and its lessons.

Pages that do not ask for each item​

Some Orchard Core features list or read content without asking ViewContent for each item. Learning keeps lesson bodies out of them:

PathWhat a person who is not enrolled gets
Search resultsThe lesson's title and link only. Course items render without their body, files, video or link in the Summary display, for every content type with the course item part. The Course catalog recipe indexes courses only, so lessons are not searchable unless a site adds them to an index.
RSS feed of a listNothing for a course: Learning turns off the List part feed of courses, because that feed writes the body of each contained item.
Queries APINothing: a query answers only people granted its own permission, and no Learning role holds one. A query you add that returns lessons hands their full documents to whoever you grant it to.
SitemapsA lesson's address and title, only if a sitemap is set to list the lesson types. The lesson page itself still refuses people who are not enrolled.
Liquid templatesWhatever the template reads. Templates run with the trust of the person who wrote them; a template that loads a lesson by id prints it to everyone who sees the page.

Lesson files​

Turn on Secure Media (the Learning setup recipe does). A file attached to a lesson through a media field is stored under mediafields/{type}/{contentItemId}/, and each request for it asks ViewContent on the lesson, so a person who is not enrolled gets 404.

Learners see each file of a course item under its original name: the text the author gave it, else the name it had when uploaded (the attached media editor keeps it in the field's AttachedFileNames), else the stored name without a leading GUID (LearningFileNames.GetDisplayName). The MediaField-LearningFiles template does this for the media fields of every type with CourseItemPart, in every display but Summary (CourseItemFileShapes).

Secure Media protects the rest of the media library too: files outside lesson folders then need View media content in the root folder or a folder's own permission. The Learning public media recipe gives the root folder to everyone. Never give View media content in all folders to the Anonymous or Authenticated role: a role that holds it passes Secure Media before the folder check runs, which opens every lesson file. The recipe removes it from both roles.

Enrollment by cohort​

With Enrollment by Cohort on, the editor of a course, and of a learning path when Learning Programs is on, has a Cohorts card for people with Manage enrollments. The cohorts chosen are kept on the item in a LearningCohortsPart (CohortIds), so recipes and deployments carry them with the course; the type does not need the part. The part also records who saved the cohorts (LinkedBy): every save made in a request writes the person saving, whatever the posted content said, and the Moodle import writes the person who queued it.

When the item is published, a deferred task (after the request, in its own scope, because enrolling commits) compares the cohorts with the ones it applied before, kept in a CohortLearningLink document of the Learning collection with a CohortLearningLinkIndex row per cohort:

  • the members of a newly linked cohort are enrolled;
  • the members of an unlinked cohort lose what it gave them;
  • when someone joins or leaves a linked cohort, ICohortMembershipObserver does the same for that person, also in a deferred task.

Each kind of item is enrolled through an ICohortLearningTarget, named by the part that marks it and registered with services.AddCohortLearningTarget<T>():

TargetPartJoiningLeaving
Course (Learning)CoursePartEnrolls with a grant of source Cohort and a source id made of the cohort, course and user ids (CohortEnrollmentGrants.SourceId), one grant per cohort. Someone who completed the course and has no open enrollment is not enrolled again.Revokes that grant only. An enrollment left with no grant is withdrawn; one another source still grants stays open, and a completed one never changes.
Learning path (Programs)LearningPathPartStarts the person with source Cohort; a person already on the path keeps their progress.When the person is in no other linked cohort, ILearningPathService.StopAsync removes progress the sync started and revokes the path's course grants. A path the person, required learning or anyone else started, and a completed one, stay.

Linking a cohort enrolls everyone in it, so a change of the linked cohorts is applied only when the person who published the item, or else the person LinkedBy names, holds Manage enrollments; a change by anyone else (an instructor saving through the content API, a scheduled publish of their draft) is logged and not applied. A publish without a person (a recipe, setup) is the site's own. The link of an item is read and saved under a distributed lock per item, and a second link left by two publishes close together is merged and removed.

Every hour, the Learning cohort catch-up background task (CohortLearningSync.CatchUpAsync) repairs what a missed membership change left behind: for each link, in the order of the item ids, it takes each linked cohort's members in pages in the order of their user ids, enrolls a member the target never enrolled, and ends what the cohort gave a person who is no longer in it. A target says whom it enrolled through ICohortLearningTarget.ListJoinedUserIdsAsync (the course reads its cohort grants, the path its progress started by the cohort).

A cohort that a course or path is linked to cannot be deleted (ICohortUsage). Deleting the course forgets its link without touching enrollments. To target cohorts with required learning instead, use an audience with the CohortMember rule.

Learner pages​

With Learner Pages on:

PageURL
My learning/learning
Transcript/learning/transcript
Player/learning/courses/{courseId}/play/{itemId}

My learning (LearnerPageService.BuildMyLearningAsync) is a course overview: one card (or list row) per course, from the learner's open enrollment, else the completed one, else the one whose access ended, with the cover (CourseCovers) or a pattern drawn from the course id (the _CourseCover partial, also on the catalog), the first category, the progress as "3 of 7 complete", the due date and the next step. status filters by LearnerCourseStates (inprogress: started and not completed; notstarted: nothing opened yet, waiting for approval or before the start; completed), q searches titles and codes, and view=list shows rows instead of cards; the filters show their counts. A learner with no course sees the account empty state. With the storefront account (the Users module's My Account feature) on, My learning and My transcript are entries of the account menu (for people with Access learning) and render inside the account frame (the CommerceAccountPage shape), with the menu beside them, as do the other Learning pages a learner reads: My required learning, My certifications, My education credits and My credentials. Without it, each page stands alone with a Home breadcrumb.

My courses is in Orchard Core's user menu, on the site's pages and in the admin, beside Profile and Security, for people with Access learning (LearningUserMenuDisplayDriver, the UserMenuItems__LearningCourses shape). It links to My learning and lists the learner's active courses, newest enrollment first, each opening the player, with See all when there are more than five. The list comes from one indexed query of the learner's active enrollments, capped at six, and one read of their courses. A theme overrides UserMenuItems-LearningCourses.cshtml to change it.

The course page itself is the course's content page. Under the title, the CoursePart_Hero shape (Detail, Header:after) shows the summary, the facts (code, level, estimated time, required items, categories, dates), the cover and the one action: Sign in to enroll, Enroll (or the key, or Ask to enroll), the progress with Continue where you left off and the item it continues with, or the completion panel. The outline (CoursePart_Learner, Content:20) follows the description. The player tracks time and video watching with the learning-player script and refuses progress for an enrollment that is not the signed-in person's (404). The player shows the item's title once, in its own header with the kind, section, step and estimated time: it removes the TitlePart shape from the item's Detail display, and titles the tab "Item - Course - Site". When an item completes in the background (the heartbeat after a minimum time, a video's share, or a package runtime call, which raises the learning:item-completed DOM event), the learning-player script fetches the page again and swaps in the parts marked data-learning-refresh (index: the progress card, outline: the outline with its locks, ticks and section counts, nav: Previous and Next or Finish, condition: the item's own To do/Done condition), keeping the sections the learner folded. Its progress bar is the _LearnerProgress partial, labelled "3 of 7 complete · 43%"; the progress calls return completedItems and requiredItems so the script keeps the label current. When an enrollment completes, the player shows the course completion panel (_CourseCompletedPanel) at /learning/courses/{courseId}/completed (route LearningCourseCompleted; a learner who has not completed the course is sent to the player): the completion date in the viewer's time zone, the grade and pass, the links that ICourseCompletionLinkProvider implementations add (Learning Certifications links the certifications the course counts toward, Learning Credentials the credentials the enrollment earned) and My transcript. Mark as done and Confirm redirect there when they complete the course; a completion reported by the script shows a message with a link; the course page shows the same panel. Register a provider with services.AddScoped<ICourseCompletionLinkProvider, MyProvider>(); it gets only the learner's own completed enrollment and returns CourseCompletionLink values (text, URL, icon, position). Each item shows its completion condition, as Moodle does: CourseItemConditionText turns the item's completion mode into the learner's words ("Mark it as done", "Watch 80% of the video", "Pass with 70%", "Receive a score of 90% or more", "Complete the activity"; nothing for a mode it does not know, such as one a module adds), and the _ItemCondition partial shows it as To do: ..., Done: ... or Not passed: ... from the item's state, with Optional for an optional item. The player shows it under the item's title and the script turns it to Done when the item completes; the course page's outline shows it with each item's kind and estimated time. The outline (_LearnerOutline, model LearnerOutlineViewModel) folds each section in a <details> element with the count of required items done, and the player's Collapse all keeps the section of the open item open.

The catalog is Orchard Core search: the Learning course catalog recipe creates a Lucene index named courses of published courses, searchable by everyone at /search/courses.

Course dates​

A course may have a start date and an end date (CoursePart.StartsUtc and EndsUtc), entered on the course editor's Dates card in the person's time zone (ILocalClock, ToUtcLenientAsync) and kept in UTC. CourseSchedules.Of(part, utcNow) says whether a course is NotStarted, Open or Ended.

  • Before the start, learners see the course and may enroll, but ICourseAccessService refuses its items: NotReleased with the CourseNotStarted refusal ("The course has not started yet.") and the start date as AvailableFromUtc. Staff and free previews are not affected, and the player locks every item until the start.
  • After the end, nothing is locked. This follows Moodle, where the end date mostly moves a course out of "in progress" on the dashboard and does not close it: an open enrollment in an ended course keeps its card on My learning, marked Ended on, with Continue, and the catalog and the course page say Ended on. Self enrollment stays open; close it with the enrollment mode.
  • The access length after enrollment (AccessDays) sets the access end of a self enrollment (DefaultSelfEnrollmentService), and that access end keeps ending the learner's access, whatever the dates. Other enrollments end when their own access end says.

The dates show on the course page, in the course summary display and in the catalog, through the DateTime shape, never as UTC.

Course categories​

The Course Categories feature gives courses a category tree from Orchard Core Taxonomies, the building block that owns categorizing content:

  • Its migration adds a Category taxonomy field to the Course type's own part, creates the Course categories taxonomy (term type CourseCategory, alias and path course-categories) once the migration is committed, and adds the taxonomy to the Taxonomy filters setting of the admin content list (the Taxonomies Contents List Filters feature), so the list of courses filters by category.
  • A site that already has a taxonomy field on the Course type's own part keeps it (the one named Category first) with its taxonomy; a site that already has a taxonomy titled Course categories, such as one made by hand, gets the new field pointed at it instead of a second taxonomy (CourseCategorySetup). A field named Category of another kind makes the new field CourseCategory.
  • CourseCategoryService (Learning.Core) reads the field and the tree (TaxonomyTermTree), finds a category by name or by path from the top and adds what is missing (publishing the taxonomy), and reads and sets a course's categories. Without a taxonomy field on courses there are no categories; nothing else needs the feature.

No new records: the taxonomy, its terms and the field move with the Content and ContentDefinition steps, and the filter setting with the site settings deployment step of Taxonomies.

Course catalog​

With Learner Pages on, /learning/catalog (route LearningCatalog, for people with View content) lists the published courses by title, 24 to a page, with a title search (q) and, when courses have categories, a category tree to browse (category): a category lists its own courses and those of the categories under it (CourseCategoryTerms.WithDescendants, TaxonomyIndex). Each course shows its cover (the first file of the Cover media field, CourseCovers.GetPath), code, categories, dates and summary. My learning links to it. Full-text search stays on the Learning course catalog recipe's search index.

Imported courses​

CoursePart.SourceIdentifier and CourseItemPart.SourceIdentifier keep where a course or a course item was imported from, such as moodle:1a2b3c4d5e6f:course:12 and ...:cm:345, and LearningSourceIndex (migration step 5) finds the latest version by it, so an importer updates what an earlier import made. The Moodle import uses them.

Permissions​

PermissionAdministratorDefault
Manage coursesYes
Manage the courses you teach (as course staff)Yes
Manage enrollmentsYes
View enrollmentsYes
View learner recordsYes
View learning reportsYes
Export learner recordsYes
Access learningYesAuthenticated

The Learning roles recipe creates Learning Administrator, Course Author, Instructor, Grader, Training Manager and Learner roles.

Workflows​

Events: Enrollment Requested, Learner Enrolled, Enrollment Status Changed, Course Started, Course Item Completed, Course Completed, Access Expiring, Learner Inactive. Each can be limited to some courses, and ignores changes made by a workflow unless told otherwise, so a workflow does not trigger itself.

Tasks: Enroll User, Approve Enrollment, Reject Enrollment, Change Enrollment Status, Extend Access or Due Date, Mark Course Item Complete.

Data source and reports​

The Learning data source (with Data Pipelines on) has four data sets: LearningEnrollments, LearningItemProgress, LearningCompletions and LearningCourseStaff. Their field names never change, so reports built on them keep working.

The Enroll learners pipeline step (LearningEnrollLearners) enrolls the user named by a column in a course, with a grant from the pipeline so a second run changes nothing; rows that fail go to its rejected output.

Coded reports, under Reports, need View learning reports; exporting one needs Export learner records:

  • Course completion (learning-course-completion): per course, people who enrolled in the period, in progress, completed, expired or withdrawn, the completion rate and the average grade.
  • Learner transcript (learning-transcript): completions in the period, for one learner (by user name) or everyone.
  • Inactive learners (learning-inactive-learners): active enrollments with no activity for longer than the inactive period.

Recipe and deployment step​

The LearningEnrollments step moves enrollments with their progress. People are written by user name, so a recipe works on another site; a row whose user is missing is reported and skipped. Enrollments keep their ids, so running a recipe again updates them.

{
"name": "LearningEnrollments",
"Enrollments": [
{
"ItemId": "4pj234zj1ypsnvynfa931j3gmx",
"UserName": "learner1",
"CourseId": "4pwq1bb2380et59270b871984s",
"Status": "Active",
"Number": "E000001",
"Grants": [ { "Source": "Manual", "SourceId": "admin" } ]
}
]
}

The deployment step exports one course or every course, created within a date range, with or without progress, and needs Export learner records. Each export is written to the Audit Trail.

Configuration​

The daily upkeep reads OrchardCore:CrestApps:Learning:Upkeep:

{
"OrchardCore": {
"CrestApps": {
"Learning": {
"Upkeep": {
"AccessEndingNoticeDays": 7,
"InactiveDays": 14,
"DueSoonDays": 3
}
}
}
}
}

Zero turns a notice off. The upkeep runs every hour, expires enrollments whose access ended, and raises each notice once per enrollment.

Media limits​

Orchard Core Media takes files of up to 30 MB by default and no OpenDocument spreadsheets or caption files, which is too little for training videos and handouts. Learning does not change Media's limits: they belong to Orchard Core Media, are the same for every upload of the tenant (the media library included), and are set in Media's own configuration section, OrchardCore:OrchardCore_Media. A site that keeps large lesson files raises them there:

{
"OrchardCore": {
"OrchardCore_Media": {
"MaxFileSize": 2147483648,
"AllowedFileExtensions": [
".jpg", ".jpeg", ".png", ".gif", ".webp", ".ico",
".pdf", ".doc", ".docx", ".ppt", ".pptx", ".pps", ".ppsx", ".odt", ".xls", ".xlsx", ".psd", ".ods", ".odp", ".odg", ".rtf", ".txt", ".vsdx",
".mp3", ".m4a", ".ogg", ".wav",
".mp4", ".m4v", ".mov", ".wmv", ".avi", ".mpg", ".ogv", ".3gp", ".webm",
".vtt", ".srt"
]
}
}
}
  • MaxFileSize is in bytes (2 GB above).
  • AllowedFileExtensions replaces Media's list, so keep the default extensions you still want next to the ones you add (OpenDocument and other office files, plain text, and the .vtt and .srt caption files above). Never add programs, scripts, web or server pages, or macro-enabled Office files.

Media uploads are sent in chunks of MaxUploadChunkSize (100 MB by default), and Media raises Kestrel's request limit for its own upload endpoint. Behind IIS (Azure App Service on Windows), IIS refuses a request over requestLimits maxAllowedContentLength (30,000,000 bytes by default) before the site sees it: raise it above the chunk size, or set OrchardCore:OrchardCore_Media:MaxUploadChunkSize below it. Orchard Core logs a warning at startup when the two disagree. A reverse proxy in front of the site (nginx client_max_body_size, for one) needs the same.

Extending Learning​

  • AddCourseItemKind<TPart>(name, ...) adds a kind of course item.
  • AddEnrollmentSource(name, ...) adds a grant source, such as an order.
  • AddCourseItemReleaseRule<T>() and AddCourseCompletionCriterion<T>() add rules.
  • AddEnrollmentObserver<T>() hears about every enrollment change after it is saved.
  • AddCourseItemHandler<T>() hears about item events.