return $status; } function podcast_backup_one_mod($bf, $preferences, $podcast) { global $CFG; if (is_numeric($podcast)) { $podcast = get_record('podcast', 'id', $podcast); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 7, true)); //Print podcast data fwrite($bf, full_tag("ID", 8, false, $podcast->id)); fwrite($bf, full_tag("MODTYPE", 8, false, "podcast")); fwrite($bf, full_tag("USERID", 8, false, $podcast->userid)); fwrite($bf, full_tag("NAME", 8, false, $podcast->name)); fwrite($bf, full_tag("AUTHOR", 8, false, $podcast->author)); fwrite($bf, full_tag("INTRO", 8, false, $podcast->intro)); fwrite($bf, full_tag("OWNER", 8, false, $podcast->owner)); fwrite($bf, full_tag("OWNER_EMAIL", 8, false, $podcast->owner_email)); fwrite($bf, full_tag("COPYRIGHT", 8, false, $podcast->copyright)); fwrite($bf, full_tag("LANG", 8, false, $podcast->lang)); fwrite($bf, full_tag("PUBDATE", 8, false, $podcast->pubdate)); fwrite($bf, full_tag("IMAGE_URL", 8, false, $podcast->image_url)); fwrite($bf, full_tag("IMAGE_IMG", 8, false, $podcast->image_img)); fwrite($bf, full_tag("CATEGORY", 8, false, $podcast->category)); fwrite($bf, full_tag("TIMEMODIFIED", 8, false, $podcast->timemodified)); //if we've selected to backup users info, then execute backup_podcast_items if (backup_userdata_selected($preferences, 'podcast', $podcast->id)) { $status = backup_podcast_items($bf, $preferences, $podcast->id); } //End mod $status = fwrite($bf, end_tag("MOD", 7, true));
function imagegallery_backup_one_mod($bf, $preferences, $imagegallery) { global $CFG; if (is_numeric($imagegallery)) { $imagegallery = get_record('imagegallery', 'id', $imagegallery); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print imagegallery data fwrite($bf, full_tag("ID", 4, false, $imagegallery->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "imagegallery")); fwrite($bf, full_tag("NAME", 4, false, $imagegallery->name)); fwrite($bf, full_tag("INTRO", 4, false, $imagegallery->intro)); fwrite($bf, full_tag("MAXBYTES", 4, false, $imagegallery->maxbytes)); fwrite($bf, full_tag("MAXWIDTH", 4, false, $imagegallery->maxwidth)); fwrite($bf, full_tag("MAXHEIGHT", 4, false, $imagegallery->maxheight)); fwrite($bf, full_tag("ALLOWSTUDENTUPLOAD", 4, false, $imagegallery->allowstudentupload)); fwrite($bf, full_tag("IMAGESPERPAGE", 4, false, $imagegallery->imagesperpage)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $imagegallery->timemodified)); fwrite($bf, full_tag("REQUIRELOGIN", 4, false, $imagegallery->requirelogin)); fwrite($bf, full_tag("RESIZE", 4, false, $imagegallery->resize)); fwrite($bf, full_tag("DEFAULTCATEGORY", 4, false, $imagegallery->defaultcategory)); fwrite($bf, full_tag("SHADOW", 4, false, $imagegallery->shadow)); //if we've selected to backup users info, then execute backup_imagegallery_categories if (backup_userdata_selected($preferences, 'imagegallery', $imagegallery->id)) { $status = backup_imagegallery_categories($bf, $preferences, $imagegallery->id); } if (backup_userdata_selected($preferences, 'imagegallery', $imagegallery->id)) { $status = backup_imagegallery_images($bf, $preferences, $imagegallery->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function journal_backup_one_mod($bf, $preferences, $journal) { global $CFG; if (is_numeric($journal)) { $journal = get_record('journal', 'id', $journal); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print journal data fwrite($bf, full_tag("ID", 4, false, $journal->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "journal")); fwrite($bf, full_tag("NAME", 4, false, $journal->name)); fwrite($bf, full_tag("INTRO", 4, false, $journal->intro)); fwrite($bf, full_tag("INTROFORMAT", 4, false, $journal->introformat)); fwrite($bf, full_tag("DAYS", 4, false, $journal->days)); fwrite($bf, full_tag("ASSESSED", 4, false, $journal->assessed)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $journal->timemodified)); //if we've selected to backup users info, then execute backup_journal_entries if (backup_userdata_selected($preferences, 'journal', $journal->id)) { $status = backup_journal_entries($bf, $preferences, $journal->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function wiki_backup_one_mod($bf, $preferences, $wiki) { $status = true; if (is_numeric($wiki)) { $wiki = get_record('wiki', 'id', $wiki); } //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print assignment data fwrite($bf, full_tag("ID", 4, false, $wiki->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "wiki")); fwrite($bf, full_tag("NAME", 4, false, $wiki->name)); fwrite($bf, full_tag("SUMMARY", 4, false, $wiki->summary)); fwrite($bf, full_tag("PAGENAME", 4, false, $wiki->wtype)); fwrite($bf, full_tag("WTYPE", 4, false, $wiki->wtype)); fwrite($bf, full_tag("EWIKIPRINTTITLE", 4, false, $wiki->ewikiprinttitle)); fwrite($bf, full_tag("HTMLMODE", 4, false, $wiki->htmlmode)); fwrite($bf, full_tag("EWIKIACCEPTBINARY", 4, false, $wiki->ewikiacceptbinary)); fwrite($bf, full_tag("DISABLECAMELCASE", 4, false, $wiki->disablecamelcase)); fwrite($bf, full_tag("SETPAGEFLAGS", 4, false, $wiki->setpageflags)); fwrite($bf, full_tag("STRIPPAGES", 4, false, $wiki->strippages)); fwrite($bf, full_tag("REMOVEPAGES", 4, false, $wiki->removepages)); fwrite($bf, full_tag("REVERTCHANGES", 4, false, $wiki->revertchanges)); fwrite($bf, full_tag("INITIALCONTENT", 4, false, $wiki->initialcontent)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $wiki->timemodified)); //backup entries and pages if (backup_userdata_selected($preferences, 'wiki', $wiki->id)) { $status = backup_wiki_entries($bf, $preferences, $wiki->id, $preferences->mods["wiki"]->userinfo); $status = backup_wiki_files_instance($bf, $preferences, $wiki->id); } //End mod fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function nanogong_backup_one_mod($bf, $preferences, $nanogong) { global $CFG; if (is_numeric($nanogong)) { $nanogong = get_record('nanogong', 'id', $nanogong); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print nanogong data fwrite($bf, full_tag("ID", 4, false, $nanogong->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "nanogong")); fwrite($bf, full_tag("NAME", 4, false, $nanogong->name)); fwrite($bf, full_tag("MESSAGE", 4, false, $nanogong->message)); fwrite($bf, full_tag("COLOR", 4, false, $nanogong->color)); fwrite($bf, full_tag("MAXDURATION", 4, false, $nanogong->maxduration)); fwrite($bf, full_tag("MAXMESSAGES", 4, false, $nanogong->maxmessages)); fwrite($bf, full_tag("MAXSCORE", 4, false, $nanogong->maxscore)); fwrite($bf, full_tag("ALLOWGUESTACCESS", 4, false, $nanogong->allowguestaccess)); fwrite($bf, full_tag("TIMECREATED", 4, false, $nanogong->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $nanogong->timemodified)); //if we've selected to backup users info, then execute backup_nanogong_messages and //backup_nanogong_files_instance if (backup_userdata_selected($preferences, 'nanogong', $nanogong->id)) { $status = backup_nanogong_message($bf, $preferences, $nanogong->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function chat_backup_one_mod($bf, $preferences, $chat) { global $CFG; if (is_numeric($chat)) { $chat = get_record('chat', 'id', $chat); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print chat data fwrite($bf, full_tag("ID", 4, false, $chat->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "chat")); fwrite($bf, full_tag("NAME", 4, false, $chat->name)); fwrite($bf, full_tag("INTRO", 4, false, $chat->intro)); fwrite($bf, full_tag("KEEPDAYS", 4, false, $chat->keepdays)); fwrite($bf, full_tag("STUDENTLOGS", 4, false, $chat->studentlogs)); fwrite($bf, full_tag("SCHEDULE", 4, false, $chat->schedule)); fwrite($bf, full_tag("CHATTIME", 4, false, $chat->chattime)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $chat->timemodified)); //if we've selected to backup users info, then execute backup_chat_messages if (backup_userdata_selected($preferences, 'chat', $chat->id)) { $status = backup_chat_messages($bf, $preferences, $chat->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function qcreate_backup_one_mod($bf, $preferences, $qcreate) { if (is_numeric($qcreate)) { $qcreate = get_record('qcreate', 'id', $qcreate); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print qcreate data fwrite($bf, full_tag("ID", 4, false, $qcreate->id)); fwrite($bf, full_tag("MODTYPE", 4, false, 'qcreate')); fwrite($bf, full_tag("NAME", 4, false, $qcreate->name)); fwrite($bf, full_tag("GRADE", 4, false, $qcreate->grade)); fwrite($bf, full_tag("GRADERATIO", 4, false, $qcreate->graderatio)); fwrite($bf, full_tag("INTRO", 4, false, $qcreate->intro)); fwrite($bf, full_tag("INTROFORMAT", 4, false, $qcreate->introformat)); fwrite($bf, full_tag("ALLOWED", 4, false, $qcreate->allowed)); fwrite($bf, full_tag("TOTALREQUIRED", 4, false, $qcreate->totalrequired)); fwrite($bf, full_tag("STUDENTQACCESS", 4, false, $qcreate->studentqaccess)); fwrite($bf, full_tag("TIMEOPEN", 4, false, $qcreate->timeopen)); fwrite($bf, full_tag("TIMECLOSE", 4, false, $qcreate->timeclose)); fwrite($bf, full_tag("TIMECREATED", 4, false, $qcreate->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $qcreate->timemodified)); $status = $status && backup_qcreate_requireds($bf, $preferences, $qcreate->id); //if we've selected to backup users info, then execute backup_qcreate_grades if (backup_userdata_selected($preferences, 'qcreate', $qcreate->id)) { $status = $status && backup_qcreate_grades($bf, $preferences, $qcreate->id); } //End mod $status = $status && fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function survey_backup_one_mod($bf, $preferences, $survey) { $status = true; if (is_numeric($survey)) { $survey = get_record('survey', 'id', $survey); } //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print choice data fwrite($bf, full_tag("ID", 4, false, $survey->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "survey")); fwrite($bf, full_tag("TEMPLATE", 4, false, $survey->template)); fwrite($bf, full_tag("DAYS", 4, false, $survey->days)); fwrite($bf, full_tag("TIMECREATED", 4, false, $survey->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $survey->timemodified)); fwrite($bf, full_tag("NAME", 4, false, $survey->name)); fwrite($bf, full_tag("INTRO", 4, false, $survey->intro)); fwrite($bf, full_tag("QUESTIONS", 4, false, $survey->questions)); //if we've selected to backup users info, then execute backup_survey_answers and //backup_survey_analysis if (backup_userdata_selected($preferences, 'survey', $survey->id)) { $status = backup_survey_answers($bf, $preferences, $survey->id); $status = backup_survey_analysis($bf, $preferences, $survey->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
/** * Write the info about the given module instance into the backup file * * @param resource $bf backup file resource * @param object $preferences Backup settings * @param object $stampcoll Stampcoll record (if object) or its ID (if numeric) * @return boolean True if success, False if failure */ function stampcoll_backup_one_mod($bf, $preferences, $stampcoll) { if (is_numeric($stampcoll)) { $stampcoll = get_record('stampcoll', 'id', $stampcoll); } $status = true; $status = $status && fwrite($bf, start_tag('MOD', 3, true)); $status = $status && fwrite($bf, full_tag('ID', 4, false, $stampcoll->id)); $status = $status && fwrite($bf, full_tag('MODTYPE', 4, false, 'stampcoll')); $status = $status && fwrite($bf, full_tag('MODVERSION', 4, false, stampcoll_modversion())); $status = $status && fwrite($bf, full_tag('NAME', 4, false, $stampcoll->name)); $status = $status && fwrite($bf, full_tag('TEXT', 4, false, $stampcoll->text)); $status = $status && fwrite($bf, full_tag('FORMAT', 4, false, $stampcoll->format)); $status = $status && fwrite($bf, full_tag('IMAGE', 4, false, $stampcoll->image)); $status = $status && fwrite($bf, full_tag('TIMEMODIFIED', 4, false, $stampcoll->timemodified)); $status = $status && fwrite($bf, full_tag('DISPLAYZERO', 4, false, $stampcoll->displayzero)); $status = $status && fwrite($bf, full_tag('ANONYMOUS', 4, false, $stampcoll->anonymous)); //If we've selected to backup users info, then backup collected stamps if (backup_userdata_selected($preferences, 'stampcoll', $stampcoll->id)) { $status = $status && stampcoll_backup_collected_stamps($bf, $preferences, $stampcoll->id); } //End module tag $status = $status && fwrite($bf, end_tag('MOD', 3, true)); return $status; }
function choice_backup_one_mod($bf, $preferences, $choice) { global $CFG, $DB; if (is_numeric($choice)) { $choice = $DB->get_record('choice', array('id' => $choice)); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print choice data fwrite($bf, full_tag("ID", 4, false, $choice->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "choice")); fwrite($bf, full_tag("NAME", 4, false, $choice->name)); fwrite($bf, full_tag("TEXT", 4, false, $choice->intro)); fwrite($bf, full_tag("FORMAT", 4, false, $choice->introformat)); fwrite($bf, full_tag("PUBLISH", 4, false, $choice->publish)); fwrite($bf, full_tag("SHOWRESULTS", 4, false, $choice->showresults)); fwrite($bf, full_tag("DISPLAY", 4, false, $choice->display)); fwrite($bf, full_tag("ALLOWUPDATE", 4, false, $choice->allowupdate)); fwrite($bf, full_tag("SHOWUNANSWERED", 4, false, $choice->showunanswered)); fwrite($bf, full_tag("LIMITANSWERS", 4, false, $choice->limitanswers)); fwrite($bf, full_tag("TIMEOPEN", 4, false, $choice->timeopen)); fwrite($bf, full_tag("TIMECLOSE", 4, false, $choice->timeclose)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $choice->timemodified)); //Now backup choice_options $status = backup_choice_options($bf, $preferences, $choice->id); //if we've selected to backup users info, then execute backup_choice_answers if (backup_userdata_selected($preferences, 'choice', $choice->id)) { $status = backup_choice_answers($bf, $preferences, $choice->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function hotpot_backup_one_mod($bf, $preferences, $instance = 0) { // $bf : resource id for b(ackup) f(ile) // $preferences : object containing switches and settings for this backup $level = 3; $status = true; $table = 'hotpot'; $select = "course={$preferences->backup_course} AND id='{$instance}'"; $records_tag = ''; $records_tags = array(); $record_tag = 'MOD'; $record_tags = array('MODTYPE' => 'hotpot'); $excluded_tags = array(); $more_backup = ''; if (function_exists('backup_userdata_selected')) { // Moodle >= 1.6 $backup_userdata_selected = backup_userdata_selected($preferences, 'hotpot', $instance); } else { // Moodle <= 1.5 $backup_userdata_selected = $preferences->mods['hotpot']->userinfo; } if ($backup_userdata_selected) { $more_backup .= '$GLOBALS["hotpot_backup_string_ids"] = array();'; $more_backup .= '$status = hotpot_backup_attempts($bf, $record, $level, $status);'; $more_backup .= '$status = hotpot_backup_questions($bf, $record, $level, $status);'; $more_backup .= '$status = hotpot_backup_strings($bf, $record, $level, $status);'; $more_backup .= 'unset($GLOBALS["hotpot_backup_string_ids"]);'; // tidy up } return hotpot_backup_records($bf, $status, $level, $table, $select, $records_tag, $records_tags, $record_tag, $record_tags, $excluded_tags, $more_backup); }
function lightboxgallery_backup_one_mod($bf, $preferences, $gallery) { $status = true; if (is_numeric($gallery)) { $gallery = get_record('lightboxgallery', 'id', $gallery); } fwrite($bf, start_tag('MOD', 3, true)); fwrite($bf, full_tag('ID', 4, false, $gallery->id)); fwrite($bf, full_tag('MODTYPE', 4, false, 'lightboxgallery')); fwrite($bf, full_tag('FOLDER', 4, false, $gallery->folder)); fwrite($bf, full_tag('NAME', 4, false, $gallery->name)); fwrite($bf, full_tag('DESCRIPTION', 4, false, $gallery->description)); fwrite($bf, full_tag('PERPAGE', 4, false, $gallery->perpage)); fwrite($bf, full_tag('COMMENTS', 4, false, $gallery->comments)); fwrite($bf, full_tag('PUBLIC', 4, false, $gallery->ispublic)); fwrite($bf, full_tag('RSS', 4, false, $gallery->rss)); fwrite($bf, full_tag('AUTORESIZE', 4, false, $gallery->autoresize)); fwrite($bf, full_tag('RESIZE', 4, false, $gallery->resize)); fwrite($bf, full_tag('EXTINFO', 4, false, $gallery->extinfo)); $status = backup_lightboxgallery_files_instance($bf, $preferences, $gallery); if ($status) { if (backup_userdata_selected($preferences, 'lightboxgallery', $gallery->id)) { $status = backup_lightboxgallery_metadata($bf, $preferences, $gallery->id); } } $status = fwrite($bf, end_tag('MOD', 3, true)); return $status; }
function oublog_backup_one_mod($bf, $preferences, $blog) { global $CFG; if (is_numeric($blog)) { $blog = get_record('oublog', 'id', $blog); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print blog data fwrite($bf, full_tag("MODTYPE", 4, false, "oublog")); $fields = array('id', 'name', 'accesstoken', 'summary', 'allowcomments', 'individual', 'maxvisibility', 'global', 'views', 'completionposts', 'completioncomments'); $status = write_rectags($bf, $fields, $blog, 4); $links = get_recordset('oublog_links', 'oublogid', $blog->id); if ($links->RecordCount()) { fwrite($bf, start_tag("LINKS", 4, true)); while ($link = rs_fetch_next_record($links)) { fwrite($bf, start_tag("LINK", 5, true)); $fields = array('id', 'oublogid', 'title', 'url', 'sortorder'); $status = write_rectags($bf, $fields, $link, 6); fwrite($bf, end_tag("LINK", 5, true)); } $status = fwrite($bf, end_tag("LINKS", 4, true)); } //if we've selected to backup users info, then execute backup_oublog_userdata if (backup_userdata_selected($preferences, 'oublog', $blog->id)) { $status = backup_oublog_userdata($bf, $preferences, $blog->id); } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function assignment_backup_one_mod($bf, $preferences, $assignment) { global $CFG; if ($assignment === 0) { //no active instances of assignment to be backed up - skip backup return false; } if (is_numeric($assignment)) { $assignment = get_record('assignment', 'id', $assignment); } if (empty($assignment->assignmenttype)) { // No assignment type will cause fatal error below in require_once so bail out now // Probably ended up here by restoring a course into // a moodle without this assignmenttype return false; } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print assignment data fwrite($bf, full_tag("ID", 4, false, $assignment->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "assignment")); fwrite($bf, full_tag("NAME", 4, false, $assignment->name)); fwrite($bf, full_tag("DESCRIPTION", 4, false, $assignment->description)); fwrite($bf, full_tag("FORMAT", 4, false, $assignment->format)); fwrite($bf, full_tag("RESUBMIT", 4, false, $assignment->resubmit)); fwrite($bf, full_tag("PREVENTLATE", 4, false, $assignment->preventlate)); fwrite($bf, full_tag("EMAILTEACHERS", 4, false, $assignment->emailteachers)); fwrite($bf, full_tag("VAR1", 4, false, $assignment->var1)); fwrite($bf, full_tag("VAR2", 4, false, $assignment->var2)); fwrite($bf, full_tag("VAR3", 4, false, $assignment->var3)); fwrite($bf, full_tag("VAR4", 4, false, $assignment->var4)); fwrite($bf, full_tag("VAR5", 4, false, $assignment->var5)); fwrite($bf, full_tag("ASSIGNMENTTYPE", 4, false, $assignment->assignmenttype)); fwrite($bf, full_tag("MAXBYTES", 4, false, $assignment->maxbytes)); fwrite($bf, full_tag("TIMEDUE", 4, false, $assignment->timedue)); fwrite($bf, full_tag("TIMEAVAILABLE", 4, false, $assignment->timeavailable)); fwrite($bf, full_tag("GRADE", 4, false, $assignment->grade)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $assignment->timemodified)); $class = 'assignment_' . $assignment->assignmenttype; require_once $CFG->dirroot . '/mod/assignment/lib.php'; require_once $CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php'; call_user_func(array($class, 'backup_one_mod'), $bf, $preferences, $assignment); //if we've selected to backup users info, then execute backup_assignment_submisions and //backup_assignment_files_instance if (backup_userdata_selected($preferences, 'assignment', $assignment->id)) { $status = backup_assignment_submissions($bf, $preferences, $assignment); if ($status) { $status = backup_assignment_files_instance($bf, $preferences, $assignment->id); } } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function certificate_backup_one_mod($bf, $preferences, $certificate) { global $CFG; if (is_numeric($certificate)) { $certificate = get_record('certificate', 'id', $certificate); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print certificate data fwrite($bf, full_tag("ID", 4, false, $certificate->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "certificate")); fwrite($bf, full_tag("NAME", 4, false, $certificate->name)); fwrite($bf, full_tag("INTRO", 4, false, $certificate->intro)); fwrite($bf, full_tag("EMAILTEACHERS", 4, false, $certificate->emailteachers)); fwrite($bf, full_tag("EMAILOTHERS", 4, false, $certificate->emailothers)); fwrite($bf, full_tag("SAVECERT", 4, false, $certificate->savecert)); fwrite($bf, full_tag("REPORTCERT", 4, false, $certificate->reportcert)); fwrite($bf, full_tag("DELIVERY", 4, false, $certificate->delivery)); fwrite($bf, full_tag("TYPE", 4, false, $certificate->certificatetype)); fwrite($bf, full_tag("BORDERSTYLE", 4, false, $certificate->borderstyle)); fwrite($bf, full_tag("BORDERCOLOR", 4, false, $certificate->bordercolor)); fwrite($bf, full_tag("PRINTWMARK", 4, false, $certificate->printwmark)); fwrite($bf, full_tag("PRINTDATE", 4, false, $certificate->printdate)); fwrite($bf, full_tag("DATEFMT", 4, false, $certificate->datefmt)); fwrite($bf, full_tag("PRINTOUTCOME", 4, false, $certificate->printoutcome)); fwrite($bf, full_tag("PRINTNUMBER", 4, false, $certificate->printnumber)); fwrite($bf, full_tag("PRINTGRADE", 4, false, $certificate->printgrade)); fwrite($bf, full_tag("GRADEFMT", 4, false, $certificate->gradefmt)); fwrite($bf, full_tag("PRINTHOURS", 4, false, $certificate->printhours)); fwrite($bf, full_tag("SETCERTIFICATION", 4, false, $certificate->setcertification)); fwrite($bf, full_tag("REQUIREDCERTIFICATION", 4, false, $certificate->requiredcertification)); fwrite($bf, full_tag("LOCKGRADE", 4, false, $certificate->lockgrade)); fwrite($bf, full_tag("REQUIREDGRADE", 4, false, $certificate->requiredgrade)); fwrite($bf, full_tag("PRINTTEACHER", 4, false, $certificate->printteacher)); fwrite($bf, full_tag("CUSTOMTEXT", 4, false, $certificate->customtext)); fwrite($bf, full_tag("PRINTSIGNATURE", 4, false, $certificate->printsignature)); fwrite($bf, full_tag("PRINTSEAL", 4, false, $certificate->printseal)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $certificate->timemodified)); //if we've selected to backup users info, then execute backup_certificate_issues and //backup_certificate_files_instance if (backup_userdata_selected($preferences, 'certificate', $certificate->id)) { $status = backup_certificate_issues($bf, $preferences, $certificate->id); if ($status) { $status = backup_certificate_file_instance($bf, $preferences, $certificate->id); } } //now backup the linked stuff $status = backup_certificate_linked_modules($bf, $preferences, $certificate->id); //End mod fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function forum_backup_one_mod($bf, $preferences, $forum) { global $CFG, $DB; if (is_numeric($forum)) { $forum = $DB->get_record('forum', array('id' => $forum)); } $instanceid = $forum->id; $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print forum data fwrite($bf, full_tag("ID", 4, false, $forum->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "forum")); fwrite($bf, full_tag("TYPE", 4, false, $forum->type)); fwrite($bf, full_tag("NAME", 4, false, $forum->name)); fwrite($bf, full_tag("INTRO", 4, false, $forum->intro)); fwrite($bf, full_tag("ASSESSED", 4, false, $forum->assessed)); fwrite($bf, full_tag("ASSESSTIMESTART", 4, false, $forum->assesstimestart)); fwrite($bf, full_tag("ASSESSTIMEFINISH", 4, false, $forum->assesstimefinish)); fwrite($bf, full_tag("MAXBYTES", 4, false, $forum->maxbytes)); fwrite($bf, full_tag("SCALE", 4, false, $forum->scale)); fwrite($bf, full_tag("FORCESUBSCRIBE", 4, false, $forum->forcesubscribe)); fwrite($bf, full_tag("TRACKINGTYPE", 4, false, $forum->trackingtype)); fwrite($bf, full_tag("RSSTYPE", 4, false, $forum->rsstype)); fwrite($bf, full_tag("RSSARTICLES", 4, false, $forum->rssarticles)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $forum->timemodified)); fwrite($bf, full_tag("WARNAFTER", 4, false, $forum->warnafter)); fwrite($bf, full_tag("BLOCKAFTER", 4, false, $forum->blockafter)); fwrite($bf, full_tag("BLOCKPERIOD", 4, false, $forum->blockperiod)); fwrite($bf, full_tag("COMPLETIONDISCUSSIONS", 4, false, $forum->completiondiscussions)); fwrite($bf, full_tag("COMPLETIONREPLIES", 4, false, $forum->completionreplies)); fwrite($bf, full_tag("COMPLETIONPOSTS", 4, false, $forum->completionposts)); //if we've selected to backup users info, then execute backup_forum_suscriptions and //backup_forum_discussions if (backup_userdata_selected($preferences, 'forum', $forum->id)) { $status = backup_forum_subscriptions($bf, $preferences, $forum->id); if ($status) { $status = backup_forum_discussions($bf, $preferences, $forum->id); } if ($status) { $status = backup_forum_read($bf, $preferences, $forum->id); } if ($status) { $status = backup_forum_files_instance($bf, $preferences, $forum->id); } } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function ouwiki_backup_one_mod($bf, $preferences, $ouwiki) { global $CFG; if (is_numeric($ouwiki)) { $ouwiki = get_record('ouwiki', 'id', $ouwiki); } try { $xb = new xml_backup($bf, $preferences, 3); $xb->tag_start('MOD'); // Required bits $xb->tag_full('ID', $ouwiki->id); $xb->tag_full('MODTYPE', 'ouwiki'); $xb->tag_full('NAME', $ouwiki->name); // Backup versioning require dirname(__FILE__) . '/version.php'; $xb->tag_full('OUWIKI_VERSION', $module->version); // Wiki-specific $xb->tag_full('SUBWIKIS', $ouwiki->subwikis); $userdata = backup_userdata_selected($preferences, 'ouwiki', $ouwiki->id); $xb->tag_full_notnull('TIMEOUT', $ouwiki->timeout); if ($ouwiki->template) { // Template setting and actual file $xb->tag_full('TEMPLATE', $ouwiki->template); $xb->copy_module_file('ouwiki', $ouwiki->id . '/' . $ouwiki->template); } $xb->tag_full_notnull('SUMMARY', $ouwiki->summary); $xb->tag_full_notnull('EDITBEGIN', $ouwiki->editbegin); $xb->tag_full_notnull('EDITEND', $ouwiki->editend); $xb->tag_full('COMPLETIONPAGES', $ouwiki->completionpages); $xb->tag_full('COMPLETIONEDITS', $ouwiki->completionedits); $xb->tag_full('COMMENTING', $ouwiki->commenting); // Now do the actual subwikis $xb->tag_start('SUBS'); // not SUBWIKIS because that name already used // We only back up content when 'user data' is turned on if ($userdata) { $subwikis = ouwiki_get_record_array('subwikis', 'wikiid', $ouwiki->id); foreach ($subwikis as $subwiki) { ouwiki_backup_subwiki($xb, $subwiki, $userdata); } } $xb->tag_end('SUBS'); $xb->tag_end('MOD'); return true; } catch (Exception $e) { ouwiki_handle_backup_exception($e); return false; } }
function forum_backup_one_mod($bf, $preferences, $forum) { global $CFG; include_once $CFG->dirroot . '/backup/incremental_backuplib.php'; if (is_numeric($forum)) { $forum = get_record('forum', 'id', $forum); } $instanceid = $forum->id; $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print forum data fwrite($bf, full_tag("GUID", 4, false, get_backup_guid('forum', 'id', $forum->id))); fwrite($bf, full_tag("ID", 4, false, $forum->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "forum")); fwrite($bf, full_tag("TYPE", 4, false, $forum->type)); fwrite($bf, full_tag("NAME", 4, false, $forum->name)); fwrite($bf, full_tag("INTRO", 4, false, $forum->intro)); fwrite($bf, full_tag("ASSESSED", 4, false, $forum->assessed)); fwrite($bf, full_tag("ASSESSTIMESTART", 4, false, $forum->assesstimestart)); fwrite($bf, full_tag("ASSESSTIMEFINISH", 4, false, $forum->assesstimefinish)); fwrite($bf, full_tag("MAXBYTES", 4, false, $forum->maxbytes)); fwrite($bf, full_tag("SCALE", 4, false, $forum->scale)); fwrite($bf, full_tag("FORCESUBSCRIBE", 4, false, $forum->forcesubscribe)); fwrite($bf, full_tag("TRACKINGTYPE", 4, false, $forum->trackingtype)); fwrite($bf, full_tag("RSSTYPE", 4, false, $forum->rsstype)); fwrite($bf, full_tag("RSSARTICLES", 4, false, $forum->rssarticles)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $forum->timemodified)); fwrite($bf, full_tag("WARNAFTER", 4, false, $forum->warnafter)); fwrite($bf, full_tag("BLOCKAFTER", 4, false, $forum->blockafter)); fwrite($bf, full_tag("BLOCKPERIOD", 4, false, $forum->blockperiod)); //if we've selected to backup users info, then execute backup_forum_suscriptions and //backup_forum_discussions if (backup_userdata_selected($preferences, 'forum', $forum->id)) { $status = backup_forum_subscriptions($bf, $preferences, $forum->id); if ($status) { $status = backup_forum_discussions($bf, $preferences, $forum->id); } if ($status) { $status = backup_forum_read($bf, $preferences, $forum->id); } if ($status) { $status = backup_forum_files_instance($bf, $preferences, $forum->id); } } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function certificate_backup_one_mod($bf, $preferences, $certificate) { global $CFG; if (is_numeric($certificate)) { $certificate = get_record('certificate', 'id', $certificate); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print certificate data fwrite($bf, full_tag("MODTYPE", 4, false, "certificate")); fwrite($bf, full_tag("ID", 4, false, $certificate->id)); fwrite($bf, full_tag("COURSE", 4, false, $certificate->course)); fwrite($bf, full_tag("NAME", 4, false, $certificate->name)); fwrite($bf, full_tag("EMAILTEACHERS", 4, false, $certificate->emailteachers)); fwrite($bf, full_tag("SAVECERT", 4, false, $certificate->savecert)); fwrite($bf, full_tag("DELIVERY", 4, false, $certificate->delivery)); fwrite($bf, full_tag("CERTIFICATETYPE", 4, false, $certificate->certificatetype)); fwrite($bf, full_tag("BORDERSTYLE", 4, false, $certificate->borderstyle)); fwrite($bf, full_tag("BORDERCOLOR", 4, false, $certificate->bordercolor)); fwrite($bf, full_tag("PRINTWMARK", 4, false, $certificate->printwmark)); fwrite($bf, full_tag("PRINTDATE", 4, false, $certificate->printdate)); fwrite($bf, full_tag("DATEFMT", 4, false, $certificate->datefmt)); fwrite($bf, full_tag("PRINTNUMBER", 4, false, $certificate->printnumber)); fwrite($bf, full_tag("PRINTGRADE", 4, false, $certificate->printgrade)); fwrite($bf, full_tag("GRADEFMT", 4, false, $certificate->gradefmt)); fwrite($bf, full_tag("PRINTTEACHER", 4, false, $certificate->printteacher)); fwrite($bf, full_tag("PRINTSIGNATURE", 4, false, $certificate->printsignature)); fwrite($bf, full_tag("PRINTSEAL", 4, false, $certificate->printseal)); fwrite($bf, full_tag("GRADECONDITION", 4, false, $certificate->gradecondition)); fwrite($bf, full_tag("PRINTCREDITHOURS", 4, false, $certificate->printcredithours)); fwrite($bf, full_tag("CREDITHOURS", 4, false, $certificate->credithours)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $certificate->timemodified)); fwrite($bf, full_tag("UNENROL", 4, false, $certificate->unenrol)); fwrite($bf, full_tag("ACTIVECONDIOTION", 4, false, $certificate->activecondition)); fwrite($bf, full_tag("PRINTGRADESTD", 4, false, $certificate->printgradestd)); //if we've selected to backup users info, then execute backup_certificate_issues and //backup_certificate_files_instance if (backup_userdata_selected($preferences, 'certificate', $certificate->id)) { $status = backup_certificate_issues($bf, $preferences, $certificate->id); if ($status) { $status = backup_certificate_file_instance($bf, $preferences, $certificate->id); } } //End mod fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function assignment_backup_one_mod($bf, $preferences, $assignment) { global $CFG, $DB; if (is_numeric($assignment)) { $assignment = $DB->get_record('assignment', array('id' => $assignment)); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print assignment data fwrite($bf, full_tag("ID", 4, false, $assignment->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "assignment")); fwrite($bf, full_tag("NAME", 4, false, $assignment->name)); fwrite($bf, full_tag("DESCRIPTION", 4, false, $assignment->intro)); fwrite($bf, full_tag("FORMAT", 4, false, $assignment->introformat)); fwrite($bf, full_tag("RESUBMIT", 4, false, $assignment->resubmit)); fwrite($bf, full_tag("PREVENTLATE", 4, false, $assignment->preventlate)); fwrite($bf, full_tag("EMAILTEACHERS", 4, false, $assignment->emailteachers)); fwrite($bf, full_tag("VAR1", 4, false, $assignment->var1)); fwrite($bf, full_tag("VAR2", 4, false, $assignment->var2)); fwrite($bf, full_tag("VAR3", 4, false, $assignment->var3)); fwrite($bf, full_tag("VAR4", 4, false, $assignment->var4)); fwrite($bf, full_tag("VAR5", 4, false, $assignment->var5)); fwrite($bf, full_tag("ASSIGNMENTTYPE", 4, false, $assignment->assignmenttype)); fwrite($bf, full_tag("MAXBYTES", 4, false, $assignment->maxbytes)); fwrite($bf, full_tag("TIMEDUE", 4, false, $assignment->timedue)); fwrite($bf, full_tag("TIMEAVAILABLE", 4, false, $assignment->timeavailable)); fwrite($bf, full_tag("GRADE", 4, false, $assignment->grade)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $assignment->timemodified)); $class = 'assignment_' . $assignment->assignmenttype; require_once $CFG->dirroot . '/mod/assignment/lib.php'; require_once $CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php'; call_user_func(array($class, 'backup_one_mod'), $bf, $preferences, $assignment); //if we've selected to backup users info, then execute backup_assignment_submisions and //backup_assignment_files_instance if (backup_userdata_selected($preferences, 'assignment', $assignment->id)) { $status = backup_assignment_submissions($bf, $preferences, $assignment); if ($status) { $status = backup_assignment_files_instance($bf, $preferences, $assignment->id); } } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function scorm_backup_one_mod($bf, $preferences, $scorm) { global $DB; $status = true; if (is_numeric($scorm)) { $scorm = $DB->get_record('scorm', array('id' => $scorm)); } //Start mod fwrite($bf, start_tag('MOD', 3, true)); //Print scorm data fwrite($bf, full_tag('ID', 4, false, $scorm->id)); fwrite($bf, full_tag('MODTYPE', 4, false, 'scorm')); fwrite($bf, full_tag('NAME', 4, false, $scorm->name)); fwrite($bf, full_tag('REFERENCE', 4, false, $scorm->reference)); fwrite($bf, full_tag('VERSION', 4, false, $scorm->version)); fwrite($bf, full_tag('MAXGRADE', 4, false, $scorm->maxgrade)); fwrite($bf, full_tag('GRADEMETHOD', 4, false, $scorm->grademethod)); fwrite($bf, full_tag('LAUNCH', 4, false, $scorm->launch)); fwrite($bf, full_tag('SKIPVIEW', 4, false, $scorm->skipview)); fwrite($bf, full_tag('SUMMARY', 4, false, $scorm->intro)); fwrite($bf, full_tag('HIDEBROWSE', 4, false, $scorm->hidebrowse)); fwrite($bf, full_tag('HIDETOC', 4, false, $scorm->hidetoc)); fwrite($bf, full_tag('HIDENAV', 4, false, $scorm->hidenav)); fwrite($bf, full_tag('AUTO', 4, false, $scorm->auto)); fwrite($bf, full_tag('POPUP', 4, false, $scorm->popup)); fwrite($bf, full_tag('OPTIONS', 4, false, $scorm->options)); fwrite($bf, full_tag('WIDTH', 4, false, $scorm->width)); fwrite($bf, full_tag('HEIGHT', 4, false, $scorm->height)); fwrite($bf, full_tag('MD5HASH', 4, false, $scorm->md5hash)); fwrite($bf, full_tag("MAXATTEMPT", 4, false, $scorm->maxattempt)); fwrite($bf, full_tag("UPDATEFREQ", 4, false, $scorm->updatefreq)); fwrite($bf, full_tag('TIMEMODIFIED', 4, false, $scorm->timemodified)); $status = backup_scorm_scoes($bf, $preferences, $scorm->id); //if we've selected to backup users info, then execute backup_scorm_scoes_track if ($status) { if (backup_userdata_selected($preferences, 'scorm', $scorm->id)) { $status = backup_scorm_scoes_track($bf, $preferences, $scorm->id); } $status = backup_scorm_files_instance($bf, $preferences, $scorm->id); } //End mod $status = fwrite($bf, end_tag('MOD', 3, true)); return $status; }
function netpublish_backup_one_mod($bf, $preferences, $netpublish) { global $CFG; $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print forum data fwrite($bf, full_tag("ID", 4, false, $netpublish->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "netpublish")); fwrite($bf, full_tag("NAME", 4, false, $netpublish->name)); fwrite($bf, full_tag("INTRO", 4, false, $netpublish->intro)); fwrite($bf, full_tag("TIMECREATED", 4, false, $netpublish->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $netpublish->timemodified)); fwrite($bf, full_tag("MAXSIZE", 4, false, $netpublish->maxsize)); fwrite($bf, full_tag("LOCKTIME", 4, false, $netpublish->locktime)); fwrite($bf, full_tag("PUBLISHED", 4, false, $netpublish->published)); fwrite($bf, full_tag("FULLPAGE", 4, false, $netpublish->fullpage)); fwrite($bf, full_tag("STATUSCOUNT", 4, false, $netpublish->statuscount)); fwrite($bf, full_tag("SCALE", 4, false, $netpublish->scale)); if (backup_userdata_selected($preferences, 'netpublish', $netpublish->id)) { // Backup grades. $status = backup_netpublish_grades($bf, $preferences, $netpublish->id); // Backup first section names. $status = backup_netpublish_first_section_name($bf, $preferences, $netpublish->id); if ($status) { // Backup sections. $status = backup_netpublish_sections($bf, $preferences, $netpublish->id); // Get articles in this netpublish and section $status = backup_netpublish_articles($bf, $preferences, $netpublish->id); } } // if we've selected to backup users info, then backup files too only once // since netpublishes files are shared through course. if ($status) { if ($preferences->mods["netpublish"]->userinfo && $count < 2) { $status = backup_netpublish_files($bf, $preferences); } } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function udutu_backup_one_mod($bf, $preferences, $udutu) { $status = true; if (is_numeric($udutu)) { $udutu = get_record('udutu', 'id', $udutu); } //Start mod fwrite($bf, start_tag('MOD', 3, true)); //Print udutu data fwrite($bf, full_tag('ID', 4, false, $udutu->id)); fwrite($bf, full_tag('MODTYPE', 4, false, 'udutu')); fwrite($bf, full_tag('NAME', 4, false, $udutu->name)); fwrite($bf, full_tag('REFERENCE', 4, false, $udutu->reference)); fwrite($bf, full_tag('VERSION', 4, false, $udutu->version)); fwrite($bf, full_tag('MAXGRADE', 4, false, $udutu->maxgrade)); fwrite($bf, full_tag('GRADEMETHOD', 4, false, $udutu->grademethod)); fwrite($bf, full_tag('LAUNCH', 4, false, $udutu->launch)); fwrite($bf, full_tag('SKIPVIEW', 4, false, $udutu->skipview)); fwrite($bf, full_tag('SUMMARY', 4, false, $udutu->summary)); fwrite($bf, full_tag('HIDEBROWSE', 4, false, $udutu->hidebrowse)); fwrite($bf, full_tag('HIDETOC', 4, false, $udutu->hidetoc)); fwrite($bf, full_tag('HIDENAV', 4, false, $udutu->hidenav)); fwrite($bf, full_tag('AUTO', 4, false, $udutu->auto)); fwrite($bf, full_tag('POPUP', 4, false, $udutu->popup)); fwrite($bf, full_tag('OPTIONS', 4, false, $udutu->options)); fwrite($bf, full_tag('WIDTH', 4, false, $udutu->width)); fwrite($bf, full_tag('HEIGHT', 4, false, $udutu->height)); fwrite($bf, full_tag('TIMEMODIFIED', 4, false, $udutu->timemodified)); $status = backup_udutu_scoes($bf, $preferences, $udutu->id); //if we've selected to backup users info, then execute backup_udutu_scoes_track if ($status) { if (backup_userdata_selected($preferences, 'udutu', $udutu->id)) { $status = backup_udutu_scoes_track($bf, $preferences, $udutu->id); } $status = backup_udutu_files_instance($bf, $preferences, $udutu->id); } //End mod $status = fwrite($bf, end_tag('MOD', 3, true)); return $status; }
function mail_backup_one_mod($bf, $preferences, $mail) { global $CFG; if (is_numeric($mail)) { $mail = get_record('mail', 'id', $mail); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print mail data fwrite($bf, full_tag("ID", 4, false, $mail->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "mail")); fwrite($bf, full_tag("NAME", 4, false, $mail->name)); fwrite($bf, full_tag("SUMMARY", 4, false, $mail->summary)); fwrite($bf, full_tag("MAXBYTES", 4, false, $mail->maxbytes)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $mail->timemodified)); $userdata = backup_userdata_selected($preferences, 'mail', $mail->id); //back up the Folders $status = backup_mail_folders($bf, $preferences, $mail->id, $userdata); //if we've selected to backup users info if ($status) { if ($userdata) { if (!backup_mail_groups($bf, $preferences, $mail->id)) { return false; } if (!backup_mail_statistics($bf, $preferences, $mail->course)) { return false; } if (!backup_mail_files_instance($bf, $preferences, $mail->id)) { return false; } } //End mod if ($status) { fwrite($bf, end_tag("MOD", 3, true)); } } return $status; }
function blended_backup_one_mod($bf, $preferences, $blended) { global $CFG; if (is_numeric($blended)) { $blended = get_record('blended', 'id', $blended); } $status = true; //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print blended data fwrite($bf, full_tag("ID", 4, false, $blended->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "blended")); fwrite($bf, full_tag("NAME", 4, false, $blended->name)); fwrite($bf, full_tag("DESCRIPTION", 4, false, $blended->description)); fwrite($bf, full_tag("IDMETHOD", 4, false, $blended->idmethod)); fwrite($bf, full_tag("IDTYPE", 4, false, $blended->idtype)); fwrite($bf, full_tag("CODEBARTYPE", 4, false, $blended->codebartype)); fwrite($bf, full_tag("LENGTHUSERINFO", 4, false, $blended->lengthuserinfo)); fwrite($bf, full_tag("TEAMMETHOD", 4, false, $blended->teammethod)); fwrite($bf, full_tag("NUMTEAMS", 4, false, $blended->numteams)); fwrite($bf, full_tag("NUMMEMBERS", 4, false, $blended->nummembers)); fwrite($bf, full_tag("ASSIGNMENT", 4, false, $blended->assignment)); fwrite($bf, full_tag("RANDOMKEY", 4, false, $blended->randomkey)); //if we've selected to backup users info, then execute backup_blended_jobs and //backup_blended_scans if (backup_userdata_selected($preferences, 'blended', $blendedt->id)) { $status = backup_blended_jobs($bf, $preferences, $blended); if ($status) { $status = backup_blended_scans($bf, $preferences, $blended->id); } //Si se quiere guardar el quiz_attempts, question_session y question_states en algún momento habría //que hacer una llamada a backup_quiz_attempts($bf,$preferences,$quiz); para cada $quiz. } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }
/** * Backs-up one instance of a SLOODLE module. * @param $bf Handle to the file to which backup data should be written. * @param $preferences Structure defining preferences which govern the backup. * @param object|int $mod If an object, then it is a record from the 'sloodle' db table. If it is a number, then it is the ID of a record in the 'sloodle' db table. * @return bool True if successful, or false if not. */ function sloodle_backup_one_mod($bf, $preferences, $mod) { // Load a 'sloodle' record if necessary if (is_numeric($mod)) { $mod = get_record('sloodle', 'id', $mod); if ($mod === false) { return false; } } $status = true; // Attempt to load the course module record from the database $cm = get_coursemodule_from_instance('sloodle', $mod->id); if ($cm === false) { return false; } // Attempt to get a SloodleModule object for this module sub-type $dummysession = new SloodleSession(false); // We need to provide this to keep the module happy! $moduleobj = sloodle_load_module($mod->type, $dummysession, $cm->id); if ($moduleobj == false) { return false; } // Start an element for this module instance, and backup the primary table data fwrite($bf, start_tag('MOD', 3, true)); fwrite($bf, full_tag('ID', 4, false, $mod->id)); // Instance ID of this SLOODLE module fwrite($bf, full_tag('MODTYPE', 4, false, 'sloodle')); // Main type of module (always 'sloodle' in this case) fwrite($bf, full_tag('SUBTYPE', 4, false, $mod->type)); // Sub-type of module (e.g. 'controller' or 'presenter') fwrite($bf, full_tag('NAME', 4, false, $mod->name)); fwrite($bf, full_tag('INTRO', 4, false, $mod->intro)); fwrite($bf, full_tag('TIMECREATED', 4, false, $mod->timecreated)); fwrite($bf, full_tag('TIMEMODIFIED', 4, false, $mod->timemodified)); // Backup any secondary data fwrite($bf, start_tag('SECONDARYDATA', 4, true)); if (!$moduleobj->backup($bf, backup_userdata_selected($preferences, 'sloodle', $mod->id))) { $status = false; } fwrite($bf, end_tag('SECONDARYDATA', 4, true)); // Finish off if (!fwrite($bf, end_tag('MOD', 3, true))) { $status = false; } return $status; }
function backup_gradebook_item_info($bf, $preferences, $backupall) { global $CFG; $status = true; // get all the grade_items, ordered by sort order since upon restoring, it is not always // possible to use the same sort order. We could at least preserve the sortorder by restoring // grade_items in the original sortorder if ($grade_items = get_records_sql("SELECT *\n FROM {$CFG->prefix}grade_items\n WHERE courseid = {$preferences->backup_course}\n ORDER BY sortorder ASC")) { //Begin grade_items tag fwrite($bf, start_tag("GRADE_ITEMS", 3, true)); //Iterate over each item foreach ($grade_items as $item) { // Instantiate a grade_item object, to access its methods $grade_item = new grade_item($item, false); // do not restore if this grade_item is a mod, and if ($grade_item->itemtype == 'mod') { //MDL-12463 - exclude grade_items of instances not chosen for backup if (empty($preferences->mods[$grade_item->itemmodule]->instances[$grade_item->iteminstance]->backup)) { continue; } } else { if ($grade_item->itemtype == 'category') { // if not all grade items are being backed up // we ignore this type of grade_item and grades associated if (!$backupall) { continue; } } } //Begin grade_item fwrite($bf, start_tag("GRADE_ITEM", 4, true)); //Output individual fields fwrite($bf, full_tag("ID", 5, false, $grade_item->id)); fwrite($bf, full_tag("CATEGORYID", 5, false, $grade_item->categoryid)); fwrite($bf, full_tag("ITEMNAME", 5, false, $grade_item->itemname)); fwrite($bf, full_tag("ITEMTYPE", 5, false, $grade_item->itemtype)); fwrite($bf, full_tag("ITEMMODULE", 5, false, $grade_item->itemmodule)); fwrite($bf, full_tag("ITEMINSTANCE", 5, false, $grade_item->iteminstance)); fwrite($bf, full_tag("ITEMNUMBER", 5, false, $grade_item->itemnumber)); fwrite($bf, full_tag("ITEMINFO", 5, false, $grade_item->iteminfo)); fwrite($bf, full_tag("IDNUMBER", 5, false, $grade_item->idnumber)); // use [idnumber] in calculation instead of [#giXXX#] fwrite($bf, full_tag("CALCULATION", 5, false, $grade_item->get_calculation())); fwrite($bf, full_tag("GRADETYPE", 5, false, $grade_item->gradetype)); fwrite($bf, full_tag("GRADEMAX", 5, false, $grade_item->grademax)); fwrite($bf, full_tag("GRADEMIN", 5, false, $grade_item->grademin)); fwrite($bf, full_tag("SCALEID", 5, false, $grade_item->scaleid)); fwrite($bf, full_tag("OUTCOMEID", 5, false, $grade_item->outcomeid)); fwrite($bf, full_tag("GRADEPASS", 5, false, $grade_item->gradepass)); fwrite($bf, full_tag("MULTFACTOR", 5, false, $grade_item->multfactor)); fwrite($bf, full_tag("PLUSFACTOR", 5, false, $grade_item->plusfactor)); fwrite($bf, full_tag("AGGREGATIONCOEF", 5, false, $grade_item->aggregationcoef)); fwrite($bf, full_tag("DISPLAY", 5, false, $grade_item->display)); fwrite($bf, full_tag("DECIMALS", 5, false, $grade_item->decimals)); fwrite($bf, full_tag("HIDDEN", 5, false, $grade_item->hidden)); fwrite($bf, full_tag("LOCKED", 5, false, $grade_item->locked)); fwrite($bf, full_tag("LOCKTIME", 5, false, $grade_item->locktime)); fwrite($bf, full_tag("NEEDSUPDATE", 5, false, $grade_item->needsupdate)); fwrite($bf, full_tag("TIMECREATED", 5, false, $grade_item->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 5, false, $grade_item->timemodified)); // back up the other stuff here // mod grades should only be backed up if selected if ($grade_item->itemtype == 'mod' && !backup_userdata_selected($preferences, $grade_item->itemmodule, $grade_item->iteminstance)) { // do not write grades if a mod grade_item is being restored // but userdata is not selected } else { $status = backup_gradebook_grades_info($bf, $preferences, $grade_item->id); } //End grade_item fwrite($bf, end_tag("GRADE_ITEM", 4, true)); } //End grade_items tag $status = fwrite($bf, end_tag("GRADE_ITEMS", 3, true)); } return $status; }
function data_backup_one_mod($bf, $preferences, $data) { global $CFG; if (is_numeric($data)) { // backwards compatibility $data = get_record('data', 'id', $data); } $instanceid = $data->id; $status = true; fwrite($bf, start_tag("MOD", 3, true)); //Print data data fwrite($bf, full_tag("ID", 4, false, $data->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "data")); fwrite($bf, full_tag("NAME", 4, false, $data->name)); fwrite($bf, full_tag("INTRO", 4, false, $data->intro)); fwrite($bf, full_tag("COMMENTS", 4, false, $data->comments)); fwrite($bf, full_tag("TIMEAVAILABLEFROM", 4, false, $data->timeavailablefrom)); fwrite($bf, full_tag("TIMEAVAILABLETO", 4, false, $data->timeavailableto)); fwrite($bf, full_tag("TIMEVIEWFROM", 4, false, $data->timeviewfrom)); fwrite($bf, full_tag("TIMEVIEWTO", 4, false, $data->timeviewto)); fwrite($bf, full_tag("REQUIREDENTRIES", 4, false, $data->requiredentries)); fwrite($bf, full_tag("REQUIREDENTRIESTOVIEW", 4, false, $data->requiredentriestoview)); fwrite($bf, full_tag("MAXENTRIES", 4, false, $data->maxentries)); fwrite($bf, full_tag("RSSARTICLES", 4, false, $data->rssarticles)); fwrite($bf, full_tag("SINGLETEMPLATE", 4, false, $data->singletemplate)); fwrite($bf, full_tag("LISTTEMPLATE", 4, false, $data->listtemplate)); fwrite($bf, full_tag("LISTTEMPLATEHEADER", 4, false, $data->listtemplateheader)); fwrite($bf, full_tag("LISTTEMPLATEFOOTER", 4, false, $data->listtemplatefooter)); fwrite($bf, full_tag("ADDTEMPLATE", 4, false, $data->addtemplate)); fwrite($bf, full_tag("RSSTEMPLATE", 4, false, $data->rsstemplate)); fwrite($bf, full_tag("RSSTITLETEMPLATE", 4, false, $data->rsstitletemplate)); fwrite($bf, full_tag("CSSTEMPLATE", 4, false, $data->csstemplate)); fwrite($bf, full_tag("JSTEMPLATE", 4, false, $data->jstemplate)); fwrite($bf, full_tag("APPROVAL", 4, false, $data->approval)); fwrite($bf, full_tag("SCALE", 4, false, $data->scale)); fwrite($bf, full_tag("ASSESSED", 4, false, $data->assessed)); fwrite($bf, full_tag("DEFAULTSORT", 4, false, $data->defaultsort)); fwrite($bf, full_tag("DEFAULTSORTDIR", 4, false, $data->defaultsortdir)); fwrite($bf, full_tag("EDITANY", 4, false, $data->editany)); fwrite($bf, full_tag("NOTIFICATION", 4, false, $data->notification)); // if we've selected to backup users info, then call any other functions we need // including backing up individual files $status = backup_data_fields($bf, $preferences, $data->id); if (backup_userdata_selected($preferences, 'data', $data->id)) { //$status = backup_someuserdata_for_this_instance(); //$status = backup_somefiles_for_this_instance(); // ... etc $status = backup_data_records($bf, $preferences, $data->id); if ($status) { $status = backup_data_files_instance($bf, $preferences, $data->id); //recursive copy } } fwrite($bf, end_tag("MOD", 3, true)); return $status; }
function backup_lesson_answers($bf, $preferences, $pageno) { global $CFG, $DB; $status = true; // get the answers in a set order, the id order $lesson_answers = $DB->get_records("lesson_answers", array("pageid" => $pageno), "id"); //If there is lesson_answers if ($lesson_answers) { //Write start tag $status = fwrite($bf, start_tag("ANSWERS", 6, true)); //Iterate over each element foreach ($lesson_answers as $answer) { //Start answer $status = fwrite($bf, start_tag("ANSWER", 7, true)); //Print answer contents fwrite($bf, full_tag("ID", 8, false, $answer->id)); fwrite($bf, full_tag("JUMPTO", 8, false, $answer->jumpto)); fwrite($bf, full_tag("GRADE", 8, false, $answer->grade)); fwrite($bf, full_tag("SCORE", 8, false, $answer->score)); fwrite($bf, full_tag("FLAGS", 8, false, $answer->flags)); fwrite($bf, full_tag("TIMECREATED", 8, false, $answer->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 8, false, $answer->timemodified)); fwrite($bf, full_tag("ANSWERTEXT", 8, false, $answer->answer)); fwrite($bf, full_tag("RESPONSE", 8, false, $answer->response)); //Now we backup any lesson attempts (if student data required) if (backup_userdata_selected($preferences, 'lesson', $answer->lessonid)) { $status = backup_lesson_attempts($bf, $preferences, $answer->id); } //End rubric $status = fwrite($bf, end_tag("ANSWER", 7, true)); } //Write end tag $status = fwrite($bf, end_tag("ANSWERS", 6, true)); } return $status; }
function quiz_backup_one_mod($bf, $preferences, $quiz) { $status = true; if (is_numeric($quiz)) { $quiz = get_record('quiz', 'id', $quiz); } //Start mod fwrite($bf, start_tag("MOD", 3, true)); //Print quiz data fwrite($bf, full_tag("ID", 4, false, $quiz->id)); fwrite($bf, full_tag("MODTYPE", 4, false, "quiz")); fwrite($bf, full_tag("NAME", 4, false, $quiz->name)); fwrite($bf, full_tag("INTRO", 4, false, $quiz->intro)); fwrite($bf, full_tag("TIMEOPEN", 4, false, $quiz->timeopen)); fwrite($bf, full_tag("TIMECLOSE", 4, false, $quiz->timeclose)); fwrite($bf, full_tag("OPTIONFLAGS", 4, false, $quiz->optionflags)); fwrite($bf, full_tag("PENALTYSCHEME", 4, false, $quiz->penaltyscheme)); fwrite($bf, full_tag("ATTEMPTS_NUMBER", 4, false, $quiz->attempts)); fwrite($bf, full_tag("ATTEMPTONLAST", 4, false, $quiz->attemptonlast)); fwrite($bf, full_tag("GRADEMETHOD", 4, false, $quiz->grademethod)); fwrite($bf, full_tag("DECIMALPOINTS", 4, false, $quiz->decimalpoints)); fwrite($bf, full_tag("REVIEW", 4, false, $quiz->review)); fwrite($bf, full_tag("QUESTIONSPERPAGE", 4, false, $quiz->questionsperpage)); fwrite($bf, full_tag("SHUFFLEQUESTIONS", 4, false, $quiz->shufflequestions)); fwrite($bf, full_tag("SHUFFLEANSWERS", 4, false, $quiz->shuffleanswers)); fwrite($bf, full_tag("QUESTIONS", 4, false, $quiz->questions)); fwrite($bf, full_tag("SUMGRADES", 4, false, $quiz->sumgrades)); fwrite($bf, full_tag("GRADE", 4, false, $quiz->grade)); fwrite($bf, full_tag("TIMECREATED", 4, false, $quiz->timecreated)); fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $quiz->timemodified)); fwrite($bf, full_tag("TIMELIMIT", 4, false, $quiz->timelimit)); fwrite($bf, full_tag("PASSWORD", 4, false, $quiz->password)); fwrite($bf, full_tag("SUBNET", 4, false, $quiz->subnet)); fwrite($bf, full_tag("POPUP", 4, false, $quiz->popup)); fwrite($bf, full_tag("DELAY1", 4, false, $quiz->delay1)); fwrite($bf, full_tag("DELAY2", 4, false, $quiz->delay2)); //Now we print to xml question_instances (Course Level) $status = backup_quiz_question_instances($bf, $preferences, $quiz->id); //Now we print to xml quiz_feedback (Course Level) $status = backup_quiz_feedback($bf, $preferences, $quiz->id); //Now we print to xml question_versions (Course Level) $status = backup_quiz_question_versions($bf, $preferences, $quiz->id); //if we've selected to backup users info, then execute: // - backup_quiz_grades // - backup_quiz_attempts if (backup_userdata_selected($preferences, 'quiz', $quiz->id) && $status) { $status = backup_quiz_grades($bf, $preferences, $quiz->id); if ($status) { $status = backup_quiz_attempts($bf, $preferences, $quiz->id); } } //End mod $status = fwrite($bf, end_tag("MOD", 3, true)); return $status; }