]> git.mjollnir.org Git - moodle.git/commitdiff
Check page finished (all mods except quiz).
authorstronk7 <stronk7>
Fri, 2 May 2003 17:22:18 +0000 (17:22 +0000)
committerstronk7 <stronk7>
Fri, 2 May 2003 17:22:18 +0000 (17:22 +0000)
backup/STATUS.txt
backup/check.html
backup/mod/journal/backuplib.php [new file with mode: 0644]
backup/mod/pgassignment/backuplib.php [new file with mode: 0644]
backup/mod/resource/backuplib.php
backup/mod/survey/backuplib.php [new file with mode: 0644]

index 71ff087feb7e1e8dcd9fb7ae90a51d1de1a86330..9dff24375d0b1303f515d265f9fdf24ce34a3277 100644 (file)
@@ -50,11 +50,11 @@ Backup Details:
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
                  + files........................................NO EXISTS
-              x journals........................................NO EXISTS
+              x journals........................................IN PROGRESS
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
                  + files........................................NO EXISTS
-              x peer graded assignments.........................NO EXISTS
+              x peer graded assignments.........................IN PROGRESS
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
                  + files........................................NO EXISTS
@@ -62,21 +62,22 @@ Backup Details:
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
                  + files........................................NO EXISTS
-              x resources.......................................NO EXISTS
+              x resources.......................................IN PROGRESS
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
                  + files........................................NO EXISTS
-              x surveys.........................................NO EXISTS
+              x surveys.........................................IN PROGRESS
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
+                 + files........................................NO EXISTS
    - Compress the backup (zip)..................................NO EXISTS
       - XML File................................................NO EXISTS
       - Course Files............................................NO EXISTS
       - User Files..............................................NO EXISTS
-   - Browse backup files........................................NO EXISTS
+   - Browse backup files........................................DONE. TO FILE MANAGER
    - Obtain info about backup files.............................NO EXISTS
-   - Download backup files......................................NO EXISTS
-   - Delete backup files........................................NO EXISTS
+   - Download backup files......................................DONE. TO FILE MANAGER
+   - Delete backup files........................................DONE. TO FILE MANAGER
    - Program automatic backups..................................NO EXISTS
 
 Restore Details:
@@ -143,7 +144,7 @@ Restore Details:
       - Course Files............................................NO EXISTS
       - User Files..............................................NO EXISTS
    - Obtain info about backup files.............................NO EXISTS
-   - Upload backup files........................................NO EXISTS
+   - Upload backup files........................................DONE. TO FILE MANAGER
 
 ========== ========== ========== =========== =========== =========== ===
 
index c43609f2b191285e2b4eff09c54a16e0a9c477c9..9a4f371b8dc7375dfc9854df6dc17e536f99e976 100644 (file)
     }
     //Calculate the format string
     $backup_name_format = get_string("backupnameformat");
-    //If non-translated, use "%%Y%%m%%d-%%H%%M"
+    //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 .= "-".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 temp dir name to do all the work
+    $tempdir_name = userdate(time(),"%Y%m%d%H%M",99,false);
+    //Add as hidden name
+    echo "<input type=\"hidden\" name=\"tempdir_name\" value=\"".$tempdir_name."\">";
+    
     //Line
     echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
 
diff --git a/backup/mod/journal/backuplib.php b/backup/mod/journal/backuplib.php
new file mode 100644 (file)
index 0000000..ae22a46
--- /dev/null
@@ -0,0 +1,78 @@
+<?PHP //$Id$
+    //This php script contains all the stuff to backup/restore
+    //journal mods
+
+    //This is the "graphical" structure of the journal mod:
+    //
+    //                      journal                                      
+    //                    (CL,pk->id)
+    //                        |
+    //                        |
+    //                        |
+    //                   journal_entries 
+    //               (UL,pk->id, fk->journal)     
+    //
+    // Meaning: pk->primary key field of the table
+    //          fk->foreign key to link with parent
+    //          nt->nested field (recursive data)
+    //          CL->course level info
+    //          UL->user level info
+    //          files->table may have files)
+    //
+    //-----------------------------------------------------------
+
+    function journal_backup_mods($course,$user_data=false) {
+        print "hola";
+    }
+   
+   ////Return an array of info (name,value)
+   function journal_check_backup_mods($course,$user_data=false) {
+        //First the course data
+        $info[0][0] = get_string("modulenameplural","journal");
+        if ($ids = journal_ids ($course)) {
+            $info[0][1] = count($ids);
+        } else {
+            $info[0][1] = 0;
+        }
+
+        //Now, if requested, the user_data
+        if ($user_data) {
+            $info[1][0] = get_string("entries","journal");
+            if ($ids = journal_entry_ids_by_course ($course)) {
+                $info[1][1] = count($ids);
+            } else {
+                $info[1][1] = 0;
+            }
+        }
+        return $info;
+    }
+
+
+
+
+
+
+    // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
+
+    //Returns an array of journals id
+    function journal_ids ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT a.id, a.course
+                                 FROM {$CFG->prefix}journal a
+                                 WHERE a.course = '$course'");
+    }
+   
+    //Returns an array of journal entries id
+    function journal_entry_ids_by_course ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT s.id , s.journal
+                                 FROM {$CFG->prefix}journal_entries s,
+                                      {$CFG->prefix}journal a
+                                 WHERE a.course = '$course' AND
+                                       s.journal = a.id");
+    }
+?>
diff --git a/backup/mod/pgassignment/backuplib.php b/backup/mod/pgassignment/backuplib.php
new file mode 100644 (file)
index 0000000..267ce47
--- /dev/null
@@ -0,0 +1,125 @@
+<?PHP //$Id$
+    //This php script contains all the stuff to backup/restore
+    //pgassignment mods
+
+    //This is the "graphical" structure of the pgassignment mod:
+    //
+    //                        pgassignment                                      
+    //                        (CL,pk->id)
+    //                            |
+    //             -----------------------------------        
+    //             |                                 |
+    //     pgassignment_elements            pgassignment_submissions
+    //  (CL,pk->id, fk->pgassignment)   (UL,pk->id, fk->pgassignment,files)
+    //                                               |
+    //                                               |
+    //                                               |
+    //                                       pgasignments_grades
+    //                                  (UL,pk->id,fk->submission) 
+    //
+    // Meaning: pk->primary key field of the table
+    //          fk->foreign key to link with parent
+    //          nt->nested field (recursive data)
+    //          CL->course level info
+    //          UL->user level info
+    //          files->table may have files)
+    //
+    //-----------------------------------------------------------
+
+    function pgassignment_backup_mods($course,$user_data=false) {
+        print "hola";
+    }
+
+   ////Return an array of info (name,value)
+   function pgassignment_check_backup_mods($course,$user_data=false) {
+        //First the course data
+        $info[0][0] = get_string("modulenameplural","pgassignment");
+        if ($ids = pgassignment_ids ($course)) {
+            $info[0][1] = count($ids);
+        } else {
+            $info[0][1] = 0;
+        }
+        //Elements
+        $info[1][0] = get_string("elements","pgassignment");
+        if ($ids = pgassignment_element_ids_by_course ($course)) { 
+            $info[1][1] = count($ids);
+        } else {
+            $info[1][1] = 0;
+        }
+
+        //Now, if requested, the user_data
+        if ($user_data) {
+            //Submissions
+            $info[2][0] = get_string("submissions","pgassignment");
+            if ($ids = pgassignment_submission_ids_by_course ($course)) {
+                $info[2][1] = count($ids);
+            } else {
+                $info[2][1] = 0;
+            }
+            //Grades
+            $info[3][0] = get_string("grades","pgassignment");
+            if ($ids = pgassignment_grade_ids_by_course ($course)) {
+                $info[3][1] = count($ids);
+            } else {
+                $info[3][1] = 0;
+            }
+        }
+        return $info;
+    }
+
+
+
+
+
+
+    // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
+
+    //Returns an array of pgassignments id
+    function pgassignment_ids ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT a.id, a.course
+                                 FROM {$CFG->prefix}pgassignment a
+                                 WHERE a.course = '$course'");
+    }
+
+    //Returns an array of pgassignment elements id
+    function pgassignment_element_ids_by_course ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT s.id , s.pgassignment
+                                 FROM {$CFG->prefix}pgassignment_elements s,
+                                      {$CFG->prefix}pgassignment a
+                                 WHERE a.course = '$course' AND
+                                       s.pgassignment = a.id");
+    }
+
+    //Returns an array of pgassignment submissions id
+    function pgassignment_submission_ids_by_course ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT s.id , s.pgassignment
+                                 FROM {$CFG->prefix}pgassignment_submissions s,
+                                      {$CFG->prefix}pgassignment a
+                                 WHERE a.course = '$course' AND
+                                       s.pgassignment = a.id");
+    }
+
+    //Returns an array of pgassignment grades id
+    function pgassignment_grade_ids_by_course ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT g.id , g.submission, s.pgassignment
+                                 FROM {$CFG->prefix}pgassignment_grades g,
+                                      {$CFG->prefix}pgassignment_submissions s,
+                                      {$CFG->prefix}pgassignment a
+                                 WHERE a.course = '$course' AND
+                                       s.pgassignment = a.id AND
+                                       g.submission = s.id");
+    }
+
+?>
index ffb070081f68f9dd6aa419892c4d3e6d9a6f114c..f7581496304cdb992b296465f9818bc2589fa2bb 100644 (file)
@@ -24,7 +24,7 @@
    function resource_check_backup_mods($course,$user_data=false) {
         //First the course data
         $info[0][0] = get_string("modulenameplural","resource");
-        if ($ids = choice_ids ($course)) {
+        if ($ids = resource_ids ($course)) {
             $info[0][1] = count($ids);
         } else {
             $info[0][1] = 0;
@@ -41,7 +41,7 @@
     // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
 
     //Returns an array of resources id
-    function resources_ids ($course) {
+    function resource_ids ($course) {
 
         global $CFG;
 
diff --git a/backup/mod/survey/backuplib.php b/backup/mod/survey/backuplib.php
new file mode 100644 (file)
index 0000000..f407402
--- /dev/null
@@ -0,0 +1,81 @@
+<?PHP //$Id$
+    //This php script contains all the stuff to backup/restore
+    //survey mods
+
+    //This is the "graphical" structure of the survey mod:
+    //                                                    --------------------
+    //                           survey                   | survey_questions |
+    //                        (CL,pk->id)                 |(CL,pk->id,?????) |
+    //                            |                       --------------------
+    //                            |
+    //             -----------------------------------        
+    //             |                                 |
+    //        survey_analysis                   survey_answers
+    //    (UL,pk->id, fk->survey)           (UL,pk->id, fk->survey)
+    //
+    // Meaning: pk->primary key field of the table
+    //          fk->foreign key to link with parent
+    //          nt->nested field (recursive data)
+    //          CL->course level info
+    //          UL->user level info
+    //          files->table may have files)
+    //
+    //-----------------------------------------------------------
+
+    function survey_backup_mods() {
+        print "hola";
+    }
+
+   ////Return an array of info (name,value)
+   function survey_check_backup_mods($course,$user_data=false) {
+        //First the course data
+        $info[0][0] = get_string("modulenameplural","survey");
+        if ($ids = survey_ids ($course)) {
+            $info[0][1] = count($ids);
+        } else {
+            $info[0][1] = 0;
+        }
+
+        //Now, if requested, the user_data
+        if ($user_data) {
+            //Subscriptions
+            $info[1][0] = get_string("answers","survey");
+            if ($ids = survey_answer_ids_by_course ($course)) {
+                $info[1][1] = count($ids);
+            } else {
+                $info[1][1] = 0;
+            }
+        }
+        return $info;
+    }
+
+
+
+
+
+
+    // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
+
+    //Returns an array of surveys id
+    function survey_ids ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT a.id, a.course
+                                 FROM {$CFG->prefix}survey a
+                                 WHERE a.course = '$course'");
+    }
+
+    //Returns an array of survey answer id
+    function survey_answer_ids_by_course ($course) {
+
+        global $CFG;
+
+        return get_records_sql ("SELECT s.id , s.survey
+                                 FROM {$CFG->prefix}survey_answers s,
+                                      {$CFG->prefix}forum a
+                                 WHERE a.course = '$course' AND
+                                       s.survey = a.id");
+    }
+
+?>