function attforblock_delete_instance($id) { /// Given an ID of an instance of this module, /// this function will permanently delete the instance /// and any data that depends on it. if (!($attforblock = get_record('attforblock', 'id', $id))) { return false; } $result = delete_records('attforblock', 'id', $id); attforblock_grade_item_delete($attforblock); return $result; }
function attforblock_delete_instance($id) { global $DB; if (!($attforblock = $DB->get_record('attforblock', array('id' => $id)))) { return false; } if ($sessids = array_keys($DB->get_records('attendance_sessions', array('attendanceid' => $id), '', 'id'))) { $DB->delete_records_list('attendance_log', 'sessionid', $sessids); $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 true; }