diff --git a/classes/structure.php b/classes/structure.php index ebb515d..9090216 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -454,13 +454,18 @@ class mod_attendance_structure { public function add_sessions($sessions) { global $DB; + $config = get_config('attendance'); + foreach ($sessions as $sess) { $sess->attendanceid = $this->id; $sess->automarkcompleted = 0; if (!isset($sess->automark)) { $sess->automark = 0; } - + if (empty($config->enablecalendar)) { + // If calendard disabled at site level, don't use it. + $sess->calendarevent = 0; + } $sess->id = $DB->insert_record('attendance_sessions', $sess); $description = file_save_draft_area_files($sess->descriptionitemid, $this->context->id, 'mod_attendance', 'session', $sess->id,