Pushing Data to Moodle¶
The push direction takes the academic structure maintained in OpenEduCat and reproduces it in Moodle. It runs automatically through the Moodle: Full Push Sync scheduled action, and on demand from the instance form, the manual sync wizard or the individual records.
The Moodle Hierarchy¶
OpenEduCat builds a four-level structure in Moodle:
Department becomes a top-level Moodle course category.
Course / Program becomes a sub-category inside its department's category.
Subject becomes a Moodle course inside its program's sub-category.
Batch becomes a group within the Moodle courses of that batch's subjects.
Each subject gets its own Moodle course, which gives it a dedicated gradebook, quiz bank and assignment space, and makes grades unambiguous to map on the way back.
Push Order¶
A full push always runs in dependency order, and each step is skipped when its toggle is off:
Departments — categories
Courses / Programs — sub-categories
Subjects — Moodle courses
Students — Moodle users
Faculty — Moodle users with the teacher role
Batches — groups
Enrollments — enrolments and group membership
Timetable sessions — calendar events
Every step only considers records changed since the matching Last Push timestamp on the Status tab, so routine runs stay small.
Identifiers Written to Moodle¶
Each pushed record carries an idnumber in Moodle that encodes its OpenEduCat origin.
These identifiers are what the reconciliation wizard uses to rebuild mappings.
Record |
Identifier in Moodle |
|---|---|
Department |
|
Course / Program |
|
Subject |
|
Batch |
|
Student |
|
Faculty |
|
Timetable session |
|
Administrative user |
|
تحذير
Do not edit or clear these identifiers in Moodle. They are the link between the two systems, and removing one causes the next push to create a duplicate record.
Running a Push¶
From the instance¶
Open , select the site and click
Push All. A confirmation is requested, after which every enabled entity is pushed in the
order above. The same action is available as Sync to Moodle on the kanban card.
From an individual record¶
The module adds a Sync to Moodle button to the records it synchronizes, which is useful when a single correction has to reach Moodle immediately.
Record |
Button |
|---|---|
Department |
Sync to Moodle — creates or updates the category. |
Course |
Sync to Moodle — pushes the program and its subjects. |
Subject |
Sync to Moodle — shows the number of linked Moodle courses. |
Batch |
Sync to Moodle — creates or updates the group. |
Student and Faculty |
Moodle User — displays the Moodle user ID, or |
In bulk from a list¶
Select several students or faculty members in their list view and use the Actions menu:
Moodle: Suspend Account — suspends the selected accounts in Moodle.
Moodle: Re-enable Account — restores previously suspended accounts.
Suspending and Re-enabling Accounts¶
Moodle accounts are never deleted by the integration. When a student leaves or an account must be blocked, it is suspended instead, which preserves grades, submissions and the mapping.
On a student or faculty form, the Moodle Account button shows the current state:
Active — click to suspend. A confirmation explains that the person will not be able to log in until the account is re-enabled.
Suspended — click to restore access.
Both buttons are reserved for the Moodle Manager group and each action is written to the sync log.
Enrollments¶
An enrollment push does two things for every student subject: it enrols the student in the corresponding Moodle course with the configured student role, and it adds the student to the group representing their batch. Faculty are enrolled in the courses they teach with the teacher role.
The Moodle Enrolled flag on the enrollment record shows whether the enrolment reached Moodle, and the completion status pulled back from Moodle is stored alongside it.
Timetable Sessions¶
When Push Timetable Sessions is enabled and openeducat_timetable is installed,
sessions are published as Moodle calendar events. Because Moodle offers no calendar update
service, a changed session is applied by deleting the old event and creating a new one, and
the mapping is updated to the new event ID.
Change Detection¶
Each mapping stores a hash of the data last sent to Moodle. When a push finds the hash unchanged, the record is skipped and logged with the skipped status instead of being sent again. This keeps routine runs fast and the API traffic low.
To force a record to be re-sent, clear the sync hash on its mapping and run the push again.