-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathriskAssessments.php
executable file
·349 lines (320 loc) · 18 KB
/
riskAssessments.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<?php
# Class implementing a risk assessment system
class riskAssessments extends reviewableAssessments
{
# Define forms available
public $forms = array (
'form_default', // Legacy, not available for new assessments, as marked below
'form_lowrisk',
'form_mediumrisk',
'form_highrisk',
'form_groupactivity',
'form_event',
'form_exemption',
);
# Legacy form types, which do not permit cloning
public $legacyForms = array (
'form_default',
);
# Colours for listing
public $formColours = array (
'form_lowrisk' => 'blue',
'form_mediumrisk' => 'orange',
'form_highrisk' => 'red',
);
# Function to assign defaults additional to the general application defaults
public function defaults ()
{
# Add implementation defaults
$defaults = array (
'applicationName' => 'Risk assessments',
'database' => 'riskassessments',
'description' => 'risk assessment',
'descriptionPlural' => 'risk assessments',
'directorDescription' => 'Departmental Safety Officer',
'stage2Info' => 'customs/insurance information',
'listingAdditionalFields' => array ('country', 'when'),
'emailSubjectAddition' => array ('form_highrisk' => 'HIGH RISK', ),
);
# Merge in the default defaults
$defaults += parent::defaults ();
# Return the defaults
return $defaults;
}
public function main ()
{
# Load each form definition class
#!# Currently loaded manually
foreach ($this->forms as $form) {
$class = "riskAssessments_{$form}";
$file = $class . '.php';
require_once ($file);
$this->formClasses[$form] = new $class ($this->settings);
}
# Run main
parent::main ();
}
# Choice form
public function choiceForm ($form)
{
# Overall form type
$form->radiobuttons (array (
'name' => 'choice0',
'title' => 'What type of risk assessment?',
'values' => array (
'a_goto1' => 'Risk assessment for individual activity<br />',
'b_result_groupactivity' => 'Risk assessment for group activity (e.g. group fieldtrips)<br />',
'c_result_event' => 'Risk assessment for events<br />',
'd_result_exemption' => 'Exemption from risk assessment form (MPhil in Anthropocene/Holocene only)<br />',
),
'entities' => false,
'discard' => true,
));
# Intermediate choice values, which result in selection of the 'form' value below
$form->radiobuttons (array (
'name' => 'choice1',
'title' => '1. Where are you going?',
'values' => array (
'a_goto2' => 'Travel is in the UK<br />',
'b_goto2' => 'Travel is outside the UK and there is no FCDO advice in place for anywhere in the country<br />',
'c_goto3' => 'Travel is outside the UK and there is local FCDO advice<br />',
'd_goto4' => 'Travel is outside the UK and FCDO advises against all but essential travel or advise against all travel',
),
'entities' => false,
'discard' => true,
));
$form->radiobuttons (array (
'name' => 'choice2',
'title' => '2. Traveller details',
'values' => array (
'a_goto5' => 'Traveller has relevant experience, understanding and skills for the work proposed<br />',
'b_goto6' => 'Traveller has personal characteristics (e.g. health, disability, pregnancy, language, ethnic, religious, protected characteristics or cultural factors) that may require specific adjustments or support during work, or because of living away from home.<br />',
'c_goto7' => 'Traveller has personal characteristics (e.g. health, disability, pregnancy, language, ethnic, religious, protected characteristics or cultural factors) that could significantly increase their vulnerability to certain risks.<br />',
'd_goto7' => 'Traveller does not have experience of conducting a higher risk activity or working in a higher risk location.',
),
'entities' => false,
'discard' => true,
));
$form->radiobuttons (array (
'name' => 'choice3',
'title' => '3. Traveller details',
'values' => array (
'a_goto6' => 'Traveller has relevant experience, understanding and skills for the work proposed<br />',
'b_goto6' => 'Traveller has personal characteristics (e.g. health, disability, pregnancy, language, ethnic, religious, protected characteristics or cultural factors) that may require specific adjustments or support during work, or because of living away from home.<br />',
'c_goto7' => 'Traveller has personal characteristics (e.g. health, disability, pregnancy, language, ethnic, religious, protected characteristics or cultural factors) that could significantly increase their vulnerability to certain risks.<br />',
'd_goto7' => 'Traveller does not have experience of conducting a higher risk activity or working in a higher risk location.',
),
'entities' => false,
'discard' => true,
));
$form->radiobuttons (array (
'name' => 'choice4',
'title' => '4. Traveller details',
'values' => array (
'a_goto7' => 'Traveller has relevant experience, understanding and skills for the work proposed<br />',
'b_goto7' => 'Traveller has personal characteristics (e.g. health, disability, pregnancy, language, ethnic, religious, protected characteristics or cultural factors) that may require specific adjustments or support during work, or because of living away from home.<br />',
'c_goto7' => 'Traveller has personal characteristics (e.g. health, disability, pregnancy, language, ethnic, religious, protected characteristics or cultural factors) that could significantly increase their vulnerability to certain risks.<br />',
'd_goto7' => 'Traveller will be conducting a higher risk activity or working in a higher risk location and does not have prior experience.',
),
'entities' => false,
'discard' => true,
));
$form->radiobuttons (array (
'name' => 'choice5',
'title' => '5. What are you going to be doing?',
'values' => array (
'a_result_lowrisk' => 'Conducting non-practical work such as desk work, attendance at a seminar, conference or exhibition held in a controlled environment.<br />',
'b_result_mediumrisk' => 'Standard fieldwork, including interviews, location visits, accessing archives, etc. This does not include practical work.<br />',
'c_result_mediumrisk' => 'Conducting practical work (field visits, work in a lab, work in a remote area), and/or an activity where permits/licenses are required (mountaineering, diving, archaeological dig), where the individual is accompanied by a professional guide, or any other work/research that requires the traveller to complete a standard ethics assessment.<br />',
'd_result_highrisk' => 'Conducting lone practical work in an area of high risk (field visits, work in a lab, work in a remote area), or an activity where permits/licenses are required (mountaineering, diving) and will not be accompanied by a professional guide.<br />',
'e_result_highrisk' => 'Researching a highly sensitive/controversial topic that could potentially put you in danger.',
),
'entities' => false,
'discard' => true,
));
$form->radiobuttons (array (
'name' => 'choice6',
'title' => '6. What are you going to be doing?',
'values' => array (
'a_result_mediumrisk' => 'Traveller is planning to conduct non-practical work such as desk work, attendance at a seminar, conference or exhibition held in a controlled environment<br />',
'b_result_mediumrisk' => 'Traveller is planning to conduct practical work (field visits, work in a lab, work in a remote area), and/or an activity where permits/licenses are required (mountaineering, diving, archaeological dig), where the individual is accompanied by a professional guide, or any other work/research that requires the traveller to complete a standard ethics assessment.<br />',
'c_result_highrisk' => 'Traveller is planning to conduct lone practical work in an area of high risk (field visits, work in a lab, work in a remote area), or an activity where permits/licenses are required (mountaineering, diving) and will not be accompanied by a professional guide.<br />',
'd_result_highrisk' => 'Traveller is researching a highly sensitive/controversial topic that could put them in danger',
),
'entities' => false,
'discard' => true,
));
$form->radiobuttons (array (
'name' => 'choice7',
'title' => '7. What are you going to be doing?',
'values' => array (
'a_result_highrisk' => 'Traveller is planning to conduct non-practical work such as desk work, attendance at a seminar, conference or exhibition held in a controlled environment<br />',
'b_result_highrisk' => 'Traveller is planning to conduct practical work (field visits, work in a lab, work in a remote area), and/or an activity where permits/licenses are required (mountaineering, diving, archaeological dig), where the individual is accompanied by a professional guide, or any other work/research that requires the traveller to complete a standard ethics assessment.<br />',
'c_result_highrisk' => 'Traveller is planning to conduct lone practical work in an area of high risk (field visits, work in a lab, work in a remote area), or an activity where permits/licenses are required (mountaineering, diving) and will not be accompanied by a professional guide.<br />',
'd_result_highrisk' => 'Traveller is researching a highly sensitive/controversial topic that could put them in danger',
),
'entities' => false,
'discard' => true,
));
# The 'form' value, which will be used
$form->radiobuttons (array (
'name' => 'form',
'title' => '<strong>Confirmation:</strong><br />Your activity is classed as:',
'values' => array (
'form_lowrisk' => 'Low risk',
'form_mediumrisk' => 'Medium risk',
'form_highrisk' => 'High risk',
'form_groupactivity' => 'Group activity',
'form_event' => 'Event',
'form_exemption' => 'Exemption from risk assessment',
),
'entities' => false,
'required' => true, // Not necessary because of the JS but ensures the form cannot pass if JS is disabled
));
# Return the form handle
return $form;
}
/* Forms */
# NB If adding a new form below, ensure it is also registered above in the $forms property
/* form_default: Default form */
public function form_default ($data, $watermark) {
return $this->formClasses['form_default']->form_default ($data, $watermark);
}
public function form_default_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_default']->form_default_mainAttributes ($formMainAttributes);
}
public function form_default_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_default']->setCountries ($this->getCountries ());
return $this->formClasses['form_default']->form_default_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_default_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_default']->form_default_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_default_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_default']->form_default_localExcludeFields ($localExcludeFields, $data);
}
public function form_default_validationRules ($form, $data) {
return $this->formClasses['form_default']->form_default_validationRules ($form, $data);
}
/* Low risk */
public function form_lowrisk ($data, $watermark) {
return $this->formClasses['form_lowrisk']->form_lowrisk ($data, $watermark);
}
public function form_lowrisk_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_lowrisk']->form_lowrisk_mainAttributes ($formMainAttributes);
}
public function form_lowrisk_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_lowrisk']->setCountries ($this->getCountries ());
return $this->formClasses['form_lowrisk']->form_lowrisk_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_lowrisk_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_lowrisk']->form_lowrisk_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_lowrisk_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_lowrisk']->form_lowrisk_localExcludeFields ($localExcludeFields, $data);
}
public function form_lowrisk_validationRules ($form, $data) {
return $this->formClasses['form_lowrisk']->form_lowrisk_validationRules ($form, $data);
}
/* Medium risk */
public function form_mediumrisk ($data, $watermark) {
return $this->formClasses['form_mediumrisk']->form_mediumrisk ($data, $watermark);
}
public function form_mediumrisk_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_mediumrisk']->form_mediumrisk_mainAttributes ($formMainAttributes);
}
public function form_mediumrisk_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_mediumrisk']->setCountries ($this->getCountries ());
return $this->formClasses['form_mediumrisk']->form_mediumrisk_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_mediumrisk_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_mediumrisk']->form_mediumrisk_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_mediumrisk_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_mediumrisk']->form_mediumrisk_localExcludeFields ($localExcludeFields, $data);
}
public function form_mediumrisk_validationRules ($form, $data) {
return $this->formClasses['form_mediumrisk']->form_mediumrisk_validationRules ($form, $data);
}
/* High risk */
public function form_highrisk ($data, $watermark) {
return $this->formClasses['form_highrisk']->form_highrisk ($data, $watermark);
}
public function form_highrisk_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_highrisk']->form_highrisk_mainAttributes ($formMainAttributes);
}
public function form_highrisk_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_highrisk']->setCountries ($this->getCountries ());
return $this->formClasses['form_highrisk']->form_highrisk_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_highrisk_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_highrisk']->form_highrisk_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_highrisk_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_highrisk']->form_highrisk_localExcludeFields ($localExcludeFields, $data);
}
public function form_highrisk_validationRules ($form, $data) {
return $this->formClasses['form_highrisk']->form_highrisk_validationRules ($form, $data);
}
/* Event */
public function form_event ($data, $watermark) {
return $this->formClasses['form_event']->form_event ($data, $watermark);
}
public function form_event_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_event']->form_event_mainAttributes ($formMainAttributes);
}
public function form_event_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_event']->setCountries ($this->getCountries ());
return $this->formClasses['form_event']->form_event_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_event_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_event']->form_event_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_event_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_event']->form_event_localExcludeFields ($localExcludeFields, $data);
}
public function form_event_validationRules ($form, $data) {
return $this->formClasses['form_event']->form_event_validationRules ($form, $data);
}
/* Group trip */
public function form_groupactivity ($data, $watermark) {
return $this->formClasses['form_groupactivity']->form_groupactivity ($data, $watermark);
}
public function form_groupactivity_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_groupactivity']->form_groupactivity_mainAttributes ($formMainAttributes);
}
public function form_groupactivity_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_groupactivity']->setCountries ($this->getCountries ());
return $this->formClasses['form_groupactivity']->form_groupactivity_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_groupactivity_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_groupactivity']->form_groupactivity_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_groupactivity_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_groupactivity']->form_groupactivity_localExcludeFields ($localExcludeFields, $data);
}
public function form_groupactivity_validationRules ($form, $data) {
return $this->formClasses['form_groupactivity']->form_groupactivity_validationRules ($form, $data);
}
/* Exemption */
public function form_exemption ($data, $watermark) {
return $this->formClasses['form_exemption']->form_exemption ($data, $watermark);
}
public function form_exemption_mainAttributes ($formMainAttributes) {
return $this->formClasses['form_exemption']->form_exemption_mainAttributes ($formMainAttributes);
}
public function form_exemption_dataBindingAttributes ($dataBindingAttributes, $data) {
$this->formClasses['form_exemption']->setCountries ($this->getCountries ());
return $this->formClasses['form_exemption']->form_exemption_dataBindingAttributes ($dataBindingAttributes, $data);
}
public function form_exemption_localRequiredFields ($formLocalRequiredFields, $data) {
return $this->formClasses['form_exemption']->form_exemption_localRequiredFields ($formLocalRequiredFields, $data);
}
public function form_exemption_localExcludeFields ($localExcludeFields, $data) {
return $this->formClasses['form_exemption']->form_exemption_localExcludeFields ($localExcludeFields, $data);
}
public function form_exemption_validationRules ($form, $data) {
return $this->formClasses['form_exemption']->form_exemption_validationRules ($form, $data);
}
}
?>