PiRSquared17 / mw-calendar

Automatically exported from code.google.com/p/mw-calendar
0 stars 0 forks source link

import event times along with the events (iCal import) #104

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Sorry for opening so many issues regarding the iCal import. ;-)

I wanted to have the event times along with the events when I import an
*.ics calendar. Therefore I patched the load_ical method in Calendar.php. I
added this at line 1284 (after the end time is set):

/* patch starts here */
$end = $event['DTEND'];

// add start and end time to description
if ($start['hours'] > 0) {
  $old_description = $description;
  $minutes = str_pad($start['minutes'], 2, '0', STR_PAD_LEFT);
  $description = $start['hours'] . '.' . $minutes;
  if ($end != $start) {
    $minutes = str_pad($end['minutes'], 2, '0', STR_PAD_LEFT);
    $description .= '-' . $end['hours'] . '.' . $minutes;
  }
  $description .= ': ' . $old_description;
}
/* end of patch */

This works well so far and adds the start and end time (if set) to the
description. Thus, you can see the times on the event page in front of the
description.

Maybe this helps someone else out there, and maybe you can use this for the
next version of the extension. If so, it probably should be disabled by
default and the user would enable it with a variable in LocalSettings.php,
I guess.

Original issue reported on code.google.com by johan...@bolarus.de on 29 Sep 2009 at 1:21

GoogleCodeExporter commented 9 years ago
Thanks!

Original comment by kenyu73 on 10 Oct 2009 at 2:13