Removing debug error_log calls in uploadlib
[moodle.git] / backup / backup_form.html
CommitLineData
7ef0797d 1<?php //$Id$
a615cc7b 2 //This page prints the backup form to select everything
3
c563a9a0 4 //Check login
5 require_login();
6
bd38123e 7 if (!empty($course->id)) {
63bcc9b5 8 if (!isteacheredit($course->id)) {
bd38123e 9 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
10 }
11 } else {
12 if (!isadmin()) {
13 error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
14 }
c563a9a0 15 }
16
17 //Check site
18 if (!$site = get_site()) {
19 error("Site not found!");
20 }
21
a615cc7b 22 //Checks for the required files/functions to backup every mod
23 //And check if there is data about it
24 $count = 0;
25 if ($allmods = get_records("modules") ) {
26 foreach ($allmods as $mod) {
27 $modname = $mod->name;
9c1ae5ae 28 $modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
a615cc7b 29 $modbackup = $modname."_backup_mods";
30 $modcheckbackup = $modname."_check_backup_mods";
31 if (file_exists($modfile)) {
32 include_once($modfile);
33 if (function_exists($modbackup) and function_exists($modcheckbackup)) {
34 $var = "exists_".$modname;
35 $$var = true;
36 $count++;
37 }
38 }
39 //Check data
40 //Check module info
41 $var = "backup_".$modname;
42 if (!isset($$var)) {
43 $$var = 1;
44 }
45 //Check include user info
46 $var = "backup_user_info_".$modname;
47 if (!isset($$var)) {
48 $$var = 1;
49 }
50 }
51 }
52
53 //Check other parameters
54 if (!isset($backup_users)) {
55 $backup_users = 1;
56 }
57
58 if (!isset($backup_logs)) {
042c19f5 59 $backup_logs = 0;
a615cc7b 60 }
61
62 if (!isset($backup_user_files)) {
63 $backup_user_files = 1;
64 }
65
66 if (!isset($backup_course_files)) {
67 $backup_course_files = 1;
68 }
69
70 if ($count == 0) {
71 notice("No backupable modules are installed!");
72 }
73
74?>
75
0e232d18 76<form name="form" method="post" action="<?php echo $ME ?>">
7ef0797d 77<table cellpadding="5">
145cb8f9 78<?php
a615cc7b 79 if ($allmods = get_records("modules") ) {
80 foreach ($allmods as $mod) {
81 $modname = $mod->name;
82 $modbackup = $modname."_backup_mods";
83 //If exists the lib & function
84 $var = "exists_".$modname;
142a6a46 85 if (isset($$var) && $$var) {
a615cc7b 86 //Print the full tr
87 echo "<tr>";
7ef0797d 88 echo "<td align=\"right\"><p><b>";
a615cc7b 89 echo get_string("include")." ". get_string("modulenameplural",$modname).":";
90 echo "</td><td>";
91 $backup_options[0] = get_string("no");
92 $backup_options[1] = get_string("yes");
93 $var = "backup_".$modname;
94 choose_from_menu($backup_options, $var, $$var, "");
95 $backup_user_options[0] = get_string("withoutuserdata");
96 $backup_user_options[1] = get_string("withuserdata");
97 $var = "backup_user_info_".$modname;
98 choose_from_menu($backup_user_options, $var, $$var, "");
99 echo "</td></tr>";
100 }
101 }
102 //Line
103 echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
104
105 //Now print the Users tr
106 echo "<tr>";
7ef0797d 107 echo "<td align=\"right\"><p><b>";
a615cc7b 108 echo get_string("users").":";
109 echo "</td><td>";
110 $user_options[0] = get_string("all");
111 $user_options[1] = get_string("course");
fa96ad2f 112 $user_options[2] = get_string("none");
a615cc7b 113 choose_from_menu($user_options, "backup_users", $backup_users, "");
114 echo "</td></tr>";
115
116 //Now print the Logs tr
117 echo "<tr>";
7ef0797d 118 echo "<td align=\"right\"><p><b>";
a615cc7b 119 echo get_string("logs").":";
120 echo "</td><td>";
121 $log_options[0] = get_string("no");
122 $log_options[1] = get_string("yes");
123 choose_from_menu($log_options, "backup_logs", $backup_logs, "");
124 echo "</td></tr>";
125
126 //Now print the User Files tr
127 echo "<tr>";
7ef0797d 128 echo "<td align=\"right\"><p><b>";
a615cc7b 129 echo get_string ("userfiles").":";
130 echo "</td><td>";
131 $user_file_options[0] = get_string("no");
132 $user_file_options[1] = get_string("yes");
133 choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
134 echo "</td></tr>";
135
136 //Now print the Course Files tr
137 echo "<tr>";
7ef0797d 138 echo "<td align=\"right\"><p><b>";
a615cc7b 139 echo get_string ("coursefiles").":";
140 echo "</td><td>";
141 $course_file_options[0] = get_string("no");
142 $course_file_options[1] = get_string("yes");
143 choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
144 echo "</td></tr>";
145 }
146?>
147</table>
7ef0797d 148<br />
149<center>
150<input type="hidden" name="id" value="<?php p($id) ?>">
151<input type="hidden" name="launch" value="check">
76eac7a5 152<input type="submit" value="<?php print_string("continue") ?>">
7ef0797d 153<input type="submit" name="cancel" value="<?php print_string("cancel") ?>">
154</center>
155</form>