diff --git a/lang/en/attforblock.php b/lang/en/attforblock.php index 0673f77..a42d284 100644 --- a/lang/en/attforblock.php +++ b/lang/en/attforblock.php @@ -94,7 +94,6 @@ $string['includeall'] = 'Select all sessions'; $string['includenottaken'] = 'Include not taken sessions'; $string['indetail'] = 'In detail...'; $string['jumpto'] = 'Jump to'; -$string['moduledescription'] = 'Removal of this module will not entail removal of the data!'; $string['modulename'] = 'Attendance'; $string['modulenameplural'] = 'Attendances'; $string['months'] = 'Months'; diff --git a/lang/ru/attforblock.php b/lang/ru/attforblock.php index 2667152..3215395 100644 --- a/lang/ru/attforblock.php +++ b/lang/ru/attforblock.php @@ -80,7 +80,6 @@ $string['includeall'] = 'Выбрать все занятия'; $string['includenottaken'] = 'Включить не прошедшие занятия'; $string['indetail'] = 'Подробнее...'; $string['jumpto'] = 'Перейти к занятию '; -$string['moduledescription'] = 'Удаление этого модуля не повлечет удаление данных о посещаемости!'; $string['modulename'] = 'Посещаемость'; $string['modulenameplural'] = 'Посещаемость'; $string['months'] = 'Месяц'; diff --git a/lib.php b/lib.php index 791100d..0ee6110 100644 --- a/lib.php +++ b/lib.php @@ -102,16 +102,23 @@ function attforblock_delete_instance($id) { return false; } - $result = $DB->delete_records('attforblock', array('id'=> $id)); + if ($sess = $DB->get_records('attendance_sessions', array('attendanceid'=> $id), '', 'id')) { + $slist = implode(',', array_keys($sess)); + $DB->delete_records_select('attendance_log', "sessionid IN ($slist)"); + $DB->delete_records('attendance_sessions', array('attendanceid'=> $id)); + } + $DB->delete_records('attendance_statuses', array('attendanceid'=> $id)); + + $DB->delete_records('attforblock', array('id'=> $id)); attforblock_grade_item_delete($attforblock); - return $result; + return true; } function attforblock_delete_course($course, $feedback=true){ - global $DB; + global $DB; if ($sess = $DB->get_records('attendance_sessions', array('courseid'=> $course->id), '', 'id')) { $slist = implode(',', array_keys($sess)); diff --git a/mod_form.php b/mod_form.php index a28c778..11a0c2f 100644 --- a/mod_form.php +++ b/mod_form.php @@ -21,8 +21,6 @@ class mod_attforblock_mod_form extends moodleform_mod { $mform->addRule('name', null, 'required', null, 'client'); $mform->setDefault('name', get_string('modulename', 'attforblock')); - $mform->addElement('static', 'attdescription', '', get_string('moduledescription', 'attforblock')); - $mform->addElement('modgrade', 'grade', get_string('grade')); $mform->setDefault('grade', 100);