Merge branch 'MDL-73438-master' of git://github.com/mihailges/moodle

This commit is contained in:
Ilya Tregubov 2022-01-17 10:42:45 +02:00
commit f5740bf995
3 changed files with 17 additions and 11 deletions

View File

@ -140,7 +140,6 @@ class mod_choice_renderer extends plugin_renderer_base {
*/
public function display_publish_name_vertical($choices) {
$html ='';
$html .= html_writer::tag('h3',format_string(get_string("responses", "choice")));
$attributes = array('method'=>'POST');
$attributes['action'] = new moodle_url($this->page->url);

View File

@ -63,8 +63,9 @@
}
}
$groupmode = groups_get_activity_groupmode($cm);
if (!$download) {
$PAGE->navbar->add($strresponses);
$PAGE->set_title(format_string($choice->name).": $strresponses");
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->set_attrs([
@ -72,16 +73,16 @@
'description' => ''
]);
echo $OUTPUT->header();
echo $OUTPUT->heading($strresponses);
/// Check to see if groups are being used in this choice
$groupmode = groups_get_activity_groupmode($cm);
if ($groupmode) {
groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/choice/report.php?id='.$id);
$groupsactivitymenu = groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/choice/report.php?id=' . $id,
true);
echo html_writer::div($groupsactivitymenu, 'mb-2');
}
} else {
$groupmode = groups_get_activity_groupmode($cm);
// Trigger the report downloaded event.
$eventdata = array();
$eventdata['context'] = $context;

View File

@ -117,11 +117,6 @@ $eventdata['context'] = $context;
/// Check to see if groups are being used in this choice
$groupmode = groups_get_activity_groupmode($cm);
if ($groupmode) {
groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/choice/view.php?id='.$id);
}
// Check if we want to include responses from inactive users.
$onlyactive = $choice->includeinactive ? false : true;
@ -233,6 +228,17 @@ if (!$choiceformshown) {
if (choice_can_view_results($choice, $current, $choiceopen)) {
$results = prepare_choice_show_results($choice, $course, $cm, $allresponses);
$renderer = $PAGE->get_renderer('mod_choice');
if ($results->publish) { // If set to publish full results, display a heading for the responses section.
echo html_writer::tag('h3', format_string(get_string("responses", "choice")), ['class' => 'mt-4']);
}
if ($groupmode) { // If group mode is enabled, display the groups selector.
groups_get_activity_group($cm, true);
$groupsactivitymenu = groups_print_activity_menu($cm, new moodle_url('/mod/choice/view.php', ['id' => $id]),
true);
echo html_writer::div($groupsactivitymenu, 'mt-3 mb-1');
}
$resultstable = $renderer->display_result($results);
echo $OUTPUT->box($resultstable);