Calendar integration

Calendar integration

by Gustav W Delius -
Number of replies: 18

The idea of integrating a calendar into Moodle has come up frequently during the past year. Students here in York would like a calendar to see the times for their lectures, seminars and, most importantly from their point of view, deadlines. Several of the Moodle activities have dates associated with them and they could all show up in the student's calendar.

I know that from the Moodle point of view a calendar is not so important because its educational benefit is not very clear. However student convenience does count and therefore integration of a calendar is going to be one of the required features here in an upcoming tender for a centrally supported VLE.

A calendar was planned as a central feature of the MyMoodle page. However I am not aware of any work towards it having taken place. I would like to find some other Moodlers who would like to see a calendar in Moodle and would like to start collaborating on this little project.

I have had a look at available PHP calendars and it seems to me that WebCalendar fits our requirements very well. In addition to user calendars it allows non-user calendars. Users can include any number of these non-user calendars into their calendar, WebCalendar speaks of "layers". So I propose that every course in Moodle should have a calendar associated to it. Each user could have the calendars of all the courses they are enrolled in layered onto their calendar. That way they will have all the relevant Moodle dates visible in their calendar but can also add any events of their own.

Installation of WebCalendar is very unproblematic. I unzipped it into a calendar subdirectory of my moodle directory, put the details of the moodle database into WebCalendars config file, created the required tables using a supplied .sql file, placed a Web link to the calendar onto the Moodle home page and it worked straightaway. If you like to play with this non-integrated calendar you can go to my site http://aiminfo.net and use the Calendar link at the bottom of the Main menu.

The following things now need to be done to integrate the calendar into Moodle:

1) there needs to be a script that creates a calendar for each Moodle user and one for each Moodle course and layers the course calendars into the user calendars. This would be done in bulk the first time the calendar is installed but should later be done whenever a user or a course is created and when a user is enrolled or unenrolled.

2) the link from the Moodle homepage needs to post the username and password to automatically log the user into WebCalendar.

3) there need to be library functions in Moodle to create, change, and delete events in WebCalendar.

4) all date related modules in Moodle should use these functions to update the course calendars whenever appropriate.

I think we will not need to do much hacking of WebCalendar itself which will make it a lot easier to upgrade. Because any interaction with the calendar will be through Moodle library functions we can also switch over to a different PHP calendar in the future should that be desirable.

Average of ratings: -
In reply to Gustav W Delius

Re: Calendar integration

by Ger Tielemans -

WebCalendar stays interesting because you can combine personal calendars with timetable overlays and students and teachers can compose their own views:

  • calendars/planners of five groupmenbers as columns on one screen
  • calenders/planners of groups of students you mentor/monitor

It would be more flexible if each Moodle could export (every evening at 1800 hour?) a standard calendar-format: user can choose to which calemdar t should go:

  • webCalendar (support also things like LDAP)
  • Outlouk
  • or - in our case - Novell WebAccess

    the last two have integrated emailfacilities, another wish...

In reply to Gustav W Delius

Re: Calendar integration

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I like webcalendar too, but I can see some problems arising from keeping the calendar data "cached" separately in the webcalendar database.

Example scenario: Say a teacher creates an assignment and assigns it to next thursday at 3:00pm. The assignment module duly uses the Moodle API to "register" that date in the related course layer.

Problem 1: What happens in multi-lingual courses? All students need to see the data in their own language.

Problem 2: What happens if the assignment is changed? Moodle needs to be able to find the exact item to change, and be able to cope with overlaid items (eg two assignments scheduled for the same time).

Problem 3: The calendar display is controlled by webcalendar itself. This is fine for a full-page display, but I think a lot of people would like to see tighter integration into the Moodle interface. I've been planning to have a mini-display inside MyMoodle on the home page that looked something like this for each course:

Example course name 101
- 5 new forum posts
- 1 new assignment posted
Coming up soon:
- Assignment "Essay on stuff" due: Thursday, 9th July 2004, 5:00pm
- Quiz "Revision of week 3" closes: Friday, 10th July 2004, 5:00;pm


So, for all these reasons, I think it's better to maintain a standard table of calendar information inside Moodle that is dynamically maintained by Moodle modules with al the information needed to relate items back to activities.  Then we could have a system to intelligently "pump" that information out into other systems (controlled by cron probably). This "pump" system could be implemented as modular plugins, so that people can write plugins for different calendars (including webcalendar) and output formats (iCalendar for example).

How does all that sound?
In reply to Martin Dougiamas

Re: Calendar integration

by Gustav W Delius -

Yes, I entirely agree that ALL information about events must be stored in the Moodle database. However that doesn't have to stop Moodle modules from updating a calendar database AS WELL as the Moodle database.

Your point 1: I don't know how courses with multi-lingual content (as opposed to multi-lingual Moodle interface) are currently handled. I am not even sure that a course with multi-lingual content is such a good idea because it would make communication among students difficult and thus constructivist teaching would be very difficult as well.

Your point 2: Moodle would indeed have to store the event's unique WebCalendar identifier in its database.

Your point 3: It should indeed be possible to incorporate a small calendar display inside Moodle pages. Again this should be done by calling a Moodle library function in order to make it work with different calendars.

Martin, I don't know how you manage to find the time to think about all these different issues wide eyes. I hear that you are even still thinking about MyMoodle and that at the same time as working on the Groups implementation approve. I am very impressed.

In reply to Gustav W Delius

Re: Calendar integration

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You wouldn't believe the pile on my plate at the moment. People seem to prefer pushing new food on it rather than helping me eat what's there. mixed .. but it's a lovely banquet!  smile

(When reading the following please think of me with a friendly tone because it could quite easily be read otherwise and that's not my intention. smile )

Firstly, I agree that a calendar can be updated in realtime, but it should be Moodle, not the modules that update the calendar. The modules need a stable core API to talk to, and Moodle communicates with calendars via a plugin structure.

1) I didn't mean multilingual content so much (although that is on the way) but just the words that appear in the string files, like "Assignment", or "Quiz due". There are lots of sites who would want these in different languages for different students.

2) I would rather not be dependent on webcalendar, or any one calendar system. Ideally, the Moodle ID for the code could be somehow passed and stored in external calendars in case back-referencing is needed.

3) A small Moodle function to read data out of different calendars is not the best appoach, since the other calendars may not be PHP, may not be on the same web site, and may not be on the web even.

I know you have a particular purpose in mind and can see a quick way of getting there using Webcalendar but will you be here when I'm trying to upgrade thousands of sites next year into a new level of functionality?  wide eyes
In reply to Martin Dougiamas

Re: Calendar integration

by Gustav W Delius -

Hi Martin,

I can imagine how overworked you must be. Everyone in the community is astonished at how much work you do. I am sorry if I made the impression of requiring your immediate attention with this calendar module. I am quite happy for it to be a community project for a while before you even start thinking about making it core Moodle.

I do however believe that I took your suggestions into account. I agree with all the points you make in your post and the event module has been designed accordingly.

Firstly, I agree that a calendar can be updated in realtime, but it should be Moodle, not the modules that update the calendar. The modules need a stable core API to talk to, and Moodle communicates with calendars via a plugin structure.

Modules do not update the calendar. Modules call functions to update the event table. These functions as a side effect also update the calendar. If a different calendar is needed then simply the definition of these functions need to be changed. I think that is a well defined API. I agree that at this early point it can't be considered stable.

1) I didn't mean multilingual content so much (although that is on the way) but just the words that appear in the string files, like "Assignment", or "Quiz due". There are lots of sites who would want these in different languages for different students.

This already works fine with strings printed to the screen, why should any different approach be needed for printing to the calendar? If a module constructs the name and description of an event then it should use get_string().

2) I would rather not be dependent on webcalendar, or any one calendar system. Ideally, the Moodle ID for the code could be somehow passed and stored in external calendars in case back-referencing is needed

We agree that Moodle should not depend on a particular calendar system. I designed the event module with that in mind. The suggestion to allow back-references from the calendar to Moodle is a good one but on a separate issue.

3) A small Moodle function to read data out of different calendars is not the best appoach, since the other calendars may not be PHP, may not be on the same web site, and may not be on the web even.

I never proposed such a function. All events are stored in the moodle table event. No need to read them out of a calendar.

In reply to Gustav W Delius

Re: Calendar integration

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
No problems at all - it's just better to sort some of this stuff out earlier rather than later because people rapidly start depending on things and making it difficult to change later.

I think the key issue from my point of view is separating the function of the event module (which is for adding arbitrary events and could be nicely combined with scheduler and appointment smile) from the Moodle calendar (which is a central list of data that all modules can write to, including the event module). The event table can be very simple, mostly just referring to entries in the calendar table. Something pluggable (like the auth system) can then take care of talking to different calendars, eventually on a per-user basis.

What I mean about languages is that rather than storing the "get-string" version of the event we should store a language-neutral form as far as possible, so that the translation can occur at user view time (see the MyMoodle example I gave a few posts above). It's a bit similar to your new Gradebook code (which I've been working on today) where in one place you write "Total" to the database as the column name. It would be better to write "total" to the database and then use get_string("total") later on at run time. I know it's a hassle but language support is one of Moodle's strengths.
In reply to Martin Dougiamas

Re: Calendar integration

by Gustav W Delius -

I think our views on these issues are very close. The only reason why the event table is currently a module table is because modules are the way the Moodle community can contribute to Moodle without messing with the central system. I wanted to get this calendar into the community so that it can be developed further. When it is stable then it will be easy to convert it from a module into a central part of Moodle.

I think you are very right to stress to people that this event module is a development project, not a Moodle feature. People should not rely on it staying constant, it is supposed to change constantly as we learn how to best do things.

On a different subject: I hear that you are looking at the gradebook code and that makes me want to crawl under a table blush. It is horrible hack and not at all ready for the big time. My excuse is that it really was a feature that we needed to have in place before the end of term. It is taylored to our needs and thus in particular does not take care of non-numeric grades.

In reply to Gustav W Delius

Re: Calendar integration

by Gustav W Delius -

I have now taken the first step towards integrating WebCalendar into Moodle. Users on my Moodle site now automatically have their private calendar created when they first visit it. They are also automatically logged into the calendar. You can try it out at http://aiminfo.net. Click on "Calendar" at the bottom of the "Main menu" on the left-hand side (off course you first have to create a user account on Moodle for yourself before you get your private calendar).

Martin: can I create myself a directory  cvs:/contrib/calendar and commit the integrated calendar there?

In reply to Gustav W Delius

Re: Calendar integration

by John Gone -
Bravo Gustav! Just came from your site, the calendar is excellent! This is an excellent addition to Moodle. Sorry I couldn't help, I'm learning but it's gonna take time...
Thank you!
john captain
In reply to Gustav W Delius

Re: Calendar integration

by Kam Vento -
I also had a look at the calendar on your site. It looks good. I'm looking forward to seeing a calendar integrated into Moodle.smile Looking forward to giving it a try on my development server.
In reply to Gustav W Delius

Re: Calendar integration

by Ger Tielemans -
  • Nice, so users do not have to login twice? 

    (although I prefer more and more "an iCalendar pump", I can imagine that some people will like Moodle to grow into the complete system for eLearning, replacing also their current website and school-timetable-programs...)

My five cents:

Looking at WebCalendar you can hoover over an appointment and you get a popup screen:

  • if You see a hyperlink in that popup AND you are the owner of that appointment, you can click on the appointment
  • You can click again on the hyperlink that is in the description-page that shows up and you go to the link... (I placed moodle.org in your SUNY example in the demo)
  • If you are not the owner, you never can open the description page, so never can click the hyperlink.
  • If I import timetables for classes as transparant overlays, I must also change the ownership-status, before this can function....  ....but then students can change the timetables, for example the exam-date when they are not yet ready for it..wink

In a demo we changed the functionality a little (I do not trust our code, so give you the idea)

  • Change the title of the appointment: if there is a hyperlink under it on the description page, then the title will become a hyperlink for the first URL on that description page
  • If you are the owner of an appointment, you will see a new button behind the title that gives you access to the description field (see sreendump)

I also wish to get the possibility to import the (sometimes individual) timetables the support staff creates for the classes: but..

  • NOT ALL CLASSES ARE IN MOODLE  (yet smile )
  • the support staff uses other tools for creating these timetables, they never ( = not next year?) will do it in Moodle
Attachment ScreenShot001.png
In reply to Ger Tielemans

Re: Calendar integration

by Ger Tielemans -

We are moving ahead: simplifying our school-organisation in favor of Moodle glimlach what a dream!!

  • In 2004-2005 every course should use the week approach and create a timetable in the sections
  • A personal calendar (like the new one) should collect information from ALL MY courses and show them in the big calendar overview
  • In the short overview the calendar should show that there are events in several categories: exam, delvery deadline, meetings (See the discussion in the calendar area)
In reply to Gustav W Delius

Re: Calendar integration

by A. Chavan -
The calendar looks great!

I will be using Moodle for a project which needs calendar functionality of the type provided by WebCalendar. I am glad that integrating WebCalendar with Moodle is being considered. I think there is a demand for that feature particulary for the "social" courses.

Let me know if you need any help. I was planning on using WebCalendar myself and integrating it with Moodle anyway and I was happy your posting about it. I will be glad to help out in any way I can.

Can I download your code somewhere or will it be available via CVS?

Thanks!
In reply to A. Chavan

Re: Calendar integration

by Gustav W Delius -

Thanks for offering to help. Help is very welcome. I will put the code into CVS in a few hours. At that time I will also post what needs to be done.

In reply to Gustav W Delius

Re: Calendar integration

by Gustav W Delius -
The integrated calendar is now in CVS as part of an events module in cvs:/contrib/event/. I have started a new thread to discuss the module at http://moodle.org/mod/forum/discuss.php?d=3944 . There you will also find a zip file containing the module because CVS is 24 hours behind for most.
In reply to Gustav W Delius

Re: Calendar integration

by Ger Tielemans -

If I enter ../../moodle/mod/event/calendar.php in the adressbar i get:

Error: you must reconfigure your php.ini file to have magic_quotes_gpc set to On

In reply to Ger Tielemans

Re: Calendar integration

by Gustav W Delius -
Yes, WebCalendar requires that setting. This is pointed out in the WebCalendar documentation and also in the event module README file.