Renamed from check.html, execute.html and backup.html to avoid
[moodle.git] / backup / backup_form.html
CommitLineData
a615cc7b 1<?PHP //$Id$
2 //This page prints the backup form to select everything
3
4 //Checks for the required files/functions to backup every mod
5 //And check if there is data about it
6 $count = 0;
7 if ($allmods = get_records("modules") ) {
8 foreach ($allmods as $mod) {
9 $modname = $mod->name;
10 $modfile = "$mods_home/$modname/backuplib.php";
11 $modbackup = $modname."_backup_mods";
12 $modcheckbackup = $modname."_check_backup_mods";
13 if (file_exists($modfile)) {
14 include_once($modfile);
15 if (function_exists($modbackup) and function_exists($modcheckbackup)) {
16 $var = "exists_".$modname;
17 $$var = true;
18 $count++;
19 }
20 }
21 //Check data
22 //Check module info
23 $var = "backup_".$modname;
24 if (!isset($$var)) {
25 $$var = 1;
26 }
27 //Check include user info
28 $var = "backup_user_info_".$modname;
29 if (!isset($$var)) {
30 $$var = 1;
31 }
32 }
33 }
34
35 //Check other parameters
36 if (!isset($backup_users)) {
37 $backup_users = 1;
38 }
39
40 if (!isset($backup_logs)) {
41 $backup_logs = 1;
42 }
43
44 if (!isset($backup_user_files)) {
45 $backup_user_files = 1;
46 }
47
48 if (!isset($backup_course_files)) {
49 $backup_course_files = 1;
50 }
51
52 if ($count == 0) {
53 notice("No backupable modules are installed!");
54 }
55
56?>
57
58<form name="form" method="post" <?=$onsubmit ?> action="<?=$ME ?>">
59<table cellpadding=5>
60<?
61 if ($allmods = get_records("modules") ) {
62 foreach ($allmods as $mod) {
63 $modname = $mod->name;
64 $modbackup = $modname."_backup_mods";
65 //If exists the lib & function
66 $var = "exists_".$modname;
67 if ($$var) {
68 //Print the full tr
69 echo "<tr>";
70 echo "<td align=\"right\"><P><B>";
71 echo get_string("include")." ". get_string("modulenameplural",$modname).":";
72 echo "</td><td>";
73 $backup_options[0] = get_string("no");
74 $backup_options[1] = get_string("yes");
75 $var = "backup_".$modname;
76 choose_from_menu($backup_options, $var, $$var, "");
77 $backup_user_options[0] = get_string("withoutuserdata");
78 $backup_user_options[1] = get_string("withuserdata");
79 $var = "backup_user_info_".$modname;
80 choose_from_menu($backup_user_options, $var, $$var, "");
81 echo "</td></tr>";
82 }
83 }
84 //Line
85 echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
86
87 //Now print the Users tr
88 echo "<tr>";
89 echo "<td align=\"right\"><P><B>";
90 echo get_string("users").":";
91 echo "</td><td>";
92 $user_options[0] = get_string("all");
93 $user_options[1] = get_string("course");
94 //$user_options[2] = get_string("needed");-->NOT IMPLEMENTED
95 choose_from_menu($user_options, "backup_users", $backup_users, "");
96 echo "</td></tr>";
97
98 //Now print the Logs tr
99 echo "<tr>";
100 echo "<td align=\"right\"><P><B>";
101 echo get_string("logs").":";
102 echo "</td><td>";
103 $log_options[0] = get_string("no");
104 $log_options[1] = get_string("yes");
105 choose_from_menu($log_options, "backup_logs", $backup_logs, "");
106 echo "</td></tr>";
107
108 //Now print the User Files tr
109 echo "<tr>";
110 echo "<td align=\"right\"><P><B>";
111 echo get_string ("userfiles").":";
112 echo "</td><td>";
113 $user_file_options[0] = get_string("no");
114 $user_file_options[1] = get_string("yes");
115 choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
116 echo "</td></tr>";
117
118 //Now print the Course Files tr
119 echo "<tr>";
120 echo "<td align=\"right\"><P><B>";
121 echo get_string ("coursefiles").":";
122 echo "</td><td>";
123 $course_file_options[0] = get_string("no");
124 $course_file_options[1] = get_string("yes");
125 choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
126 echo "</td></tr>";
127 }
128?>
129</table>
130<BR>
131<CENTER>
132<input type="hidden" name=id value="<? p($id) ?>">
133<input type="hidden" name=launch value="check">
134<input type="submit" value="<? print_string("continue") ?>">
135<input type="submit" name=cancel value="<? print_string("cancel") ?>">
136</CENTER>
137</FORM>