@@ -70,12 +70,12 @@ protected function responseclass() {
70
70
/**
71
71
* Survey display output.
72
72
*
73
- * @param response $response
73
+ * @param \stdClass $formdata
74
74
* @param object $descendantsdata
75
75
* @param bool $blankquestionnaire
76
- * @return object| string
76
+ * @return string
77
77
*/
78
- protected function question_survey_display ($ response , $ descendantsdata , $ blankquestionnaire = false ) {
78
+ protected function question_survey_display ($ formdata , $ descendantsdata , $ blankquestionnaire = false ) {
79
79
global $ CFG , $ PAGE ;
80
80
require_once ($ CFG ->libdir . '/filelib.php ' );
81
81
$ elname = 'q ' . $ this ->id ;
@@ -114,27 +114,29 @@ private function get_file_manager_option() {
114
114
return [
115
115
'mainfile ' => '' ,
116
116
'subdirs ' => false ,
117
- 'accepted_types ' => array ('image ' , '.pdf ' )
117
+ 'accepted_types ' => array ('image ' , '.pdf ' ),
118
+ 'maxfiles ' => 1 ,
118
119
];
119
120
}
120
121
121
122
/**
122
123
* Response display output.
123
124
*
124
- * @param response $response
125
- * @return object| string
125
+ * @param \stdClass $data
126
+ * @return string
126
127
*/
127
- protected function response_survey_display ($ response ) {
128
+ protected function response_survey_display ($ data ) {
128
129
global $ PAGE , $ CFG ;
129
130
require_once ($ CFG ->libdir . '/filelib.php ' );
130
131
require_once ($ CFG ->libdir . '/resourcelib.php ' );
131
- if (isset ($ response ->answers [$ this ->id ])) {
132
- $ answer = reset ($ response ->answers [$ this ->id ]);
132
+ if (isset ($ data ->answers [$ this ->id ])) {
133
+ $ answer = reset ($ data ->answers [$ this ->id ]);
133
134
} else {
134
135
return '' ;
135
136
}
136
137
$ fs = get_file_storage ();
137
138
$ file = $ fs ->get_file_by_id ($ answer ->value );
139
+ $ code = '' ;
138
140
139
141
if ($ file ) {
140
142
// There is a file.
@@ -150,8 +152,6 @@ protected function response_survey_display($response) {
150
152
$ mimetype = $ file ->get_mimetype ();
151
153
$ title = '' ;
152
154
153
- $ extension = resourcelib_get_extension ($ file ->get_filename ());
154
-
155
155
$ mediamanager = core_media_manager::instance ($ PAGE );
156
156
$ embedoptions = array (
157
157
core_media_manager::OPTION_TRUSTED => true ,
@@ -177,11 +177,7 @@ protected function response_survey_display($response) {
177
177
$ code = resourcelib_embed_general ($ moodleurl , $ title , get_string ('view ' ), $ mimetype );
178
178
}
179
179
}
180
- $ output = '' ;
181
- $ output .= '<div class="response text"> ' ;
182
- $ output .= $ code ;
183
- $ output .= '</div> ' ;
184
- return $ output ;
180
+ return '<div class="response text"> ' . $ code . '</div> ' ;
185
181
}
186
182
187
183
/**
0 commit comments