mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 15:49:43 +02:00
MDL-78633 core_course: Improve tertiary navigation in course completion
This commit is contained in:
parent
ef93325f27
commit
b14669a34a
11 changed files with 41 additions and 35 deletions
|
@ -314,7 +314,7 @@ class manager {
|
||||||
|
|
||||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||||
$completionlink = new moodle_url('/course/completion.php', ['id' => $courseid]);
|
$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)) {
|
if (has_capability('moodle/course:manageactivities', $coursecontext)) {
|
||||||
|
|
|
@ -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 set the field "completionusegrade" to "1"
|
||||||
And I press "Save and return to course"
|
And I press "Save and return to course"
|
||||||
And I navigate to "Course completion" in current page administration
|
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 expand all fieldsets
|
||||||
And I set the field "Assignment - Test assignment name" to "1"
|
And I set the field "Assignment - Test assignment name" to "1"
|
||||||
And I set the field "Assignment - Test assignment name2" to "1"
|
And I set the field "Assignment - Test assignment name2" to "1"
|
||||||
|
|
|
@ -37,7 +37,7 @@ Feature: Allow teachers to bulk edit activity completion rules in a course.
|
||||||
Given I log in as "teacher1"
|
Given I log in as "teacher1"
|
||||||
And I am on "Course 1" course homepage with editing mode on
|
And I am on "Course 1" course homepage with editing mode on
|
||||||
When I navigate to "Course completion" in current page administration
|
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 one" "checkbox"
|
||||||
And I click on "Test assignment two" "checkbox"
|
And I click on "Test assignment two" "checkbox"
|
||||||
And I click on "Edit" "button"
|
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"
|
Given I log in as "teacher1"
|
||||||
And I am on "Course 1" course homepage with editing mode on
|
And I am on "Course 1" course homepage with editing mode on
|
||||||
When I navigate to "Course completion" in current page administration
|
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 one" "checkbox"
|
||||||
And I click on "Test assignment two" "checkbox"
|
And I click on "Test assignment two" "checkbox"
|
||||||
And I click on "Edit" "button"
|
And I click on "Edit" "button"
|
||||||
|
|
|
@ -30,7 +30,7 @@ Feature: Allow teachers to edit the default activity completion rules in a cours
|
||||||
| Enable completion tracking | Yes |
|
| Enable completion tracking | Yes |
|
||||||
And I press "Save and display"
|
And I press "Save and display"
|
||||||
When I navigate to "Course completion" in current page administration
|
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 "Assignments" "checkbox"
|
||||||
And I click on "Edit" "button"
|
And I click on "Edit" "button"
|
||||||
And I should see "Completion tracking"
|
And I should see "Completion tracking"
|
||||||
|
|
|
@ -73,8 +73,6 @@ echo $OUTPUT->header();
|
||||||
$actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url);
|
$actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url);
|
||||||
echo $renderer->render_course_completion_action_bar($actionbar);
|
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']);
|
$PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['theform']);
|
||||||
|
|
||||||
echo $renderer->bulkcompletion($bulkcompletiondata);
|
echo $renderer->bulkcompletion($bulkcompletiondata);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
namespace core_course\output;
|
namespace core_course\output;
|
||||||
|
|
||||||
|
use core\output\select_menu;
|
||||||
use core_completion\manager;
|
use core_completion\manager;
|
||||||
use moodle_url;
|
use moodle_url;
|
||||||
use renderable;
|
use renderable;
|
||||||
|
@ -57,12 +58,18 @@ class completion_action_bar implements templatable, renderable {
|
||||||
* completion pages.
|
* completion pages.
|
||||||
*/
|
*/
|
||||||
public function export_for_template(renderer_base $output): array {
|
public function export_for_template(renderer_base $output): array {
|
||||||
$urlselect = new url_select(manager::get_available_completion_options($this->courseid),
|
$selectmenu = new select_menu(
|
||||||
$this->currenturl->out(false), null, 'coursecompletionactionselect');
|
'coursecompletionnavigation',
|
||||||
$urlselect->set_label(get_string('coursecompletionnavigation', 'completion'), ['class' => 'sr-only']);
|
manager::get_available_completion_options($this->courseid),
|
||||||
|
$this->currenturl->out(false)
|
||||||
|
);
|
||||||
|
$selectmenu->set_label(
|
||||||
|
get_string('coursecompletionnavigation', 'completion'),
|
||||||
|
['class' => 'sr-only']
|
||||||
|
);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'urlselect' => $urlselect->export_for_template($output),
|
'navigation' => $selectmenu->export_for_template($output),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,8 +166,6 @@ echo $OUTPUT->header();
|
||||||
$actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url);
|
$actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url);
|
||||||
echo $renderer->render_course_completion_action_bar($actionbar);
|
echo $renderer->render_course_completion_action_bar($actionbar);
|
||||||
|
|
||||||
echo $OUTPUT->heading(get_string('editcoursecompletionsettings', 'core_completion'));
|
|
||||||
|
|
||||||
$form->display();
|
$form->display();
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
|
|
@ -68,8 +68,6 @@ echo $OUTPUT->header();
|
||||||
$actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url);
|
$actionbar = new \core_course\output\completion_action_bar($course->id, $PAGE->url);
|
||||||
echo $renderer->render_course_completion_action_bar($actionbar);
|
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']);
|
$PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['theform']);
|
||||||
|
|
||||||
echo $renderer->defaultcompletion($activityresourcedata);
|
echo $renderer->defaultcompletion($activityresourcedata);
|
||||||
|
|
|
@ -17,37 +17,39 @@
|
||||||
Actions bar in the course completion pages.
|
Actions bar in the course completion pages.
|
||||||
|
|
||||||
Context variables required for this template:
|
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):
|
Example context (json):
|
||||||
{
|
{
|
||||||
"urlselect": {
|
"navigation": {
|
||||||
"id": "url_select_test",
|
"name":"coursecompletionnavigation",
|
||||||
"action": "https://example.com/post",
|
"label": "Course completion tertiary navigation",
|
||||||
"formid": "url_select_form",
|
"value": "\/course\/completion.php?id=4",
|
||||||
"sesskey": "sesskey",
|
"baseid": "select-menu64a40e3ea86ed8",
|
||||||
"classes": "urlselect",
|
"selectedoption": "Grader report",
|
||||||
"label": "",
|
|
||||||
"helpicon": false,
|
|
||||||
"showbutton": null,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"name": "Some name",
|
"id": "select-menu-option1",
|
||||||
"value": "/mod/data/someurl.php",
|
"name": "Course completion settings",
|
||||||
"selected": false
|
"value": "/course/completion.php?id=4",
|
||||||
|
"selected": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"disabled": false,
|
"labelattributes":[
|
||||||
"title": null
|
{
|
||||||
|
"name":"class",
|
||||||
|
"value":"sr-only"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
<div class="container-fluid tertiary-navigation">
|
<div class="container-fluid tertiary-navigation border-bottom" id="tertiary-navigation">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#urlselect}}
|
{{#navigation}}
|
||||||
<div class="navitem">
|
<div class="navitem">
|
||||||
{{>core/url_select}}
|
{{>core/tertiary_navigation_selector}}
|
||||||
</div>
|
</div>
|
||||||
{{/urlselect}}
|
{{/navigation}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -130,6 +130,7 @@ $string['coursecompletedmessage'] = '<p>Congratulations!</p><p>You have complete
|
||||||
$string['coursecompletion'] = 'Course completion';
|
$string['coursecompletion'] = 'Course completion';
|
||||||
$string['coursecompletioncondition'] = 'Condition: {$a}';
|
$string['coursecompletioncondition'] = 'Condition: {$a}';
|
||||||
$string['coursecompletionnavigation'] = 'Course completion tertiary navigation';
|
$string['coursecompletionnavigation'] = 'Course completion tertiary navigation';
|
||||||
|
$string['coursecompletionsettings'] = 'Course completion settings';
|
||||||
$string['coursegrade'] = 'Course grade';
|
$string['coursegrade'] = 'Course grade';
|
||||||
$string['coursesavailable'] = 'Courses available';
|
$string['coursesavailable'] = 'Courses available';
|
||||||
$string['coursesavailableexplaination'] = 'Note: Course completion conditions must be set for a course to appear in the above list.';
|
$string['coursesavailableexplaination'] = 'Note: Course completion conditions must be set for a course to appear in the above list.';
|
||||||
|
@ -153,7 +154,6 @@ $string['detail_desc:receivepassgrade'] = 'Receive a passing grade';
|
||||||
$string['detail_desc:view'] = 'View';
|
$string['detail_desc:view'] = 'View';
|
||||||
$string['done'] = 'Done';
|
$string['done'] = 'Done';
|
||||||
$string['hiddenrules'] = 'Some settings specific to <b>{$a}</b> have been hidden. To view unselect other activities';
|
$string['hiddenrules'] = 'Some settings specific to <b>{$a}</b> have been hidden. To view unselect other activities';
|
||||||
$string['editcoursecompletionsettings'] = 'Edit course completion settings';
|
|
||||||
$string['enablecompletion'] = 'Enable completion tracking';
|
$string['enablecompletion'] = 'Enable completion tracking';
|
||||||
$string['enablecompletion_help'] = 'If enabled, activity completion conditions may be set in the activity settings and/or course completion conditions may be set. It is recommended to have this enabled so that meaningful data is displayed in the course overview on the Dashboard.';
|
$string['enablecompletion_help'] = 'If enabled, activity completion conditions may be set in the activity settings and/or course completion conditions may be set. It is recommended to have this enabled so that meaningful data is displayed in the course overview on the Dashboard.';
|
||||||
$string['enrolmentduration'] = 'Enrolment duration';
|
$string['enrolmentduration'] = 'Enrolment duration';
|
||||||
|
@ -253,3 +253,4 @@ $string['xdays'] = '{$a} days';
|
||||||
|
|
||||||
// Deprecated since Moodle 4.0.
|
// Deprecated since Moodle 4.0.
|
||||||
$string['yourprogress'] = 'Your progress';
|
$string['yourprogress'] = 'Your progress';
|
||||||
|
$string['editcoursecompletionsettings'] = 'Edit course completion settings';
|
||||||
|
|
|
@ -79,4 +79,5 @@ selectdevice,core_admin
|
||||||
selecttheme,core_admin
|
selecttheme,core_admin
|
||||||
themenoselected,core_admin
|
themenoselected,core_admin
|
||||||
unsettheme,core_admin
|
unsettheme,core_admin
|
||||||
showmore,core_availability
|
showmore,core_availability
|
||||||
|
editcoursecompletionsettings,core_completion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue