@@ -169,6 +169,19 @@ public function formulation_and_controls(question_attempt $qa, question_display_
169
169
array ($ responsefieldid ));
170
170
}
171
171
172
+ if (!empty ($ CFG ->enableplagiarism )) {
173
+ require_once ($ CFG ->libdir . '/plagiarismlib.php ' );
174
+
175
+ $ qtext .= plagiarism_get_links ([
176
+ 'context ' => $ options ->context ->id ,
177
+ 'component ' => $ qa ->get_question ()->qtype ->plugin_name (),
178
+ 'area ' => $ qa ->get_usage_id (),
179
+ 'itemid ' => $ qa ->get_slot (),
180
+ 'userid ' => $ step ->get_user_id (),
181
+ 'content ' => $ qa ->get_response_summary ()
182
+ ]);
183
+ }
184
+
172
185
return $ qtext ;
173
186
}
174
187
@@ -558,13 +571,27 @@ public function correct_response(question_attempt $qa) {
558
571
* not be displayed. Used to get the context.
559
572
*/
560
573
public function files_read_only (question_attempt $ qa , question_display_options $ options ) {
574
+ global $ CFG ;
561
575
$ files = $ qa ->get_last_qt_files ('attachments ' , $ options ->context ->id );
562
576
$ output = array ();
563
577
564
578
foreach ($ files as $ file ) {
565
- $ output [] = html_writer::tag ('p ' , html_writer::link ($ qa ->get_response_file_url ($ file ),
566
- $ this ->output ->pix_icon (file_file_icon ($ file ), get_mimetype_description ($ file ),
567
- 'moodle ' , array ('class ' => 'icon ' )) . ' ' . s ($ file ->get_filename ())));
579
+ $ out = html_writer::link ($ qa ->get_response_file_url ($ file ),
580
+ $ this ->output ->pix_icon (file_file_icon ($ file ), get_mimetype_description ($ file ),
581
+ 'moodle ' , array ('class ' => 'icon ' )) . ' ' . s ($ file ->get_filename ()));
582
+ if (!empty ($ CFG ->enableplagiarism )) {
583
+ require_once ($ CFG ->libdir . '/plagiarismlib.php ' );
584
+
585
+ $ out .= plagiarism_get_links ([
586
+ 'context ' => $ options ->context ->id ,
587
+ 'component ' => $ qa ->get_question ()->qtype ->plugin_name (),
588
+ 'area ' => $ qa ->get_usage_id (),
589
+ 'itemid ' => $ qa ->get_slot (),
590
+ 'userid ' => $ step ->get_user_id (),
591
+ 'file ' => $ file
592
+ ]);
593
+ }
594
+ $ output [] = html_writer::tag ('p ' , $ out );
568
595
}
569
596
return implode ($ output );
570
597
}
0 commit comments