/** * Given an ID of an instance of this module, * this function will permanently delete the instance * and any data that depends on it. * * @param int $id Id of the module instance * @return boolean Success/Failure **/ function lti_delete_instance($id) { global $DB; if (!($basiclti = $DB->get_record("lti", array("id" => $id)))) { return false; } $result = true; // Delete any dependent records here. lti_grade_item_delete($basiclti); $ltitype = $DB->get_record('lti_types', array('id' => $basiclti->typeid)); $DB->delete_records('lti_tool_settings', array('toolproxyid' => $ltitype->toolproxyid, 'course' => $basiclti->course, 'coursemoduleid' => $id)); return $DB->delete_records("lti", array("id" => $basiclti->id)); }
/** * Given an ID of an instance of this module, * this function will permanently delete the instance * and any data that depends on it. * * @param int $id Id of the module instance * @return boolean Success/Failure **/ function lti_delete_instance($id) { global $DB; if (! $basiclti = $DB->get_record("lti", array("id" => $id))) { return false; } $result = true; # Delete any dependent records here # lti_grade_item_delete($basiclti); return $DB->delete_records("lti", array("id" => $basiclti->id)); }