/
_selector.php
97 lines (86 loc) · 3.65 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
<?php
/**
* Render the selector for surveys massive actions.
*
*/
?>
<!-- Rendering massive action widget -->
<?php
$buttons = array();
$surveyId = intval(App()->getRequest()->getQuery('surveyid'));
if (Permission::model()->hasSurveyPermission($surveyId, 'responses','delete')) {
// Delete
$buttons[] = array(
// li element
'type' => 'action',
'action' => 'delete',
'url' => App()->createUrl('/admin/responses/sa/actionDelete/surveyid/'.$surveyId),
'iconClasses' => 'text-danger fa fa-trash',
'text' => gT('Delete'),
'grid-reload' => 'yes',
// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'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' => array(
array( 'name'=>'sid', 'value'=> $surveyId),
),
);
$buttons[] = array(
'type' => 'action',
'action' => 'deleteAttachments',
//'url' => App()->createUrl("admin/responses", array("sa"=>"actionDeleteAttachments")),
'url' => App()->createUrl("/admin/responses/sa/actionDeleteAttachments/", array("surveyid" => $surveyId )),
'iconClasses' => 'text-danger fa fa-paperclip',
'text' => gT('Delete attachments'),
'grid-reload' => 'yes',
// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'keepopen' => 'no',
'sModalTitle' => gT('Delete attachments'),
'htmlModalBody' => gT('Are you sure you want to delete all uploaded files from the selected responses?'),
'aCustomDatas' => array(
array( 'name'=>'sid', 'value'=> $surveyId),
),
);
}
if (Permission::model()->hasSurveyPermission($surveyId, 'responses', 'read')) {
// Download ZIP archive of file upload question types
$buttons[] = array(
'type' => 'action',
'action' => 'downloadZip',
'url' => App()->createUrl('/admin/responses/sa/actionDownloadfiles/iSurveyId/' . $surveyId) . '/sResponseId/',
'iconClasses' => 'fa fa-download',
'text' => gT('Download files'),
'grid-reload' => 'no',
'actionType' => 'window-location-href'
);
// Export responses
$buttons[] = array(
// li element
'type' => 'action',
'action' => 'export',
'url' => App()->createUrl('admin/export/sa/exportresults/surveyid/'.$surveyId),
'iconClasses' => 'fa fa-upload',
'text' => gT('Export'),
'aLinkSpecificDatas' => array(
'input-name' => 'responseIds',
'input-separator' => ',',
'target' => '_self',
),
'actionType' => 'redirect',
);
}
$this->widget('ext.admin.grid.MassiveActionsWidget.MassiveActionsWidget', array(
'pk' => 'id',
'gridid' => 'responses-grid',
'dropupId' => 'responsesListActions',
'dropUpText' => gT('Selected response(s)...'),
'aActions' => $buttons
));
?>