function liveclassroom_backup_one_mod($bf, $preferences, $liveclassroom)
{
    global $CFG;
    if (is_numeric($liveclassroom)) {
        $liveclassroom = get_record('liveclassroom', 'id', $liveclassroom);
    }
    $status = true;
    $lcAction = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, null, $liveclassroom->course);
    $roomPreview = $lcAction->getRoomPreview($liveclassroom->type);
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print liveclassroom data
    fwrite($bf, full_tag("ID", 4, false, $liveclassroom->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "liveclassroom"));
    fwrite($bf, full_tag("COURSE", 4, false, $liveclassroom->course));
    fwrite($bf, full_tag("NAME", 4, false, $liveclassroom->name));
    if ($lcAction->isStudentAdmin($liveclassroom->course, $liveclassroom->course . '_S') == "true") {
        fwrite($bf, full_tag("ISSTUDENTADMIN", 4, false, "true"));
    } else {
        fwrite($bf, full_tag("ISSTUDENTADMIN", 4, false, "false"));
    }
    fwrite($bf, full_tag("PREVIEW", 4, false, $roomPreview));
    fwrite($bf, full_tag("TYPE", 4, false, $liveclassroom->type));
    fwrite($bf, full_tag("SECTION", 4, false, $liveclassroom->section));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $liveclassroom->timemodified));
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function backup_journal_entries($bf, $preferences, $journal)
{
    global $CFG;
    $status = true;
    $journal_entries = get_records("journal_entries", "journal", $journal, "id");
    //If there is entries
    if ($journal_entries) {
        //Write start tag
        $status = fwrite($bf, start_tag("ENTRIES", 4, true));
        //Iterate over each entry
        foreach ($journal_entries as $jou_ent) {
            //Start entry
            $status = fwrite($bf, start_tag("ENTRY", 5, true));
            //Print journal_entries contents
            fwrite($bf, full_tag("ID", 6, false, $jou_ent->id));
            fwrite($bf, full_tag("USERID", 6, false, $jou_ent->userid));
            fwrite($bf, full_tag("MODIFIED", 6, false, $jou_ent->modified));
            fwrite($bf, full_tag("TEXT", 6, false, $jou_ent->text));
            fwrite($bf, full_tag("FORMAT", 6, false, $jou_ent->format));
            fwrite($bf, full_tag("RATING", 6, false, $jou_ent->rating));
            fwrite($bf, full_tag("ENTRYCOMMENT", 6, false, $jou_ent->entrycomment));
            fwrite($bf, full_tag("TEACHER", 6, false, $jou_ent->teacher));
            fwrite($bf, full_tag("TIMEMARKED", 6, false, $jou_ent->timemarked));
            fwrite($bf, full_tag("MAILED", 6, false, $jou_ent->mailed));
            //End entry
            $status = fwrite($bf, end_tag("ENTRY", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("ENTRIES", 4, true));
    }
    return $status;
}
Example #3
0
function backup_slideshow_captions($bf, $preferences, $slideshow)
{
    global $CFG;
    $status = true;
    $slideshow_captions = get_records("slideshow_captions", "slideshow", $slideshow->instance);
    //If there is captions
    if ($slideshow_captions) {
        //Write start tag
        $status = fwrite($bf, start_tag("CAPTIONS", 4, true));
        //Iterate over each caption
        foreach ($slideshow_captions as $sli_cap) {
            //Start caption
            $status = fwrite($bf, start_tag("CAPTION", 5, true));
            //Print caption contents
            fwrite($bf, full_tag("ID", 6, false, $sli_cap->id));
            fwrite($bf, full_tag("SLIDESHOW", 6, false, $sli_cap->slideshow));
            fwrite($bf, full_tag("IMAGE", 6, false, $sli_cap->image));
            fwrite($bf, full_tag("TITLE", 6, false, $sli_cap->title));
            fwrite($bf, full_tag("CAPTION", 6, false, $sli_cap->caption));
            //End submission
            $status = fwrite($bf, end_tag("CAPTION", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("CAPTIONS", 4, true));
    }
    return $status;
}
function backup_chat_messages($bf, $preferences, $chat)
{
    global $CFG;
    $status = true;
    $chat_messages = get_records("chat_messages", "chatid", $chat, "id");
    //If there is messages
    if ($chat_messages) {
        //Write start tag
        $status = fwrite($bf, start_tag("MESSAGES", 4, true));
        //Iterate over each message
        foreach ($chat_messages as $cha_mes) {
            //Start message
            $status = fwrite($bf, start_tag("MESSAGE", 5, true));
            //Print message contents
            fwrite($bf, full_tag("ID", 6, false, $cha_mes->id));
            fwrite($bf, full_tag("USERID", 6, false, $cha_mes->userid));
            fwrite($bf, full_tag("GROUPID", 6, false, $cha_mes->groupid));
            fwrite($bf, full_tag("SYSTEM", 6, false, $cha_mes->system));
            fwrite($bf, full_tag("MESSAGE_TEXT", 6, false, $cha_mes->message));
            fwrite($bf, full_tag("TIMESTAMP", 6, false, $cha_mes->timestamp));
            //End submission
            $status = fwrite($bf, end_tag("MESSAGE", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("MESSAGES", 4, true));
    }
    return $status;
}
Example #5
0
function wwassignment_backup_one_mod($bf, $preferences, $wwassignment)
{
    //error_log("wwassignment_backup_one_mod");
    ////error_log("preferences ".print_r($preferences,true));
    global $CFG;
    if (is_numeric($wwassignment)) {
        $wwassignment = get_record('wwassignment', 'id', $wwassignment);
    }
    $status = true;
    //             function full_tag($tag,$level=0,$endline=true,$content,$attributes=null) {
    //         //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print wwassignment data
    fwrite($bf, full_tag("ID", 4, false, $wwassignment->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "wwassignment"));
    fwrite($bf, full_tag("NAME", 4, false, $wwassignment->name));
    fwrite($bf, full_tag("DESCRIPTION", 4, false, $wwassignment->description));
    fwrite($bf, full_tag("WEBWORK_SET", 4, false, $wwassignment->webwork_set));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $wwassignment->timemodified));
    //if we've selected to backup users info, then execute backup_assignment_submisions and
    //backup_assignment_files_instance
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    //error_log("end wwassignment_one_backup_mod");
    //error_log("preferences ".print_r($preferences,true));
    return $status;
}
function kaltura_backup_one_mod($bf, $preferences, $resource)
{
    global $CFG;
    if (is_numeric($resource)) {
        $kaltura_entry = get_record('kaltura_entries', 'id', $resource);
    } else {
        $kaltura_entry = get_record('kaltura_entries', 'id', $resource->id);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $kaltura_entry->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "kaltura"));
    fwrite($bf, full_tag("ENTRY_ID", 4, false, $kaltura_entry->entry_id));
    fwrite($bf, full_tag("DIMENSIONS", 4, false, $kaltura_entry->dimensions));
    fwrite($bf, full_tag("SIZE", 4, false, $kaltura_entry->size));
    fwrite($bf, full_tag("CUSTOM_WIDTH", 4, false, $kaltura_entry->custom_width));
    fwrite($bf, full_tag("DESIGN", 4, false, $kaltura_entry->design));
    fwrite($bf, full_tag("TITLE", 4, false, $kaltura_entry->title));
    fwrite($bf, full_tag("CONTEXT", 4, false, $kaltura_entry->context));
    fwrite($bf, full_tag("ENTRY_TYPE", 4, false, $kaltura_entry->entry_type));
    fwrite($bf, full_tag("MEDIA_TYPE", 4, false, $kaltura_entry->media_type));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
Example #7
0
function webscheme_backup_one_mod($bf, $preferences, $ws)
{
    global $CFG;
    if (is_numeric($ws)) {
        $ws = get_record('webscheme', 'id', $ws);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print webscheme data
    fwrite($bf, full_tag("ID", 4, false, $ws->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "webscheme"));
    fwrite($bf, full_tag("NAME", 4, false, $ws->name));
    fwrite($bf, full_tag("INTRO", 4, false, $ws->intro));
    fwrite($bf, full_tag("INTROFORMAT", 4, false, $ws->introformat));
    fwrite($bf, full_tag("TIMECREATED", 4, false, $ws->timecreated));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $ws->timemodified));
    fwrite($bf, full_tag("WS_SETTINGS", 4, false, htmlentities($ws->ws_settings)));
    fwrite($bf, full_tag("WS_EVENTS", 4, false, htmlentities($ws->ws_events)));
    fwrite($bf, full_tag("WS_INITEXPR", 4, false, htmlentities($ws->ws_initexpr)));
    fwrite($bf, full_tag("WS_LOADURLS", 4, false, htmlentities($ws->ws_loadurls)));
    fwrite($bf, full_tag("WS_HTML", 4, false, htmlentities($ws->ws_html)));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
Example #8
0
function resource_backup_one_mod($bf, $preferences, $resource)
{
    global $CFG;
    if (is_numeric($resource)) {
        $resource = get_record('resource', 'id', $resource);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $resource->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "resource"));
    fwrite($bf, full_tag("NAME", 4, false, $resource->name));
    fwrite($bf, full_tag("TYPE", 4, false, $resource->type));
    fwrite($bf, full_tag("REFERENCE", 4, false, $resource->reference));
    fwrite($bf, full_tag("SUMMARY", 4, false, $resource->summary));
    fwrite($bf, full_tag("ALLTEXT", 4, false, $resource->alltext));
    fwrite($bf, full_tag("POPUP", 4, false, $resource->popup));
    fwrite($bf, full_tag("OPTIONS", 4, false, $resource->options));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $resource->timemodified));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    if ($status && ($resource->type == 'file' || $resource->type == 'directory' || $resource->type == 'ims')) {
        // more should go here later!
        // backup files for this resource.
        $status = resource_backup_files($bf, $preferences, $resource);
    }
    return $status;
}
function backup_book_chapters($bf, $preferences, $book)
{
    global $CFG;
    $status = true;
    //Print book's chapters
    if ($chapters = get_records('book_chapters', 'bookid', $book->id, 'id')) {
        //Write start tag
        $status = fwrite($bf, start_tag('CHAPTERS', 4, true));
        foreach ($chapters as $ch) {
            //Start chapter
            fwrite($bf, start_tag('CHAPTER', 5, true));
            //Print chapter data
            fwrite($bf, full_tag('ID', 6, false, $ch->id));
            fwrite($bf, full_tag('PAGENUM', 6, false, $ch->pagenum));
            fwrite($bf, full_tag('SUBCHAPTER', 6, false, $ch->subchapter));
            fwrite($bf, full_tag('TITLE', 6, false, $ch->title));
            fwrite($bf, full_tag('CONTENT', 6, false, $ch->content));
            fwrite($bf, full_tag('HIDDEN', 6, false, $ch->hidden));
            fwrite($bf, full_tag('TIMECREATED', 6, false, $ch->timecreated));
            fwrite($bf, full_tag('TIMEMODIFIED', 6, false, $ch->timemodified));
            fwrite($bf, full_tag('IMPORTSRC', 6, false, $ch->importsrc));
            //End chapter
            $status = fwrite($bf, end_tag('CHAPTER', 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag('CHAPTERS', 4, true));
    }
    return $status;
}
function backup_map_locations($bf, $preferences, $map)
{
    global $CFG;
    $status = true;
    $map_locations = get_records("map_locations", "mapid", $map, "id");
    //If there is locations
    if ($map_locations) {
        //Write start tag
        $status = fwrite($bf, start_tag("LOCATIONS", 4, true));
        //Iterate over each answer
        foreach ($map_locations as $map_location) {
            //Start answer
            $status = fwrite($bf, start_tag("LOCATION", 5, true));
            //Print location contents
            fwrite($bf, full_tag("ID", 6, false, $map_location->id));
            fwrite($bf, full_tag("USERID", 6, false, $map_location->userid));
            fwrite($bf, full_tag("TITLE", 6, false, $map_location->title));
            fwrite($bf, full_tag("SHOWCODE", 6, false, $map_location->showcode));
            fwrite($bf, full_tag("LATITUDE", 6, false, $map_location->latitude));
            fwrite($bf, full_tag("LONGITUDE", 6, false, $map_location->longitude));
            fwrite($bf, full_tag("ADDRESS", 6, false, $map_location->address));
            fwrite($bf, full_tag("CITY", 6, false, $map_location->city));
            fwrite($bf, full_tag("STATE", 6, false, $map_location->state));
            fwrite($bf, full_tag("COUNTRY", 6, false, $map_location->country));
            fwrite($bf, full_tag("TEXT", 6, false, $map_location->text));
            fwrite($bf, full_tag("TIMEMODIFIED", 6, false, $map_location->timemodified));
            //End answer
            $status = fwrite($bf, end_tag("LOCATION", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("LOCATIONS", 4, true));
    }
    return $status;
}
function backup_adobeconnect_meeting_groups($bf, $preferences, $adobeconnectid)
{
    global $CFG;
    // Set status to false because there must be at least one meeting instance
    $status = false;
    // Go through all of the meeting instances and backup each group's meeting
    if ($meetgroups = get_records("adobeconnect_meeting_groups", 'instanceid', $adobeconnectid)) {
        if ($meetgroups) {
            //Write start tag
            $status = fwrite($bf, start_tag("MEETINGGROUPS", 4, true));
            //Iterate over each meeting instance
            foreach ($meetgroups as $meetgroup) {
                //Start of meeting group instance
                $status = fwrite($bf, start_tag("MEETINGGROUP", 5, true));
                fwrite($bf, full_tag("ID", 6, false, $meetgroup->id));
                fwrite($bf, full_tag("INSTANCEID", 6, false, $meetgroup->instanceid));
                fwrite($bf, full_tag("MEETINGSCOID", 6, false, $meetgroup->meetingscoid));
                fwrite($bf, full_tag("GROUPID", 6, false, $meetgroup->groupid));
                //End of meeting group instance
                $status = fwrite($bf, end_tag("MEETINGGROUP", 5, true));
            }
            //Write end tag
            $status = fwrite($bf, end_tag("MEETINGGROUPS", 4, true));
        }
    }
    return $status;
}
 /** 
  * Writes an XML start tag and indents.
  * @param string $tag Name of tag (traditionally upper-case)
  * @param bool $endline If true (default), adds newline after start tag
  * @throws Exception if there's an error writing 
  */
 public function tag_start($tag, $endline = false)
 {
     if (!fwrite($this->bf, start_tag($tag, $this->nestlevel, $endline))) {
         throw new Exception('Failed to write backup data', EXN_LOCAL_BACKUPWRITE);
     }
     $this->stack[$this->nestlevel] = $tag;
     $this->nestlevel++;
 }
/**
 * Format's backup routine
 *
 * @param handler $bf Backup file handler
 * @param object $preferences Backup preferences
 * @return boolean Success
 **/
function topcoll_backup_format_data($bf, $preferences)
{
    $status = true;
    if ($layout = get_record('format_topcoll_layout', 'courseid', $preferences->backup_course)) {
        $status = $status and fwrite($bf, start_tag('LAYOUT', 3, true));
        $status = $status and fwrite($bf, full_tag('LAYOUTELEMENT', 4, false, $layout->layoutelement));
        $status = $status and fwrite($bf, full_tag('LAYOUTSTRUCTURE', 4, false, $layout->layoutstructure));
        $status = $status and fwrite($bf, end_tag('LAYOUT', 3, true));
    }
    return $status;
}
function econsole_backup_one_mod($bf, $preferences, $econsole)
{
    global $CFG;
    if (is_numeric($econsole)) {
        $econsole = get_record('econsole', 'id', $econsole);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print econsole data
    fwrite($bf, full_tag("ID", 4, false, $econsole->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "econsole"));
    fwrite($bf, full_tag("NAME", 4, false, $econsole->name));
    fwrite($bf, full_tag("CONTENT", 4, false, $econsole->content));
    fwrite($bf, full_tag("UNITSTRING", 4, false, $econsole->unitstring));
    fwrite($bf, full_tag("SHOWUNIT", 4, false, $econsole->showunit));
    fwrite($bf, full_tag("LESSONSTRING", 4, false, $econsole->lessonstring));
    fwrite($bf, full_tag("SHOWLESSON", 4, false, $econsole->showlesson));
    fwrite($bf, full_tag("URL1NAME", 4, false, $econsole->url1name));
    fwrite($bf, full_tag("URL1", 4, false, $econsole->url1));
    fwrite($bf, full_tag("URL2NAME", 4, false, $econsole->url2name));
    fwrite($bf, full_tag("URL2", 4, false, $econsole->url2));
    fwrite($bf, full_tag("URL3NAME", 4, false, $econsole->url3name));
    fwrite($bf, full_tag("URL3", 4, false, $econsole->url3));
    fwrite($bf, full_tag("URL4NAME", 4, false, $econsole->url4name));
    fwrite($bf, full_tag("URL4", 4, false, $econsole->url4));
    fwrite($bf, full_tag("URL5NAME", 4, false, $econsole->url5name));
    fwrite($bf, full_tag("URL5", 4, false, $econsole->url5));
    fwrite($bf, full_tag("URL6NAME", 4, false, $econsole->url6name));
    fwrite($bf, full_tag("URL6", 4, false, $econsole->url6));
    fwrite($bf, full_tag("GLOSSARY", 4, false, $econsole->glossary));
    fwrite($bf, full_tag("JOURNAL", 4, false, $econsole->journal));
    fwrite($bf, full_tag("FORUM", 4, false, $econsole->forum));
    fwrite($bf, full_tag("CHAT", 4, false, $econsole->chat));
    fwrite($bf, full_tag("CHOICE", 4, false, $econsole->choice));
    fwrite($bf, full_tag("QUIZ", 4, false, $econsole->quiz));
    fwrite($bf, full_tag("ASSIGNMENT", 4, false, $econsole->assignment));
    fwrite($bf, full_tag("WIKI", 4, false, $econsole->wiki));
    fwrite($bf, full_tag("THEME", 4, false, $econsole->theme));
    fwrite($bf, full_tag("IMAGEBARTOP", 4, false, $econsole->imagebartop));
    fwrite($bf, full_tag("IMAGEBARBOTTOM", 4, false, $econsole->imagebarbottom));
    fwrite($bf, full_tag("TIMECREATED", 4, false, $econsole->timecreated));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $econsole->timemodified));
    //if we've selected to backup users info, then execute backup_econsole_messages
    /*		
            if (backup_userdata_selected($preferences,'econsole',$econsole->id)) {
                $status = backup_econsole_messages($bf,$preferences,$econsole->id);
            }		
    */
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function swf_backup_one_mod($bf, $preferences, $swf)
{
    global $CFG;
    if (is_numeric($swf)) {
        $swf = get_record('swf', 'id', $swf);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print swf data
    fwrite($bf, full_tag("ID", 4, false, $swf->id));
    //tags will not be UTF encoded as they are already in UTF format
    fwrite($bf, full_tag("MODTYPE", 4, false, "swf"));
    fwrite($bf, full_tag("COURSE", 4, false, $swf->course));
    fwrite($bf, full_tag("NAME", 4, false, $swf->name));
    fwrite($bf, full_tag("INTRO", 4, false, $swf->intro));
    fwrite($bf, full_tag("INTROFORMAT", 4, false, $swf->introformat));
    fwrite($bf, full_tag("SWFURL", 4, false, $swf->swfurl));
    fwrite($bf, full_tag("WIDTH", 4, false, $swf->width));
    fwrite($bf, full_tag("HEIGHT", 4, false, $swf->height));
    fwrite($bf, full_tag("VERSION", 4, false, $swf->version));
    fwrite($bf, full_tag("INTERACTION", 4, false, $swf->interaction));
    fwrite($bf, full_tag("XMLURL", 4, false, $swf->xmlurl));
    fwrite($bf, full_tag("APIKEY", 4, false, $swf->apikey));
    fwrite($bf, full_tag("PLAY", 4, false, $swf->play));
    fwrite($bf, full_tag("LOOPSWF", 4, false, $swf->loopswf));
    fwrite($bf, full_tag("MENU", 4, false, $swf->menu));
    fwrite($bf, full_tag("QUALITY", 4, false, $swf->quality));
    fwrite($bf, full_tag("SCALE", 4, false, $swf->scale));
    fwrite($bf, full_tag("SALIGN", 4, false, $swf->salign));
    fwrite($bf, full_tag("WMODE", 4, false, $swf->wmode));
    fwrite($bf, full_tag("BGCOLOR", 4, false, $swf->bgcolor));
    fwrite($bf, full_tag("DEVICEFONT", 4, false, $swf->devicefont));
    fwrite($bf, full_tag("SEAMLESSTABBING", 4, false, $swf->seamlesstabbing));
    fwrite($bf, full_tag("ALLOWFULLSCREEN", 4, false, $swf->allowfullscreen));
    fwrite($bf, full_tag("ALLOWSCRIPTACCESS", 4, false, $swf->allowscriptaccess));
    fwrite($bf, full_tag("ALLOWNETWORKING", 4, false, $swf->allownetworking));
    fwrite($bf, full_tag("ALIGN", 4, false, $swf->align));
    fwrite($bf, full_tag("FLASHVAR1", 4, false, $swf->flashvar1));
    fwrite($bf, full_tag("FLASHVAR2", 4, false, $swf->flashvar2));
    fwrite($bf, full_tag("FLASHVAR3", 4, false, $swf->flashvar3));
    fwrite($bf, full_tag("GRADING", 4, false, $swf->grading));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    if ($status && ($swf->type == 'file' || $swf->type == 'directory' || $swf->type == 'ims')) {
        // more should go here later!
        // backup files for this swf.
        $status = swf_backup_files($bf, $preferences, $swf);
    }
    return $status;
}
function backup_lightboxgallery_metadata($bf, $preferences, $galleryid)
{
    $status = true;
    if ($records = get_records('lightboxgallery_image_meta', 'gallery', $galleryid, 'id')) {
        $status = fwrite($bf, start_tag('IMAGEMETAS', 4, true));
        foreach ($records as $record) {
            fwrite($bf, start_tag('IMAGEMETA', 5, true));
            fwrite($bf, full_tag('ID', 6, false, $record->id));
            fwrite($bf, full_tag('IMAGE', 6, false, $record->image));
            fwrite($bf, full_tag('METATYPE', 6, false, $record->metatype));
            fwrite($bf, full_tag('DESCRIPTION', 6, false, $record->description));
            $status = fwrite($bf, end_tag('IMAGEMETA', 5, true));
        }
        $status = fwrite($bf, end_tag('IMAGEMETAS', 4, true));
    }
    return $status;
}
Example #17
0
function diplome_backup_one_mod($bf, $preferences, $diplome)
{
    global $CFG;
    if (is_numeric($diplome)) {
        $diplome = get_record('diplome', 'id', $diplome);
    }
    $status = true;
    fwrite($bf, start_tag("MOD", 3, true));
    fwrite($bf, full_tag("ID", 4, false, $diplome->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "diplome"));
    fwrite($bf, full_tag("NAME", 4, false, $diplome->name));
    fwrite($bf, full_tag("INTRO", 4, false, $diplome->intro));
    fwrite($bf, full_tag("INTROFORMAT", 4, false, $diplome->introformat));
    fwrite($bf, full_tag("TIMECREATED", 4, false, $diplome->timecreated));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $diplome->timemodified));
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
Example #18
0
function wwassignment_backup_one_mod($bf, $preferences, $wwassignment)
{
    $status = true;
    if (is_numeric($wwassignment)) {
        $wwassignment = get_record('wwassignment', 'id', $wwassignment);
    }
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print wwassignment data
    fwrite($bf, full_tag("ID", 4, false, $wwassignment->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "wwassignment"));
    fwrite($bf, full_tag("NAME", 4, false, $wwassignment->name));
    fwrite($bf, full_tag("DESCRIPTION", 4, false, $wwassignment->description));
    fwrite($bf, full_tag("WEBWORK_SET", 4, false, $wwassignment->webwork_set));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
/**
 * Format's backup routine
 *
 * @param handler $bf Backup file handler
 * @param object $preferences Backup preferences
 * @return boolean
 **/
function ebook_backup_format_data($bf, $preferences)
{
    $status = true;
    if ($pages = get_records('course_format_ebook', 'courseid', $preferences->backup_course)) {
        fwrite($bf, start_tag('PAGES', 3, true));
        foreach ($pages as $page) {
            fwrite($bf, start_tag('PAGE', 4, true));
            fwrite($bf, full_tag('ID', 5, false, $page->id));
            fwrite($bf, full_tag('COURSEID', 5, false, $page->courseid));
            fwrite($bf, full_tag('CHAPTER', 5, false, $page->chapter));
            fwrite($bf, full_tag('PAGE', 5, false, $page->page));
            fwrite($bf, full_tag('SECTION', 5, false, $page->section));
            fwrite($bf, full_tag('TITLE', 5, false, $page->title));
            fwrite($bf, end_tag('PAGE', 4, true));
        }
        $status = fwrite($bf, end_tag('PAGES', 3, true));
    }
    return $status;
}
function ezproxy_backup_one_mod($bf, $preferences, $ezproxy)
{
    global $CFG;
    if (is_numeric($ezproxy)) {
        $ezproxy = get_record('ezproxy', 'id', $ezproxy);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $ezproxy->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "ezproxy"));
    fwrite($bf, full_tag("NAME", 4, false, $ezproxy->name));
    fwrite($bf, full_tag("SERVERURL", 4, false, $ezproxy->serverurl));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $ezproxy->timemodified));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function skype_backup_one_mod($bf, $preferences, $skype)
{
    global $CFG;
    if (is_numeric($skype)) {
        $skype = get_record('skype', 'id', $skype);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $skype->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "skype"));
    fwrite($bf, full_tag("NAME", 4, false, $skype->name));
    fwrite($bf, full_tag("PARTICIPANTS", 4, false, $skype->participants));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $skype->timemodified));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
Example #22
0
function label_backup_one_mod($bf, $preferences, $label)
{
    global $CFG;
    if (is_numeric($label)) {
        $label = get_record('label', 'id', $label);
    }
    $status = true;
    //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;
}
function tab_backup_one_mod($bf, $preferences, $tab)
{
    global $CFG;
    if (is_numeric($tab)) {
        $tab = get_record('tab', 'id', $tab);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $tab->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "tab"));
    fwrite($bf, full_tag("NAME", 4, false, $tab->name));
    fwrite($bf, full_tag("TAB1", 4, false, $tab->tab1));
    fwrite($bf, full_tag("TAB2", 4, false, $tab->tab2));
    fwrite($bf, full_tag("TAB3", 4, false, $tab->tab3));
    fwrite($bf, full_tag("TAB4", 4, false, $tab->tab4));
    fwrite($bf, full_tag("TAB5", 4, false, $tab->tab5));
    fwrite($bf, full_tag("TAB6", 4, false, $tab->tab6));
    fwrite($bf, full_tag("TAB7", 4, false, $tab->tab7));
    fwrite($bf, full_tag("TAB8", 4, false, $tab->tab8));
    fwrite($bf, full_tag("TAB9", 4, false, $tab->tab9));
    fwrite($bf, full_tag("TAB0", 4, false, $tab->tab0));
    fwrite($bf, full_tag("TAB1CONTENT", 4, false, $tab->tab1content));
    fwrite($bf, full_tag("TAB2CONTENT", 4, false, $tab->tab2content));
    fwrite($bf, full_tag("TAB3CONTENT", 4, false, $tab->tab3content));
    fwrite($bf, full_tag("TAB4CONTENT", 4, false, $tab->tab4content));
    fwrite($bf, full_tag("TAB5CONTENT", 4, false, $tab->tab5content));
    fwrite($bf, full_tag("TAB6CONTENT", 4, false, $tab->tab6content));
    fwrite($bf, full_tag("TAB7CONTENT", 4, false, $tab->tab7content));
    fwrite($bf, full_tag("TAB8CONTENT", 4, false, $tab->tab8content));
    fwrite($bf, full_tag("TAB9CONTENT", 4, false, $tab->tab9content));
    fwrite($bf, full_tag("TAB0CONTENT", 4, false, $tab->tab0content));
    fwrite($bf, full_tag("CSS", 4, false, $tab->css));
    fwrite($bf, full_tag("MENUCSS", 4, false, $tab->menucss));
    fwrite($bf, full_tag("DISPLAYMENU", 4, false, $tab->displaymenu));
    fwrite($bf, full_tag("MENUNAME", 4, false, $tab->menuname));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $tab->timemodified));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function voiceemail_backup_one_mod($bf, $preferences, $voiceemail)
{
    global $CFG;
    if (is_numeric($voiceemail)) {
        $voiceemail = get_record('voiceemail', 'id', $voiceemail);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print voiceemail data
    fwrite($bf, full_tag("ID", 4, false, $voiceemail->id));
    fwrite($bf, full_tag("RID", 4, false, $voiceemail->rid));
    fwrite($bf, full_tag("MODTYPE", 4, false, "voiceemail"));
    fwrite($bf, full_tag("COURSE", 4, false, $voiceemail->course));
    fwrite($bf, full_tag("NAME", 4, false, $voiceemail->name));
    fwrite($bf, full_tag("RECIPIENTS_EMAIL", 4, false, $voiceemail->recipients_email));
    fwrite($bf, full_tag("SECTION", 4, false, $voiceemail->section));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $voiceemail->timemodified));
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function voicepodcaster_backup_one_mod($bf, $preferences, $voicefeature)
{
    global $CFG;
    if (is_numeric($voicefeature)) {
        $voicefeature = get_record('voicepodcaster', 'id', $voicefeature);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print voicepodcaster data
    fwrite($bf, full_tag("ID", 4, false, $voicefeature->id));
    fwrite($bf, full_tag("RID", 4, false, $voicefeature->rid));
    fwrite($bf, full_tag("MODTYPE", 4, false, "voicepodcaster"));
    fwrite($bf, full_tag("COURSE", 4, false, $voicefeature->course));
    fwrite($bf, full_tag("NAME", 4, false, $voicefeature->name));
    fwrite($bf, full_tag("TYPE", 4, false, $voicefeature->type));
    fwrite($bf, full_tag("SECTION", 4, false, $voicefeature->section));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $voicefeature->timemodified));
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
/**
 * Format's backup routine
 *
 * @param handler $bf Backup file handler
 * @param object $preferences Backup preferences
 * @return boolean
 **/
function page_backup_format_data($bf, $preferences)
{
    $status = true;
    if ($pages = get_records('format_page', 'courseid', $preferences->backup_course)) {
        fwrite($bf, start_tag('PAGES', 3, true));
        foreach ($pages as $page) {
            fwrite($bf, start_tag('PAGE', 4, true));
            fwrite($bf, full_tag('ID', 5, false, $page->id));
            fwrite($bf, full_tag('NAMEONE', 5, false, $page->nameone));
            fwrite($bf, full_tag('NAMETWO', 5, false, $page->nametwo));
            fwrite($bf, full_tag('DISPLAY', 5, false, $page->display));
            fwrite($bf, full_tag('PREFLEFTWIDTH', 5, false, $page->prefleftwidth));
            fwrite($bf, full_tag('PREFCENTERWIDTH', 5, false, $page->prefcenterwidth));
            fwrite($bf, full_tag('PREFRIGHTWIDTH', 5, false, $page->prefrightwidth));
            fwrite($bf, full_tag('PARENT', 5, false, $page->parent));
            fwrite($bf, full_tag('SORTORDER', 5, false, $page->sortorder));
            fwrite($bf, full_tag('TEMPLATE', 5, false, $page->template));
            fwrite($bf, full_tag('SHOWBUTTONS', 5, false, $page->showbuttons));
            fwrite($bf, full_tag('LOCKS', 5, false, $page->locks));
            // Now grab the page items
            if ($items = get_records('format_page_items', 'pageid', $page->id, 'position, sortorder')) {
                fwrite($bf, start_tag('ITEMS', 5, true));
                foreach ($items as $item) {
                    fwrite($bf, start_tag('ITEM', 6, true));
                    fwrite($bf, full_tag('ID', 7, false, $item->id));
                    fwrite($bf, full_tag('CMID', 7, false, $item->cmid));
                    fwrite($bf, full_tag('BLOCKINSTANCE', 7, false, $item->blockinstance));
                    fwrite($bf, full_tag('POSITION', 7, false, $item->position));
                    fwrite($bf, full_tag('SORTORDER', 7, false, $item->sortorder));
                    fwrite($bf, full_tag('VISIBLE', 7, false, $item->visible));
                    fwrite($bf, end_tag('ITEM', 6, true));
                }
                fwrite($bf, end_tag('ITEMS', 5, true));
            }
            fwrite($bf, end_tag('PAGE', 4, true));
        }
        $status = fwrite($bf, end_tag('PAGES', 3, true));
    }
    return $status;
}
function voiceauthoring_backup_one_mod($bf, $preferences, $voiceauthoring)
{
    global $CFG;
    if (is_numeric($voiceauthoring)) {
        $voiceauthoring = get_record('voiceauthoring', 'id', $voiceauthoring);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print voiceauthoring data
    fwrite($bf, full_tag("ID", 4, false, $voiceauthoring->id));
    fwrite($bf, full_tag("RID", 4, false, $voiceauthoring->rid));
    fwrite($bf, full_tag("MID", 4, false, $voiceauthoring->mid));
    fwrite($bf, full_tag("MODTYPE", 4, false, "voiceauthoring"));
    fwrite($bf, full_tag("COURSE", 4, false, $voiceauthoring->course));
    fwrite($bf, full_tag("NAME", 4, false, $voiceauthoring->name));
    fwrite($bf, full_tag("ACTIVITY_NAME", 4, false, $voiceauthoring->activityname));
    fwrite($bf, full_tag("SECTION", 4, false, $voiceauthoring->section));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $voiceauthoring->timemodified));
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function bigbluebuttonbn_backup_one_mod($bf, $preferences, $bigbluebuttonbn)
{
    global $CFG;
    if (is_numeric($bigbluebuttonbn)) {
        $bigbluebuttonbn = get_record('bigbluebuttonbn', 'id', $bigbluebuttonbn);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $bigbluebuttonbn->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "bigbluebuttonbn"));
    fwrite($bf, full_tag("NAME", 4, false, $bigbluebuttonbn->name));
    fwrite($bf, full_tag("MODERATORPASS", 4, false, $bigbluebuttonbn->moderatorpass));
    fwrite($bf, full_tag("VIEWERPASS", 4, false, $bigbluebuttonbn->viewerpass));
    fwrite($bf, full_tag("WAIT", 4, false, $bigbluebuttonbn->wait));
    fwrite($bf, full_tag("MEETINGID", 4, false, $bigbluebuttonbn->meetingid));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $bigbluebuttonbn->timemodified));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
function groupselect_backup_one_mod($bf, $preferences, $groupselect)
{
    global $CFG;
    if (is_numeric($groupselect)) {
        $groupselect = get_record('groupselect', 'id', $groupselect);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $groupselect->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "groupselect"));
    fwrite($bf, full_tag("NAME", 4, false, $groupselect->name));
    fwrite($bf, full_tag("INTRO", 4, false, $groupselect->intro));
    fwrite($bf, full_tag("PASSWORD", 4, false, $groupselect->password));
    fwrite($bf, full_tag("TIMEAVAILABLE", 4, false, $groupselect->timeavailable));
    fwrite($bf, full_tag("TIMEDUE", 4, false, $groupselect->timedue));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $groupselect->timemodified));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
Example #30
0
function openmeetings_backup_one_mod($bf, $preferences, $openmeetings)
{
    global $CFG;
    if (is_numeric($openmeetings)) {
        $openmeetings = get_record('openmeetings', 'id', $openmeetings);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print openmeetings data
    fwrite($bf, full_tag("ID", 4, false, $openmeetings->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "openmeetings"));
    fwrite($bf, full_tag("NAME", 4, false, $openmeetings->name));
    fwrite($bf, full_tag("INTRO", 4, false, $openmeetings->intro));
    fwrite($bf, full_tag("INTROFORMAT", 4, false, $openmeetings->introformat));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $openmeetings->timemodified));
    fwrite($bf, full_tag("TIMECREATED", 4, false, $openmeetings->timecreated));
    fwrite($bf, full_tag("ROOM_ID", 4, false, $openmeetings->room_id));
    fwrite($bf, full_tag("TEACHER", 4, false, $openmeetings->teacher));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}