Getting calendar events from external system

Getting calendar events from external system

Eric Ross Cortes發表於
Number of replies: 6

Hi there!

Currently my university is in the process of migrating from Claroline (https://en.wikipedia.org/wiki/Claroline) to Moodle, and the difference is superb! In particular, we are going to use the calendar events in each course to make everyone's life easier, BUT right now most of the relevant events and dates are in a different system, where we plan all the courses in each semester and put dates and activities and such. And we don't want the teachers to do the same work twice.

Is there a good strategy to make all the calendar events from the "other" system appear in Moodle? Is LTI a good choice in this case? Or the REST API is best? Or maybe I need to go directly to the database? My plan for now is to code some Python to get all the relevant events in the original system (directly from the database), and then do whatever I need to do to send the data to Moodle (using LTI, REST, direct db, etc).

(Yes, I'm simplifying a lot: we need some way to link both systems, so we can know that course X in one system matches course Y in moodle, but I wanted to ask first for the best strategy before starting to dig further).

Thanks in advance!

評比平均分數: -
In reply to Eric Ross Cortes

Re: Getting calendar events from external system

Helen Foster發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

Hi Eric,

Does the calendar in your other system follow the iCal standard? If so, you could use the standard feature Calendar import.

評比平均分數:Useful (1)
In reply to Helen Foster

Re: Getting calendar events from external system

Eric Ross Cortes發表於
Hi Helen!

I can make it happen, but I'm talking about a process that will run every 30 minutes to automatically transfer the events from the other system to Moodle. Also, it needs to update the events (maybe the events will move from time to time).

Thanks!
In reply to Eric Ross Cortes

Re: Getting calendar events from external system

Eric Ross Cortes發表於
Ops! Maybe I needed to start my post asking if I can use REST to import a iCal file? Or there's support to "subscribe" to an external iCal, so Moodle can update automatically?
In reply to Eric Ross Cortes

Re: Getting calendar events from external system

Eric Ross Cortes發表於
Wow, I'm answering to myself.
Actually, I'm going to test creating an URL to connect the calendar to the external system (sorry, it's in spanish!):

Thanks Helen!
In reply to Eric Ross Cortes

Re: Getting calendar events from external system

Andrew Lyons發表於
Core developers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片 Testers的相片

Hi Eric,

This is an interesting one and it is possible, but a lot depends on how you have things set up in Moodle. Whichever way that you achieve this, LTI is not a suitable candidate in my opinion. LTI is intended to allow one system to access one activity, or a collection of activities, on a remote system. It does not cater to individual pieces of data relating to a diverse range of different things.

It sounds like you already have a system which is intended as a canonical source of information for all data. I assume that this is some kind of Student Information System? If so, then I’d strongly recommend looking into writing an Enrolment plugin for Moodle. This would allow you to actually create all courses (and course categories) in Moodle automatically, including names, and dates, as well as user enrollments in those courses. If you are writing your own Enrollment plugin then you can also have it create activities, groups of users within a course, calendar events, and more.

If you do not have a system which stores all of this information or you do not wish to have this level of integration, then you can either write a custom integration, or you should be able to use the REST API.

For all of these options the approach is, largely speaking, the same:

Every user, course category, course, and activity in Moodle has a field called an ‘idnumber’. This is unique within each data type (i.e. a user and a course can both have an idnumber of “foo” but two courses cannot have the same idnumber). The idnumber is intended to support integration with remote systems in whichever way you see fit. Usually you would use the unique ID in the source system as the idnumber in Moodle. This allows you to quickly and easily identify the same item in Moodle and then update it.

The calendar is the only item type you mention which does not have an idnumber, but it does have a uuid field which I think you should be able to use in a similar way.

Without knowing more about what you hope to achieve it’s hard to give any specifics but I’d encourage you to look at the existing enrollment plugins for some clues. I will shortly be releasing an alpha version of a new Enrollment plugin for One Roster too.

Best wishes,

Andrew

評比平均分數:Useful (1)
In reply to Andrew Lyons

Re: Getting calendar events from external system

Eric Ross Cortes發表於
Thank you Andrew!

Actually, after a previous post from Helen, I started looking at using the iCal option, and it works! (almost 100%). Using a subscription in the calendar I was able to show the events from the "main" system in Moodle:



It works pretty well! As I'm using the uuid field, Moodle updates the events with no problem (I tested moving, adding and deleting events).

I have 3 issues right now:
- Something about the dates and timezone maybe? Because the events are in the wrong day (they are off by -1)

- Also, the iCal has no time, only dates, but Moodle show the events like happening at 20:00 always! I have no idea why

- Each teacher will have to configure her calendars for each course. I'd like for that to happen automatically, but ¯\_(ツ)_/¯


Thanks!
Best regards!