Created
July 9, 2016 16:30
-
-
Save nadavkav/e3e5af5390074b5fd0dfdbd922f88e01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------ backup/restore.php ------------------------------ | |
index ab97369..9c41dc3 100644 | |
@@ -30,6 +30,10 @@ if (is_null($course)) { | |
$PAGE->set_title($courseshortname . ': ' . get_string('restore')); | |
$PAGE->set_heading($coursefullname); | |
+$PAGE->requires->jquery(); | |
+$PAGE->requires->jquery_plugin('ui'); | |
+$PAGE->requires->jquery_plugin('ui-css'); | |
+ | |
$renderer = $PAGE->get_renderer('core','backup'); | |
if (empty($cancel)) { | |
// Do not print the header if user cancelled the process, as we are going to redirect the user. | |
------------------------- backup/util/ui/renderer.php ------------------------- | |
index a3901e5..df964be 100644 | |
@@ -272,9 +272,15 @@ class core_backup_renderer extends plugin_renderer_base { | |
$hasrestoreoption = false; | |
$html = html_writer::start_tag('div', array('class' => 'backup-course-selector backup-restore')); | |
+ $html .= html_writer::start_tag('ul', array('id' => 'restore-course-selector')); | |
+ $html .= html_writer::tag('li', html_writer::tag('a', 'new', array('href' => '#bcs-new-course'))); | |
+ $html .= html_writer::tag('li', html_writer::tag('a', 'current', array('href' => '#bcs-current-course'))); | |
+ $html .= html_writer::tag('li', html_writer::tag('a', 'existing', array('href' => '#bcs-existing-course'))); | |
+ $html .= html_writer::end_tag('ul'); | |
if ($wholecourse && !empty($categories) && ($categories->get_count() > 0 || $categories->get_search())) { | |
// New course. | |
$hasrestoreoption = true; | |
+ $html .= html_writer::start_tag('div', array('id' => 'bcs-new-course')); | |
$html .= $form; | |
$html .= html_writer::start_tag('div', array('class' => 'bcs-new-course backup-section')); | |
$html .= $this->output->heading(get_string('restoretonewcourse', 'backup'), 2, array('class' => 'header')); | |
@@ -293,11 +299,13 @@ class core_backup_renderer extends plugin_renderer_base { | |
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue')))); | |
$html .= html_writer::end_tag('div'); | |
$html .= html_writer::end_tag('form'); | |
+ $html .= html_writer::end_tag('div'); | |
} | |
if ($wholecourse && !empty($currentcourse)) { | |
// Current course. | |
$hasrestoreoption = true; | |
+ $html .= html_writer::start_tag('div', array('id' => 'bcs-current-course')); | |
$html .= $form; | |
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'targetid', 'value' => $currentcourse)); | |
$html .= html_writer::start_tag('div', array('class' => 'bcs-current-course backup-section')); | |
@@ -309,6 +317,7 @@ class core_backup_renderer extends plugin_renderer_base { | |
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue')))); | |
$html .= html_writer::end_tag('div'); | |
$html .= html_writer::end_tag('form'); | |
+ $html .= html_writer::end_tag('div'); | |
} | |
// If we are restoring an activity, then include the current course. | |
@@ -319,6 +328,7 @@ class core_backup_renderer extends plugin_renderer_base { | |
if (!empty($courses) && ($courses->get_count() > 0 || $courses->get_search())) { | |
// Existing course. | |
$hasrestoreoption = true; | |
+ $html .= html_writer::start_tag('div', array('id' => 'bcs-existing-course')); | |
$html .= $form; | |
$html .= html_writer::start_tag('div', array('class' => 'bcs-existing-course backup-section')); | |
$html .= $this->output->heading(get_string('restoretoexistingcourse', 'backup'), 2, array('class' => 'header')); | |
@@ -343,6 +353,7 @@ class core_backup_renderer extends plugin_renderer_base { | |
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue')))); | |
$html .= html_writer::end_tag('div'); | |
$html .= html_writer::end_tag('form'); | |
+ $html .= html_writer::end_tag('div'); | |
} | |
if (!$hasrestoreoption) { | |
@@ -350,6 +361,7 @@ class core_backup_renderer extends plugin_renderer_base { | |
} | |
$html .= html_writer::end_tag('div'); | |
+ $html .= html_writer::script('$(function() { $(".backup-course-selector").tabs(); });'); | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment