Skip to content

Commit

Permalink
MDL-31443 backup: Title and cancel messages stating import and restore
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Jun 8, 2018
1 parent cad7a07 commit 68d4285
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
12 changes: 10 additions & 2 deletions backup/util/ui/backup_ui_stage.class.php
Expand Up @@ -183,7 +183,11 @@ protected function initialise_stage_form() {
foreach ($tasks as &$task) {
// For the initial stage we are only interested in the root settings.
if ($task instanceof backup_root_task) {
$form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
if ($this->ui instanceof import_ui) {
$form->add_heading('rootsettings', get_string('importrootsettings', 'backup'));
} else {
$form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
}
$settings = $task->get_settings();
// First add all settings except the filename setting.
foreach ($settings as &$setting) {
Expand Down Expand Up @@ -469,7 +473,11 @@ protected function initialise_stage_form() {
foreach ($tasks as $task) {
if ($task instanceof backup_root_task) {
// If its a backup root add a root settings heading to group nicely.
$form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
if ($this->ui instanceof import_ui) {
$form->add_heading('rootsettings', get_string('importrootsettings', 'backup'));
} else {
$form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
}
} else if (!$courseheading) {
// We haven't already add a course heading.
$form->add_heading('coursesettings', get_string('includeditems', 'backup'));
Expand Down
8 changes: 7 additions & 1 deletion backup/util/ui/base_moodleform.class.php
Expand Up @@ -383,7 +383,13 @@ public function display() {
$this->require_definition_after_data();

$config = new stdClass;
$config->title = get_string('confirmcancel', 'backup');
if ($this->uistage->get_ui() instanceof import_ui) {
$config->title = get_string('confirmcancelimport', 'backup');
} else if ($this->uistage->get_ui() instanceof restore_ui) {
$config->title = get_string('confirmcancelrestore', 'backup');
} else {
$config->title = get_string('confirmcancel', 'backup');
}
$config->question = get_string('confirmcancelquestion', 'backup');
$config->yesLabel = get_string('confirmcancelyes', 'backup');
$config->noLabel = get_string('confirmcancelno', 'backup');
Expand Down
8 changes: 7 additions & 1 deletion backup/util/ui/renderer.php
Expand Up @@ -125,7 +125,13 @@ public function backup_details($details, $nextstageurl) {
$html .= html_writer::end_tag('div');

$html .= html_writer::start_tag('div', array('class' => 'backup-section settings-section'));
$html .= $this->output->heading(get_string('backupsettings', 'backup'), 2, array('class' => 'header'));
if ($this instanceof import_ui_stage_inital) {
$html .= $this->output->heading(get_string('importrootsettings', 'backup'), 2, array('class' => 'header'));
} else if ($this instanceof restore_ui_stage_settings) {
$html .= $this->output->heading(get_string('restorerootsettings', 'backup'), 2, array('class' => 'header'));
} else {
$html .= $this->output->heading(get_string('backupsettings', 'backup'), 2, array('class' => 'header'));
}
foreach ($details->root_settings as $label => $value) {
if ($label == 'filename' or $label == 'user_files') {
continue;
Expand Down
3 changes: 3 additions & 0 deletions lang/en/backup.php
Expand Up @@ -120,6 +120,8 @@
$string['configrestoreuserscompletion'] = 'If enabled user completion information will be restored by default if it was included in the backup.';
$string['configrestoreusers'] = 'Sets the default for whether to restore users if they were included in the backup.';
$string['confirmcancel'] = 'Cancel backup';
$string['confirmcancelrestore'] = 'Cancel restore';
$string['confirmcancelimport'] = 'Cancel import';
$string['confirmcancelquestion'] = 'Are you sure you wish to cancel?
Any information you have entered will be lost.';
$string['confirmcancelyes'] = 'Cancel';
Expand Down Expand Up @@ -198,6 +200,7 @@
$string['importcurrentstage4'] = 'Confirmation and review';
$string['importcurrentstage8'] = 'Perform import';
$string['importcurrentstage16'] = 'Complete';
$string['importrootsettings'] = 'Import settings';
$string['importsettings'] = 'General import settings';
$string['importsuccess'] = 'Import complete. Click continue to return to the course.';
$string['includeactivities'] = 'Include:';
Expand Down

0 comments on commit 68d4285

Please sign in to comment.