diff --git a/admin/tool/monitor/tests/behat/course_report_monitor.feature b/admin/tool/monitor/tests/behat/course_report_monitor.feature
index 033b9ce68a7..0294e65849a 100644
--- a/admin/tool/monitor/tests/behat/course_report_monitor.feature
+++ b/admin/tool/monitor/tests/behat/course_report_monitor.feature
@@ -23,7 +23,7 @@ Feature: In a course administration page, navigate through report page, test for
And I click on "Enable" "link"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Event monitoring rules"
And the field "Report" matches value "Event monitoring rules"
diff --git a/admin/tool/monitor/tests/behat/rule.feature b/admin/tool/monitor/tests/behat/rule.feature
index 221ae54df5e..ac2b741ee1c 100644
--- a/admin/tool/monitor/tests/behat/rule.feature
+++ b/admin/tool/monitor/tests/behat/rule.feature
@@ -19,7 +19,7 @@ Feature: tool_monitor_rule
And I click on "Enable" "link"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
And I press "Add a new rule"
And I set the following fields to these values:
| name | New rule course level |
@@ -47,7 +47,7 @@ Feature: tool_monitor_rule
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
When I press "Add a new rule"
And I set the following fields to these values:
| name | New rule |
@@ -68,7 +68,7 @@ Feature: tool_monitor_rule
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
When I click on "Delete rule" "link"
Then I should see "Are you sure you want to delete the rule \"New rule course level\"?"
And I press "Continue"
@@ -79,7 +79,7 @@ Feature: tool_monitor_rule
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
When I click on "Edit rule" "link"
And I set the following fields to these values:
| name | New rule quiz |
@@ -99,7 +99,7 @@ Feature: tool_monitor_rule
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
When I click on "Duplicate rule" "link" in the "New rule course level" "table_row"
Then I should see "Rule successfully duplicated"
And "#toolmonitorrules_r1" "css_element" should appear before "#toolmonitorrules_r2" "css_element"
@@ -159,7 +159,7 @@ Feature: tool_monitor_rule
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
When I click on "Duplicate rule" "link" in the "New rule site level" "table_row"
Then I should see "Rule successfully duplicated"
And "#toolmonitorrules_r2" "css_element" should appear after "#toolmonitorrules_r1" "css_element"
diff --git a/admin/tool/monitor/tests/behat/subscription.feature b/admin/tool/monitor/tests/behat/subscription.feature
index d0ff66a9983..8007fd5cfaa 100644
--- a/admin/tool/monitor/tests/behat/subscription.feature
+++ b/admin/tool/monitor/tests/behat/subscription.feature
@@ -24,7 +24,7 @@ Feature: tool_monitor_subscriptions
And I click on "Enable" "link"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Event monitoring rules" from the "Report type" singleselect
+ And I click on "Event monitoring rules" "link"
And I press "Add a new rule"
And I set the following fields to these values:
| name | New rule course level |
diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature
index 8be0a3f92ce..dfe5f224273 100644
--- a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature
+++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature
@@ -37,7 +37,7 @@ Feature: Enable Block Completion in a course using manual completion by others
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course completion" from the "Report type" singleselect
+ And I click on "Course completion" "link" in the "region-main" "region"
And I follow "Click to mark user complete"
# Running completion task just after clicking sometimes fail, as record
# should be created before the task runs.
@@ -73,7 +73,7 @@ Feature: Enable Block Completion in a course using manual completion by others
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course completion" from the "Report type" singleselect
+ And I click on "Course completion" "link" in the "region-main" "region"
And I follow "Click to mark user complete"
And I log out
And I log in as "student1"
@@ -88,7 +88,7 @@ Feature: Enable Block Completion in a course using manual completion by others
And I log in as "teacher2"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course completion" from the "Report type" singleselect
+ And I click on "Course completion" "link" in the "region-main" "region"
And I follow "Click to mark user complete"
# Running completion task just after clicking sometimes fail, as record
# should be created before the task runs.
diff --git a/completion/tests/behat/behat_completion.php b/completion/tests/behat/behat_completion.php
index cecc1d89089..ec2bc038961 100644
--- a/completion/tests/behat/behat_completion.php
+++ b/completion/tests/behat/behat_completion.php
@@ -88,7 +88,7 @@ class behat_completion extends behat_base {
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
$reportsnode);
- $this->execute("behat_forms::i_select_from_the_singleselect", [$completionnode, "Report type"]);
+ $this->execute("behat_general::i_click_on_in_the", [$completionnode, "link", "region-main", "region"]);
}
/**
diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index b27722301e3..7265b9317f7 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -4665,6 +4665,10 @@ class settings_navigation extends navigation_node {
foreach ($reports as $reportfunction) {
$reportfunction($reportnav, $course, $coursecontext);
}
+
+ if (!$reportnav->has_children()) {
+ $reportnav->remove();
+ }
}
// Check if we can view the gradebook's setup page.
@@ -5633,6 +5637,10 @@ class settings_navigation extends navigation_node {
foreach ($reports as $reportfunction) {
$reportfunction($frontpagenav, $course, $coursecontext);
}
+
+ if (!$frontpagenav->has_children()) {
+ $frontpagenav->remove();
+ }
}
// Backup this course
diff --git a/lib/templates/report_link_page.mustache b/lib/templates/report_link_page.mustache
new file mode 100644
index 00000000000..9307eccf5bf
--- /dev/null
+++ b/lib/templates/report_link_page.mustache
@@ -0,0 +1,51 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template core/report_link_page
+
+ Display the report page with a list of available reports.
+
+ Example context (json):
+ {
+ "node": {
+ "text": "Root of menu",
+ "key": "test0",
+ "display": true,
+ "children": [
+ {
+ "text": "Child of menu",
+ "key": "test1",
+ "display": true,
+ "children": []
+ }
+ ]
+ }
+ }
+}}
+{{#node}}
+
+
+
+ {{#node.children}}
+ {{#display}}
+ - {{text}}
+ {{/display}}
+ {{/node.children}}
+
+
+
+{{/node}}
diff --git a/lib/tests/behat/alpha_chooser.feature b/lib/tests/behat/alpha_chooser.feature
index 7aa3d4c696f..05437a39000 100644
--- a/lib/tests/behat/alpha_chooser.feature
+++ b/lib/tests/behat/alpha_chooser.feature
@@ -251,7 +251,7 @@ Feature: Initials bar
And I log out
And I am on the "C1" "Course" page logged in as "teacher"
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And ".initialbarall.page-item.active" "css_element" should exist in the ".initialbar.firstinitial" "css_element"
And ".initialbarall.page-item.active" "css_element" should exist in the ".initialbar.lastinitial" "css_element"
And ".page-item.active.B" "css_element" should not exist in the ".initialbar.firstinitial" "css_element"
@@ -277,7 +277,7 @@ Feature: Initials bar
And I should not see "Cstudent Cstudent"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And ".initialbarall.page-item.active" "css_element" should not exist in the ".initialbar.firstinitial" "css_element"
And ".initialbarall.page-item.active" "css_element" should not exist in the ".initialbar.lastinitial" "css_element"
And ".page-item.active.B" "css_element" should exist in the ".initialbar.firstinitial" "css_element"
diff --git a/mod/choice/tests/behat/activity_info_completion_automatic.feature b/mod/choice/tests/behat/activity_info_completion_automatic.feature
index 30e228c31af..5ac4d731caa 100644
--- a/mod/choice/tests/behat/activity_info_completion_automatic.feature
+++ b/mod/choice/tests/behat/activity_info_completion_automatic.feature
@@ -46,7 +46,7 @@ Feature: Automatic completion in the choice activity
Scenario: Overriding automatic choice completion for a user
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And I click on "Student 1, What to drink?: Not completed" "link"
And I press "Save changes"
And I log out
diff --git a/mod/choice/tests/behat/activity_info_completion_manual.feature b/mod/choice/tests/behat/activity_info_completion_manual.feature
index ec408b3d446..f424623f8d3 100644
--- a/mod/choice/tests/behat/activity_info_completion_manual.feature
+++ b/mod/choice/tests/behat/activity_info_completion_manual.feature
@@ -54,7 +54,7 @@ Feature: Manual completion in the choice activity
Scenario: Overriding a manual choice completion for a user to done
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And I click on "Student 1, What to drink?: Not completed" "link"
And I press "Save changes"
And I log out
@@ -71,7 +71,7 @@ Feature: Manual completion in the choice activity
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And I click on "Student 1, What to drink?: Completed" "link"
And I press "Save changes"
And I log out
diff --git a/mod/quiz/tests/behat/completion_condition_attempts_used.feature b/mod/quiz/tests/behat/completion_condition_attempts_used.feature
index c58e3387d64..e520f959541 100644
--- a/mod/quiz/tests/behat/completion_condition_attempts_used.feature
+++ b/mod/quiz/tests/behat/completion_condition_attempts_used.feature
@@ -60,7 +60,7 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
And "Test quiz name" should have the "Receive a pass grade or complete all available attempts" completion condition
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "" "icon" should exist in the "Student 1" "table_row"
Examples:
diff --git a/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature b/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature
index 1c5df692704..01d5ed4bd21 100644
--- a/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature
+++ b/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature
@@ -58,5 +58,5 @@ Feature: Set a quiz to be marked complete when the student completes a minimum a
And "Test quiz name" should have the "Make attempts: 2" completion condition
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "Completed" "icon" should exist in the "Student 1" "table_row"
diff --git a/mod/quiz/tests/behat/completion_condition_passing_grade.feature b/mod/quiz/tests/behat/completion_condition_passing_grade.feature
index 86c92a607eb..b021ca18d50 100644
--- a/mod/quiz/tests/behat/completion_condition_passing_grade.feature
+++ b/mod/quiz/tests/behat/completion_condition_passing_grade.feature
@@ -52,5 +52,5 @@ Feature: Set a quiz to be marked complete when the student passes
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "Completed" "icon" should exist in the "Student 1" "table_row"
diff --git a/mod/quiz/tests/behat/quiz_activity_completion.feature b/mod/quiz/tests/behat/quiz_activity_completion.feature
index 7845ea74c75..1fe3c90264e 100644
--- a/mod/quiz/tests/behat/quiz_activity_completion.feature
+++ b/mod/quiz/tests/behat/quiz_activity_completion.feature
@@ -76,7 +76,7 @@ Feature: View activity completion in the quiz activity
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "" "icon" should exist in the "Student 1" "table_row"
Examples:
diff --git a/report/competency/tests/behat/breakdown_by_activity.feature b/report/competency/tests/behat/breakdown_by_activity.feature
index f4d078d0940..d61e0749bf6 100644
--- a/report/competency/tests/behat/breakdown_by_activity.feature
+++ b/report/competency/tests/behat/breakdown_by_activity.feature
@@ -49,7 +49,7 @@ Feature: See the competencies for an activity
@javascript
Scenario: Go to the competency breakdown report
When I navigate to "Reports" in current page administration
- And I select "Competency breakdown" from the "Report type" singleselect
+ And I click on "Competency breakdown" "link"
And I set the field "Filter competencies by resource or activity" to "PageName1"
Then I should see "Test-Comp1"
And I should not see "Test-Comp2"
diff --git a/report/competency/tests/behat/course_report_competency.feature b/report/competency/tests/behat/course_report_competency.feature
index 1cc0226ce18..355b5a4d1f0 100644
--- a/report/competency/tests/behat/course_report_competency.feature
+++ b/report/competency/tests/behat/course_report_competency.feature
@@ -21,7 +21,7 @@ Feature: In a course administration page, navigate through report page, test for
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Competency breakdown" from the "Report type" singleselect
+ And I click on "Competency breakdown" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Competency breakdown"
And the field "Report" matches value "Competency breakdown"
diff --git a/report/completion/tests/behat/completion_report.feature b/report/completion/tests/behat/completion_report.feature
index aa1503259d4..0e73a80ed00 100644
--- a/report/completion/tests/behat/completion_report.feature
+++ b/report/completion/tests/behat/completion_report.feature
@@ -34,5 +34,5 @@ Feature: See the completion for items in a course
And I press "Save changes"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Course completion" from the "Report type" singleselect
+ And I click on "Course completion" "link" in the "region-main" "region"
Then I should see "Ann, Jill, Grainne, Beauchamp"
diff --git a/report/completion/tests/behat/course_report_completion.feature b/report/completion/tests/behat/course_report_completion.feature
index a5647d5de5b..5f14a1eab1a 100644
--- a/report/completion/tests/behat/course_report_completion.feature
+++ b/report/completion/tests/behat/course_report_completion.feature
@@ -27,7 +27,7 @@ Feature: In a course administration page, navigate through report page, test for
And I press "Save changes"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Course completion" from the "Report type" singleselect
+ And I click on "Course completion" "link" in the "region-main" "region"
Then "Report" "field" should exist
And the "Report" select box should contain "Course completion"
And the field "Report" matches value "Course completion"
diff --git a/report/log/tests/behat/course_report_log.feature b/report/log/tests/behat/course_report_log.feature
index 435df1b3ef4..8fa527802dc 100644
--- a/report/log/tests/behat/course_report_log.feature
+++ b/report/log/tests/behat/course_report_log.feature
@@ -21,7 +21,7 @@ Feature: In a course administration page, navigate through report page, test for
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Logs" from the "Report type" singleselect
+ And I click on "Logs" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Logs"
And the field "Report" matches value "Logs"
diff --git a/report/log/tests/behat/user_log.feature b/report/log/tests/behat/user_log.feature
index 7a62b3df50d..2d81d15e056 100644
--- a/report/log/tests/behat/user_log.feature
+++ b/report/log/tests/behat/user_log.feature
@@ -69,7 +69,7 @@ Feature: User can view activity log.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Logs" from the "Report type" singleselect
+ And I click on "Logs" "link"
And I set the field with xpath "//select[@name='user']" to "Ann, Jill, Grainne, Beauchamp"
When I click on "Get these logs" "button"
Then I should see "Ann, Jill, Grainne, Beauchamp"
diff --git a/report/loglive/tests/behat/course_report_loglive.feature b/report/loglive/tests/behat/course_report_loglive.feature
index f623e4c1d76..b293ca0e294 100644
--- a/report/loglive/tests/behat/course_report_loglive.feature
+++ b/report/loglive/tests/behat/course_report_loglive.feature
@@ -21,7 +21,7 @@ Feature: In a course administration page, navigate through report page, test for
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Live logs" from the "Report type" singleselect
+ And I click on "Live logs" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Live logs"
And the field "Report" matches value "Live logs"
diff --git a/report/outline/tests/behat/course_report_outline.feature b/report/outline/tests/behat/course_report_outline.feature
index 72f995b4ac7..90b2e410ac6 100644
--- a/report/outline/tests/behat/course_report_outline.feature
+++ b/report/outline/tests/behat/course_report_outline.feature
@@ -21,7 +21,7 @@ Feature: In a course administration page, navigate through report page, test for
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Activity report"
And the field "Report" matches value "Activity report"
diff --git a/report/outline/tests/behat/filter.feature b/report/outline/tests/behat/filter.feature
index 62acb65e051..f8b0678bb82 100644
--- a/report/outline/tests/behat/filter.feature
+++ b/report/outline/tests/behat/filter.feature
@@ -46,7 +46,7 @@ Feature: Filter an outline report
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
And I should see "2 views by 2 users" in the "Book name" "table_row"
And I should see "1 views by 1 users" in the "Forum name" "table_row"
When I set the following fields to these values:
@@ -79,7 +79,7 @@ Feature: Filter an outline report
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
And I should see "2 views by 2 users" in the "Book name" "table_row"
And I should see "1 views by 1 users" in the "Forum name" "table_row"
When I set the following fields to these values:
diff --git a/report/outline/tests/behat/outline.feature b/report/outline/tests/behat/outline.feature
index 8e6de50a98b..76c2812841b 100644
--- a/report/outline/tests/behat/outline.feature
+++ b/report/outline/tests/behat/outline.feature
@@ -45,7 +45,7 @@ Feature: View an outline report
And I log in as "teacher1"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "2 views by 2 users" in the "Book name" "table_row"
And I should see "1 views by 1 users" in the "Forum name" "table_row"
@@ -67,7 +67,7 @@ Feature: View an outline report
And I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "2 views by 2 users" in the "Book name" "table_row"
And I should see "1 views by 1 users" in the "Forum name" "table_row"
@@ -91,7 +91,7 @@ Feature: View an outline report
And I log in as "teacher1"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "2 views by 2 users" in the "Book name" "table_row"
And I should see "1 views by 1 users" in the "Forum name" "table_row"
@@ -101,7 +101,7 @@ Feature: View an outline report
And I click on "Disable" "link" in the "Standard log" "table_row"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "No log reader enabled"
Scenario: Multiple views from a single user are identified as not distinct
@@ -118,7 +118,7 @@ Feature: View an outline report
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "3 views by 1 users" in the "Forum name" "table_row"
And I should see "-" in the "Book name" "table_row"
@@ -145,7 +145,7 @@ Feature: View an outline report
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "6 views by 2 users" in the "Forum name" "table_row"
And I should see "-" in the "Book name" "table_row"
@@ -154,6 +154,6 @@ Feature: View an outline report
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity report" from the "Report type" singleselect
+ And I click on "Activity report" "link"
Then I should see "-" in the "Forum name" "table_row"
And I should see "-" in the "Book name" "table_row"
diff --git a/report/participation/tests/behat/course_report_participation.feature b/report/participation/tests/behat/course_report_participation.feature
index df57b743aa2..d9fca6ae486 100644
--- a/report/participation/tests/behat/course_report_participation.feature
+++ b/report/participation/tests/behat/course_report_participation.feature
@@ -21,7 +21,7 @@ Feature: In a course administration page, navigate through report page, test for
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Course participation"
And the field "Report" matches value "Course participation"
diff --git a/report/participation/tests/behat/filter_participation.feature b/report/participation/tests/behat/filter_participation.feature
index 1d175d85b3d..0bf0bb0383c 100644
--- a/report/participation/tests/behat/filter_participation.feature
+++ b/report/participation/tests/behat/filter_participation.feature
@@ -43,7 +43,7 @@ Feature: In a participation report, admin can filter student actions
When I am on the "Course 1" course page logged in as admin
When I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
@@ -73,7 +73,7 @@ Feature: In a participation report, admin can filter student actions
And I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
@@ -87,7 +87,7 @@ Feature: In a participation report, admin can filter student actions
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
diff --git a/report/participation/tests/behat/message_participants.feature b/report/participation/tests/behat/message_participants.feature
index 495a98140cd..4e776474782 100644
--- a/report/participation/tests/behat/message_participants.feature
+++ b/report/participation/tests/behat/message_participants.feature
@@ -34,7 +34,7 @@ Feature: Use the particiaption report to message groups of students
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
@@ -49,7 +49,7 @@ Feature: Use the particiaption report to message groups of students
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
@@ -69,7 +69,7 @@ Feature: Use the particiaption report to message groups of students
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Course participation" from the "Report type" singleselect
+ And I click on "Course participation" "link"
When I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
diff --git a/report/progress/tests/behat/activity_completion_report.feature b/report/progress/tests/behat/activity_completion_report.feature
index c693ffe968b..799f98794eb 100644
--- a/report/progress/tests/behat/activity_completion_report.feature
+++ b/report/progress/tests/behat/activity_completion_report.feature
@@ -42,7 +42,7 @@ Feature: Teacher can view and override users' activity completion data via the p
# Teacher overrides the activity completion statuses to incomplete.
When I am on the "Course 1" course page logged in as teacher1
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "my assignment" "link" in the "Ann, Jill, Grainne, Beauchamp" "table_row"
@@ -68,7 +68,7 @@ Feature: Teacher can view and override users' activity completion data via the p
# And the activity completion report should show the same.
And I am on the "Course 1" Course page logged in as teacher1
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
@@ -80,7 +80,7 @@ Feature: Teacher can view and override users' activity completion data via the p
# When the teacher overrides the activity completion statuses to complete.
When I am on the "Course 1" Course page logged in as teacher1
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Not completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 3: Not completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "my assignment" "link" in the "Ann, Jill, Grainne, Beauchamp" "table_row"
diff --git a/report/progress/tests/behat/activity_completion_report_filter.feature b/report/progress/tests/behat/activity_completion_report_filter.feature
index 8fed1c558af..247a914333d 100644
--- a/report/progress/tests/behat/activity_completion_report_filter.feature
+++ b/report/progress/tests/behat/activity_completion_report_filter.feature
@@ -37,7 +37,7 @@ Feature: Teacher can view and filter activity completion data by group and activ
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
Then "My quiz B" "link" should appear before "My quiz A" "link" in the "completion-progress" "table"
And I should see "My assignment" in the "completion-progress" "table"
And I should see "My page" in the "completion-progress" "table"
diff --git a/report/progress/tests/behat/course_report_progress.feature b/report/progress/tests/behat/course_report_progress.feature
index efe49b4c21e..f8517349bb1 100644
--- a/report/progress/tests/behat/course_report_progress.feature
+++ b/report/progress/tests/behat/course_report_progress.feature
@@ -27,7 +27,7 @@ Feature: In a course administration page, navigate through report page, test for
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
Then "Report" "field" should exist
And the "Report" select box should contain "Activity completion"
And the field "Report" matches value "Activity completion"
@@ -46,6 +46,6 @@ Feature: In a course administration page, navigate through report page, test for
| showuseridentity | email,profile_field_frog |
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Reports" in current page administration
- And I select "Activity completion" from the "Report type" singleselect
+ And I click on "Activity completion" "link"
Then I should see "Favourite frog"
Then I should see "Kermit" in the "Student Two" "table_row"
diff --git a/report/view.php b/report/view.php
index cd72b82d111..f8d768a96a8 100644
--- a/report/view.php
+++ b/report/view.php
@@ -36,22 +36,30 @@ if (!$course = $DB->get_record('course', array('id' => $courseid))) {
}
require_login($course);
-// Get all course reports from the settings navigation.
-if ($reportsnode = $PAGE->settingsnav->find('coursereports', \navigation_node::TYPE_CONTAINER)) {
- // If there are available course reports to the user.
- if ($reportsnode->children->count() > 0) {
- // Redirect to the first course report from the list.
- $firstreportnode = $reportsnode->children->getIterator()[0];
- redirect($firstreportnode->action()->out(false));
- }
-}
// Otherwise, output the page with a notification stating that there are no available course reports.
$PAGE->set_title(get_string('reports'));
$PAGE->set_pagelayout('incourse');
$PAGE->set_heading($course->fullname);
$PAGE->set_pagetype('course-view-' . $course->format);
+$PAGE->add_body_class('limitedwidth');
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('reports'));
-echo html_writer::div($OUTPUT->notification(get_string('noreports', 'debug'), 'error'), 'mt-3');
+
+// Check if there is at least one displayable report.
+$hasreports = false;
+if ($reportnode = $PAGE->settingsnav->find('coursereports', \navigation_node::TYPE_CONTAINER)) {
+ foreach ($reportnode->children as $child) {
+ if ($child->display) {
+ $hasreports = true;
+ break;
+ }
+ }
+}
+
+if ($hasreports) {
+ echo $OUTPUT->render_from_template('core/report_link_page', ['node' => $reportnode]);
+} else {
+ echo html_writer::div($OUTPUT->notification(get_string('noreports', 'debug'), 'error'), 'mt-3');
+}
echo $OUTPUT->footer();