Merge branch 'MDL-73914-master' of https://github.com/lameze/moodle

This commit is contained in:
Víctor Déniz
2022-03-24 15:54:56 +00:00
5 changed files with 7 additions and 15 deletions
@@ -30,8 +30,7 @@ Feature: Course content can be downloaded
Scenario: A student can download course content when the feature is enabled in their course
Given I log in as "student1"
When I am on "Hockey 101" course homepage
And "Download course content" "button" should exist
And I press "Download course content"
And I navigate to "Download course content" in current page administration
Then I should see "You are about to download a zip file"
# Without the ability to check the downloaded file, the absence of an exception being thrown here is considered a success.
And I click on "Download" "button" in the "Download course content" "dialogue"
@@ -95,10 +95,10 @@ Feature: Access to downloading course content can be controlled
And I set the field "Enable download course content" to "Yes"
And I press "Save and display"
And I log out
# Check student can see download button.
# Check student can see the download link.
And I log in as "student1"
And I am on "Hockey 101" course homepage
And "Download course content" "button" should exist
And "Download course content" "link" should exist in current page administration
And I log out
And I log in as "admin"
# Remove student's capability for download course content.
@@ -106,7 +106,7 @@ Feature: Access to downloading course content can be controlled
| capability | permission |
| moodle/course:downloadcoursecontent | Prohibit |
And I log out
# Check student can no longer see download button.
# Check student can no longer see the download link.
And I log in as "student1"
And I am on "Hockey 101" course homepage
Then "Download course content" "link" should not exist in current page administration
-6
View File
@@ -219,12 +219,6 @@
if ($PAGE->user_allowed_editing()) {
$buttons = $OUTPUT->edit_button($PAGE->url);
$PAGE->set_button($buttons);
} else if ($candownloadcourse) {
// Show the download course content button if user has permission to access it.
// Only showing this if user doesn't have edit rights, since those who do will access it via the actions menu.
$buttonattr = \core_course\output\content_export_link::get_attributes($context);
$button = new single_button($buttonattr->url, $buttonattr->displaystring, 'post', false, $buttonattr->elementattributes);
$PAGE->set_button($OUTPUT->render($button));
}
// If viewing a section, make the title more specific
+1 -1
View File
@@ -517,7 +517,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
if ($unenrollink = $plugin->get_unenrolself_link($instance)) {
$shortname = format_string($course->shortname, true, array('context' => $coursecontext));
$coursenode->add(get_string('unenrolme', 'core_enrol', $shortname), $unenrollink, navigation_node::TYPE_SETTING, null, 'unenrolself', new pix_icon('i/user', ''));
$coursenode->get('unenrolself')->set_force_into_more_menu();
$coursenode->get('unenrolself')->set_force_into_more_menu(true);
break;
//TODO. deal with multiple unenrol links - not likely case, but still...
}
+2 -3
View File
@@ -4737,14 +4737,13 @@ class settings_navigation extends navigation_node {
}
// Prepare data for course content download functionality if it is enabled.
// Will only be included here if the action menu is already in use, otherwise a button will be added to the UI elsewhere.
if (\core\content::can_export_context($coursecontext, $USER) && !empty($coursenode->get_children_key_list())) {
if (\core\content::can_export_context($coursecontext, $USER)) {
$linkattr = \core_course\output\content_export_link::get_attributes($coursecontext);
$actionlink = new action_link($linkattr->url, $linkattr->displaystring, null, $linkattr->elementattributes);
$coursenode->add($linkattr->displaystring, $actionlink, self::TYPE_SETTING, null, 'download',
new pix_icon('t/download', ''));
$coursenode->get('download')->set_force_into_more_menu();
$coursenode->get('download')->set_force_into_more_menu(true);
}
// Return we are done