|
1
|
|
|
<?php |
|
2
|
|
|
/* For license terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Plugin class for the Extended Question Pool plugin. |
|
6
|
|
|
* |
|
7
|
|
|
* @package chamilo.plugin.extendedquestionpool |
|
8
|
|
|
* |
|
9
|
|
|
* @author Nosolored <[email protected]> |
|
10
|
|
|
*/ |
|
11
|
|
|
class ExtendedQuestionPoolPlugin extends Plugin |
|
12
|
|
|
{ |
|
13
|
|
|
//public $isCoursePlugin = true; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Constructor. |
|
17
|
|
|
*/ |
|
18
|
|
|
protected function __construct() |
|
19
|
|
|
{ |
|
20
|
|
|
parent::__construct( |
|
21
|
|
|
'1.0', |
|
22
|
|
|
'NoSoloRed', |
|
23
|
|
|
[ |
|
24
|
|
|
'enable_plugin' => 'boolean', |
|
25
|
|
|
'correct_score' => 'text', |
|
26
|
|
|
'error_score' => 'text', |
|
27
|
|
|
] |
|
28
|
|
|
); |
|
29
|
|
|
|
|
30
|
|
|
$this->isAdminPlugin = true; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Instance the plugin. |
|
35
|
|
|
* |
|
36
|
|
|
* @staticvar null $result |
|
37
|
|
|
* |
|
38
|
|
|
* @return ExtendedQuestionPool |
|
39
|
|
|
*/ |
|
40
|
|
|
public static function create() |
|
41
|
|
|
{ |
|
42
|
|
|
static $result = null; |
|
43
|
|
|
|
|
44
|
|
|
return $result ? $result : $result = new self(); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* This method creates the tables required to this plugin. |
|
49
|
|
|
*/ |
|
50
|
|
|
public function install() |
|
51
|
|
|
{ |
|
52
|
|
|
require_once api_get_path(SYS_PLUGIN_PATH).'extendedquestionpool/database.php'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* This method drops the plugin tables. |
|
57
|
|
|
*/ |
|
58
|
|
|
public function uninstall() |
|
59
|
|
|
{ |
|
60
|
|
|
// Deleting course settings. |
|
61
|
|
|
$this->uninstall_course_fields_in_all_courses(); |
|
62
|
|
|
$extraFieldTable = Database::get_main_table(TABLE_EXTRA_FIELD); |
|
63
|
|
|
$query = "UPDATE $extraFieldTable |
|
64
|
|
|
SET visible_to_self = 0, |
|
65
|
|
|
visible_to_others = 0, |
|
66
|
|
|
changeable = 0, |
|
67
|
|
|
filter = 0 |
|
68
|
|
|
WHERE variable = 'additional_question_category'"; |
|
69
|
|
|
Database::query($query); |
|
70
|
|
|
$query = "UPDATE $extraFieldTable |
|
71
|
|
|
SET visible_to_self = 0, |
|
72
|
|
|
visible_to_others = 0, |
|
73
|
|
|
changeable = 0, |
|
74
|
|
|
filter = 0 |
|
75
|
|
|
WHERE variable = 'question_data1'"; |
|
76
|
|
|
Database::query($query); |
|
77
|
|
|
$query = "UPDATE $extraFieldTable |
|
78
|
|
|
SET visible_to_self = 0, |
|
79
|
|
|
visible_to_others = 0, |
|
80
|
|
|
changeable = 0, |
|
81
|
|
|
filter = 0 |
|
82
|
|
|
WHERE variable = 'question_data2'"; |
|
83
|
|
|
Database::query($query); |
|
84
|
|
|
$query = "UPDATE $extraFieldTable |
|
85
|
|
|
SET visible_to_self = 0, |
|
86
|
|
|
visible_to_others = 0, |
|
87
|
|
|
changeable = 0, |
|
88
|
|
|
filter = 0 |
|
89
|
|
|
WHERE variable = 'question_data3'"; |
|
90
|
|
|
Database::query($query); |
|
91
|
|
|
$query = "UPDATE $extraFieldTable |
|
92
|
|
|
SET visible_to_self = 0, |
|
93
|
|
|
visible_to_others = 0, |
|
94
|
|
|
changeable = 0, |
|
95
|
|
|
filter = 0 |
|
96
|
|
|
WHERE variable = 'question_extra_info'"; |
|
97
|
|
|
Database::query($query); |
|
98
|
|
|
$this->manageTab(false); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* This method updates plugin. |
|
103
|
|
|
*/ |
|
104
|
|
|
public function update() |
|
105
|
|
|
{ |
|
106
|
|
|
//update actions |
|
107
|
|
|
} |
|
108
|
|
|
} |