mirror of
https://github.com/moodle/moodle.git
synced 2025-03-17 14:10:08 +01:00
MDL-49943 mod_choice: display multiple answers in complete report
This commit is contained in:
parent
6a74e76fb8
commit
42dfbb5416
@ -79,20 +79,23 @@ function choice_user_outline($course, $user, $mod, $choice) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @global object
|
||||
* Callback for the "Complete" report - prints the activity summary for the given user
|
||||
*
|
||||
* @param object $course
|
||||
* @param object $user
|
||||
* @param object $mod
|
||||
* @param object $choice
|
||||
* @return string|void
|
||||
*/
|
||||
function choice_user_complete($course, $user, $mod, $choice) {
|
||||
global $DB;
|
||||
if ($answer = $DB->get_record('choice_answers', array("choiceid" => $choice->id, "userid" => $user->id))) {
|
||||
$result = new stdClass();
|
||||
$result->info = "'".format_string(choice_get_option_text($choice, $answer->optionid))."'";
|
||||
$result->time = $answer->timemodified;
|
||||
echo get_string("answered", "choice").": $result->info. ".get_string("updated", '', userdate($result->time));
|
||||
if ($answers = $DB->get_records('choice_answers', array("choiceid" => $choice->id, "userid" => $user->id))) {
|
||||
$info = [];
|
||||
foreach ($answers as $answer) {
|
||||
$info[] = "'" . format_string(choice_get_option_text($choice, $answer->optionid)) . "'";
|
||||
}
|
||||
core_collator::asort($info);
|
||||
echo get_string("answered", "choice") . ": ". join(', ', $info) . ". " .
|
||||
get_string("updated", '', userdate($answer->timemodified));
|
||||
} else {
|
||||
print_string("notanswered", "choice");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user