diff options
author | Sem <sembrestels@riseup.net> | 2012-08-11 01:41:00 +0200 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2012-08-11 01:41:00 +0200 |
commit | 6879aa27f768b2284644606e84a8f5ae1a9012bd (patch) | |
tree | 180c271463d87fd99cf550fb6ad4f49aee7d7e03 | |
parent | 822b97cd05b048f88a78622fbff5322e42b05d69 (diff) | |
download | elgg-6879aa27f768b2284644606e84a8f5ae1a9012bd.tar.gz elgg-6879aa27f768b2284644606e84a8f5ae1a9012bd.tar.bz2 |
Fixed moves of repeating events.
-rw-r--r-- | models/model.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/model.php b/models/model.php index 649d6027a..c651b0055 100644 --- a/models/model.php +++ b/models/model.php @@ -2112,6 +2112,18 @@ function event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delt $event->end_time += $minute_delta; } } + $dow = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday'); + $week_repeats = array(); + $weekday_delta = (($day_delta % 7) + 7) % 7; // Imagine delta is -12: ((-12 % 7) + 7 % 7) = +2 (thursdays are saturdays) + foreach ($dow as $i => $w) { + $v = 'event-calendar-repeating-'.$w.'-value'; + $new_day = $dow[($i+$weekday_delta)%7]; + $week_repeats[$new_day] = $event->$v; + } + foreach ($week_repeats as $w => $value) { + $v = 'event-calendar-repeating-'.$w.'-value'; + $event->$v = $value; + } return TRUE; } } |