2 //This script is used to configure and execute the backup proccess.
4 //Define some globals for all the script
6 //MUST CHANGE WITH FINAL BACKUP LOCATION !! WITHOUT TRAILING SLASH !!
7 //ALL RELATIVE FROM THE LOCATION OF THE backup.php SCRIPT !!!
9 $moodle_home = "../../..";
15 require_once ("$moodle_home/config.php");
16 require_once ("$moodle_home/version.php");
17 require_once ("backup_version.php");
18 require_once ("db/backup_$CFG->dbtype.php");
19 require_once ("lib.php");
20 require_once ("backuplib.php");
23 optional_variable($id); // course id
30 error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
34 if (!$site = get_site()) {
35 error("Site not found!");
38 //Check backup_version
39 upgrade_backup_db($backup_version,$backup_release,"backup.php");
42 $strcoursebackup = get_string("coursebackup");
43 $stradministration = get_string("administration");
45 //If no course has been selected or cancel button pressed
46 if (!$id or $cancel) {
47 print_header("$site->shortname: $strcoursebackup", $site->fullname
,
48 "<A HREF=\"$moodle_home/$CFG->admin/index.php\">$stradministration</A> -> $strcoursebackup");
50 if ($courses = get_courses()) {
51 print_heading(get_string("choosecourse"));
52 print_simple_box_start("CENTER");
53 foreach ($courses as $course) {
54 echo "<A HREF=\"backup.php?id=$course->id\">$course->fullname ($course->shortname)</A><BR>";
56 print_simple_box_end();
58 print_heading(get_string("nocoursesyet"));
59 print_continue("$moodle_home/$CFG->admin/index.php");
65 //Get and check course
66 if (! $course = get_record("course", "id", $id)) {
67 error("Course ID was incorrect (can't find it)");
70 print_header("$site->shortname: $strcoursebackup", $site->fullname
,
71 "<A HREF=\"$moodle_home/$CFG->admin/index.php\">$stradministration</A> ->
72 <A HREF=\"backup.php\">$strcoursebackup</A> -> $course->fullname ($course->shortname)");
75 print_heading("$strcoursebackup: $course->fullname ($course->shortname)");
76 print_simple_box_start("center", "", "$THEME->cellheading");
77 //Call the form, depending the step we are
79 include_once("backup_form.html");
80 } else if ($launch == "check") {
81 include_once("backup_check.html");
82 } else if ($launch == "execute") {
83 include_once("backup_execute.html");
85 print_simple_box_end();