mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 23:59:41 +02:00
MDL-44190 backup: Current course will be selected by default
This commit is contained in:
parent
e77452220b
commit
18dca30eca
2 changed files with 14 additions and 2 deletions
|
@ -754,9 +754,12 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||||
$row->attributes['class'] .= ' dimmed';
|
$row->attributes['class'] .= ' dimmed';
|
||||||
}
|
}
|
||||||
$id = $this->make_unique_id('restore-course');
|
$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 = [
|
$row->cells = [
|
||||||
html_writer::empty_tag('input', ['type' => 'radio', 'name' => 'targetid', 'value' => $course->id,
|
html_writer::empty_tag('input', $attrs),
|
||||||
'id' => $id]),
|
|
||||||
html_writer::label(
|
html_writer::label(
|
||||||
format_string($course->shortname, true, ['context' => context_course::instance($course->id)]),
|
format_string($course->shortname, true, ['context' => context_course::instance($course->id)]),
|
||||||
$id,
|
$id,
|
||||||
|
|
|
@ -363,6 +363,15 @@ class restore_course_search extends restore_search_base {
|
||||||
public function set_include_currentcourse() {
|
public function set_include_currentcourse() {
|
||||||
$this->includecurrentcourse = true;
|
$this->includecurrentcourse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current course id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function get_current_course_id(): int {
|
||||||
|
return $this->currentcourseid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue