MDL-11510 added missing fields in new gradebook backup
[moodle-pu.git] / backup / backup_execute.html
blob16abc3a81ccb42e7534b2adda59b779fca283b53
1 <?php //$Id$
2 //This page prints the backup todo list to see everything
4 //Check login
5 require_login();
7 if (!empty($course->id)) {
8 if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
9 if (empty($to)) {
10 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
11 } else {
12 if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
13 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
17 } else {
18 if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
19 error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
24 //Check site
25 if (!$site = get_site()) {
26 error("Site not found!");
29 $preferences = new StdClass;
30 backup_fetch_prefs_from_request($preferences,$count,$course);
31 //Another Info
32 backup_add_static_preferences($preferences);
34 if ($count == 0) {
35 notice("No backupable modules are installed!");
39 if (empty($to)) {
40 //Start the main table
41 echo "<table cellpadding=\"5\">";
43 //Now print the Backup Name tr
44 echo "<tr>";
45 echo "<td align=\"right\"><b>";
46 echo get_string("name").":";
47 echo "</b></td><td>";
48 echo $preferences->backup_name;
49 echo "</td></tr>";
51 //Start the main tr, where all the backup progress is done
52 echo "<tr>";
53 echo "<td colspan=\"2\">";
55 //Start the main ul
56 echo "<ul>";
59 $errorstr = '';
60 $status = backup_execute($preferences, $errorstr);
62 //Ends th main ul
63 echo "</ul>";
65 //End the main tr, where all the backup is done
66 echo "</td></tr>";
68 //End the main table
69 echo "</table>";
71 if (!$status) {
72 error ("The backup did not complete successfully",
73 "$CFG->wwwroot/course/view.php?id=$course->id");
76 if (empty($to)) {
77 //Print final message
78 print_simple_box(get_string("backupfinished"),"center");
79 print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&amp;wdir=/backupdata");
80 } else {
81 print_simple_box(get_string('importdataexported'),"CENTER");
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;
87 error_log($filename);
88 $SESSION->import_preferences = $preferences;
89 print_continue($CFG->wwwroot.'/course/import/activities/index.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
92 $SESSION->backupprefs[$course->id] = null; // unset it so we're clear next time.