diff --git a/completion/classes/manager.php b/completion/classes/manager.php index 99cb4ee7a98..82bcb53369d 100644 --- a/completion/classes/manager.php +++ b/completion/classes/manager.php @@ -314,7 +314,7 @@ class manager { if (has_capability('moodle/course:update', $coursecontext)) { $completionlink = new moodle_url('/course/completion.php', ['id' => $courseid]); - $options[$completionlink->out(false)] = get_string('coursecompletion', 'completion'); + $options[$completionlink->out(false)] = get_string('coursecompletionsettings', 'completion'); } if (has_capability('moodle/course:manageactivities', $coursecontext)) { diff --git a/completion/tests/behat/activity_completion_criteria.feature b/completion/tests/behat/activity_completion_criteria.feature index beb6ce8eaf8..2d25ad07dbf 100644 --- a/completion/tests/behat/activity_completion_criteria.feature +++ b/completion/tests/behat/activity_completion_criteria.feature @@ -78,6 +78,7 @@ Feature: Allow to mark course as completed without cron for activity completion And I set the field "completionusegrade" to "1" And I press "Save and return to course" And I navigate to "Course completion" in current page administration + And I should see "Course completion settings" in the "tertiary-navigation" "region" And I expand all fieldsets And I set the field "Assignment - Test assignment name" to "1" And I set the field "Assignment - Test assignment name2" to "1" diff --git a/completion/tests/behat/bulk_edit_activity_completion.feature b/completion/tests/behat/bulk_edit_activity_completion.feature index fadf12e8e71..60f955a01b0 100644 --- a/completion/tests/behat/bulk_edit_activity_completion.feature +++ b/completion/tests/behat/bulk_edit_activity_completion.feature @@ -37,7 +37,7 @@ Feature: Allow teachers to bulk edit activity completion rules in a course. Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on When I navigate to "Course completion" in current page administration - And I select "Bulk edit activity completion" from the "Course completion tertiary navigation" singleselect + And I set the field "Course completion tertiary navigation" to "Bulk edit activity completion" And I click on "Test assignment one" "checkbox" And I click on "Test assignment two" "checkbox" And I click on "Edit" "button" @@ -68,7 +68,7 @@ Feature: Allow teachers to bulk edit activity completion rules in a course. Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on When I navigate to "Course completion" in current page administration - And I select "Bulk edit activity completion" from the "Course completion tertiary navigation" singleselect + And I set the field "Course completion tertiary navigation" to "Bulk edit activity completion" And I click on "Test assignment one" "checkbox" And I click on "Test assignment two" "checkbox" And I click on "Edit" "button" diff --git a/completion/tests/behat/default_activity_completion.feature b/completion/tests/behat/default_activity_completion.feature index e74420d301c..fec208894fb 100644 --- a/completion/tests/behat/default_activity_completion.feature +++ b/completion/tests/behat/default_activity_completion.feature @@ -30,7 +30,7 @@ Feature: Allow teachers to edit the default activity completion rules in a cours | Enable completion tracking | Yes | And I press "Save and display" When I navigate to "Course completion" in current page administration - And I select "Default activity completion" from the "Course completion tertiary navigation" singleselect + And I set the field "Course completion tertiary navigation" to "Default activity completion" And I click on "Assignments" "checkbox" And I click on "Edit" "button" And I should see "Completion tracking" diff --git a/course/bulkcompletion.php b/course/bulkcompletion.php index 4d84af92863..019888b76d1 100644 --- a/course/bulkcompletion.php +++ b/course/bulkcompletion.php @@ -73,8 +73,6 @@ echo $OUTPUT->header(); $actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url); echo $renderer->render_course_completion_action_bar($actionbar); -echo $OUTPUT->heading(get_string('bulkactivitycompletion', 'completion')); - $PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['theform']); echo $renderer->bulkcompletion($bulkcompletiondata); diff --git a/course/classes/output/completion_action_bar.php b/course/classes/output/completion_action_bar.php index 54f0b8f9daf..5173e61efb9 100644 --- a/course/classes/output/completion_action_bar.php +++ b/course/classes/output/completion_action_bar.php @@ -16,6 +16,7 @@ namespace core_course\output; +use core\output\select_menu; use core_completion\manager; use moodle_url; use renderable; @@ -57,12 +58,18 @@ class completion_action_bar implements templatable, renderable { * completion pages. */ public function export_for_template(renderer_base $output): array { - $urlselect = new url_select(manager::get_available_completion_options($this->courseid), - $this->currenturl->out(false), null, 'coursecompletionactionselect'); - $urlselect->set_label(get_string('coursecompletionnavigation', 'completion'), ['class' => 'sr-only']); + $selectmenu = new select_menu( + 'coursecompletionnavigation', + manager::get_available_completion_options($this->courseid), + $this->currenturl->out(false) + ); + $selectmenu->set_label( + get_string('coursecompletionnavigation', 'completion'), + ['class' => 'sr-only'] + ); return [ - 'urlselect' => $urlselect->export_for_template($output), + 'navigation' => $selectmenu->export_for_template($output), ]; } } diff --git a/course/completion.php b/course/completion.php index 0a7f2d1f6e6..f83f8576db0 100644 --- a/course/completion.php +++ b/course/completion.php @@ -166,8 +166,6 @@ echo $OUTPUT->header(); $actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url); echo $renderer->render_course_completion_action_bar($actionbar); -echo $OUTPUT->heading(get_string('editcoursecompletionsettings', 'core_completion')); - $form->display(); echo $OUTPUT->footer(); diff --git a/course/defaultcompletion.php b/course/defaultcompletion.php index 5e81eaf6886..8aa84a0f646 100644 --- a/course/defaultcompletion.php +++ b/course/defaultcompletion.php @@ -68,8 +68,6 @@ echo $OUTPUT->header(); $actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url); echo $renderer->render_course_completion_action_bar($actionbar); -echo $OUTPUT->heading(get_string('defaultcompletion', 'completion')); - $PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['theform']); echo $renderer->defaultcompletion($activityresourcedata); diff --git a/course/templates/completion_action_bar.mustache b/course/templates/completion_action_bar.mustache index 0ad8699f913..0cf4b868688 100644 --- a/course/templates/completion_action_bar.mustache +++ b/course/templates/completion_action_bar.mustache @@ -17,37 +17,39 @@ Actions bar in the course completion pages. Context variables required for this template: - * urlselect - The data object containing the required properties to render core/url_select. + * navigation - The data object containing the required properties to render core/tertiary_navigation_selector. Example context (json): { - "urlselect": { - "id": "url_select_test", - "action": "https://example.com/post", - "formid": "url_select_form", - "sesskey": "sesskey", - "classes": "urlselect", - "label": "", - "helpicon": false, - "showbutton": null, + "navigation": { + "name":"coursecompletionnavigation", + "label": "Course completion tertiary navigation", + "value": "\/course\/completion.php?id=4", + "baseid": "select-menu64a40e3ea86ed8", + "selectedoption": "Grader report", "options": [ { - "name": "Some name", - "value": "/mod/data/someurl.php", - "selected": false + "id": "select-menu-option1", + "name": "Course completion settings", + "value": "/course/completion.php?id=4", + "selected": true } ], - "disabled": false, - "title": null + "labelattributes":[ + { + "name":"class", + "value":"sr-only" + } + ] } } }} -