-
Notifications
You must be signed in to change notification settings - Fork 991
/
_selector.php
99 lines (89 loc) · 3.31 KB
/
_selector.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
<?php
/**
* Render the selector for surveys massive actions.
*
*/
?>
<!-- Rendering massive action widget -->
<?php
$buttons = [];
$surveyId = intval(App()->getRequest()->getQuery('surveyId'));
if (Permission::model()->hasSurveyPermission($surveyId, 'responses', 'delete')) {
// Delete
$buttons[] = [
// li element
'type' => 'action',
'action' => 'delete',
'url' => App()->createUrl("responses/delete/", ['surveyId' => $surveyId]),
'iconClasses' => 'ri-delete-bin-fill text-danger',
'text' => gT('Delete'),
'grid-reload' => 'yes',
// modal
'actionType' => 'modal',
'modalType' => 'cancel-delete',
'keepopen' => 'no',
'sModalTitle' => gT('Delete responses'),
'htmlModalBody' => gT('Are you sure you want to delete the selected responses?')
. '<br/>'
. gT('Please note that if you delete an incomplete response during a running survey, the participant will not be able to complete it.'),
'aCustomDatas' => [
['name' =>'sid', 'value' => $surveyId],
],
];
$buttons[] = [
'type' => 'action',
'action' => 'deleteAttachments',
//'url' => App()->createUrl("admin/responses", array("sa"=>"actionDeleteAttachments")),
'url' => App()->createUrl("responses/deleteAttachments/", ["surveyId" => $surveyId]),
'iconClasses' => 'text-danger ri-attachment-2',
'text' => gT('Delete attachments'),
'grid-reload' => 'yes',
// modal
'actionType' => 'modal',
'modalType' => 'cancel-delete',
'keepopen' => 'no',
'sModalTitle' => gT('Delete attachments'),
'htmlModalBody' => gT('Are you sure you want to delete all uploaded files from the selected responses?'),
'aCustomDatas' => [
['name' =>'sid', 'value' => $surveyId],
],
];
}
if (Permission::model()->hasSurveyPermission($surveyId, 'responses', 'read')) {
// Download ZIP archive of file upload question types
$buttons[] = [
'type' => 'action',
'action' => 'downloadZip',
'url' => App()->createUrl('responses/downloadfiles/', ['surveyId' => $surveyId, 'responseIds' => '']),
'iconClasses' => 'ri-download-fill test',
'text' => gT('Download files'),
'grid-reload' => 'no',
'actionType' => 'window-location-href'
];
// Export responses
$buttons[] = [
// li element
'type' => 'action',
'action' => 'export',
'url' => App()->createUrl('admin/export/sa/exportresults/', ['surveyId' => $surveyId]),
'iconClasses' => 'ri-upload-fill',
'text' => gT('Export'),
'aLinkSpecificDatas' => [
'input-name' => 'responseIds',
'input-separator' => ',',
'target' => '_self',
],
'actionType' => 'redirect',
];
}
$this->widget(
'ext.admin.grid.MassiveActionsWidget.MassiveActionsWidget',
[
'pk' => 'id',
'gridid' => 'responses-grid',
'dropupId' => 'responsesListActions',
'dropUpText' => gT('Selected response(s)...'),
'aActions' => $buttons
]
);
?>