File: backuplib.php

package info (click to toggle)
moodle 1.4.4.dfsg.1-3sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 57,876 kB
  • ctags: 29,496
  • sloc: php: 271,617; sql: 5,084; xml: 702; perl: 638; sh: 403; java: 283; makefile: 42; pascal: 21
file content (51 lines) | stat: -rw-r--r-- 1,929 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?PHP //$Id: backuplib.php,v 1.2 2003/09/14 15:47:36 stronk7 Exp $
    //This php script contains all the stuff to backup/restore
    //label mods

    //This is the "graphical" structure of the label mod:
    //
    //                       label
    //                     (CL,pk->id)
    //
    // 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)
    //
    //-----------------------------------------------------------

    //This function executes all the backup procedure about this mod
    function label_backup_mods($bf,$preferences) {
        global $CFG;

        $status = true; 

        ////Iterate over label table
        if ($labels = get_records ("label","course", $preferences->backup_course,"id")) {
            foreach ($labels as $label) {
                //Start mod
                fwrite ($bf,start_tag("MOD",3,true));
                //Print assignment data
                fwrite ($bf,full_tag("ID",4,false,$label->id));
                fwrite ($bf,full_tag("MODTYPE",4,false,"label"));
                fwrite ($bf,full_tag("NAME",4,false,$label->name));
                fwrite ($bf,full_tag("CONTENT",4,false,$label->content));
                fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$label->timemodified));
                //End mod
                $status = fwrite ($bf,end_tag("MOD",3,true));
            }
        }
        return $status;
    }
   
    ////Return an array of info (name,value)
    function label_check_backup_mods($course,$user_data=false,$backup_unique_code) {
         //First the course data
         $info[0][0] = get_string("modulenameplural","label");
         $info[0][1] = count_records("label", "course", "$course");
         return $info;
    } 

?>