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:

  1. Department becomes a top-level Moodle course category.

  2. Course / Program becomes a sub-category inside its department’s category.

  3. Subject becomes a Moodle course inside its program’s sub-category.

  4. 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.

/19.0/_images/moodle_category_hierarchy.png

Push Order

A full push always runs in dependency order, and each step is skipped when its toggle is off:

  1. Departments — categories

  2. Courses / Programs — sub-categories

  3. Subjects — Moodle courses

  4. Students — Moodle users

  5. Faculty — Moodle users with the teacher role

  6. Batches — groups

  7. Enrollments — enrolments and group membership

  8. 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

oec_dept_{id}

Course / Program

oec_course_{id}

Subject

oec_subj_{subject_id}_course_{course_id}

Batch

oec_batch_{batch_id}_subj_{subject_id}

Student

oec_student_{id}

Faculty

oec_faculty_{id}

Timetable session

oec_session_{id}

Administrative user

oec_user_{id}

Advertencia

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 Moodle Integration ‣ Instances, 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.

/19.0/_images/moodle_push_all.png

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 -- when not yet synchronized.

/19.0/_images/moodle_student_sync_button.png

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.

/19.0/_images/moodle_suspend_account.png

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.