Skip to content

Commit

Permalink
Merge branch 'MDL-54607-33' of git://github.com/ankitagarwal/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_33_STABLE
  • Loading branch information
dmonllao committed Jul 17, 2017
2 parents f00cf2b + b7ab2ac commit 3b61a61
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions calendar/export_execute.php
Expand Up @@ -215,10 +215,14 @@
//dtend is better than duration, because it works in Microsoft Outlook and works better in Korganizer
$ev->add_property('dtstart', Bennu::timestamp_to_datetime($event->timestart)); // when event starts.
$ev->add_property('dtend', Bennu::timestamp_to_datetime($event->timestart + $event->timeduration));
} else if ($event->timeduration == 0) {
// When no duration is present, the event is instantaneous event, ex - Due date of a module.
// Moodle doesn't support all day events yet. See MDL-56227.
$ev->add_property('dtstart', Bennu::timestamp_to_datetime($event->timestart));
$ev->add_property('dtend', Bennu::timestamp_to_datetime($event->timestart));
} else {
// When no duration is present, ie an all day event, VALUE should be date instead of time and dtend = dtstart + 1 day.
$ev->add_property('dtstart', Bennu::timestamp_to_date($event->timestart), array('value' => 'DATE')); // All day event.
$ev->add_property('dtend', Bennu::timestamp_to_date($event->timestart + DAYSECS), array('value' => 'DATE')); // All day event.
// This can be used to represent all day events in future.
throw new coding_exception("Negative duration is not supported yet.");
}
if ($event->courseid != 0) {
$coursecontext = context_course::instance($event->courseid);
Expand Down
3 changes: 2 additions & 1 deletion calendar/lib.php
Expand Up @@ -2935,7 +2935,8 @@ function calendar_add_icalendar_event($event, $courseid, $subscriptionid, $timez
// Check to see if the event started at Midnight on the imported calendar.
date_default_timezone_set($timezone);
if (date('H:i:s', $eventrecord->timestart) === "00:00:00") {
// This event should be an all day event.
// This event should be an all day event. This is not correct, we don't do anything differently for all day events.
// See MDL-56227.
$eventrecord->timeduration = 0;
}
\core_date::set_default_server_timezone();
Expand Down
2 changes: 1 addition & 1 deletion lib/bennu/iCalendar_components.php
Expand Up @@ -411,7 +411,7 @@ function invariant_holds() {
// DTEND must be later than DTSTART
// The standard is not clear on how to hande different value types though
// TODO: handle this correctly even if the value types are different
if($this->properties['DTEND'][0]->value <= $this->properties['DTSTART'][0]->value) {
if($this->properties['DTEND'][0]->value < $this->properties['DTSTART'][0]->value) {
return false;
}

Expand Down
1 change: 1 addition & 0 deletions lib/bennu/readme_moodle.txt
Expand Up @@ -8,3 +8,4 @@ modifications:
5/ updated DTEND;TZID and DTSTAR;TZID values to support quotations (7 Nov 2014)
6/ MDL-49032: fixed rfc2445_fold() to fix incorrect RFC2445_WSP definition (16 Sep 2015)
7/ added timestamp_to_date function to support zero duration events (16 Sept 2015)
8/ Updated \iCalendar_event::invariant_holds() to allow for same dtstart and dtend timestamps (13 July 2017)

0 comments on commit 3b61a61

Please sign in to comment.