diff --git a/mod/choice/renderer.php b/mod/choice/renderer.php index 4f954bb0f20..e9f107a9202 100644 --- a/mod/choice/renderer.php +++ b/mod/choice/renderer.php @@ -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); diff --git a/mod/choice/report.php b/mod/choice/report.php index 14a08e83e42..3beede9aa06 100644 --- a/mod/choice/report.php +++ b/mod/choice/report.php @@ -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; diff --git a/mod/choice/view.php b/mod/choice/view.php index bfb15401ccc..6314ad0b9c4 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -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);