Jump to:

10843 Posts in 2514 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar: New Feature

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2679 Views
  • UncleCheese
    Avatar
    4085 Posts

    Event Calendar: New Feature Link to this post

    The Event Calendar now supports importing ICS feeds. For those of you who are not familiar with ICS, it's a normalized data format like XML, but specifically for calendars. When you click the "add to calendar" link in the module, it returns an ICS file that is readable by your calendar to add the event to iCal, Google Calendar, Outlook, etc.

    With the new import feature, you can now import a static ICS file from your calendar. Just select one, several, or all of your events in your calendar tool, and run and export to an ICS file. This can be done very easily in Google Calendar and iCal. Then, place the file in event_calendar/import/YourFile.ics. Now, go to the URL www.yoursite.com/your-calendar/import/YourFile (Note the ".ics" is not needed). You should see a series of green success messages indicating the events have been added to the database. Anything that didn't make it through will return a red error message and the index of the attempted event in your ICS file.

    But wait, there's more! ICS files can also be read as continuous, dynamic feeds to a calendar. If you're using shared calendaring, chances are you have a live ICS file living somewhere out on the web. With Google Calendar, it's very easy to get a URL for your calendar in XML, KML, or ICS format. Simply click on the "Feeds" tab on your Calendar page, and enter a title and a URL for the feed you'd like to include in your calendar. Now, every time a calendar page is viewed, it will mix in the latest data from your feed(s).

    The only limitation is that because we don't always know too much about the events being imported, they currently come in as Announcements only. One way around this might be to examine the length of the Content or Summary property of the event and determine, if more than X characters, the import becomes a full event, and not an announcement. I find that most events created on a calendar tool like iCal, however, do not have long descriptions, and are best served as Announcements on your calendar.

    I have not thoroughly tested this change. I have had success with two iCal exports and one Google feed. Test away, and enjoy.

  • mathiasmex
    Avatar
    Community Member
    28 Posts

    Re: Event Calendar: New Feature Link to this post

    @UncleCheese

    Hi, although a newbie to all this, would like no comment as follows:
    Have just tested the included ics feed. Including a Google calendar via the feed tag shows up correctly, but does not allow the RSS feed from my calendar anymore. Seems there is a typing error somewhere, as without an included ics feed, first line of source code from RSS feed in my calendar starts correctly with "<?xml version="1.0"?>". Including the ics feed, first line of source code from RSS feed in my calendar starts with "_<?xml version="1.0"?>", whereas underliune is a blank one... This throws out a XML error message.
    Still a nice and very usefull module, thanks for that....

    Brgds

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar: New Feature Link to this post

    A good lesson in why you should never close your PHP tags unless you're templating. That whitespace messes everything up!

    Run an SVN update and let me know how it works for you. Seems to have fixed the bug for me.

  • mathiasmex
    Avatar
    Community Member
    28 Posts

    Re: Event Calendar: New Feature Link to this post

    Hi,

    thanks, that worked. Just updated to r66 and RSS Feed is working now.

    Brgds.

  • Victor
    Avatar
    Community Member
    128 Posts

    Re: Event Calendar: New Feature Link to this post

    My google publicly shared calendar ICS is

    http://www.google.com/calendar/ical/d8miui2s0g6lr7d8q925u1o85s%40group.calendar.google.com/public/basic (.ics removed)

    but my when I select Calendar (not extended) it accepts this URL but nothing is imported and attempt to access blows up

    GET /testsite/test/

    Line 23 in /Applications/MAMP/htdocs/testsite/event_calendar/code/iCal.php

    Source

    14 function iCalClean($file) {
    15 return strpos($file, '.ics');
    16 }
    17
    18 function iCalReader() {
    19 $array = $this->iCalList();
    20 foreach ($array as $icalfile) {
    21 $iCaltoArray[$icalfile] = $this->iCalDecoder($icalfile);
    22 }
    23 return $iCaltoArray;
    24 }
    25
    26 function iCalDecoder($file) {
    27 $ical = file_get_contents($file);
    28 preg_match_all('/(BEGIN:VEVENT.*?END:VEVENT)/si', $ical, $result, PREG_PATTERN_ORDER);
    29 for ($i = 0; $i < count($result[0]); $i++) {
    Trace

    iCal->iCalReader()
    Line 279 of Calendar.php
    Calendar->importFromFeeds(DataObjectSet)
    Line 371 of Calendar.php
    Calendar->Events(,sfDate,sfDate,1,,)
    Line 765 of Calendar.php
    Calendar_Controller->Events()
    call_user_func_array(Array,Array)
    Line 550 of ViewableData.php
    ViewableData->cachedCall(Events,,)
    Line 591 of ViewableData.php
    ViewableData->hasValue(Events)
    Line 82 of .cache.Applications.MAMP.htdocs.testsite.event_calendar.templates.Layout.Calendar.ss
    include(/private/var/tmp/silverstripe-cache-Applications-MAMP-htdocs-testsite/.cache.Applications.MAMP.htdocs.testsite.event_calendar.templates.Layout.Calendar.ss)
    Line 354 of SSViewer.php
    SSViewer->process(Calendar_Controller)
    Line 346 of SSViewer.php
    SSViewer->process(Calendar_Controller)
    Line 175 of Controller.php
    Controller->handleAction(HTTPRequest)
    Line 129 of RequestHandler.php
    RequestHandler->handleRequest(HTTPRequest)
    Line 122 of Controller.php
    Controller->handleRequest(HTTPRequest)
    Line 29 of ModelAsController.php
    ModelAsController->handleRequest(HTTPRequest)
    Line 277 of Director.php
    Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    Director::direct(/test/)
    Line 118 of main.php

    My event_calendar is 83 Victor

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar: New Feature Link to this post

    What is the error? It doesn't look like you have pasted the entire output.

  • Victor
    Avatar
    Community Member
    128 Posts

    Re: Event Calendar: New Feature Link to this post

    Yes true: Headers

    [Notice] Undefined variable: iCaltoArray
    GET /testsite/test/

    Line 23 in /Applications/MAMP/htdocs/testsite/event_calendar/code/iCal.php

    Victor

    PS It is event_calendar without changes v83

  • Victor
    Avatar
    Community Member
    128 Posts

    Re: Event Calendar: New Feature Link to this post

    It looks like error was due to strange name collision: I called site "testsite" and event was "test"

    Still while there is no error anymore (when I renamed event) no event is coming

    I use event_calendar_r83

    2679 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.