Browse Source

Add description to event, and group to event name if present. (#296)

MOODLE_31_STABLE
Nick Phillips 7 years ago
committed by Dan Marsden
parent
commit
96cc800e60
  1. 5
      classes/calendar_helpers.php

5
classes/calendar_helpers.php

@ -45,10 +45,15 @@ function attendance_create_calendar_event(&$session) {
$caleventdata->instance = $session->attendanceid; $caleventdata->instance = $session->attendanceid;
$caleventdata->timestart = $session->sessdate; $caleventdata->timestart = $session->sessdate;
$caleventdata->timeduration = $session->duration; $caleventdata->timeduration = $session->duration;
$caleventdata->description = $session->description;
$caleventdata->eventtype = 'attendance'; $caleventdata->eventtype = 'attendance';
$caleventdata->timemodified = time(); $caleventdata->timemodified = time();
$caleventdata->modulename = 'attendance'; $caleventdata->modulename = 'attendance';
if (!empty($session->groupid)) {
$caleventdata->name .= " (". get_string('group', 'group') ." ". groups_get_group_name($session->groupid) .")";
}
$calevent = new stdClass(); $calevent = new stdClass();
if ($calevent = calendar_event::create($caleventdata, false)) { if ($calevent = calendar_event::create($caleventdata, false)) {
$session->caleventid = $calevent->id; $session->caleventid = $calevent->id;

Loading…
Cancel
Save