Take the attached file and drop it into /moodle/calendar/ and then see how it works for you just by accessing http://......./moodle/calendar/ical.php - you should be able to download the upcoming 60 days' events (max of 1000 events) in iCal format.
DISCLAIMER: This is not guaranteed in any sense! In particular, although the data loads perfectly well into "PHPicalendar", I can't get it to load into Oracle Calendar (which claims to be able to load iCal data). I don't have a phone/PDA to test it on. I believe that the output is perfectly valid iCal 2.0 data, though.
If anyone feels like reporting back on how well this works on phones/PDAs/Apple iCal, please do.
I just tried installing this, but get a file download window starting and an error:
Internet explorer cannot download ical.php from ...
I just tried downloading from a completely different computer and it worked fine.
In fact, the computer was a Mac so I tested how Apple's iCal software handled it... and it works nicely!
If anyone can diagnose the reason that the data can't be imported into Oracle Calendar / Microsoft Outlook, I'd be grateful for the input.
Sorry, I had no trouble downloading it, just it did not work on my moodle 1.5.3 installation.
I'll try again later and see if there is any change. I just put it in the \calendar folder of my moodle folder. Anything else needed to register it or activate it?
You might need to make sure it has the same file permissions as other Moodle files (typically, it needs to be "world-readable" as well as readable by you)...
I tried again and discovered that it was an Internet explorer problem. When I used firefox, I got a page of text that could be saved as an ical file.
However, I have not been able to find a program I can import it into... I use a program called Time and Chaos. I will tinker with the file to see what i can do.
I tried importing it as a .ics file into outlook with no success - claims that it is not valid... will continue to experiment
Thanks - at least the export format is working for me.
I was able to import the text file output into brown bear software's ical 3.1 for windows, so the file export worked for me if I use firefox for the download/processing of ical.php and I can import it into some vcal compatible applications. Outlook did not like it and neither did time and chaos.
I would love to be able to import and export calendar entries... or interate a calendar into moodle that I can do that with.
But I wish it was possible to find out why Outlook/T&C don't like the file... Can *anyone* help?
I was working on this feature lately (need to get it off the ground before I get that nice letter from the army recruitment office), and your effort has woken me up suddenly...
I 'm going to commit stuff in /calendar/ and /lib/bennu/ to facilitate the import/export procedure. Stay tuned!
You're right, though! Adding that fixes the problem. Thanks - I'll publish an updated version of the script.
Is there an easy way to allow the ical export function to include events that occurred before the current day? Example-- If I want to include events from last month....etc??
Ideas for anyone who might pick this up for further development -
- Discrimination between Global, Course, & Individual events
- Date ranges
- (& of course, iCal data Import as well as Export !)
Import is a separate issue, really. Of course it would be great to be able to do, but none of the functionality in my script would help anyone with the import task...
But I'm still irked by the fact that the data files don't work in all calendar software - that's the biggest issue we need to address!
We have a bunch of stuff in an Oracle calendar we'd like to Moodlize.
I'm encouraged by how long ago people were talking about doing it but discouraged by my inability to find anything about it anywhere.
Again sorry about my noobish question
The next really massive problem to solve is... Why does Internet Explorer refuse to download the file? (Is it unable to handle the MIME type "text/calendar", perhaps? Not sure.)
I have a question about ical and the Moodle calendar. I can download the Moodle calendar and open the ics file in iCal, but the time of each event is off by 4 hours. (they appear in iCal 4 hours earlier) I checked the Moodle and the time is correct in both the variables and calendar settings. It is also correct on the computer the file is downloaded to. (including the time zone) Any idea how to fix this so the times are the same (automatically)?
My time is out by 10 hours as well. It seems as though the file does not take into account the server time (I'm in Melbourne Australia where it's +10 GMT).
It would be great if someone could come up with a fix for this
I did add this to moodle/calender folder everuthing goes well , except , outlook doesn't seem to find appointments...
I 've just added a bunch of scripts that can be used to export calendar events to iCal format. You can access the scripts by manually typing this URL:
It's still quite raw, but does work. I would appreciate people giving feedback on anything, from obvious bugs to the user interface to the actual code.
Specifically for Dan, and other people who are interested in contributing to the code:
- The general idea is to break down the files as follows:
- export.php is the "driver" script. Everything that has a UI goes through this. It's this script's responsibility to include or redirect to other files as necessary.
- export_execute.php is the "worker" script. It takes parameters from the URL in a well-defined format and does the export. Afterwards it redirects back to export.php (the UI).
- export_basic.html is the UI for the screen you see when first visiting export.php.
- export_advanced.html does not exist yet, but if you take a look at the UI it's obvious what it will be for.
- /lib/bennu/ contains the library that will do the actual translation to iCal format. In other words, the worker script is responsible for translating the data from Moodle's database format to the format that Bennu recognizes. Bennu is then responsible for translating the data from its own format to iCal. This nicely encapsulates all iCal-specific stuff in /lib/bennu/, freeing up developers from actually needing to know anything about iCal.
- The code that does the actual work is very simple; the UI-related code is much more complicated. The reason for this is that I was thinking of pushing a little on the quality of the UI that Moodle offers. For example: you want to export your calendar. Here's a list of common tasks you might want to do, populated intelligently (for example, if today it's Sunday it makes more sense to give you a "next week" option rather than a "this week" option). If that's not good enough, then you can define your own export parameters (date range etc.). Then, next time you come back these options will have been "saved" and presented ready for use without your lifting a finger. Much room for novelty here, and the feedback could be very interesting.
- I 'd very much appreciate it if anyone wants to give a hand in coding /lib/bennu. The current version should be quite sufficient to do what we want to do right now, but obviously there are lots of things more to be done (e.g. to import stuff from iCal). Coding Bennu is the hard part; the actual Moodle UI doesn't involve going through RFC 2445 with a magnifying glass late at night.
By the way, the WebCT import tool includes a function icalFileToEvents($file, $courseid) which does very simple parsing/importing of iCal data.
You might or might not be able to salvage some useful code from that. It would be nice, in future, if the WebCT-importer can use Bennu for this part of the processing!
It's GPL licensed. Could easily be used in Moodle?
Some points to take into account when evaluating solutions for this problem:
- Exactly how can I reuse this piece of code? Take a moment to look at the (few and incomplete) examples included in Bennu. Then take a look at ical_parser.php. By the time you have grasped how things work in Bennu, you 'll be still scratching your head over ical_parser.
- What does the solution, as a tool, offer me? Bennu offers a clean OO interface to the world. ical_parser seems to generate $master_array, and good luck reverse engineering the rules regarding its contents. In the worst case, you 'd end up writing a separate conversion layer just to hide these (irrelevant and dangerous, from the point of client code) implementation details from "your" export code.
- Simply take a look at that code and ask yourself if you 'd want to maintain it. Hint: at some point it reaches 19 levels of tabs.
I 'm not trying to say that this thing is good and that thing is bad. In software engineering there are lots of things you have to take into account, like available resources, timetables, the often disastrous effects of deciding to rewrite a working system from scratch, etc etc. I have no doubt that ical_parser works for the PHP iCalendar people and does the job just fine, even if the maintainers sometimes wish it wasn't written this way (I can say the same for Moodle code, and it's no shame!).
My point is that when you put everything up on the table, it can make sense to develop something from scratch. Especially if you don't have screaming deadlines, you 'll get a modern and clean system designed for the job instead of an adaptation of something designed for another task, and there's something to be given back to the community in the process.
I had no idea this "hidden" code was already in CVS for 1.6
Unfortunately, it's not usable right now. To really get it working I think we need to expose a URL with GET parameters including a secret private code, so that tools like Google Calendar and iCal can subscribe to the calendar feed without too much risk of casual URL guessing, eg:
Any takers? See also the project on the student projects page:
See also the log on our gitweb:
Comments are welcome.
Hopefully this can be added to CVS.
Is it possible to incoprate with outlook exprees?
WHAT IS THE Further Research can be done in ICAL?
What version of Outlook? (I'm assuming 2007??)
Have you looked under Tools > Account setting > Internet calendar > new.
I believe (I've set it up) all you need to do is copy the info from moodle into outlook (Export - choose your info & Get calendar URL).
Did it work for you?
After setting up mine at home, I am now getting an "error on page" when I try ot 'Get calendar URL'
Error: Object doesn't support this property or method
Anyone have an idea?
To make it convenient for our parents to subscribe, it would be nice to place a link in the mentee block that points to the student's calendar feed. The mentor (parent) could grab the URL and paste it into Outlook, ICalendar, Sunbird or any other calendar program and would be automatically updated from then on.
What would it take to automatically generate the URL's for the student's personal calendars? Are they stored with each user's profile, or just generated when the calendar is viewed? How could the link then be placed into the mentee block?
did you get any further with this idea of placing a student's ical feed in the Mentee's block?
All the events have a time associated, thus, Kontact displays these events in the time schedule. So far so good, but with events that take several days (the summer break for instance) those are also listed in the the time schedule while it would be a lot more comfortable to have them listed as day events like this:
Is there a way to incorporate this functionality into Moodle? Or it is already implemented and I didn't notice?
Since true .ics subscription doesn't seem to be available yet, my little work around is to have this file automatically written every so often (through the power of cron) to the PHP iCalendar directory on the same server. Is this crazy talk?
- All events
- Events related to courses
- Events related to this course only
Right now I am browsing through /calendar/export.php on xref but must admit I am not understanding much of the code. Some guidance as to how to make this change would be appreciated.
/lang/en_utf8/calendar.php (added language for the string 'thiscourse')
/calendar/export.php (determine $isteacherincourse)
/calendar/export_basic.html (add radio button, pass courseid and pw_thiscourse to export_execute)
/calendar/export_execute.php (added new calendar_get_events database query)
If you are a teacher in a course and visit the calendar/export page from within that course, you now get a third radio button (see below) allowing you to generate a subscription URL and to export a course calendar which shows all non-hidden events for all users and all groups in just the one course.
Our school web site is being generated by some commercial software that provides some course management functions, but much more primitive than moodle. This allows a teacher to go to their course page on the commercial software, provide a link to their moodle course, and subscribe to their moodle course calendar. That's all that's needed to make moodle and the commercial software work together. All the moodle events are then pulled into the commercial software on a course-by-course basis and the commercial software then re-sorts them into each students personal calendar again.
Yes, this duplicates functions, but our school will not adopt moodle across the board and this allows us to keep using it beside the other system. If others are interested, I can post more details of the changes made to accomplish this.
Could you post this fix for all to see? I know I will need this in the next few weeks.
We've just upgraded from 1.9 to 2.3 and I've figured out the modifications to the calendar files to export a course calendar for the whole year. I've attached the actual files, modified from today's stable moodle distribution, and a diff file.
We recently upgraded to 1.9 and have started using the iCal export to send "teacher" appointments from moodle to the admins Outlook setup. We can even automate this with the following add on for outlook http://sourceforge.net/projects/remotecalendars
The problem is that each succesive "update" export enters duplicates for those appointments which already exist from a previous transfer.
Does anyone have any ideas? I imagine it would be possible to add an option which updates a flag in the calender table to show if a new appointment should be exported?
(Edit post update): This little utility seems to filter duplicates OK. I'm testing it. http://ical.gutentag.ch/ics4ol.php
Also, can anyone explain why there is a seemingly arbitrary limit such as this? I'm sure there's a good reason -- I'd just like to understand it.
I am sure I wrote a post that explained how to do this in detail some time in the past. Hopefully that is findable with a bit of searching.