-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.php
47 lines (34 loc) · 919 Bytes
/
lib.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
function testingdemo_supports($feature) {
switch($feature) {
case FEATURE_MOD_INTRO:
return true;
default:
return null;
}
}
function testingdemo_add_instance(stdClass $data, $mform=null) {
global $DB;
if (!isset($data->timemodified)) {
$data->timemodified = time();
}
return $DB->insert_record('testingdemo', $data);
}
function testingdemo_update_instance(stdClass $data, $mform=null) {
global $DB;
$data->id = $data->instance;
if (!isset($data->timemodified)) {
$data->timemodified = time();
}
$DB->update_record('testingdemo', $data);
return true;
}
function testingdemo_delete_instance($id) {
global $DB;
$cm = get_coursemodule_from_instance('testingdemo', $id);
if (!$cm) {
return false;
}
$DB->delete_records('testingdemo', array('id' => $id));
return true;
}