protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $elluminate = new backup_nested_element('elluminate', array('id'), array('meetingid', 'meetinginit', 'course', 'creator', 'sessiontype', 'groupingid', 'groupmode', 'groupid', 'groupparentid', 'name', 'sessionname', 'description', 'intro', 'introformat', 'customname', 'customdescription', 'timestart', 'timeend', 'recordingmode', 'boundarytime', 'boundarytimedisplay', 'maxtalkers', 'chairlist', 'nonchairlist', 'grade', 'timemodified')); $recordings = new backup_nested_element('recordings'); $recording = new backup_nested_element('recording', array('id'), array('meetingid', 'recordingid', 'description', 'recordingsize', 'visible', 'groupvisible', 'created')); $preloads = new backup_nested_element('preloads'); $preload = new backup_nested_element('preload', array('id'), array('meetingid', 'presentationid', 'description', 'size', 'creatorid')); $attendance = new backup_nested_element('attendance'); $attendee = new backup_nested_element('attendee', array('id'), array('userid', 'elluminateid', 'grade', 'timemodified')); // Build the tree $elluminate->add_child($recordings); $recordings->add_child($recording); $elluminate->add_child($preloads); $preloads->add_child($preload); $elluminate->add_child($attendance); $attendance->add_child($attendee); // Define sources $elluminate->set_source_table('elluminate', array('id' => backup::VAR_ACTIVITYID)); $recording->set_source_table('elluminate_recordings', array('meetingid' => '../../meetingid')); $preload->set_source_table('elluminate_preloads', array('meetingid' => '../../meetingid')); // All the rest of elements only happen if we are including user info if ($userinfo) { $attendance->set_source_table('elluminate_attendance', array('elluminateid' => backup::VAR_ACTIVITYID)); } // Define id annotations // Define file annotations // Return the root element (elluminate), wrapped into standard activity structure return $this->prepare_activity_structure($elluminate); }
protected function define_structure() { // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $lightboxgallery = new backup_nested_element('lightboxgallery', array('id'), array('course', 'folder', 'name', 'perpage', 'comments', 'extinfo', 'timemodified', 'ispublic', 'rss', 'autoresize', 'resize', 'perrow', 'captionfull', 'captionpos', 'intro', 'introformat')); $comments = new backup_nested_element('usercomments'); $comment = new backup_nested_element('comment', array('id'), array('gallery', 'userid', 'commenttext', 'timemodified')); $imagemetas = new backup_nested_element('image_metas'); $imagemeta = new backup_nested_element('image_meta', array('id'), array('gallery', 'image', 'description', 'metatype')); // Build the tree. $lightboxgallery->add_child($comments); $comments->add_child($comment); $lightboxgallery->add_child($imagemetas); $imagemetas->add_child($imagemeta); // Define sources. $lightboxgallery->set_source_table('lightboxgallery', array('id' => backup::VAR_ACTIVITYID)); $imagemeta->set_source_table('lightboxgallery_image_meta', array('gallery' => backup::VAR_PARENTID)); // All the rest of elements only happen if we are including user info. if ($userinfo) { $comment->set_source_table('lightboxgallery_comments', array('gallery' => backup::VAR_PARENTID)); } // Define file annotations. $lightboxgallery->annotate_files('mod_lightboxgallery', 'gallery_images', null); $lightboxgallery->annotate_files('mod_lightboxgallery', 'gallery_thumbs', null); $lightboxgallery->annotate_files('mod_lightboxgallery', 'gallery_index', null); $lightboxgallery->annotate_files('mod_lightboxgallery', 'intro', null); $comment->annotate_ids('user', 'userid'); // Return the root element (lightboxgallery), wrapped into standard activity structure. return $this->prepare_activity_structure($lightboxgallery); }
/** * Define the structure for the publication activity * @return void */ protected function define_structure() { // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $publication = new backup_nested_element('publication', array('id'), array('name', 'intro', 'introformat', 'alwaysshowdescription', 'duedate', 'allowsubmissionsfromdate', 'timemodified', 'cutoffdate', 'mode', 'importfrom', 'obtainstudentapproval', 'maxfiles', 'maxbytes', 'allowedfiletypes', 'obtainteacherapproval')); $extduedates = new backup_nested_element('extduedates'); $extduedate = new backup_nested_element('extduedate', array('id'), array('userid', 'publication', 'extensionduedate')); $files = new backup_nested_element('files'); $file = new backup_nested_element('file', array('id'), array('userid', 'timecreated', 'fileid', 'filename', 'contenthash', 'type', 'teacherapproval', 'studentapproval')); // Define sources. $publication->set_source_table('publication', array('id' => backup::VAR_ACTIVITYID)); if ($userinfo) { // Build the tree. $publication->add_child($extduedates); $extduedates->add_child($extduedate); $publication->add_child($files); $files->add_child($file); $extduedate->set_source_table('publication_extduedates', array('publication' => backup::VAR_PARENTID)); $file->set_source_table('publication_file', array('publication' => backup::VAR_PARENTID)); $file->annotate_files('mod_publication', 'attachment', null); // Define id annotations. $extduedate->annotate_ids('user', 'userid'); $file->annotate_ids('user', 'userid'); // Define file annotations. // This file area hasn't itemid. $publication->annotate_files('mod_publication', 'attachment', null); } // Return the root element (publication), wrapped into standard activity structure. return $this->prepare_activity_structure($publication); }
protected function define_structure() { // Define each element separated $attendance = new backup_nested_element('attendance'); $block = new backup_nested_element('block', array('id'), array('course', 'name', 'grade')); $statuses = new backup_nested_element('statuses'); $status = new backup_nested_element('status', array('id'), array('courseid', 'acronym', 'description', 'grade', 'visible', 'deleted')); $sessions = new backup_nested_element('session', array('id'), array('courseid', 'sessdate', 'duration', 'lasttaken', 'lasttakenby', 'description', 'timemodified')); $logs = new backup_nested_element('logs'); $log = new backup_nested_element('log', array('id'), array('sessionid', 'studentid', 'statusid', 'statusset', 'timetaken', 'takenby', 'remarks')); // Build the tree $attendance->add_child($block); $attendance->add_child($statuses); $statuses->add_child($status); $attendance->add_child($sessions); $sessions->add_child($logs); $logs->add_child($log); /* $sessions->add_child($logs); $logs->add_child($log); $sessions->add_child($status); $sessions->add_child($block); */ // Define sources $block->set_source_table('attforblock', array('id' => backup::VAR_ACTIVITYID)); $status->set_source_table('attendance_statuses', array('courseid' => backup::VAR_COURSEID)); $sessions->set_source_table('attendance_sessions', array('courseid' => backup::VAR_COURSEID)); $log->set_source_table('attendance_log', array('sessionid' => backup::VAR_PARENTID)); // Define id annotations $log->annotate_ids('user', 'studentid'); // Return the root element (chat), wrapped into standard activity structure return $this->prepare_activity_structure($attendance); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $choice = new backup_nested_element('choice', array('id'), array('name', 'intro', 'introformat', 'publish', 'showresults', 'display', 'allowupdate', 'allowunanswered', 'limitanswers', 'timeopen', 'timeclose', 'timemodified', 'completionsubmit')); $options = new backup_nested_element('options'); $option = new backup_nested_element('option', array('id'), array('text', 'maxanswers', 'timemodified')); $answers = new backup_nested_element('answers'); $answer = new backup_nested_element('answer', array('id'), array('userid', 'optionid', 'timemodified')); // Build the tree $choice->add_child($options); $options->add_child($option); $choice->add_child($answers); $answers->add_child($answer); // Define sources $choice->set_source_table('choice', array('id' => backup::VAR_ACTIVITYID)); $option->set_source_sql(' SELECT * FROM {choice_options} WHERE choiceid = ?', array(backup::VAR_PARENTID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $answer->set_source_table('choice_answers', array('choiceid' => '../../id')); } // Define id annotations $answer->annotate_ids('user', 'userid'); // Define file annotations $choice->annotate_files('mod_choice', 'intro', null); // This file area hasn't itemid // Return the root element (choice), wrapped into standard activity structure return $this->prepare_activity_structure($choice); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $survey = new backup_nested_element('survey', array('id'), array('name', 'intro', 'introformat', 'template', 'questions', 'days', 'timecreated', 'timemodified', 'completionsubmit')); $answers = new backup_nested_element('answers'); $answer = new backup_nested_element('answer', array('id'), array('userid', 'question', 'time', 'answer1', 'answer2')); $analysis = new backup_nested_element('analysis'); $analys = new backup_nested_element('analys', array('id'), array('userid', 'notes')); // Build the tree $survey->add_child($answers); $answers->add_child($answer); $survey->add_child($analysis); $analysis->add_child($analys); // Define sources $survey->set_source_table('survey', array('id' => backup::VAR_ACTIVITYID)); $answer->set_source_table('survey_answers', array('survey' => backup::VAR_PARENTID)); $analys->set_source_table('survey_analysis', array('survey' => backup::VAR_PARENTID)); // Define id annotations $answer->annotate_ids('user', 'userid'); $analys->annotate_ids('user', 'userid'); // Define file annotations $survey->annotate_files('mod_survey', 'intro', null); // This file area hasn't itemid // Return the root element (survey), wrapped into standard activity structure return $this->prepare_activity_structure($survey); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $voiceshadow = new backup_nested_element('voiceshadow', array('id'), array('course', 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'teacher', 'embedvideo', 'recordtype', 'timemodified')); $files = new backup_nested_element('files', array('id'), array('instance', 'userid', 'summary', 'itemoldid', 'itemid', 'itemimgid', 'filename', 'time')); $ratings = new backup_nested_element('ratings', array('id'), array('fileid', 'userid', 'rating', 'ratingrhythm', 'ratingclear', 'ratingintonation', 'ratingspeed', 'ratingreproduction', 'summary', 'time')); $comments = new backup_nested_element('comments', array('id'), array('instance', 'fileid', 'userid', 'summary', 'itemoldid', 'itemid', 'itemimgid', 'filename', 'time')); $process = new backup_nested_element('process', array('id'), array('itemid', 'type')); // Build the tree $voiceshadow->add_child($files); $voiceshadow->add_child($ratings); $voiceshadow->add_child($comments); $voiceshadow->add_child($process); // Define sources $voiceshadow->set_source_table('voiceshadow', array('id' => backup::VAR_ACTIVITYID, 'course' => backup::VAR_COURSEID)); $files->set_source_table('voiceshadow_files', array('instance' => backup::VAR_ACTIVITYID)); $comments->set_source_table('voiceshadow_comments', array('instance' => backup::VAR_ACTIVITYID)); // Define id annotations $voiceshadow->annotate_ids('teacher', 'userid'); $files->annotate_ids('userid', 'userid'); $ratings->annotate_ids('userid', 'userid'); $comments->annotate_ids('userid', 'userid'); // Return the root element (voiceshadow), wrapped into standard activity structure return $this->prepare_activity_structure($voiceshadow); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $groupselect = new backup_nested_element('groupselect', array('id'), array('name', 'intro', 'introformat', 'targetgrouping', 'maxmembers', 'timeavailable', 'timedue', 'timecreated', 'timemodified', 'hidefullgroups', 'deleteemptygroups', 'studentcancreate', 'minmembers', 'assignteachers', 'studentcansetdesc', 'showassignedteacher', 'studentcansetenrolmentkey', 'studentcansetgroupname', 'notifyexpiredselection')); $passwords = new backup_nested_element('passwords'); $password = new backup_nested_element('password', array('id'), array('groupid', 'password')); $groupteachers = new backup_nested_element('groupteachers'); $groupteacher = new backup_nested_element('groupteacher', array('id'), array('groupid', 'teacherid')); // Build the tree $groupselect->add_child($passwords); $passwords->add_child($password); $groupselect->add_child($groupteachers); $groupteachers->add_child($groupteacher); // Define sources $groupselect->set_source_table('groupselect', array('id' => backup::VAR_ACTIVITYID)); $password->set_source_table('groupselect_passwords', array('instance_id' => backup::VAR_ACTIVITYID)); if ($userinfo) { $groupteacher->set_source_table('groupselect_groups_teachers', array('instance_id' => backup::VAR_ACTIVITYID)); } // Define id annotations $groupselect->annotate_ids('grouping', 'targetgrouping'); $password->annotate_ids('group', 'groupid'); $groupteacher->annotate_ids('group', 'groupid'); $groupteacher->annotate_ids('user', 'teacherid'); // Define file annotations $groupselect->annotate_files('mod_groupselect', 'intro', null); // This file areas haven't itemid // Return the root element (groupselect), wrapped into standard activity structure return $this->prepare_activity_structure($groupselect); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $hvp = new backup_nested_element('hvp', array('id'), array('course', 'name', 'json_content', 'embed_type', 'disable', 'main_library_id', 'content_type', 'author', 'license', 'meta_keywords', 'meta_description', 'filtered', 'slug', 'timecreated', 'timemodified')); $hvp_libraries = new backup_nested_element('libraries'); $hvp_library = new backup_nested_element('library', null, array('machine_name', 'major_version', 'minor_version', 'patch_version', 'dependency_type', 'drop_css', 'weight')); $content_user_data_entries = new backup_nested_element('content_user_data'); $content_user_data = new backup_nested_element('entry', array('id'), array('user_id', 'hvp_id', 'sub_content_id', 'data_id', 'data', 'preloaded', 'delete_on_content_change')); // Build the tree $hvp->add_child($content_user_data_entries); $content_user_data_entries->add_child($content_user_data); $hvp->add_child($hvp_libraries); $hvp_libraries->add_child($hvp_library); // Define sources $hvp->set_source_table('hvp', array('id' => backup::VAR_ACTIVITYID)); $lib_sql = "SELECT\n machine_name,\n major_version,\n minor_version,\n patch_version,\n dependency_type,\n drop_css,\n weight\n FROM {hvp_libraries} hl\n JOIN {hvp_contents_libraries} hcl\n ON hl.id = hcl.library_id\n JOIN {hvp} h\n ON h.id = hcl.hvp_id\n WHERE h.id = ?"; $hvp_library->set_source_sql($lib_sql, array(backup::VAR_ACTIVITYID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $content_user_data->set_source_table('hvp_content_user_data', array('hvp_id' => backup::VAR_PARENTID), 'id ASC'); } // Define id annotations $content_user_data->annotate_ids('user', 'user_id'); // Define file annotations $hvp->annotate_files('mod_hvp', 'content', null); // Return the root element (hvp), wrapped into standard activity structure return $this->prepare_activity_structure($hvp); }
/** * Define the structure of the backup file. * * @return backup_nested_element */ protected function define_structure() { // The instance. $customcert = new backup_nested_element('customcert', array('id'), array('name', 'intro', 'introformat', 'requiredtime', 'protection', 'timecreated', 'timemodified')); // The issues. $issues = new backup_nested_element('issues'); $issue = new backup_nested_element('issue', array('id'), array('customcertid', 'userid', 'timecreated', 'code')); // The pages. $pages = new backup_nested_element('pages'); $page = new backup_nested_element('page', array('id'), array('customcertid', 'width', 'height', 'margin', 'pagenumber', 'timecreated', 'timemodified')); // The elements. $element = new backup_nested_element('element', array('id'), array('pageid', 'name', 'element', 'data', 'font', 'size', 'colour', 'width', 'refpoint', 'align', 'posx', 'posy', 'sequence', 'timecreated', 'timemodified')); // Build the tree. $customcert->add_child($issues); $issues->add_child($issue); $customcert->add_child($pages); $pages->add_child($page); $page->add_child($element); // Define sources. $customcert->set_source_table('customcert', array('id' => backup::VAR_ACTIVITYID)); // Define page source. $page->set_source_table('customcert_pages', array('customcertid' => backup::VAR_ACTIVITYID)); // Define element source, each element belongs to a page. $element->set_source_table('customcert_elements', array('pageid' => backup::VAR_PARENTID)); // If we are including user info then save the issues. if ($this->get_setting_value('userinfo')) { $issue->set_source_table('customcert_issues', array('customcertid' => backup::VAR_ACTIVITYID)); } // Annotate the user id's where required. $issue->annotate_ids('user', 'userid'); // Return the root element (customcert), wrapped into standard activity structure. return $this->prepare_activity_structure($customcert); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $rcontent = new backup_nested_element('rcontent', array('id'), array('course', 'name', 'intro', 'introformat', 'levelid', 'whatgrade', 'popup', 'popup_options', 'frame', 'width', 'height', 'timecreated', 'timemodified', 'levelcode', 'isbn', 'unitcode', 'activitycode')); $grades = new backup_nested_element('grades'); $grade = new backup_nested_element('grade', array('id'), array('userid', 'rcontentid', 'grade', 'mingrade', 'maxgrade', 'attempt', 'maxattempts', 'starttime', 'totaltime', 'maxtotaltime', 'status', 'comments', 'urlviewresults', 'sumweights', 'timecreated', 'timemodified', 'unitcode', 'activitycode')); $grades_details = new backup_nested_element('grades_details'); $grade_detail = new backup_nested_element('grade_detail', array('id'), array('userid', 'rcontentid', 'code', 'typeid', 'description', 'grade', 'mingrade', 'maxgrade', 'starttime', 'totaltime', 'maxtotaltime', 'attempt', 'maxattempts', 'weight', 'urlviewresults', 'timecreated', 'timemodified', 'unitcode', 'activitycode')); $track_credentials = new backup_nested_element('track_credentials'); $track_credential = new backup_nested_element('track_credential', array('id'), array('username', 'password', 'publisherid', 'timecreated', 'timemodified')); // Build the tree $rcontent->add_child($grades); $grades->add_child($grade); $grade->add_child($grades_details); $grades_details->add_child($grade_detail); $rcontent->add_child($track_credentials); $track_credentials->add_child($track_credential); // Define sources //$rcontent->set_source_table('rcontent', array('id' => backup::VAR_ACTIVITYID)); $rcontent->set_source_sql('SELECT rc.*,rlevel.code as levelcode, rcb.isbn as isbn, unit.code as unitcode, activity.code as activitycode FROM {rcontent} rc LEFT outer JOIN {rcommon_level} rlevel on rlevel.id=rc.levelid LEFT outer JOIN {rcommon_books} rcb on rcb.id=rc.bookid and rcb.levelid=rc.levelid LEFT outer JOIN {rcommon_books_units} unit on unit.id=rc.unitid and unit.bookid=rc.bookid LEFT outer JOIN {rcommon_books_activities} activity on activity.id=rc.activityid and activity.bookid=rc.bookid and activity.unitid = rc.unitid WHERE rc.id = ?', array(backup::VAR_ACTIVITYID)); // Use set_source_sql for other calls as set_source_table returns records in reverse order // and order is important for several rcontent fields - esp rcontent_scoes. $grade->set_source_sql(' SELECT rg.*, unit.code as unitcode, activity.code as activitycode FROM {rcontent_grades} rg INNER JOIN {rcontent} rc ON rc.id=rg.rcontentid LEFT outer JOIN {rcommon_books_units} unit on unit.id=rc.unitid and unit.bookid=rc.bookid LEFT outer JOIN {rcommon_books_activities} activity on activity.id=rc.activityid and activity.bookid=rc.bookid and activity.unitid = rc.unitid WHERE rg.rcontentid = :rcontent ORDER BY rg.id', array('rcontent' => backup::VAR_PARENTID)); $grade_detail->set_source_sql(' SELECT rc.*, unit.code as unitcode, activity.code as activitycode FROM {rcontent_grades_details} rg INNER JOIN {rcontent} rc ON rc.id=rg.rcontentid LEFT outer JOIN {rcommon_books_units} unit on unit.id=rc.unitid and unit.bookid=rc.bookid LEFT outer JOIN {rcommon_books_activities} activity on activity.id=rc.activityid and activity.bookid=rc.bookid and activity.unitid = rc.unitid WHERE rg.rcontentid = :rcontent ORDER BY rg.id', array('rcontent' => backup::VAR_PARENTID)); $track_credentials->set_source_sql(' SELECT * FROM {rcontent_track_credentials} ORDER BY id', array()); // Define id annotations $grade->annotate_ids('user', 'userid'); $grade_detail->annotate_ids('user', 'userid'); // Define file annotations $rcontent->annotate_files('mod_rcontent', 'intro', null); // This file area hasn't itemid // Return the root element (rcontent), wrapped into standard activity structure return $this->prepare_activity_structure($rcontent); }
protected function define_structure() { // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $activequiz = new backup_nested_element('activequiz', array('id'), array('name', 'intro', 'introformat', 'graded', 'scale', 'grademethod', 'workedingroups', 'grouping', 'groupattendance', 'reviewoptions', 'timecreated', 'timemodified', 'defaultquestiontime', 'waitforquestiontime', 'questionorder')); $questions = new backup_nested_element('questions'); $question = new backup_nested_element('question', array('id'), array('questionid', 'notime', 'questiontime', 'tries', 'points', 'showhistoryduringquiz')); $grades = new backup_nested_element('grades'); $grade = new backup_nested_element('grade', array('id'), array('userid', 'gradeval', 'timemodified')); $sessions = new backup_nested_element('sessions'); $session = new backup_nested_element('session', array('id'), array('name', 'sessionopen', 'status', 'currentquestion', 'currentqnum', 'currentquestiontime', 'classresult', 'nextstarttime', 'created')); $attempts = new backup_nested_element('attempts'); $attempt = new backup_nested_element('attempt', array('id'), array('userid', 'attemptnum', 'questionengid', 'status', 'preview', 'responded', 'forgroupid', 'timestart', 'timefinish', 'timemodified', 'qubalayout')); // This module is using questions, so produce the related question states and sessions // attaching them to the $attempt element based in 'questionengid' matching. $this->add_question_usages($attempt, 'questionengid'); $groupattendances = new backup_nested_element('groupattendances'); $groupattendance = new backup_nested_element('groupattendance', array('id'), array('activequizid', 'sessionid', 'groupid', 'userid')); // Build the tree. $activequiz->add_child($questions); $questions->add_child($question); $activequiz->add_child($grades); $grades->add_child($grade); $activequiz->add_child($sessions); $sessions->add_child($session); $session->add_child($attempts); $attempts->add_child($attempt); $attempt->add_child($groupattendances); $groupattendances->add_child($groupattendance); // Define sources. $activequiz->set_source_table('activequiz', array('id' => backup::VAR_ACTIVITYID)); $question->set_source_table('activequiz_questions', array('activequizid' => backup::VAR_PARENTID)); // If user info backup grades table. if ($userinfo) { $grade->set_source_table('activequiz_grades', array('activequizid' => backup::VAR_PARENTID)); $session->set_source_table('activequiz_sessions', array('activequizid' => backup::VAR_PARENTID)); $attempt->set_source_table('activequiz_attempts', array('sessionid' => backup::VAR_PARENTID)); $groupattendance->set_source_table('activequiz_groupattendance', array('attemptid' => backup::VAR_PARENTID)); } // Define source alias. $grade->set_source_alias('grade', 'gradeval'); // Define id annotations. $activequiz->annotate_ids('grouping', 'grouping'); $grade->annotate_ids('user', 'userid'); $attempt->annotate_ids('user', 'userid'); $attempt->annotate_ids('group', 'forgroupid'); $question->annotate_ids('question', 'questionid'); $groupattendance->annotate_ids('group', 'groupid'); $groupattendance->annotate_ids('user', 'userid'); // Define file annotations. $activequiz->annotate_files('mod_activequiz', 'intro', null); // This file area hasn't itemid. // Return the root element (activequiz), wrapped into standard activity structure. return $this->prepare_activity_structure($activequiz); }
protected function define_structure() { //error_log("in define_structure()"); global $DB, $CFG; // To know if we are including userinfo $userinfo = $this->get_setting_value('users'); // Get the block $block = $DB->get_record('block_instances', array('id' => $this->task->get_blockid())); // Extract configdata $config = unserialize(base64_decode($block->configdata)); //$pre=$CFG->prefix.'block_timetracker_'; $pre = 'block_timetracker_'; //error_log($pre); $timetracker_main = new backup_nested_element('timetracker', array('id'), null); // Define each element separated $workerinfo = new backup_nested_element('workerinfo', array('id'), array('active', 'address', 'budget', 'comments', 'currpayrate', 'dept', 'email', 'firstname', 'idnum', 'institution', 'lastname', 'maxtermearnings', 'phonenumber', 'supervisor', 'timetrackermethod', 'mdluserid')); //annotate mdluserid $terms = new backup_nested_element('term', array('id'), array('name', 'month', 'day')); $config = new backup_nested_element('config', array('id'), array('name', 'value')); $alertunits = new backup_nested_element('alerunits', array('id'), array('timein', 'lasteditedby', 'lastedited', 'message', 'origtimein', 'origtimeout', 'payrate', 'todelete', 'alerttime')); $alertcom = new backup_nested_element('alert_com', array('id'), array('mdluserid')); $pending = new backup_nested_element('pending', array('id'), array('timein')); $workunits = new backup_nested_element('workunit', array('id'), array('timein', 'timeout', 'lastedited', 'lasteditedby', 'payrate')); // Build the tree -- isn't this all of the dependencies? $timetracker_main->add_child($workerinfo); $timetracker_main->add_child($terms); $timetracker_main->add_child($config); $workerinfo->add_child($alertunits); $workerinfo->add_child($pending); $alertunits->add_child($alertcom); $workerinfo->add_child($workunits); // Define sources $timetracker_main->set_source_array(array((object) array('id' => $this->task->get_blockid()))); $terms->set_source_table($pre . 'term', array('courseid' => backup::VAR_COURSEID)); $config->set_source_table($pre . 'config', array('courseid' => backup::VAR_COURSEID)); if ($userinfo) { $workerinfo->set_source_table($pre . 'workerinfo', array('courseid' => backup::VAR_COURSEID)); $alertunits->set_source_table($pre . 'alertunits', array('courseid' => backup::VAR_COURSEID, 'userid' => '../id')); /* //need to fix all of this $alertcom->set_source_table($pre.'alert_com', array('courseid' => backup::VAR_COURSEID, 'alertid'=>'../id')); */ $pending->set_source_table($pre . 'pending', array('courseid' => backup::VAR_COURSEID, 'userid' => '../id')); $workunits->set_source_table($pre . 'workunit', array('courseid' => backup::VAR_COURSEID, 'userid' => '../id')); } // Annotations (none) $alertcom->annotate_ids('user', 'mdluserid'); $workerinfo->annotate_ids('user', 'mdluserid'); // Return the root element (timetracker), wrapped into standard block structure return $this->prepare_block_structure($timetracker_main); }
protected function define_structure() { // are we including userinfo? $userinfo = $this->get_setting_value('userinfo'); //////////////////////////////////////////////////////////////////////// // XML nodes declaration - non-user data //////////////////////////////////////////////////////////////////////// $attforblock = new backup_nested_element('attforblock', array('id'), array('name', 'grade')); $statuses = new backup_nested_element('statuses'); $status = new backup_nested_element('status', array('id'), array('acronym', 'description', 'grade', 'visible', 'deleted')); $sessions = new backup_nested_element('sessions'); $session = new backup_nested_element('session', array('id'), array('groupid', 'sessdate', 'duration', 'lasttaken', 'lasttakenby', 'timemodified', 'description', 'descriptionformat')); //////////////////////////////////////////////////////////////////////// // XML nodes declaration - user data //////////////////////////////////////////////////////////////////////// $logs = new backup_nested_element('logs'); $log = new backup_nested_element('log', array('id'), array('sessionid', 'studentid', 'statusid', 'lasttaken', 'statusset', 'timetaken', 'takenby', 'remarks')); //////////////////////////////////////////////////////////////////////// // build the tree in the order needed for restore //////////////////////////////////////////////////////////////////////// $attforblock->add_child($statuses); $statuses->add_child($status); $attforblock->add_child($sessions); $sessions->add_child($session); $session->add_child($logs); $logs->add_child($log); //////////////////////////////////////////////////////////////////////// // data sources - non-user data //////////////////////////////////////////////////////////////////////// $attforblock->set_source_table('attforblock', array('id' => backup::VAR_ACTIVITYID)); $status->set_source_table('attendance_statuses', array('attendanceid' => backup::VAR_PARENTID)); $session->set_source_table('attendance_sessions', array('attendanceid' => backup::VAR_PARENTID)); //////////////////////////////////////////////////////////////////////// // data sources - user related data //////////////////////////////////////////////////////////////////////// if ($userinfo) { $log->set_source_table('attendance_log', array('sessionid' => backup::VAR_PARENTID)); } //////////////////////////////////////////////////////////////////////// // id annotations //////////////////////////////////////////////////////////////////////// $session->annotate_ids('user', 'lasttakenby'); $session->annotate_ids('group', 'groupid'); $log->annotate_ids('user', 'studentid'); $log->annotate_ids('user', 'takenby'); //////////////////////////////////////////////////////////////////////// // file annotations //////////////////////////////////////////////////////////////////////// $session->annotate_files('mod_attforblock', 'session', 'id'); // return the root element (workshop), wrapped into standard activity structure return $this->prepare_activity_structure($attforblock); }
protected function define_structure() { global $CFG, $DB; // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $turnitintool = new backup_nested_element('turnitintool', array('id'), array('type', 'name', 'grade', 'numparts', 'tiiaccount', 'defaultdtstart', 'defaultdtdue', 'defaultdtpost', 'anon', 'portfolio', 'allowlate', 'reportgenspeed', 'submitpapersto', 'spapercheck', 'internetcheck', 'journalcheck', 'maxfilesize', 'intro', 'introformat', 'timecreated', 'timemodified', 'studentreports', 'dateformat', 'usegrademark', 'gradedisplay', 'autoupdates', 'commentedittime', 'commentmaxsize', 'autosubmission', 'shownonsubmission', 'excludebiblio', 'excludequoted', 'excludevalue', 'excludetype', 'erater', 'erater_handbook', 'erater_dictionary', 'erater_spelling', 'erater_grammar', 'erater_usage', 'erater_mechanics', 'erater_style', 'transmatch')); $parts = new backup_nested_element('parts'); $part = new backup_nested_element('part', array('id'), array('turnitintoolid', 'partname', 'tiiassignid', 'dtstart', 'dtdue', 'dtpost', 'maxmarks', 'deleted')); $courses = new backup_nested_element('courses'); $course = new backup_nested_element('course', array('id'), array('courseid', 'ownerid', 'ownertiiuid', 'owneremail', 'ownerfn', 'ownerln', 'ownerun', 'turnitin_ctl', 'turnitin_cid')); $submissions = new backup_nested_element('submissions'); $submission = new backup_nested_element('submission', array('id'), array('userid', 'submission_part', 'submission_title', 'submission_type', 'submission_filename', 'submission_objectid', 'submission_score', 'submission_grade', 'submission_gmimaged', 'submission_status', 'submission_queued', 'submission_attempts', 'submission_modified', 'submission_parent', 'submission_nmuserid', 'submission_nmfirstname', 'submission_nmlastname', 'submission_unanon', 'submission_anonreason', 'submission_transmatch', 'tiiuserid')); $comments = new backup_nested_element('comments'); $comment = new backup_nested_element('comment', array('id'), array('submissionid', 'userid', 'commenttext', 'dateupdated', 'deleted')); // Build the tree $comments->add_child($comment); $submission->add_child($comments); $submissions->add_child($submission); $parts->add_child($part); $turnitintool->add_child($parts); $turnitintool->add_child($course); $turnitintool->add_child($submissions); // Define sources $turnitintool->set_source_table('turnitintool', array('id' => backup::VAR_ACTIVITYID)); $values['tiiaccount'] = $CFG->turnitin_account_id; $turnitintool->fill_values($values); $part->set_source_table('turnitintool_parts', array('turnitintoolid' => backup::VAR_ACTIVITYID)); $course->set_source_sql(' SELECT t.id, t.courseid, t.ownerid, tu.turnitin_uid AS ownertiiuid, u.email AS owneremail, u.firstname AS ownerfn, u.lastname AS ownerln, u.username AS ownerun, t.turnitin_ctl, t.turnitin_cid FROM {turnitintool_courses} t, {user} u, {turnitintool_users} tu WHERE t.ownerid=u.id AND tu.userid=t.ownerid AND t.courseid = ?', array(backup::VAR_COURSEID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $comment->set_source_table('turnitintool_comments', array('submissionid' => '../../id')); //$submission->set_source_table('turnitintool_submissions', array('turnitintoolid' => '../../id')); $submission->set_source_sql(' SELECT s.*, tu.turnitin_uid AS tiiuserid FROM {turnitintool_submissions} s, {turnitintool_users} tu WHERE s.userid=tu.userid AND s.turnitintoolid = ?', array(backup::VAR_ACTIVITYID)); } // Define id annotations $submission->annotate_ids('user', 'userid'); // Define file annotations $turnitintool->annotate_files('mod_turnitintool', 'intro', null); // This file area hasn't itemid $submission->annotate_files('mod_turnitintool', 'submission', 'id'); // Return the root element (turnitintool), wrapped into standard activity structure return $this->prepare_activity_structure($turnitintool); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $glossary = new backup_nested_element('glossary', array('id'), array('name', 'intro', 'introformat', 'allowduplicatedentries', 'displayformat', 'mainglossary', 'showspecial', 'showalphabet', 'showall', 'allowcomments', 'allowprintview', 'usedynalink', 'defaultapproval', 'globalglossary', 'entbypage', 'editalways', 'rsstype', 'rssarticles', 'assessed', 'assesstimestart', 'assesstimefinish', 'scale', 'timecreated', 'timemodified', 'completionentries')); $entries = new backup_nested_element('entries'); $entry = new backup_nested_element('entry', array('id'), array('userid', 'concept', 'definition', 'definitionformat', 'definitiontrust', 'attachment', 'timecreated', 'timemodified', 'teacherentry', 'sourceglossaryid', 'usedynalink', 'casesensitive', 'fullmatch', 'approved')); $aliases = new backup_nested_element('aliases'); $alias = new backup_nested_element('alias', array('id'), array('alias_text')); $ratings = new backup_nested_element('ratings'); $rating = new backup_nested_element('rating', array('id'), array('scaleid', 'value', 'userid', 'timecreated', 'timemodified')); $categories = new backup_nested_element('categories'); $category = new backup_nested_element('category', array('id'), array('name', 'usedynalink')); $categoryentries = new backup_nested_element('category_entries'); $categoryentry = new backup_nested_element('category_entry', array('id'), array('entryid')); // Build the tree $glossary->add_child($entries); $entries->add_child($entry); $entry->add_child($aliases); $aliases->add_child($alias); $entry->add_child($ratings); $ratings->add_child($rating); $glossary->add_child($categories); $categories->add_child($category); $category->add_child($categoryentries); $categoryentries->add_child($categoryentry); // Define sources $glossary->set_source_table('glossary', array('id' => backup::VAR_ACTIVITYID)); $category->set_source_table('glossary_categories', array('glossaryid' => backup::VAR_PARENTID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $entry->set_source_table('glossary_entries', array('glossaryid' => backup::VAR_PARENTID)); $alias->set_source_table('glossary_alias', array('entryid' => backup::VAR_PARENTID)); $alias->set_source_alias('alias', 'alias_text'); $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID)); $rating->set_source_alias('rating', 'value'); $categoryentry->set_source_table('glossary_entries_categories', array('categoryid' => backup::VAR_PARENTID)); } // Define id annotations $glossary->annotate_ids('scale', 'scale'); $entry->annotate_ids('user', 'userid'); $rating->annotate_ids('scale', 'scaleid'); $rating->annotate_ids('user', 'userid'); // Define file annotations $glossary->annotate_files('mod_glossary', 'intro', null); // This file area hasn't itemid $entry->annotate_files('mod_glossary', 'entry', 'id'); $entry->annotate_files('mod_glossary', 'attachment', 'id'); // Return the root element (glossary), wrapped into standard activity structure return $this->prepare_activity_structure($glossary); }
/** * Define the structure for the assign activity * @return void */ protected function define_structure() { // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $assign = new backup_nested_element('assign', array('id'), array('name', 'intro', 'introformat', 'alwaysshowdescription', 'submissiondrafts', 'sendnotifications', 'sendlatenotifications', 'sendstudentnotifications', 'duedate', 'cutoffdate', 'allowsubmissionsfromdate', 'grade', 'timemodified', 'completionsubmit', 'requiresubmissionstatement', 'teamsubmission', 'requireallteammemberssubmit', 'teamsubmissiongroupingid', 'blindmarking', 'revealidentities', 'attemptreopenmethod', 'maxattempts', 'markingworkflow', 'markingallocation', 'preventsubmissionnotingroup')); $userflags = new backup_nested_element('userflags'); $userflag = new backup_nested_element('userflag', array('id'), array('userid', 'assignment', 'mailed', 'locked', 'extensionduedate', 'workflowstate', 'allocatedmarker')); $submissions = new backup_nested_element('submissions'); $submission = new backup_nested_element('submission', array('id'), array('userid', 'timecreated', 'timemodified', 'status', 'groupid', 'attemptnumber', 'latest')); $grades = new backup_nested_element('grades'); $grade = new backup_nested_element('grade', array('id'), array('userid', 'timecreated', 'timemodified', 'grader', 'grade', 'attemptnumber')); $pluginconfigs = new backup_nested_element('plugin_configs'); $pluginconfig = new backup_nested_element('plugin_config', array('id'), array('plugin', 'subtype', 'name', 'value')); // Build the tree. $assign->add_child($userflags); $userflags->add_child($userflag); $assign->add_child($submissions); $submissions->add_child($submission); $assign->add_child($grades); $grades->add_child($grade); $assign->add_child($pluginconfigs); $pluginconfigs->add_child($pluginconfig); // Define sources. $assign->set_source_table('assign', array('id' => backup::VAR_ACTIVITYID)); $pluginconfig->set_source_table('assign_plugin_config', array('assignment' => backup::VAR_PARENTID)); if ($userinfo) { $userflag->set_source_table('assign_user_flags', array('assignment' => backup::VAR_PARENTID)); $submission->set_source_table('assign_submission', array('assignment' => backup::VAR_PARENTID)); $grade->set_source_table('assign_grades', array('assignment' => backup::VAR_PARENTID)); // Support 2 types of subplugins. $this->add_subplugin_structure('assignsubmission', $submission, true); $this->add_subplugin_structure('assignfeedback', $grade, true); } // Define id annotations. $userflag->annotate_ids('user', 'userid'); $userflag->annotate_ids('user', 'allocatedmarker'); $submission->annotate_ids('user', 'userid'); $submission->annotate_ids('group', 'groupid'); $grade->annotate_ids('user', 'userid'); $grade->annotate_ids('user', 'grader'); $assign->annotate_ids('grouping', 'teamsubmissiongroupingid'); // Define file annotations. // These file areas don't have an itemid. $assign->annotate_files('mod_assign', 'intro', null); $assign->annotate_files('mod_assign', 'introattachment', null); $this->annotate_plugin_config_files($assign, 'assignsubmission'); $this->annotate_plugin_config_files($assign, 'assignfeedback'); // Return the root element (choice), wrapped into standard activity structure. return $this->prepare_activity_structure($assign); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $data = new backup_nested_element('data', array('id'), array('name', 'intro', 'introformat', 'comments', 'timeavailablefrom', 'timeavailableto', 'timeviewfrom', 'timeviewto', 'requiredentries', 'requiredentriestoview', 'maxentries', 'rssarticles', 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate', 'asearchtemplate', 'approval', 'manageapproved', 'scale', 'assessed', 'assesstimestart', 'assesstimefinish', 'defaultsort', 'defaultsortdir', 'editany', 'notification')); $fields = new backup_nested_element('fields'); $field = new backup_nested_element('field', array('id'), array('type', 'name', 'description', 'required', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7', 'param8', 'param9', 'param10')); $records = new backup_nested_element('records'); $record = new backup_nested_element('record', array('id'), array('userid', 'groupid', 'timecreated', 'timemodified', 'approved')); $contents = new backup_nested_element('contents'); $content = new backup_nested_element('content', array('id'), array('fieldid', 'content', 'content1', 'content2', 'content3', 'content4')); $ratings = new backup_nested_element('ratings'); $rating = new backup_nested_element('rating', array('id'), array('component', 'ratingarea', 'scaleid', 'value', 'userid', 'timecreated', 'timemodified')); // Build the tree $data->add_child($fields); $fields->add_child($field); $data->add_child($records); $records->add_child($record); $record->add_child($contents); $contents->add_child($content); $record->add_child($ratings); $ratings->add_child($rating); // Define sources $data->set_source_table('data', array('id' => backup::VAR_ACTIVITYID)); $field->set_source_sql(' SELECT * FROM {data_fields} WHERE dataid = ?', array(backup::VAR_PARENTID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $record->set_source_table('data_records', array('dataid' => backup::VAR_PARENTID)); $content->set_source_table('data_content', array('recordid' => backup::VAR_PARENTID)); $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID, 'component' => backup_helper::is_sqlparam('mod_data'), 'ratingarea' => backup_helper::is_sqlparam('entry'))); $rating->set_source_alias('rating', 'value'); } // Define id annotations $data->annotate_ids('scale', 'scale'); $record->annotate_ids('user', 'userid'); $record->annotate_ids('group', 'groupid'); $rating->annotate_ids('scale', 'scaleid'); $rating->annotate_ids('user', 'userid'); // Define file annotations $data->annotate_files('mod_data', 'intro', null); // This file area hasn't itemid $content->annotate_files('mod_data', 'content', 'id'); // By content->id // Return the root element (data), wrapped into standard activity structure return $this->prepare_activity_structure($data); }
protected function define_structure() { // To know if we are including userinfo //$userinfo = $this->get_setting_value('userinfo'); $rootcontainer = new backup_nested_element("rootcontainer"); // Define each element separated $bundles = new backup_nested_element("bundles"); $bundle = new backup_nested_element("bundle", array("id"), array("name", "description")); $bundle_connections = new backup_nested_element("bundle_connections"); $bundle_connection = new backup_nested_element("bundle_connection", array("id"), array("bundle_id", "course_id")); $learning_paths = new backup_nested_element("learning_paths"); $learning_path = new backup_nested_element("learning_path", array("id"), array("name", "path", "color", "bundle_id")); $modmetas = new backup_nested_element("modmetas"); $modmeta = new backup_nested_element("modmeta", array("id"), array("shortname", "linguistic_requirement", "social_requirement", "logical_requirement", "learningstyle_perception", "learningstyle_organization", "learningstyle_perspective", "learningstyle_input", "difficulty", "learningstyle_processing", "learning_time", "keywords", "learning_tasks", "taxonomy", "catalog", "coursemoduleid")); $relations = new backup_nested_element("relations"); $relation = new backup_nested_element("relation", array("id"), array("source", "target", "type")); $semantic_web_pref = new backup_nested_element("semantic_web_pref", array("id"), array("block_id", "depth", "adaption", "case_collection", "web_animation")); $last_activities = new backup_nested_element("last_activities"); $last_activity = new backup_nested_element("last_activity", array("id"), array("userid", "courseid", "course_module", "last_access")); // Build the tree $bundles->add_child($bundle); $bundle->add_child($bundle_connections); $bundle_connections->add_child($bundle_connection); $bundle->add_child($learning_paths); $learning_paths->add_child($learning_path); $modmetas->add_child($modmeta); $relations->add_child($relation); $last_activities->add_child($last_activity); $rootcontainer->add_child($bundles); $rootcontainer->add_child($modmetas); $rootcontainer->add_child($relations); $rootcontainer->add_child($semantic_web_pref); $rootcontainer->add_child($last_activities); // Define sources $bundle->set_source_sql("SELECT * FROM {dasis_bundles} b\n \t\t\t\t\t\t\tLEFT JOIN {dasis_bundle_connections} bc ON b.id = bc.bundle_id\n \t\t\t\t\t\t\tWHERE bc.course_id = ?", array(backup::VAR_COURSEID)); $bundle_connection->set_source_table("dasis_bundle_connections", array("course_id" => backup::VAR_COURSEID)); $learning_path->set_source_table("dasis_learning_paths", array("bundle_id" => "../../id")); $modmeta->set_source_sql("SELECT * FROM {dasis_modmeta} dm \n \t\t\t\t\t\t\tLEFT JOIN {course_modules} cm ON dm.coursemoduleid = cm.id \n \t\t\t\t\t\t\tWHERE cm.course = ?", array(backup::VAR_COURSEID)); $relation->set_source_sql("SELECT DISTINCT r.* \n \t\t\t\t\t\t\tFROM {dasis_relations} r, {course_modules} cm \n \t\t\t\t\t\t\tWHERE ((r.source = cm.id) OR (r.target = cm.id)) AND cm.course = ?", array(backup::VAR_COURSEID)); $semantic_web_pref->set_source_table("dasis_semantic_web_prefs", array("block_id" => backup::VAR_BLOCKID)); $last_activity->set_source_table("dasis_last_activity", array("courseid" => backup::VAR_COURSEID)); // Define id annotations $last_activity->annotate_ids("user", "userid"); $modmeta->annotate_ids("coursemodule", "coursemoduleid"); // Define file annotations // Return the root element (choice), wrapped into standard activity structure return $this->prepare_block_structure($rootcontainer); }
protected function define_structure() { // Define each element separated $dialogue = new backup_nested_element('dialogue', array('id'), array('course', 'deleteafter', 'dialoguetype', 'multipleconversations', 'maildefault', 'timemodified', 'name', 'intro', 'edittime')); $conversations = new backup_nested_element('conversations'); $conversation = new backup_nested_element('conversation', array('id'), array('dialogueid', 'userid', 'recipientid', 'lastid', 'lastrecipientid', 'timemodified', 'closed', 'seenon', 'ctype', 'format', 'subject', 'groupid', 'grouping')); $entries = new backup_nested_element('entries'); $entry = new backup_nested_element('entry', array('id'), array('dialogueid', 'conversationid', 'userid', 'recipientid', 'timecreated', 'timemodified', 'mailed', 'text', 'attachment')); $readentries = new backup_nested_element('read_entries'); $read = new backup_nested_element('read_entry', array('id'), array('entryid', 'userid', 'firstread', 'lastread', 'conversationid')); // Build the tree $dialogue->add_child($conversations); $conversations->add_child($conversation); $conversation->add_child($entries); $entries->add_child($entry); $conversation->add_child($readentries); $readentries->add_child($read); // Define sources $dialogue->set_source_table('dialogue', array('id' => backup::VAR_ACTIVITYID)); $conversation->set_source_table('dialogue_conversations', array('dialogueid' => backup::VAR_PARENTID)); $entry->set_source_table('dialogue_entries', array('conversationid' => backup::VAR_PARENTID)); $read->set_source_table('dialogue_read', array('conversationid' => backup::VAR_PARENTID)); // Define id annotations $conversation->annotate_ids('user', 'userid'); $conversation->annotate_ids('user', 'recipientid'); $entry->annotate_ids('user', 'userid'); $entry->annotate_ids('user', 'recipientid'); $read->annotate_ids('user', 'userid'); // Define file annotations $dialogue->annotate_files('mod_dialogue', 'intro', null); // This file area hasn't itemid $entry->annotate_files('mod_dialogue', 'attachment', 'id'); // Return the root element, wrapped into standard activity structure return $this->prepare_activity_structure($dialogue); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $certificate = new backup_nested_element('certificate', array('id'), array('name', 'intro', 'introformat', 'emailteachers', 'emailothers', 'savecert', 'reportcert', 'delivery', 'certificatetype', 'orientation', 'borderstyle', 'bordercolor', 'printwmark', 'printdate', 'datefmt', 'printnumber', 'printgrade', 'gradefmt', 'printoutcome', 'printhours', 'printteacher', 'customtext', 'printsignature', 'printseal', 'timecreated', 'timemodified')); $issues = new backup_nested_element('issues'); $issue = new backup_nested_element('issue', array('id'), array('certificateid', 'userid', 'timecreated', 'code')); // Build the tree $certificate->add_child($issues); $issues->add_child($issue); // Define sources $certificate->set_source_table('certificate', array('id' => backup::VAR_ACTIVITYID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $issue->set_source_table('certificate_issues', array('certificateid' => backup::VAR_PARENTID)); } // Annotate the user id's where required. $issue->annotate_ids('user', 'userid'); // Define file annotations $certificate->annotate_files('mod_certificate', 'intro', null); // This file area hasn't itemid $issue->annotate_files('mod_certificate', 'issue', 'id'); // Return the root element (certificate), wrapped into standard activity structure return $this->prepare_activity_structure($certificate); }
protected function define_structure() { $journal = new backup_nested_element('journal', array('id'), array('name', 'intro', 'introformat', 'days', 'grade', 'timemodified')); $entries = new backup_nested_element('entries'); $entry = new backup_nested_element('entry', array('id'), array('userid', 'modified', 'text', 'format', 'rating', 'entrycomment', 'teacher', 'timemarked', 'mailed')); // journal -> entries -> entry $journal->add_child($entries); $entries->add_child($entry); // Sources $journal->set_source_table('journal', array('id' => backup::VAR_ACTIVITYID)); if ($this->get_setting_value('userinfo')) { $entry->set_source_table('journal_entries', array('journal' => backup::VAR_PARENTID)); } // Define id annotations $entry->annotate_ids('user', 'userid'); $entry->annotate_ids('user', 'teacher'); // Define file annotations $journal->annotate_files('mod_journal', 'intro', null); // This file areas haven't itemid $entry->annotate_files('mod_journal_entries', 'text', null); // This file areas haven't itemid $entry->annotate_files('mod_journal_entries', 'entrycomment', null); // This file areas haven't itemid return $this->prepare_activity_structure($journal); }
/** * Define the structure for the assign activity * @return void */ protected function define_structure() { // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $blended = new backup_nested_element('blended', array('id'), array('name', 'intro', 'introformat', 'idmethod', 'idtype', 'codebartype', 'lengthuserinfo', 'teammethod', 'numteams', 'nummembers', 'assignment', 'randomkey')); $teams = new backup_nested_element('teams'); $team = new backup_nested_element('team', array('id'), array('id_team', 'itemid', 'name_team', 'userid_leader')); $members = new backup_nested_element('members'); $member = new backup_nested_element('member', array('id'), array('userid', 'id_member', 'id_team', 'leader')); //Build the tree $blended->add_child($teams); $teams->add_child($team); $team->add_child($members); $members->add_child($member); // Define sources $blended->set_source_table('blended', array('id' => backup::VAR_ACTIVITYID)); //TODO remove blended_member estructure $member->set_source_table('blended_member', array('id_team' => backup::VAR_PARENTID)); //$team->set_source_table('blended_team', array('blendedid' => backup::VAR_PARENTID)); //$assign_grouping->set_source_table('blended_assign_grouping', array('blendedid' => backup::VAR_PARENTID)); //$member->set_source_table('blended_member', array('blendedid' => backup::VAR_PARENTID)); //$grade->set_source_table('blended_grade', array('blendedid' => backup::VAR_PARENTID)); //Anotate ids $team->annotate_ids('group', 'id_team'); $team->annotate_ids('user', 'userid_leader'); $member->annotate_ids('user', 'userid'); $member->annotate_ids('group', 'id_team'); // This file area hasn't itemid. $blended->annotate_files('mod_blended', 'intro', null); // Return the root element (blended), wrapped into standard activity structure. return $this->prepare_activity_structure($blended); }
protected function define_structure() { global $DB; // Get the block $block = $DB->get_record('block_instances', array('id' => $this->task->get_blockid())); // Extract configdata $config = unserialize(base64_decode($block->configdata)); // Get array of used rss feeds if (!empty($config->rssid)) { $feedids = $config->rssid; // Get the IN corresponding query list($in_sql, $in_params) = $DB->get_in_or_equal($feedids); // Define all the in_params as sqlparams foreach ($in_params as $key => $value) { $in_params[$key] = backup_helper::is_sqlparam($value); } } // Define each element separated $rss_client = new backup_nested_element('rss_client', array('id'), null); $feeds = new backup_nested_element('feeds'); $feed = new backup_nested_element('feed', array('id'), array('title', 'preferredtitle', 'description', 'shared', 'url')); // Build the tree $rss_client->add_child($feeds); $feeds->add_child($feed); // Define sources $rss_client->set_source_array(array((object) array('id' => $this->task->get_blockid()))); // Only if there are feeds if (!empty($config->rssid)) { $feed->set_source_sql("\n SELECT *\n FROM {block_rss_client}\n WHERE id {$in_sql}", $in_params); } // Annotations (none) // Return the root element (rss_client), wrapped into standard block structure return $this->prepare_block_structure($rss_client); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element $attendanceregister = new backup_nested_element('attendanceregister', array('id'), array('name', 'intro', 'introformat', 'type', 'offlinesessions', 'sessiontimeout', 'dayscertificable', 'offlinecomments', 'mandatoryofflinecomm', 'offlinespecifycourse', 'mandofflspeccourse', 'timemodified', 'completiontotaldurationmins')); $sessions = new backup_nested_element('sessions'); $session = new backup_nested_element('session', array('id'), array('userid', 'login', 'logout', 'duration', 'onlinesess', 'refcourseshortname', 'comments', 'addedbyuserid')); // Builds the tree $attendanceregister->add_child($sessions); $sessions->add_child($session); // Define sources $attendanceregister->set_source_table('attendanceregister', array('id' => backup::VAR_ACTIVITYID)); if ($userinfo) { $session->set_source_sql(' SELECT s.id, s.register, s.userid, s.login, s.logout, s.duration, s.onlinesess, s.comments, c.shortname AS refcourseshortname, s.addedbyuserid FROM {attendanceregister_session} s LEFT JOIN {course} c ON c.id = s.refcourse WHERE s.register = ? AND s.onlinesess = 0 ', array(backup::VAR_PARENTID)); } // Define ID annotations $session->annotate_ids('user', 'userid'); $session->annotate_ids('user', 'addedbyuserid'); // Define file annotations $attendanceregister->annotate_files('mod_attendanceregister', 'intro', null); // This file area hasn't itemid // Return the root element (attendanceregister), wrapped into standard activity structure return $this->prepare_activity_structure($attendanceregister); }
/** * Define structure. */ protected function define_structure() { global $DB; $userinfo = $this->get_setting_value('users'); // Define each element separated. $xpconfig = new backup_nested_element('config', array('courseid'), array('enabled', 'enablelog', 'keeplogs', 'levels', 'lastlogpurge', 'enableladder', 'enableinfos', 'levelsdata', 'enablelevelupnotif', 'enablecustomlevelbadges', 'maxactionspertime', 'timeformaxactions', 'timebetweensameactions', 'identitymode', 'rankmode', 'neighbours')); $xpfilters = new backup_nested_element('filters'); $xpfilter = new backup_nested_element('filter', array('courseid'), array('ruledata', 'points', 'sortorder')); $xplevels = new backup_nested_element('xps'); $xplevel = new backup_nested_element('xp', array('courseid'), array('userid', 'xp', 'lvl')); $xplogs = new backup_nested_element('logs'); $xplog = new backup_nested_element('log', array('courseid'), array('userid', 'eventname', 'xp', 'time')); // Prepare the structure. $xp = $this->prepare_block_structure($xpconfig); $xpfilters->add_child($xpfilter); $xp->add_child($xpfilters); if ($userinfo) { $xplevels->add_child($xplevel); $xp->add_child($xplevels); $xplogs->add_child($xplog); $xp->add_child($xplogs); } // Define sources. $xpconfig->set_source_table('block_xp_config', array('courseid' => backup::VAR_COURSEID)); $xpfilter->set_source_table('block_xp_filters', array('courseid' => backup::VAR_COURSEID)); $xplevel->set_source_table('block_xp', array('courseid' => backup::VAR_COURSEID)); $xplog->set_source_table('block_xp_log', array('courseid' => backup::VAR_COURSEID)); // Annotations. $xplevel->annotate_ids('user', 'userid'); $xplog->annotate_ids('user', 'userid'); $xp->annotate_files('block_xp', 'badges', null, context_course::instance($this->get_courseid())->id); // Return the root element. return $xp; }
protected function define_structure() { global $CFG; // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $certificate = new backup_nested_element('simplecertificate', array('id'), array('name', 'intro', 'introformat', 'timemodified', 'width', 'height', 'certificateimage', 'certificatetext', 'certificatetextformat', 'certificatetextx', 'certificatetexty', 'coursename', 'coursehours', 'outcome', 'certdate', 'certdatefmt', 'certgrade', 'gradefmt', 'emailfrom', 'emailothers', 'emailteachers', 'reportcert', 'delivery', 'requiredtime', 'printqrcode', 'qrcodefirstpage', 'codex', 'codey', 'enablesecondpage', 'secondpagex', 'secondpagey', 'secondpagetext', 'secondpagetextformat', 'secondimage', 'timestartdatefmt')); $issues = new backup_nested_element('issues'); $issue = new backup_nested_element('issue', array('id'), array('userid', 'certificatename', 'timecreated', 'code', 'timedeleted')); // Build the tree $certificate->add_child($issues); $issues->add_child($issue); // Define sources $certificate->set_source_table('simplecertificate', array('id' => backup::VAR_ACTIVITYID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $issue->set_source_table('simplecertificate_issues', array('certificateid' => backup::VAR_PARENTID)); } // Annotate the user id's where required. $certificate->annotate_ids('outcome', 'outcome'); $certificate->annotate_ids('certdate', 'certdate'); $certificate->annotate_ids('certgrade', 'certgrade'); $issue->annotate_ids('user', 'userid'); // Define file annotations //$certificate->annotate_files('mod_simplecertificate', 'intro', null); $certificate->annotate_files(simplecertificate::CERTIFICATE_COMPONENT_NAME, simplecertificate::CERTIFICATE_IMAGE_FILE_AREA, null); $issue->annotate_files(simplecertificate::CERTIFICATE_COMPONENT_NAME, simplecertificate::CERTIFICATE_ISSUES_FILE_AREA, 'id'); // Return the root element (certificate), wrapped into standard activity structure return $this->prepare_activity_structure($certificate); }
/** * Returns the subplugin information to attach to feedback element * @return backup_subplugin_element */ protected function define_grade_subplugin_structure() { // Create XML elements. $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subpluginelementfiles = new backup_nested_element('feedback_editpdf_files', null, array('gradeid')); $subpluginelementannotations = new backup_nested_element('feedback_editpdf_annotations'); $subpluginelementannotation = new backup_nested_element('annotation', null, array('gradeid', 'pageno', 'type', 'x', 'y', 'endx', 'endy', 'colour', 'path', 'draft')); $subpluginelementcomments = new backup_nested_element('feedback_editpdf_comments'); $subpluginelementcomment = new backup_nested_element('comment', null, array('gradeid', 'pageno', 'x', 'y', 'width', 'rawtext', 'colour', 'draft')); // Connect XML elements into the tree. $subplugin->add_child($subpluginwrapper); $subpluginelementannotations->add_child($subpluginelementannotation); $subpluginelementcomments->add_child($subpluginelementcomment); $subpluginwrapper->add_child($subpluginelementfiles); $subpluginwrapper->add_child($subpluginelementannotations); $subpluginwrapper->add_child($subpluginelementcomments); // Set source to populate the data. $subpluginelementfiles->set_source_sql('SELECT id AS gradeid from {assign_grades} where id = :gradeid', array('gradeid' => backup::VAR_PARENTID)); $subpluginelementannotation->set_source_table('assignfeedback_editpdf_annot', array('gradeid' => backup::VAR_PARENTID)); $subpluginelementcomment->set_source_table('assignfeedback_editpdf_cmnt', array('gradeid' => backup::VAR_PARENTID)); // We only need to backup the files in the final pdf area - all the others can be regenerated. $subpluginelementfiles->annotate_files('assignfeedback_editpdf', 'download', 'gradeid'); $subpluginelementfiles->annotate_files('assignfeedback_editpdf', 'stamps', 'gradeid'); return $subplugin; }
protected function define_structure() { $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $chat = new backup_nested_element('chat', array('id'), array('name', 'intro', 'introformat', 'keepdays', 'studentlogs', 'chattime', 'schedule', 'timemodified')); $messages = new backup_nested_element('messages'); $message = new backup_nested_element('message', array('id'), array('userid', 'groupid', 'system', 'message_text', 'timestamp')); // It is not cool to have two tags with same name, so we need to rename message field to message_text. $message->set_source_alias('message', 'message_text'); // Build the tree. $chat->add_child($messages); $messages->add_child($message); // Define sources. $chat->set_source_table('chat', array('id' => backup::VAR_ACTIVITYID)); // User related messages only happen if we are including user info. if ($userinfo) { $message->set_source_table('chat_messages', array('chatid' => backup::VAR_PARENTID)); } // Define id annotations. $message->annotate_ids('user', 'userid'); $message->annotate_ids('group', 'groupid'); // Annotate the file areas in chat module. $chat->annotate_files('mod_chat', 'intro', null); // The chat_intro area doesn't use itemid. // Return the root element (chat), wrapped into standard activity structure. return $this->prepare_activity_structure($chat); }
protected function define_structure() { // Define each element separated $organizer = new backup_nested_element('organizer', array('id'), array('course', 'name', 'intro', 'introformat', 'timemodified', 'isgrouporganizer', 'emailteachers', 'allowregistrationsfromdate', 'duedate', 'relativedeadline', 'grade')); $slots = new backup_nested_element('slots'); $slot = new backup_nested_element('slot', array('id'), array('organizerid', 'starttime', 'duration', 'location', 'locationlink', 'maxparticipants', 'teacherid', 'isanonymous', 'availablefrom', 'timemodified', 'notificationtime', 'comments', 'teachervisible', 'eventid', 'notified')); $appointments = new backup_nested_element('appointments'); $appointment = new backup_nested_element('appointment', array('id'), array('slotid', 'userid', 'groupid', 'applicantid', 'registrationtime', 'attended', 'grade', 'feedback', 'comments', 'eventid', 'notified', 'allownewappointments')); // Build the tree $organizer->add_child($slots); $slots->add_child($slot); $slot->add_child($appointments); $appointments->add_child($appointment); // Define sources $organizer->set_source_table('organizer', array('id' => backup::VAR_ACTIVITYID)); // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); if ($userinfo) { $slot->set_source_table('organizer_slots', array('organizerid' => backup::VAR_PARENTID)); $appointment->set_source_table('organizer_slot_appointments', array('slotid' => backup::VAR_PARENTID)); } // Annotate the user id's where required. $slot->annotate_ids('user', 'teacherid'); $appointment->annotate_ids('user', 'userid'); $appointment->annotate_ids('user', 'applicantid'); $appointment->annotate_ids('group', 'groupid'); // Return the root element (organizer), wrapped into standard activity structure return $this->prepare_activity_structure($organizer); }