/** * 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 * @return bool true if successful */ function simplecertificate_delete_instance($id) { global $DB, $CFG; global $CFG; require_once $CFG->dirroot . '/mod/simplecertificate/locallib.php'; $cm = get_coursemodule_from_instance('simplecertificate', $id, 0, false, MUST_EXIST); $context = context_module::instance($cm->id); $simplecertificate = new simplecertificate($context, null, null); return $simplecertificate->delete_instance(); }