|
@ -454,13 +454,18 @@ class mod_attendance_structure { |
|
|
public function add_sessions($sessions) { |
|
|
public function add_sessions($sessions) { |
|
|
global $DB; |
|
|
global $DB; |
|
|
|
|
|
|
|
|
|
|
|
$config = get_config('attendance'); |
|
|
|
|
|
|
|
|
foreach ($sessions as $sess) { |
|
|
foreach ($sessions as $sess) { |
|
|
$sess->attendanceid = $this->id; |
|
|
$sess->attendanceid = $this->id; |
|
|
$sess->automarkcompleted = 0; |
|
|
$sess->automarkcompleted = 0; |
|
|
if (!isset($sess->automark)) { |
|
|
if (!isset($sess->automark)) { |
|
|
$sess->automark = 0; |
|
|
$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); |
|
|
$sess->id = $DB->insert_record('attendance_sessions', $sess); |
|
|
$description = file_save_draft_area_files($sess->descriptionitemid, |
|
|
$description = file_save_draft_area_files($sess->descriptionitemid, |
|
|
$this->context->id, 'mod_attendance', 'session', $sess->id, |
|
|
$this->context->id, 'mod_attendance', 'session', $sess->id, |
|
|