mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-69559 course: Add course content download UI and execution page
This commit is contained in:
parent
cdf91cc236
commit
c053b93f0c
8 changed files with 308 additions and 1 deletions
|
@ -4448,7 +4448,7 @@ class settings_navigation extends navigation_node {
|
|||
* @return navigation_node|false
|
||||
*/
|
||||
protected function load_course_settings($forceopen = false) {
|
||||
global $CFG;
|
||||
global $CFG, $USER;
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
|
||||
$course = $this->page->course;
|
||||
|
@ -4605,6 +4605,16 @@ 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())) {
|
||||
$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', ''));
|
||||
}
|
||||
|
||||
// Return we are done
|
||||
return $coursenode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue