예제 #1
0
function backup_course_sections($bf, $preferences)
{
    global $CFG;
    $status = true;
    //Get info from sections
    $section = false;
    if ($sections = get_records("course_sections", "course", $preferences->backup_course, "section")) {
        //Section open tag
        fwrite($bf, start_tag("SECTIONS", 2, true));
        //Iterate over every section (ordered by section)
        foreach ($sections as $section) {
            //Begin Section
            fwrite($bf, start_tag("SECTION", 3, true));
            fwrite($bf, full_tag("ID", 4, false, $section->id));
            fwrite($bf, full_tag("NUMBER", 4, false, $section->section));
            fwrite($bf, full_tag("SUMMARY", 4, false, $section->summary));
            fwrite($bf, full_tag("VISIBLE", 4, false, $section->visible));
            //Now print the mods in section
            backup_course_modules($bf, $preferences, $section);
            //End section
            fwrite($bf, end_tag("SECTION", 3, true));
        }
        //Section close tag
        $status = fwrite($bf, end_tag("SECTIONS", 2, true));
    }
    return $status;
}
 protected function xmlSetSection($xml)
 {
     fwrite($xml, start_tag('SECTIONS', 2, TRUE));
     fwrite($xml, start_tag('SECTION', 3, TRUE));
     fwrite($xml, full_tag('ID', 4, FALSE, $this->section->id));
     fwrite($xml, full_tag('NUMBER', 4, FALSE, $this->section->section));
     fwrite($xml, full_tag('SUMMARY', 4, FALSE, $this->section->summary));
     fwrite($xml, full_tag('VISIBLE', 4, FALSE, $this->section->visible));
     // E_NOTICE レベルの警告 "Undefined index" を一時的に抑制
     $prev_error_level = error_reporting(error_reporting() & ~E_NOTICE & ~E_STRICT);
     backup_course_modules($xml, $this->prefs, $this->section);
     error_reporting($prev_error_level);
     fwrite($xml, end_tag('SECTION', 3, TRUE));
     fwrite($xml, end_tag('SECTIONS', 2, TRUE));
 }