MDL-71912 mod_choice: Small alteration to show responses.

Depending on whether the secondary navigation is shown or not will
determine if the link to the responses is shown on the view.php
page.

Co-authored-by: Sujith Haridasan <[email protected]>
This commit is contained in:
Adrian Greeve
2021-11-09 11:24:08 +08:00
committed by abgreeve
co-authored by Sujith Haridasan
parent b72fa5fbae
commit c4c00f4e69
5 changed files with 25 additions and 27 deletions
+3 -1
View File
@@ -68,7 +68,9 @@
$PAGE->set_title(format_string($choice->name).": $strresponses");
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($choice->name), 2, null);
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($choice->name), 2, null);
}
/// Check to see if groups are being used in this choice
$groupmode = groups_get_activity_groupmode($cm);
if ($groupmode) {
+13 -19
View File
@@ -48,10 +48,9 @@ Feature: Include responses from inactive users
| student1 | C1 | student | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "View 3 responses"
And I follow "View 3 responses"
And I should see "Student 1"
And I click on "Choice name" "link" in the "region-main" "region"
And I navigate to "Responses" in current page administration
Then I should see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
And I log out
@@ -60,9 +59,8 @@ Feature: Include responses from inactive users
| student2 | C1 | student | 2145830400 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "View 3 responses"
And I follow "View 3 responses"
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
@@ -72,9 +70,8 @@ Feature: Include responses from inactive users
| student3 | C1 | student | 1425168000 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "View 3 responses"
And I follow "View 3 responses"
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
@@ -107,9 +104,8 @@ Feature: Include responses from inactive users
| student1 | C1 | student | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "View 2 responses"
And I follow "View 2 responses"
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should not see "Student 1"
And I should see "Student 2"
And I should see "Student 3"
@@ -119,9 +115,8 @@ Feature: Include responses from inactive users
| student2 | C1 | student | 2145830400 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "View 1 responses"
And I follow "View 1 responses"
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should not see "Student 1"
And I should not see "Student 2"
And I should see "Student 3"
@@ -131,9 +126,8 @@ Feature: Include responses from inactive users
| student3 | C1 | student | 1425168000 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
Then I should see "View 0 responses"
And I follow "View 0 responses"
And I click on "Choice name" "link" in the "region-main" "region"
Then I navigate to "Responses" in current page administration
And I should not see "Student 1"
And I should not see "Student 2"
And I should not see "Student 3"
@@ -72,7 +72,7 @@ Feature: Multiple option choice response
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I follow "View 1 responses"
And I navigate to "Responses" in current page administration
Then I should see "Option 1 (Full)"
And I should see "Limit: 1"
And I am on "Course 1" course homepage with editing mode on
@@ -83,6 +83,6 @@ Feature: Multiple option choice response
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I follow "View 1 responses"
And I navigate to "Responses" in current page administration
Then I should not see "Limit: 1"
And I log out
@@ -35,9 +35,9 @@ Feature: Update a choice activity removing options
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Choice name"
And I should see "View 2 responses"
And I click on "Choice name" "link" in the "region-main" "region"
And I navigate to "Settings" in current page administration
And I set the field "option[2]" to ""
And I press "Save and display"
Then I should see "View 1 responses"
Then I navigate to "Responses" in current page administration
And I should see "1" in the "Number of responses" "table_row"
+4 -2
View File
@@ -98,7 +98,9 @@ if (data_submitted() && !empty($action) && confirm_sesskey()) {
choice_view($choice, $course, $cm, $context);
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($choice->name), 2, null);
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($choice->name), 2, null);
}
// Render the activity information.
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
@@ -132,7 +134,7 @@ $onlyactive = $choice->includeinactive ? false : true;
$allresponses = choice_get_response_data($choice, $cm, $groupmode, $onlyactive); // Big function, approx 6 SQL calls per user.
if (has_capability('mod/choice:readresponses', $context)) {
if (has_capability('mod/choice:readresponses', $context) && !$PAGE->has_secondary_navigation()) {
choice_show_reportlink($allresponses, $cm);
}