2 //This page prints the backup todo list to see everything
7 $loginurl = get_login_url();
9 if (!empty($course->id
)) {
10 if (!has_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_COURSE
, $course->id
))) {
12 print_error("cannotuseadminadminorteacher", '', $loginurl);
14 if (!has_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_COURSE
, $to))) {
15 print_error("cannotuseadminadminorteacher", '', $loginurl);
20 if (!has_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_SYSTEM
))) {
21 print_error("cannotuseadmin", '', $loginurl);
29 $preferences = new StdClass
;
30 backup_fetch_prefs_from_request($preferences,$count,$course);
32 backup_add_static_preferences($preferences);
35 notice("No backupable modules are installed!");
40 //Start the main table
41 echo "<table cellpadding=\"5\">";
43 //Now print the Backup Name tr
45 echo "<td align=\"right\"><b>";
46 echo get_string("name").":";
48 echo $preferences->backup_name
;
51 //Start the main tr, where all the backup progress is done
53 echo "<td colspan=\"2\">";
60 $status = backup_execute($preferences, $errorstr);
65 //End the main tr, where all the backup is done
72 print_error('error', 'error', "$CFG->wwwroot/course/view.php?id=$course->id");
77 echo $OUTPUT->box(get_string("backupfinished"));
78 $context = get_context_instance(CONTEXT_COURSE
, $course->id
);
79 echo $OUTPUT->continue_button("$CFG->wwwroot/files/index.php?contextid=".$context->id
."&component=backup&filearea=course&itemid=0");
81 echo $OUTPUT->box(get_string('importdataexported'));
82 if (!empty($preferences->backup_destination
)) {
83 $filename = $preferences->backup_destination
."/".$preferences->backup_name
;
85 $filename = $preferences->backup_course
."/backupdata/".$preferences->backup_name
;
88 $SESSION->import_preferences
= $preferences;
89 echo $OUTPUT->continue_button($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.