@@ -126,6 +126,19 @@ public function formulation_and_controls(question_attempt $qa, question_display_
126
126
$ currentanswer = "\n" . $ currentanswer ;
127
127
}
128
128
129
+ if (!empty ($ CFG ->enableplagiarism )) {
130
+ require_once ($ CFG ->libdir . '/plagiarismlib.php ' );
131
+
132
+ $ currentanswer .= plagiarism_get_links ([
133
+ 'context ' => $ options ->context ->id ,
134
+ 'component ' => $ qa ->get_question ()->qtype ->plugin_name (),
135
+ 'area ' => $ qa ->get_usage_id (),
136
+ 'itemid ' => $ qa ->get_slot (),
137
+ 'userid ' => $ step ->get_user_id (),
138
+ 'content ' => $ qa ->get_response_summary ()
139
+ ]);
140
+ }
141
+
129
142
$ rows = isset ($ question ->answerboxlines ) ? $ question ->answerboxlines : constants::DEFAULT_NUM_ROWS ;
130
143
$ taattributes = $ this ->answerbox_attributes ($ responsefieldname , $ rows ,
131
144
$ question , $ currentlanguage , $ options ->readonly );
@@ -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