]> git.mjollnir.org Git - moodle.git/commitdiff
Renamed from check.html, execute.html and backup.html to avoid
authorstronk7 <stronk7>
Sun, 4 May 2003 21:29:27 +0000 (21:29 +0000)
committerstronk7 <stronk7>
Sun, 4 May 2003 21:29:27 +0000 (21:29 +0000)
problems when doing restore.
Old files deleted from CVS

backup/backup_check.html [new file with mode: 0644]
backup/backup_execute.html [new file with mode: 0644]
backup/backup_form.html [new file with mode: 0644]

diff --git a/backup/backup_check.html b/backup/backup_check.html
new file mode 100644 (file)
index 0000000..a2660ed
--- /dev/null
@@ -0,0 +1,202 @@
+<?PHP //$Id$
+    //This page prints the backup todo list to see everything
+
+   //Checks for the required files/functions to backup every mod
+    //And check if there is data about it
+    $count = 0;
+    if ($allmods = get_records("modules") ) {
+        foreach ($allmods as $mod) {
+            $modname = $mod->name;
+            $modfile = "$mods_home/$modname/backuplib.php";
+            $modbackup = $modname."_backup_mods";
+            $modcheckbackup = $modname."_check_backup_mods";
+            if (file_exists($modfile)) {
+               include_once($modfile);
+               if (function_exists($modbackup) and function_exists($modcheckbackup)) {
+                   $var = "exists_".$modname;
+                   $$var = true;
+                   $count++;
+               }
+            }
+            //Check data
+            //Check module info
+            $var = "backup_".$modname;
+            if (!isset($$var)) {
+                $$var = 1;
+            }
+            //Check include user info
+            $var = "backup_user_info_".$modname;
+            if (!isset($$var)) {
+                $$var = 1;
+            }
+        }
+    }
+
+    //Check other parameters
+    if (!isset($backup_users)) {
+        $backup_users = 1;
+    }
+   
+    if (!isset($backup_logs)) {
+        $backup_logs = 1;
+    }
+
+    if (!isset($backup_user_files)) {
+        $backup_user_files = 1;
+   }
+
+    if (!isset($backup_course_files)) {
+        $backup_course_files = 2;
+    }
+
+    if ($count == 0) {
+        notice("No backupable modules are installed!");
+    }
+
+?>
+
+<form name="form" method="post" <?=$onsubmit ?> action="<?=$ME ?>">
+<table cellpadding=5>
+<?
+
+    //Now print the Backup Name tr
+    echo "<tr>";
+    echo "<td align=\"right\"><P><B>";
+    echo get_string("name").":";
+    echo "</B></td><td>";
+    //Calculate the backup string
+    $backup_name = strtolower(get_string("backup"));
+    //If non-translated, use "backup"
+    if (substr($backup_name,0,1) == "[") {
+        $backup_name = "backup";
+    }
+    //Calculate the format string
+    $backup_name_format = get_string("backupnameformat");
+    //If non-translated, use "%Y%m%d-%H%M"
+    if (substr($backup_name_format,0,1) == "[") {
+        $backup_name_format = "%%Y%%m%%d-%%H%%M";
+    }
+    $backup_name .= "-".strtolower($course->shortname)."-".userdate(time(),$backup_name_format,99,false).".zip";
+    echo $backup_name;
+    //Add as hidden name
+    echo "<input type=\"hidden\" name=\"backup_name\" value=\"".$backup_name."\">";
+    echo "</td></tr>";
+
+    //Calculate the backup unique code to allow simultaneus backups (to define
+    //the temp-directory name and records in backup temp tables
+    $backup_unique_code = time();
+    //Add as hidden name
+    echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"".$backup_unique_code."\">";
+    
+    //Line
+    echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+
+    //Now print the To Do list
+    echo "<tr>";    
+    echo "<td colspan=\"2\" align=\"center\"><P><B>";
+    echo get_string("backupdetails").":";
+    echo "</td></tr>";
+
+    //This is tha align to every ingo table                
+    $table->align = array ("LEFT","RIGHT");
+
+    if ($allmods = get_records("modules") ) {
+        foreach ($allmods as $mod) {
+            $modname = $mod->name;
+            $modbackup = $modname."_backup_mods";
+            //If exists the lib & function
+            $var = "exists_".$modname;
+            if ($$var) {
+                //Add hidden fields
+                $var = "backup_".$modname;
+                echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
+                $var = "backup_user_info_".$modname;
+                echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
+                $var = "backup_".$modname;
+                //Only if selected
+                if ($$var == 1) {
+                    //Print the full tr
+                    echo "<tr>";
+                    echo "<td colspan=\"2\"><P><B>";
+                    //Print the mod name
+                    echo "<li>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
+                    //Now look for user-data status
+                    $backup_user_options[0] = get_string("withoutuserdata"); 
+                    $backup_user_options[1] = get_string("withuserdata");
+                    $var = "backup_user_info_".$modname;
+                    //Print the user info
+                    echo $backup_user_options[$$var]."<P>";
+                    //Call the check function to show more info
+                    $modcheckbackup = $modname."_check_backup_mods";
+                    $table->data = $modcheckbackup($id,$$var,$backup_unique_code);
+                    print_table($table); 
+                    echo "</td></tr>";
+                }
+            }
+        }
+        //Line
+        echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+
+        //Now print the Users tr
+        echo "<tr>";
+        echo "<td colspan=\"2\"><P><B>";
+        $user_options[0] = get_string("includeallusers");
+        $user_options[1] = get_string("includecourseusers");
+        ///$user_options[2] = get_string("includeneededusers");--->NOT IMPLEMENTED
+        echo "<li>".$user_options[$backup_users]."<P>";
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_users\" value=\"".$backup_users."\">";
+        //Print info
+        $table->data = user_check_backup($id,$backup_unique_code,$backup_users);  
+        print_table($table); 
+        echo "</td></tr>";
+
+        //Now print the Logs tr conditionally
+        if ($backup_logs) {
+            echo "<tr>";
+            echo "<td colspan=\"2\"><P><B>";
+            echo "<li>".get_string("includelogentries")."<P>";
+            //Print info
+            $table->data = log_check_backup($id);
+            print_table($table);
+            echo "</td></tr>";
+        }
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_logs\" value=\"".$backup_logs."\">";
+
+        //Now print the User Files tr conditionally
+        if ($backup_user_files) {
+            echo "<tr>";
+            echo "<td colspan=\"2\"><P><B>";
+            echo "<li>".get_string("includeuserfiles")."<P>";
+            //Print info
+            $table->data = user_files_check_backup($id,$backup_unique_code);
+            print_table($table);
+            echo "</td></tr>";
+        }
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_user_files\" value=\"".$backup_user_files."\">";
+
+        //Now print the Course Files tr conditionally
+       if ($backup_course_files) {
+            echo "<tr>";
+            echo "<td colspan=\"2\"><P><B>";
+            echo "<li>".get_string("includecoursefiles")."<P>";
+            //Print info
+            $table->data = course_files_check_backup($id,$backup_unique_code);
+            print_table($table);
+            echo "</td></tr>";
+        }
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_course_files\" value=\"".$backup_course_files."\">";
+    }
+?>
+</table>
+<BR>
+<CENTER>
+<input type="hidden" name=id     value="<? p($id) ?>">
+<input type="hidden" name=launch value="execute">
+<input type="submit" value="<? print_string("continue") ?>">
+<input type="submit" name=cancel value="<? print_string("cancel") ?>">
+</CENTER>
+</FORM>
diff --git a/backup/backup_execute.html b/backup/backup_execute.html
new file mode 100644 (file)
index 0000000..a2660ed
--- /dev/null
@@ -0,0 +1,202 @@
+<?PHP //$Id$
+    //This page prints the backup todo list to see everything
+
+   //Checks for the required files/functions to backup every mod
+    //And check if there is data about it
+    $count = 0;
+    if ($allmods = get_records("modules") ) {
+        foreach ($allmods as $mod) {
+            $modname = $mod->name;
+            $modfile = "$mods_home/$modname/backuplib.php";
+            $modbackup = $modname."_backup_mods";
+            $modcheckbackup = $modname."_check_backup_mods";
+            if (file_exists($modfile)) {
+               include_once($modfile);
+               if (function_exists($modbackup) and function_exists($modcheckbackup)) {
+                   $var = "exists_".$modname;
+                   $$var = true;
+                   $count++;
+               }
+            }
+            //Check data
+            //Check module info
+            $var = "backup_".$modname;
+            if (!isset($$var)) {
+                $$var = 1;
+            }
+            //Check include user info
+            $var = "backup_user_info_".$modname;
+            if (!isset($$var)) {
+                $$var = 1;
+            }
+        }
+    }
+
+    //Check other parameters
+    if (!isset($backup_users)) {
+        $backup_users = 1;
+    }
+   
+    if (!isset($backup_logs)) {
+        $backup_logs = 1;
+    }
+
+    if (!isset($backup_user_files)) {
+        $backup_user_files = 1;
+   }
+
+    if (!isset($backup_course_files)) {
+        $backup_course_files = 2;
+    }
+
+    if ($count == 0) {
+        notice("No backupable modules are installed!");
+    }
+
+?>
+
+<form name="form" method="post" <?=$onsubmit ?> action="<?=$ME ?>">
+<table cellpadding=5>
+<?
+
+    //Now print the Backup Name tr
+    echo "<tr>";
+    echo "<td align=\"right\"><P><B>";
+    echo get_string("name").":";
+    echo "</B></td><td>";
+    //Calculate the backup string
+    $backup_name = strtolower(get_string("backup"));
+    //If non-translated, use "backup"
+    if (substr($backup_name,0,1) == "[") {
+        $backup_name = "backup";
+    }
+    //Calculate the format string
+    $backup_name_format = get_string("backupnameformat");
+    //If non-translated, use "%Y%m%d-%H%M"
+    if (substr($backup_name_format,0,1) == "[") {
+        $backup_name_format = "%%Y%%m%%d-%%H%%M";
+    }
+    $backup_name .= "-".strtolower($course->shortname)."-".userdate(time(),$backup_name_format,99,false).".zip";
+    echo $backup_name;
+    //Add as hidden name
+    echo "<input type=\"hidden\" name=\"backup_name\" value=\"".$backup_name."\">";
+    echo "</td></tr>";
+
+    //Calculate the backup unique code to allow simultaneus backups (to define
+    //the temp-directory name and records in backup temp tables
+    $backup_unique_code = time();
+    //Add as hidden name
+    echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"".$backup_unique_code."\">";
+    
+    //Line
+    echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+
+    //Now print the To Do list
+    echo "<tr>";    
+    echo "<td colspan=\"2\" align=\"center\"><P><B>";
+    echo get_string("backupdetails").":";
+    echo "</td></tr>";
+
+    //This is tha align to every ingo table                
+    $table->align = array ("LEFT","RIGHT");
+
+    if ($allmods = get_records("modules") ) {
+        foreach ($allmods as $mod) {
+            $modname = $mod->name;
+            $modbackup = $modname."_backup_mods";
+            //If exists the lib & function
+            $var = "exists_".$modname;
+            if ($$var) {
+                //Add hidden fields
+                $var = "backup_".$modname;
+                echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
+                $var = "backup_user_info_".$modname;
+                echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
+                $var = "backup_".$modname;
+                //Only if selected
+                if ($$var == 1) {
+                    //Print the full tr
+                    echo "<tr>";
+                    echo "<td colspan=\"2\"><P><B>";
+                    //Print the mod name
+                    echo "<li>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
+                    //Now look for user-data status
+                    $backup_user_options[0] = get_string("withoutuserdata"); 
+                    $backup_user_options[1] = get_string("withuserdata");
+                    $var = "backup_user_info_".$modname;
+                    //Print the user info
+                    echo $backup_user_options[$$var]."<P>";
+                    //Call the check function to show more info
+                    $modcheckbackup = $modname."_check_backup_mods";
+                    $table->data = $modcheckbackup($id,$$var,$backup_unique_code);
+                    print_table($table); 
+                    echo "</td></tr>";
+                }
+            }
+        }
+        //Line
+        echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+
+        //Now print the Users tr
+        echo "<tr>";
+        echo "<td colspan=\"2\"><P><B>";
+        $user_options[0] = get_string("includeallusers");
+        $user_options[1] = get_string("includecourseusers");
+        ///$user_options[2] = get_string("includeneededusers");--->NOT IMPLEMENTED
+        echo "<li>".$user_options[$backup_users]."<P>";
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_users\" value=\"".$backup_users."\">";
+        //Print info
+        $table->data = user_check_backup($id,$backup_unique_code,$backup_users);  
+        print_table($table); 
+        echo "</td></tr>";
+
+        //Now print the Logs tr conditionally
+        if ($backup_logs) {
+            echo "<tr>";
+            echo "<td colspan=\"2\"><P><B>";
+            echo "<li>".get_string("includelogentries")."<P>";
+            //Print info
+            $table->data = log_check_backup($id);
+            print_table($table);
+            echo "</td></tr>";
+        }
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_logs\" value=\"".$backup_logs."\">";
+
+        //Now print the User Files tr conditionally
+        if ($backup_user_files) {
+            echo "<tr>";
+            echo "<td colspan=\"2\"><P><B>";
+            echo "<li>".get_string("includeuserfiles")."<P>";
+            //Print info
+            $table->data = user_files_check_backup($id,$backup_unique_code);
+            print_table($table);
+            echo "</td></tr>";
+        }
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_user_files\" value=\"".$backup_user_files."\">";
+
+        //Now print the Course Files tr conditionally
+       if ($backup_course_files) {
+            echo "<tr>";
+            echo "<td colspan=\"2\"><P><B>";
+            echo "<li>".get_string("includecoursefiles")."<P>";
+            //Print info
+            $table->data = course_files_check_backup($id,$backup_unique_code);
+            print_table($table);
+            echo "</td></tr>";
+        }
+        //Add as hidden name
+        echo "<input type=\"hidden\" name=\"backup_course_files\" value=\"".$backup_course_files."\">";
+    }
+?>
+</table>
+<BR>
+<CENTER>
+<input type="hidden" name=id     value="<? p($id) ?>">
+<input type="hidden" name=launch value="execute">
+<input type="submit" value="<? print_string("continue") ?>">
+<input type="submit" name=cancel value="<? print_string("cancel") ?>">
+</CENTER>
+</FORM>
diff --git a/backup/backup_form.html b/backup/backup_form.html
new file mode 100644 (file)
index 0000000..7996fdb
--- /dev/null
@@ -0,0 +1,137 @@
+<?PHP //$Id$
+    //This page prints the backup form to select everything
+
+   //Checks for the required files/functions to backup every mod
+    //And check if there is data about it 
+    $count = 0;
+    if ($allmods = get_records("modules") ) {
+        foreach ($allmods as $mod) {
+            $modname = $mod->name;
+            $modfile = "$mods_home/$modname/backuplib.php";
+            $modbackup = $modname."_backup_mods";
+            $modcheckbackup = $modname."_check_backup_mods";
+            if (file_exists($modfile)) {
+               include_once($modfile);
+               if (function_exists($modbackup) and function_exists($modcheckbackup)) {
+                   $var = "exists_".$modname;
+                   $$var = true;
+                   $count++;
+               }
+            }
+            //Check data
+            //Check module info
+            $var = "backup_".$modname;
+            if (!isset($$var)) {
+                $$var = 1;
+            }
+            //Check include user info
+            $var = "backup_user_info_".$modname;
+            if (!isset($$var)) {
+                $$var = 1;
+            }
+        }
+    }
+
+    //Check other parameters
+    if (!isset($backup_users)) {
+        $backup_users = 1;
+    }
+   
+    if (!isset($backup_logs)) {
+        $backup_logs = 1;
+    }
+
+    if (!isset($backup_user_files)) {
+        $backup_user_files = 1;
+    }
+
+    if (!isset($backup_course_files)) {
+        $backup_course_files = 1;
+    }
+
+    if ($count == 0) {
+        notice("No backupable modules are installed!");
+    }
+
+?>
+
+<form name="form" method="post" <?=$onsubmit ?> action="<?=$ME ?>">
+<table cellpadding=5>
+<?
+    if ($allmods = get_records("modules") ) {
+        foreach ($allmods as $mod) {
+            $modname = $mod->name;
+            $modbackup = $modname."_backup_mods";
+            //If exists the lib & function
+            $var = "exists_".$modname;
+            if ($$var) {
+                //Print the full tr
+                echo "<tr>";
+                echo "<td align=\"right\"><P><B>";
+                echo get_string("include")." ". get_string("modulenameplural",$modname).":";
+                echo "</td><td>";
+                $backup_options[0] = get_string("no"); 
+                $backup_options[1] = get_string("yes");
+                $var = "backup_".$modname;
+                choose_from_menu($backup_options, $var, $$var, "");
+                $backup_user_options[0] = get_string("withoutuserdata"); 
+                $backup_user_options[1] = get_string("withuserdata");
+                $var = "backup_user_info_".$modname;
+                choose_from_menu($backup_user_options, $var, $$var, "");
+                echo "</td></tr>";
+            }
+        }
+        //Line
+        echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+
+        //Now print the Users tr
+        echo "<tr>";
+        echo "<td align=\"right\"><P><B>";
+        echo get_string("users").":";
+        echo "</td><td>";
+        $user_options[0] = get_string("all");
+        $user_options[1] = get_string("course");
+        //$user_options[2] = get_string("needed");-->NOT IMPLEMENTED
+        choose_from_menu($user_options, "backup_users", $backup_users, "");
+        echo "</td></tr>";
+
+        //Now print the Logs tr
+        echo "<tr>";
+        echo "<td align=\"right\"><P><B>";
+        echo get_string("logs").":";                                               
+        echo "</td><td>";
+        $log_options[0] = get_string("no");
+        $log_options[1] = get_string("yes"); 
+        choose_from_menu($log_options, "backup_logs", $backup_logs, ""); 
+        echo "</td></tr>";
+
+        //Now print the User Files tr
+        echo "<tr>";
+        echo "<td align=\"right\"><P><B>";
+        echo get_string ("userfiles").":";
+        echo "</td><td>";
+        $user_file_options[0] = get_string("no"); 
+        $user_file_options[1] = get_string("yes"); 
+        choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
+        echo "</td></tr>";
+
+        //Now print the Course Files tr
+        echo "<tr>";
+        echo "<td align=\"right\"><P><B>";
+        echo get_string ("coursefiles").":";
+        echo "</td><td>";
+        $course_file_options[0] = get_string("no");
+        $course_file_options[1] = get_string("yes");
+        choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
+        echo "</td></tr>";
+    }
+?>
+</table>
+<BR>
+<CENTER>
+<input type="hidden" name=id     value="<? p($id) ?>">
+<input type="hidden" name=launch value="check">
+<input type="submit" value="<? print_string("continue") ?>">
+<input type="submit" name=cancel value="<? print_string("cancel") ?>">
+</CENTER>
+</FORM>