DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:icalevents

icalevents plugin

Compatible with DokuWiki

2008-05-05, angua, rincewind, anteater

plugin Parses an iCal calendar .ics file and renders it as an HTML table

Last updated on
2012-09-09
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to ical

Tagged with calendar

Description

Many calendars can export their entries in the iCalendar (RFC 2445) format. This plugin can read such an *.ics file from an URL, parse it and display upcoming events as an HTML table. Limitations: For repeated events only the first occurences is shown.

Download and Installation

You can simply install the plugin with the Plugin Manager using the following URL. Please refer to Plugins on how to install plugins manually.

Usage

To use the plugin, put one of the following lines into any page of your wiki:

  • {{iCalEvents>http://host/myCalendar.ics}}
  • {{iCalEvents>http://host/myCalendar.ics#from=today&previewDays=30}}1) Display all events from today within the next 30 days
  • {{iCalEvents>http://host/myCalendar.ics#from=31/10/2009&previewDays=30}} - only display events after that fixed date (MM/dd/yyyy)

Optionally, you can filter the events that are shown with two parameters:

from A date from which on to show events. MUST be in the format MM/dd/yyyy or you can simply say “from=today”. If from is omitted, then all events are shown.
previewDays Amount of days to preview into the future. Default is 60 days. Parameter from must also be given!

in milliseconds: from <= eventdate <= from+(previewDays*24*60*3600)

Configuration

There are also some settings in the plugins/iCalEvents/conf/default.php file that you can change:

$conf['dformat']='%d.%m.%Y'; Date format that is used to display the from and to values. If you leave this empty, then the default dformat from /conf/dokuwiki.php will be used.
$conf['showEndDates']=0; Should the end dates for each event be shown?

Demo and Screenshot

You can also see this plugin in action on the start page of my private homepage: http://www.doogie.de

Version History

  • Version 2.0.2: Another unofficial release by glen
    • use lowercase plugin name for better compatibility with new dokuwiki
    • NB! after upgrade you need manually to remove old lib/plugins/iCalEvents dir (new version installs into lib/plugins/icalevents)
  • Version 2.0.1: Unofficial release (in github)
    • bugfix for multiple calendars on page (error state was overwriting first calendar error state)
    • showEndDates, dformat configurable via wiki page as well, not only config
    • from can also accept any strtotime parameter, i.e last thursday
    • showCurrentWeek option to highlight active week in output
  • Version 2.0: Fullfilled customer requests:
    • start and end date can be shown
    • configurable date format
  • Version 1.3: timezone id bugfix, little speed optimization and nasty bugfix for parsing descriptions
  • Version 1.2: updated zip file
  • Version 1.1: DokuWiki Links are rendered within iCal description texts.
  • Version 1.0: Added localization for German and English.
  • Version 0.9: First public release

Feedback & Feature requests

In order to organize this a little bit I opened a GetSatisfaction Community. Feel free to post any bugs, comments and feature requests there:


  • github and extra patches
    • i took the time and imported 2.0 zip to github and applied my patches, that i provided 6 months ago via getsatisfaction, but as getsatisfaction does not log in with my open-id i posted there initially, posting results here — glenglen

      Estonia, Tallinn
      2011/05/24 06:48
    • Hi Glen. Thank you very much for the github import — RobertDoogie
      doogie

      2011/09/11 11:33
  • Download of file to import to own organizer or handheld
    • This can be done easily, since the ics file must be available as HTTP link any way. Simply post a link to the file e.g. below the table. – Robert (plugin author)
  • Show more ics-Files in one table; szenario: you have different ics-files (e.g. public, departmentA) and all dates should be mixed
    maybe even of a folder in which ics-files are stored.
    • Ok, this is a reasonable feature request. Any volunteers? *G* – Robert
  • dates are shown depending to your own user-groups
    • Ok, but what would be the filter criteria? “If user is in group A then show only dates that are ????….??????” – Robert
  • Recurring events are not displayed: I have made a calendar with Apple's Ical (version 2.0.5 thats ships with Mac 10.4 Tiger). The plugin displays only the first event of a weekly recurring event. – Metsis
    • This is a feature thas has been requested multiple times. If I find the time, I'll try to implement recurring features sometime … – Robert (plugin author) in March 2010
    • Today I looked through the ICAL spec for recurring events: (RFC2445 Chapter Recurrence Rule “RECUR”). There is an implementation of this in phpicalendar.net (in the file functions/end_vevent.php) This implementation is about three times the code size of my whole plugin! :-) – Robert (plugin author) in Decemter 2010
    • i added some code in syntax.php to have not only “today” but also “yesterday”. just copied today-part, pasted into below today-part and added a bit code. if ($params['from'] == 'yesterday') { $from = time()-(24*60*60); } else if ($params['from']) { $from = $params['from']; } – Ronny in December 2010
  • taking care of the timezone - I added the following lines of Code to react to timezones:
// in the regex section:
$regex_timezone    = '/X-WR-TIMEZONE:(.*?)\n/';
 
// then:
$dateTimeZoneICS = new DateTimeZone("UTC");
if (preg_match($regex_timezone, $content, $timezone)) {              
   $dateTimeZoneICS = new DateTimeZone(trim($timezone[1]));
}
 
// and I changed one part in the loop:
$entry['startunixdate'] = mktime($dtstart[4], $dtstart[5], $dtstart[6], $dtstart[2], $dtstart[3], $dtstart[1]);
$startDateObj = new DateTime($dtstart[3]."-".$dtstart[2]."-".$dtstart[1]." ".$dtstart[4].":".$dtstart[5].":".$dtstart[6], $dateTimeZoneICS);
$entry['startdate']     = strftime($dateFormat, $startDateObj->getTimestamp()+$startDateObj->getOffset());
preg_match($regex_dtend, $vevent, $dtend);
$entry['endunixdate']   = mktime($dtend[4], $dtend[5], $dtend[6], $dtend[2], $dtend[3], $dtend[1]);
$endDateObj = new DateTime($dtend[3]."-".$dtend[2]."-".$dtend[1]." ".$dtend[4].":".$dtend[5].":".$dtend[6], $dateTimeZoneICS);
$entry['enddate']       = strftime($dateFormat, $endDateObj->getTimestamp()+$endDateObj->getOffset());

(now it lists my appointments in denmark from google calendar with the correct hours)


See also my other plugin doodle2

1) Do not forget the hash ('#') between the URL and the parameters.I used a hash, cause the URL might contain question marks
plugin/icalevents.txt · Last modified: 2012-11-21 00:20 by Klap-in