2 //This page prints the backup form to select everything
7 if (!empty($course->id
)) {
8 if (!isteacheredit($course->id
)) {
10 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
12 if (!isteacheredit($to)) {
13 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
19 error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
24 if (!$site = get_site()) {
25 error("Site not found!");
28 //Checks for the required files/functions to backup every mod
29 //And check if there is data about it
31 if ($allmods = get_records("modules") ) {
32 foreach ($allmods as $mod) {
33 $modname = $mod->name
;
34 $modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
35 $modbackup = $modname."_backup_mods";
36 $modcheckbackup = $modname."_check_backup_mods";
37 if (file_exists($modfile)) {
38 include_once($modfile);
39 if (function_exists($modbackup) and function_exists($modcheckbackup)) {
40 $var = "exists_".$modname;
47 $var = "backup_".$modname;
51 //Check include user info
52 $var = "backup_user_info_".$modname;
59 //Check other parameters
60 if (!isset($backup_metacourse)) {
61 $backup_metacourse = 1;
64 if (!isset($backup_users)) {
68 if (!isset($backup_logs)) {
72 if (!isset($backup_user_files)) {
73 $backup_user_files = 1;
76 if (!isset($backup_course_files)) {
77 $backup_course_files = 1;
80 if (!isset($backup_messages)) {
85 notice("No backupable modules are installed!");
90 <form name=
"form" method=
"post" action=
"backup.php">
91 <table cellpadding=
"5">
93 if ($allmods = get_records("modules") ) {
94 foreach ($allmods as $mod) {
95 $modname = $mod->name
;
96 $modbackup = $modname."_backup_mods";
97 //If exists the lib & function
98 $var = "exists_".$modname;
99 if (isset($
$var) && $
$var) {
102 echo "<td align=\"right\"><b>";
103 echo get_string("include")." ". get_string("modulenameplural",$modname).":";
104 echo "</b></td><td>";
105 $backup_options[0] = get_string("no");
106 $backup_options[1] = get_string("yes");
107 $var = "backup_".$modname;
108 choose_from_menu($backup_options, $var, $
$var, "");
109 $var = "backup_user_info_".$modname;
111 $backup_user_options[0] = get_string("withoutuserdata");
112 $backup_user_options[1] = get_string("withuserdata");
113 choose_from_menu($backup_user_options, $var, $
$var, "");
116 echo '<input type="hidden" name="'.$var.'" value="0" />';
122 echo "<tr><td colspan=\"2\"><hr /></td></tr>";
125 //Now print the Metacourse tr
127 echo "<td align=\"right\"><b>";
128 echo get_string ("metacourse").":";
129 echo "</b></td><td>";
130 $meta_options[0] = get_string("no");
131 $meta_options[1] = get_string("yes");
132 choose_from_menu($meta_options, "backup_metacourse", $backup_metacourse, "");
136 echo '<input type="hidden" name="backup_metacourse" value="0" />';
140 //Now print the Users tr
142 echo "<td align=\"right\"><b>";
143 echo get_string("users").":";
144 echo "</b></td><td>";
145 $user_options[0] = get_string("all");
146 $user_options[1] = get_string("course");
147 $user_options[2] = get_string("none");
148 choose_from_menu($user_options, "backup_users", $backup_users, "");
152 echo '<input type="hidden" name="backup_users" value="0" />';
156 //Now print the Logs tr
158 echo "<td align=\"right\"><b>";
159 echo get_string("logs").":";
160 echo "</b></td><td>";
161 $log_options[0] = get_string("no");
162 $log_options[1] = get_string("yes");
163 choose_from_menu($log_options, "backup_logs", $backup_logs, "");
167 echo '<input type="hidden" name="backup_logs" value="0" />';
171 //Now print the User Files tr
173 echo "<td align=\"right\"><b>";
174 echo get_string ("userfiles").":";
175 echo "</b></td><td>";
176 $user_file_options[0] = get_string("no");
177 $user_file_options[1] = get_string("yes");
178 choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
182 echo '<input type="hidden" name="backup_user_files" value="0" />';
184 //Now print the Course Files tr
186 echo "<td align=\"right\"><b>";
187 echo get_string ("coursefiles").":";
188 echo "</b></td><td>";
189 $course_file_options[0] = get_string("no");
190 $course_file_options[1] = get_string("yes");
191 choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
194 if (empty($to) && $course->id
== SITEID
) {
195 //If we are in a SITEID backup print the Messages tr
197 echo "<td align=\"right\"><b>";
198 echo get_string ('messages','message').":";
199 echo "</b></td><td>";
200 $mess_options[0] = get_string("no");
201 $mess_options[1] = get_string("yes");
202 choose_from_menu($mess_options, "backup_messages", $backup_messages, "");
206 echo '<input type="hidden" name="backup_messages" value="0" />';
213 <input type=
"hidden" name=
"id" value=
"<?php p($id) ?>" />
214 <input type
="hidden" name
="to" value
="<?php p($to) ?>" />
215 <input type
="hidden" name
="launch" value
="check" />
216 <input type
="submit" value
="<?php print_string("continue") ?>" />
217 <input type
="submit" name
="cancel" value
="<?php print_string("cancel
") ?>" />