1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Capability definitions for the quiz module.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_questionnaire
|
|
|
21 |
* @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org)
|
|
|
22 |
* @author Mike Churchward
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
defined('MOODLE_INTERNAL') || die();
|
|
|
27 |
|
|
|
28 |
$capabilities = array(
|
|
|
29 |
|
|
|
30 |
// Ability to add a new questionnaire instance to the course.
|
|
|
31 |
'mod/questionnaire:addinstance' => array(
|
|
|
32 |
|
|
|
33 |
'riskbitmask' => RISK_XSS,
|
|
|
34 |
'captype' => 'write',
|
|
|
35 |
'contextlevel' => CONTEXT_COURSE,
|
|
|
36 |
'archetypes' => array(
|
|
|
37 |
'editingteacher' => CAP_ALLOW,
|
|
|
38 |
'manager' => CAP_ALLOW
|
|
|
39 |
),
|
|
|
40 |
'clonepermissionsfrom' => 'moodle/course:manageactivities'
|
|
|
41 |
),
|
|
|
42 |
|
|
|
43 |
// Ability to see that the questionnaire exists, and the basic information
|
|
|
44 |
// about it.
|
|
|
45 |
'mod/questionnaire:view' => array(
|
|
|
46 |
|
|
|
47 |
'captype' => 'read',
|
|
|
48 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
49 |
'legacy' => array(
|
|
|
50 |
'student' => CAP_ALLOW,
|
|
|
51 |
'teacher' => CAP_ALLOW,
|
|
|
52 |
'editingteacher' => CAP_ALLOW,
|
|
|
53 |
'coursecreator' => CAP_ALLOW,
|
|
|
54 |
'manager' => CAP_ALLOW
|
|
|
55 |
)
|
|
|
56 |
),
|
|
|
57 |
|
|
|
58 |
// Ability to complete the questionnaire and submit.
|
|
|
59 |
'mod/questionnaire:submit' => array(
|
|
|
60 |
|
|
|
61 |
'captype' => 'write',
|
|
|
62 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
63 |
'legacy' => array(
|
|
|
64 |
'student' => CAP_ALLOW
|
|
|
65 |
)
|
|
|
66 |
),
|
|
|
67 |
|
|
|
68 |
// Ability to view individual responses to the questionnaire.
|
|
|
69 |
'mod/questionnaire:viewsingleresponse' => array(
|
|
|
70 |
|
|
|
71 |
'captype' => 'read',
|
|
|
72 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
73 |
'legacy' => array(
|
|
|
74 |
'teacher' => CAP_ALLOW,
|
|
|
75 |
'editingteacher' => CAP_ALLOW,
|
|
|
76 |
'manager' => CAP_ALLOW
|
|
|
77 |
)
|
|
|
78 |
),
|
|
|
79 |
|
|
|
80 |
// Receive a notificaton for every submission.
|
|
|
81 |
'mod/questionnaire:submissionnotification' => array(
|
|
|
82 |
|
|
|
83 |
'captype' => 'read',
|
|
|
84 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
85 |
'legacy' => array(
|
|
|
86 |
'teacher' => CAP_ALLOW,
|
|
|
87 |
'editingteacher' => CAP_ALLOW,
|
|
|
88 |
'manager' => CAP_ALLOW
|
|
|
89 |
)
|
|
|
90 |
),
|
|
|
91 |
|
|
|
92 |
// Ability to download responses in a CSV file.
|
|
|
93 |
'mod/questionnaire:downloadresponses' => array(
|
|
|
94 |
|
|
|
95 |
'captype' => 'read',
|
|
|
96 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
97 |
'legacy' => array(
|
|
|
98 |
'teacher' => CAP_ALLOW,
|
|
|
99 |
'editingteacher' => CAP_ALLOW,
|
|
|
100 |
'manager' => CAP_ALLOW
|
|
|
101 |
)
|
|
|
102 |
),
|
|
|
103 |
|
|
|
104 |
// Ability to delete someone's (or own) previous responses.
|
|
|
105 |
'mod/questionnaire:deleteresponses' => array(
|
|
|
106 |
|
|
|
107 |
'captype' => 'write',
|
|
|
108 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
109 |
'legacy' => array(
|
|
|
110 |
'editingteacher' => CAP_ALLOW,
|
|
|
111 |
'manager' => CAP_ALLOW
|
|
|
112 |
)
|
|
|
113 |
),
|
|
|
114 |
|
|
|
115 |
// Ability to create and edit surveys.
|
|
|
116 |
'mod/questionnaire:manage' => array(
|
|
|
117 |
|
|
|
118 |
'riskbitmask' => RISK_XSS,
|
|
|
119 |
'captype' => 'write',
|
|
|
120 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
121 |
'legacy' => array(
|
|
|
122 |
'editingteacher' => CAP_ALLOW,
|
|
|
123 |
'coursecreator' => CAP_ALLOW,
|
|
|
124 |
'manager' => CAP_ALLOW
|
|
|
125 |
)
|
|
|
126 |
),
|
|
|
127 |
|
|
|
128 |
// Ability to edit survey questions.
|
|
|
129 |
'mod/questionnaire:editquestions' => array(
|
|
|
130 |
|
|
|
131 |
'riskbitmask' => RISK_XSS,
|
|
|
132 |
'captype' => 'write',
|
|
|
133 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
134 |
'legacy' => array(
|
|
|
135 |
'editingteacher' => CAP_ALLOW,
|
|
|
136 |
'coursecreator' => CAP_ALLOW,
|
|
|
137 |
'manager' => CAP_ALLOW
|
|
|
138 |
)
|
|
|
139 |
),
|
|
|
140 |
|
|
|
141 |
// Ability to create template surveys which can be copied, but not used.
|
|
|
142 |
'mod/questionnaire:createtemplates' => array(
|
|
|
143 |
|
|
|
144 |
'captype' => 'write',
|
|
|
145 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
146 |
'legacy' => array(
|
|
|
147 |
'coursecreator' => CAP_ALLOW,
|
|
|
148 |
'manager' => CAP_ALLOW
|
|
|
149 |
)
|
|
|
150 |
),
|
|
|
151 |
|
|
|
152 |
// Ability to create public surveys which can be accessed from multiple places.
|
|
|
153 |
'mod/questionnaire:createpublic' => array(
|
|
|
154 |
|
|
|
155 |
'captype' => 'write',
|
|
|
156 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
157 |
'legacy' => array(
|
|
|
158 |
'coursecreator' => CAP_ALLOW,
|
|
|
159 |
'manager' => CAP_ALLOW
|
|
|
160 |
)
|
|
|
161 |
),
|
|
|
162 |
|
|
|
163 |
// Ability to read own previous responses to questionnaires.
|
|
|
164 |
'mod/questionnaire:readownresponses' => array(
|
|
|
165 |
|
|
|
166 |
'captype' => 'read',
|
|
|
167 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
168 |
'legacy' => array(
|
|
|
169 |
'manager' => CAP_ALLOW,
|
|
|
170 |
'student' => CAP_ALLOW
|
|
|
171 |
)
|
|
|
172 |
),
|
|
|
173 |
|
|
|
174 |
// Ability to read others' previous responses to questionnaires.
|
|
|
175 |
// Subject to constraints on whether responses can be viewed whilst
|
|
|
176 |
// questionnaire still open or user has not yet responded themselves.
|
|
|
177 |
'mod/questionnaire:readallresponses' => array(
|
|
|
178 |
|
|
|
179 |
'captype' => 'read',
|
|
|
180 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
181 |
'legacy' => array(
|
|
|
182 |
'manager' => CAP_ALLOW,
|
|
|
183 |
'teacher' => CAP_ALLOW,
|
|
|
184 |
'editingteacher' => CAP_ALLOW,
|
|
|
185 |
'student' => CAP_ALLOW
|
|
|
186 |
)
|
|
|
187 |
),
|
|
|
188 |
|
|
|
189 |
// Ability to read others's responses without the above checks.
|
|
|
190 |
'mod/questionnaire:readallresponseanytime' => array(
|
|
|
191 |
|
|
|
192 |
'captype' => 'read',
|
|
|
193 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
194 |
'legacy' => array(
|
|
|
195 |
'manager' => CAP_ALLOW,
|
|
|
196 |
'teacher' => CAP_ALLOW,
|
|
|
197 |
'editingteacher' => CAP_ALLOW
|
|
|
198 |
)
|
|
|
199 |
),
|
|
|
200 |
|
|
|
201 |
// Ability to print a blank questionnaire.
|
|
|
202 |
'mod/questionnaire:printblank' => array(
|
|
|
203 |
|
|
|
204 |
'captype' => 'read',
|
|
|
205 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
206 |
'legacy' => array(
|
|
|
207 |
'manager' => CAP_ALLOW,
|
|
|
208 |
'coursecreator' => CAP_ALLOW,
|
|
|
209 |
'teacher' => CAP_ALLOW,
|
|
|
210 |
'editingteacher' => CAP_ALLOW,
|
|
|
211 |
'student' => CAP_ALLOW
|
|
|
212 |
)
|
|
|
213 |
),
|
|
|
214 |
|
|
|
215 |
// Ability to preview a questionnaire.
|
|
|
216 |
'mod/questionnaire:preview' => array(
|
|
|
217 |
|
|
|
218 |
'captype' => 'read',
|
|
|
219 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
220 |
'legacy' => array(
|
|
|
221 |
'manager' => CAP_ALLOW,
|
|
|
222 |
'coursecreator' => CAP_ALLOW,
|
|
|
223 |
'teacher' => CAP_ALLOW,
|
|
|
224 |
'editingteacher' => CAP_ALLOW
|
|
|
225 |
)
|
|
|
226 |
),
|
|
|
227 |
|
|
|
228 |
// Ability to message students from a questionnaire.
|
|
|
229 |
'mod/questionnaire:message' => array(
|
|
|
230 |
|
|
|
231 |
'riskbitmask' => RISK_SPAM,
|
|
|
232 |
'captype' => 'write',
|
|
|
233 |
'contextlevel' => CONTEXT_MODULE,
|
|
|
234 |
'archetypes' => array(
|
|
|
235 |
'manager' => CAP_ALLOW,
|
|
|
236 |
'teacher' => CAP_ALLOW,
|
|
|
237 |
'editingteacher' => CAP_ALLOW
|
|
|
238 |
)
|
|
|
239 |
)
|
|
|
240 |
|
|
|
241 |
);
|