MDL-24203 unused string removed
[moodle.git] / backup / backup_execute.html
CommitLineData
795b6945 1<?php
a615cc7b 2 //This page prints the backup todo list to see everything
3
795b6945 4 //Check login
c563a9a0 5 require_login();
6
93f66983 7 $loginurl = get_login_url();
8
bd38123e 9 if (!empty($course->id)) {
d2940003 10 if (!has_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_COURSE, $course->id))) {
873bf875 11 if (empty($to)) {
93f66983 12 print_error("cannotuseadminadminorteacher", '', $loginurl);
873bf875 13 } else {
d2940003 14 if (!has_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_COURSE, $to))) {
93f66983 15 print_error("cannotuseadminadminorteacher", '', $loginurl);
873bf875 16 }
17 }
bd38123e 18 }
19 } else {
d2940003 20 if (!has_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_SYSTEM))) {
93f66983 21 print_error("cannotuseadmin", '', $loginurl);
bd38123e 22 }
c563a9a0 23 }
24
bd38123e 25
c563a9a0 26 //Check site
3f77c158 27 $site = get_site();
c563a9a0 28
a94baeaf 29 $preferences = new StdClass;
30 backup_fetch_prefs_from_request($preferences,$count,$course);
3b8bad6f 31 //Another Info
9e3775db 32 backup_add_static_preferences($preferences);
674b30f5 33
a615cc7b 34 if ($count == 0) {
35 notice("No backupable modules are installed!");
36 }
37
a615cc7b 38
873bf875 39 if (empty($to)) {
40 //Start the main table
f2d57378 41 echo "<table cellpadding=\"5\">";
795b6945 42
873bf875 43 //Now print the Backup Name tr
44 echo "<tr>";
f2d57378 45 echo "<td align=\"right\"><b>";
873bf875 46 echo get_string("name").":";
47 echo "</b></td><td>";
48 echo $preferences->backup_name;
49 echo "</td></tr>";
795b6945 50
873bf875 51 //Start the main tr, where all the backup progress is done
52 echo "<tr>";
53 echo "<td colspan=\"2\">";
795b6945 54
873bf875 55 //Start the main ul
56 echo "<ul>";
57 }
b294bc4b 58
9e3775db 59 $errorstr = '';
60 $status = backup_execute($preferences, $errorstr);
b294bc4b 61
3b8bad6f 62 //Ends th main ul
63 echo "</ul>";
a615cc7b 64
674b30f5 65 //End the main tr, where all the backup is done
3b8bad6f 66 echo "</td></tr>";
a615cc7b 67
674b30f5 68 //End the main table
69 echo "</table>";
795b6945 70
040c7b70 71 if (!$status) {
771dc7b2 72 print_error('error', 'error', "$CFG->wwwroot/course/view.php?id=$course->id");
040c7b70 73 }
47846965 74
873bf875 75 if (empty($to)) {
76 //Print final message
9549b986 77 echo $OUTPUT->box(get_string("backupfinished"));
23098cd9 78 $context = get_context_instance(CONTEXT_COURSE, $course->id);
64f93798 79 echo $OUTPUT->continue_button("$CFG->wwwroot/files/index.php?contextid=".$context->id."&component=backup&filearea=course&itemid=0");
873bf875 80 } else {
9549b986 81 echo $OUTPUT->box(get_string('importdataexported'));
873bf875 82 if (!empty($preferences->backup_destination)) {
83 $filename = $preferences->backup_destination."/".$preferences->backup_name;
84 } else {
85 $filename = $preferences->backup_course."/backupdata/".$preferences->backup_name;
86 }
87 error_log($filename);
88 $SESSION->import_preferences = $preferences;
9549b986 89 echo $OUTPUT->continue_button($CFG->wwwroot.'/course/import/activities/index.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
873bf875 90 }
a94baeaf 91
92 $SESSION->backupprefs[$course->id] = null; // unset it so we're clear next time.
a615cc7b 93?>