-
Notifications
You must be signed in to change notification settings - Fork 4
/
module_delete.php
47 lines (34 loc) · 1.52 KB
/
module_delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*******
* this function named [module_name]_delete is called whenever a course content is deleted
* which includes when restoring a backup with override set, or when deleting an entire course.
* the function must delete all module-specific material associated with this course.
* $course is the ID of the course to delete.
*/
function gameme_delete($course) {
global $db;
// delete GameMe course settings
$sql = "DELETE FROM %sgm_badges WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_events WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_levels WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_options WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
// Delete GameMe user data for the course
$sql = "DELETE FROM %sgm_user_badges WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_user_events WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_user_alerts WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_user_logs WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
$sql = "DELETE FROM %sgm_user_scores WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $course));
// delete game course files
$path = AT_CONTENT_DIR .$course.'/gameme/';
clr_dir($path);
}
?>