MDL-73310 course: Add course index to all non-site course pages

This commit is contained in:
Amaia Anabitarte 2021-12-22 16:05:38 +01:00
parent c352b70022
commit 2cd5c61049
7 changed files with 67 additions and 22 deletions

View File

@ -28,14 +28,35 @@ Feature: Course index depending on role
And I change window size to "large"
@javascript
Scenario: Course index is present on course and activities.
Scenario: Course index is present on course pages.
Given I am on the "C1" "Course" page logged in as "teacher1"
Given the "multilang" filter is "on"
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
# Course index is visible on Course main page
When I am on the "C1" "Course" page logged in as "teacher1"
Then I am on the "Activity sample 1" "assign activity editing" page
And "courseindex-content" "region" should be visible
# Course index is visible on Settings page
And I am on the "C1" "course editing" page
And "courseindex-content" "region" should be visible
# Course index is visible on Participants page
And I am on the "C1" "enrolled users" page
And "courseindex-content" "region" should be visible
# Course index is visible on Enrolment methods page
And I am on the "C1" "enrolment methods" page
And "courseindex-content" "region" should be visible
# Course index is visible on Groups page
And I am on the "C1" "groups" page
And "courseindex-content" "region" should be visible
# Course index is visible on Permissions page
And I am on the "C1" "permissions" page
And "courseindex-content" "region" should be visible
# Course index is visible on Activity edition page
And I am on the "Activity sample 1" "assign activity editing" page
And "courseindex-content" "region" should be visible
And I set the field "Assignment name" in the "General" "fieldset" to "<span lang=\"en\" class=\"multilang\">Activity</span><span lang=\"de\" class=\"multilang\">Aktivität</span> sample 1"
And I press "Save and display"
# Course index is visible on Activity page
And "courseindex-content" "region" should be visible
And I should see "Activity sample 1" in the "courseindex-content" "region"
@javascript

View File

@ -3868,15 +3868,21 @@ function core_course_core_calendar_get_valid_event_timestart_range(\calendar_eve
*/
function core_course_drawer(): string {
global $PAGE;
$format = course_get_format($PAGE->course);
// Only course and modules are able to render course index.
$ismod = strpos($PAGE->pagetype, 'mod-') === 0;
if ($ismod || $PAGE->pagetype == 'course-view-' . $format->get_format()) {
$renderer = $format->get_renderer($PAGE);
if (method_exists($renderer, 'course_index_drawer')) {
return $renderer->course_index_drawer($format);
}
// Only add course index on non-site course pages.
if (!$PAGE->course || $PAGE->course->id == SITEID) {
return '';
}
// Show course index to users can access the course only.
if (!can_access_course($PAGE->course)) {
return '';
}
$format = course_get_format($PAGE->course);
$renderer = $format->get_renderer($PAGE);
if (method_exists($renderer, 'course_index_drawer')) {
return $renderer->course_index_drawer($format);
}
return '';

View File

@ -773,12 +773,20 @@ class behat_navigation extends behat_base {
}
return new moodle_url('/course/index.php', ['categoryid' => $categoryid]);
case 'course':
case 'course editing':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/course/edit.php', ['id' => $courseid]);
case 'course':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/course/view.php', ['id' => $courseid]);
case 'activity':

View File

@ -38,16 +38,16 @@ Feature: Teacher can view and filter activity completion data by group and activ
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
Then "My quiz B" "link" should appear before "My quiz A" "link"
And I should see "My assignment"
And I should see "My page"
And I should see "Student One"
And I should see "Student Two"
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"
And I should see "Student One" in the "completion-progress" "table"
And I should see "Student Two" in the "completion-progress" "table"
And I set the field "Separate groups" to "Group 1"
And I set the field "Include" to "Quizzes"
And I set the field "Activity order" to "Alphabetical"
And "My quiz A" "link" should appear before "My quiz B" "link"
And I should not see "My assignment"
And I should not see "My page"
And I should see "Student One"
And I should not see "Student Two"
And "My quiz A" "link" should appear before "My quiz B" "link" in the "completion-progress" "table"
And I should not see "My assignment" in the "completion-progress" "table"
And I should not see "My page" in the "completion-progress" "table"
And I should see "Student One" in the "completion-progress" "table"
And I should not see "Student Two" in the "completion-progress" "table"

View File

@ -451,6 +451,10 @@
border-right: transparent;
}
}
.show-drawer-left .gradeparent th.header {
left: -1rem;
}
}
/**

View File

@ -19542,6 +19542,9 @@ p.arrow_button {
.path-grade-report-grader .gradeparent td.noborder {
border-right: transparent; }
.path-grade-report-grader .show-drawer-left .gradeparent th.header {
left: -1rem; }
/**
* User report.
*/

View File

@ -19542,6 +19542,9 @@ p.arrow_button {
.path-grade-report-grader .gradeparent td.noborder {
border-right: transparent; }
.path-grade-report-grader .show-drawer-left .gradeparent th.header {
left: -1rem; }
/**
* User report.
*/