diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php index df29e89810b..0d82017fb07 100644 --- a/backup/util/ui/renderer.php +++ b/backup/util/ui/renderer.php @@ -754,9 +754,12 @@ class core_backup_renderer extends plugin_renderer_base { $row->attributes['class'] .= ' dimmed'; } $id = $this->make_unique_id('restore-course'); + $attrs = ['type' => 'radio', 'name' => 'targetid', 'value' => $course->id, 'id' => $id]; + if ($course->id == $component->get_current_course_id()) { + $attrs['checked'] = 'checked'; + } $row->cells = [ - html_writer::empty_tag('input', ['type' => 'radio', 'name' => 'targetid', 'value' => $course->id, - 'id' => $id]), + html_writer::empty_tag('input', $attrs), html_writer::label( format_string($course->shortname, true, ['context' => context_course::instance($course->id)]), $id, diff --git a/backup/util/ui/restore_ui_components.php b/backup/util/ui/restore_ui_components.php index ff0a31f53f1..9b165d3be30 100644 --- a/backup/util/ui/restore_ui_components.php +++ b/backup/util/ui/restore_ui_components.php @@ -363,6 +363,15 @@ class restore_course_search extends restore_search_base { public function set_include_currentcourse() { $this->includecurrentcourse = true; } + + /** + * Get the current course id + * + * @return int + */ + public function get_current_course_id(): int { + return $this->currentcourseid; + } } /**