本文整理汇总了PHP中backup_nested_element::annotate_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_nested_element::annotate_ids方法的具体用法?PHP backup_nested_element::annotate_ids怎么用?PHP backup_nested_element::annotate_ids使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backup_nested_element
的用法示例。
在下文中一共展示了backup_nested_element::annotate_ids方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define_structure
protected function define_structure()
{
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated
$scheduler = new backup_nested_element('scheduler', array('id'), array('name', 'intro', 'introformat', 'schedulermode', 'maxbookings', 'guardtime', 'defaultslotduration', 'allownotifications', 'staffrolename', 'scale', 'gradingstrategy', 'bookingrouping', 'timemodified'));
$slots = new backup_nested_element('slots');
$slot = new backup_nested_element('slot', array('id'), array('starttime', 'duration', 'teacherid', 'appointmentlocation', 'timemodified', 'notes', 'exclusivity', 'appointmentnote', 'emaildate', 'hideuntil'));
$appointments = new backup_nested_element('appointments');
$appointment = new backup_nested_element('appointment', array('id'), array('studentid', 'attended', 'grade', 'appointmentnote', 'timecreated', 'timemodified'));
// Build the tree
$scheduler->add_child($slots);
$slots->add_child($slot);
$slot->add_child($appointments);
$appointments->add_child($appointment);
// Define sources
$scheduler->set_source_table('scheduler', array('id' => backup::VAR_ACTIVITYID));
$scheduler->annotate_ids('grouping', 'bookingrouping');
// Include appointments only if we back up user information
if ($userinfo) {
$slot->set_source_table('scheduler_slots', array('schedulerid' => backup::VAR_PARENTID));
$appointment->set_source_table('scheduler_appointment', array('slotid' => backup::VAR_PARENTID));
}
// Define id annotations
$scheduler->annotate_ids('scale', 'scale');
if ($userinfo) {
$slot->annotate_ids('user', 'teacherid');
$appointment->annotate_ids('user', 'studentid');
}
// Define file annotations
$scheduler->annotate_files('mod_scheduler', 'intro', null);
// This file area has no itemid
// Return the root element (scheduler), wrapped into standard activity structure
return $this->prepare_activity_structure($scheduler);
}
示例2: define_structure
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);
}
示例3: define_structure
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);
}
示例4: define_structure
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);
}
示例5: define_structure
protected function define_structure()
{
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated
$jclic = new backup_nested_element('jclic', array('id'), array('name', 'intro', 'introformat', 'url', 'skin', 'maxattempts', 'width', 'height', 'avaluation', 'maxgrade', 'grade', 'lang', 'exiturl', 'timeavailable', 'timedue'));
$sessions = new backup_nested_element('sessions');
$session = new backup_nested_element('session', array('id'), array('session_id', 'user_id', 'session_datetime', 'project_name', 'session_key', 'session_code', 'session_context'));
$activities = new backup_nested_element('sessionactivities');
$activity = new backup_nested_element('sessionactivity', array('id'), array('session_id', 'activity_id', 'activity_name', 'num_actions', 'score', 'activity_solved', 'qualification', 'total_time', 'activity_code'));
// Build the tree
$jclic->add_child($sessions);
$sessions->add_child($session);
$session->add_child($activities);
$activities->add_child($activity);
// Define sources
$jclic->set_source_table('jclic', array('id' => backup::VAR_ACTIVITYID));
// All the rest of elements only happen if we are including user info
if ($userinfo) {
$session->set_source_table('jclic_sessions', array('jclicid' => backup::VAR_PARENTID));
$activity->set_source_table('jclic_activities', array('session_id' => '../../session_id'));
}
// Define id annotations
$jclic->annotate_ids('scale', 'grade');
$session->annotate_ids('user', 'user_id');
// Define file annotations
$jclic->annotate_files('mod_jclic', 'intro', null);
// This file area hasn't itemid
$jclic->annotate_files('mod_jclic', 'content', null);
// This file area hasn't itemid
// Return the root element (jclic), wrapped into standard activity structure
return $this->prepare_activity_structure($jclic);
}
示例6: define_structure
protected function define_structure()
{
// To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated.
$teambuilder = new backup_nested_element('teambuilder', array('id'), array('course', 'name', 'intro', 'introformat', 'open', 'close', 'groupid', 'allowupdate'));
$questions = new backup_nested_element('questions');
$question = new backup_nested_element('question', array('id'), array('builder', 'question', 'type', 'display', 'ordinal'));
$answers = new backup_nested_element('answers');
$answer = new backup_nested_element('answer', array('id'), array('question', 'answer', 'ordinal'));
$responses = new backup_nested_element('responses');
$response = new backup_nested_element('response', array('id'), array('userid', 'answerid'));
// Build the tree.
$teambuilder->add_child($questions);
$questions->add_child($question);
$question->add_child($answers);
$answers->add_child($answer);
$answer->add_child($responses);
$responses->add_child($response);
// Define sources.
$teambuilder->set_source_table('teambuilder', array('id' => backup::VAR_ACTIVITYID));
$question->set_source_table('teambuilder_question', array('builder' => backup::VAR_PARENTID));
$answer->set_source_table('teambuilder_answer', array('question' => backup::VAR_PARENTID));
// All the rest of elements only happen if we are including user info.
if ($userinfo) {
$response->set_source_table('teambuilder_response', array('answerid' => backup::VAR_PARENTID));
}
$teambuilder->annotate_ids('group', 'groupid');
$response->annotate_ids('user', 'userid');
// Define file annotations.
$teambuilder->annotate_files('mod_teambuilder', 'intro', null);
// Return the root element (teambuilder), wrapped into standard activity structure.
return $this->prepare_activity_structure($teambuilder);
}
示例7: define_structure
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('course', 'name', 'intro', 'introformat', 'targetgrouping', 'signuptype', 'password', 'maxmembers', 'individual_limits', 'timeavailable', 'timedue', 'timecreated', 'timemodified'));
$limits = new backup_nested_element('limits');
$limit = new backup_nested_element('limit', array('id'), array('groupselect', 'groupid', 'lim'));
// Build the tree
$groupselect->add_child($limits);
$limits->add_child($limit);
// Define sources
$groupselect->set_source_table('groupselect', array('id' => backup::VAR_ACTIVITYID));
$limit->set_source_sql('
SELECT *
FROM {groupselect_limits}
WHERE groupselect = ?', array(backup::VAR_PARENTID));
// Define id annotations
$groupselect->annotate_ids('grouping', 'targetgrouping');
$limit->annotate_ids('group', 'groupid');
// Define file annotations
$groupselect->annotate_files('mod_groupselect', 'intro', null);
// This file area hasn't itemid
// Return the root element (groupselect), wrapped into standard activity structure
return $this->prepare_activity_structure($groupselect);
}
示例8: define_structure
protected function define_structure()
{
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated
$geogebra = new backup_nested_element('geogebra', array('id'), array('name', 'intro', 'introformat', 'url', 'attributes', 'width', 'height', 'showsubmit', 'grade', 'autograde', 'maxattempts', 'grademethod', 'timeavailable', 'timedue', 'timecreated', 'timemodified'));
$attempts = new backup_nested_element('attempts');
$attempt = new backup_nested_element('attempt', array('id'), array('geogebra', 'userid', 'vars', 'gradecomment', 'finished', 'dateteacher', 'datestudent'));
// Build the tree
$geogebra->add_child($attempts);
$attempts->add_child($attempt);
// Define sources
$geogebra->set_source_table('geogebra', array('id' => backup::VAR_ACTIVITYID));
// All the rest of elements only happen if we are including user info
if ($userinfo) {
$attempt->set_source_table('geogebra_attempts', array('geogebra' => backup::VAR_PARENTID));
}
// Define id annotations
$geogebra->annotate_ids('scale', 'grade');
$attempt->annotate_ids('user', 'userid');
// Define file annotations
$geogebra->annotate_files('mod_geogebra', 'intro', null);
// This file area hasn't itemid
$geogebra->annotate_files('mod_geogebra', 'content', null);
// This file area hasn't itemid
// Return the root element (geogebra), wrapped into standard activity structure
return $this->prepare_activity_structure($geogebra);
}
示例9: define_structure
protected function define_structure()
{
global $DB;
// To know if we are including userinfo
$userinfo = $this->get_setting_value('users');
if ($userinfo) {
// Define each element separated
$jmail = new backup_nested_element('jmail', array('id'), array('sender', 'courseid', 'subject', 'body', 'attachment', 'approved', 'timesent', 'timecreated'));
$sents = new backup_nested_element('sents');
$sent = new backup_nested_element('sent', array('id'), array('userid', 'messageid', 'type', 'mread', 'answered', 'deleted', 'labeled'));
$labels = new backup_nested_element('labels');
$label = new backup_nested_element('label', array('id'), array('name', 'userid', 'courseid', 'timecreated'));
$mlabels = new backup_nested_element('mlabels');
$mlabel = new backup_nested_element('mlabel', array('id'), array('labelid', 'messagesentid', 'timecreated'));
$preferences = new backup_nested_element('preferences');
$preference = new backup_nested_element('preference', array('id'), array('userid', 'courseid', 'name', 'value'));
// Build the tree
$jmail->add_child($sents);
$sents->add_child($sent);
$jmail->add_child($preferences);
$preferences->add_child($preference);
$jmail->add_child($labels);
$labels->add_child($label);
$label->add_child($mlabels);
$mlabels->add_child($mlabel);
// Define sources
$jmail->set_source_table('block_jmail', array('courseid' => backup::VAR_COURSEID));
$sent->set_source_table('block_jmail_sent', array('messageid' => backup::VAR_PARENTID));
$preference->set_source_table('block_jmail_preferences', array('courseid' => backup::VAR_COURSEID));
$label->set_source_table('block_jmail_label', array('courseid' => backup::VAR_COURSEID));
$mlabel->set_source_table('block_jmail_m_label', array('labelid' => backup::VAR_PARENTID));
// Define id annotations
$jmail->annotate_ids('course', 'courseid');
$jmail->annotate_ids('user', 'sender');
$sent->annotate_ids('user', 'userid');
// Define file annotations
$jmail->annotate_files('block_jmail', 'attachment', 'id');
$jmail->annotate_files('block_jmail', 'body', 'id');
} else {
return null;
}
// Return the root element (jmail), wrapped into standard block structure
return $this->prepare_block_structure($jmail);
}
示例10: define_structure
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);
}
示例11: define_structure
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);
}
示例12: define_structure
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);
}
示例13: define_structure
/**
* Define the structure for the setask activity
* @return void
*/
protected function define_structure()
{
// To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated.
$setask = new backup_nested_element('setask', 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', 'setaskment', '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.
$setask->add_child($userflags);
$userflags->add_child($userflag);
$setask->add_child($submissions);
$submissions->add_child($submission);
$setask->add_child($grades);
$grades->add_child($grade);
$setask->add_child($pluginconfigs);
$pluginconfigs->add_child($pluginconfig);
// Define sources.
$setask->set_source_table('setask', array('id' => backup::VAR_ACTIVITYID));
$pluginconfig->set_source_table('setask_plugin_config', array('setaskment' => backup::VAR_PARENTID));
if ($userinfo) {
$userflag->set_source_table('setask_user_flags', array('setaskment' => backup::VAR_PARENTID));
$submission->set_source_table('setask_submission', array('setaskment' => backup::VAR_PARENTID));
$grade->set_source_table('setask_grades', array('setaskment' => backup::VAR_PARENTID));
// Support 2 types of subplugins.
$this->add_subplugin_structure('setasksubmission', $submission, true);
$this->add_subplugin_structure('setaskfeedback', $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');
$setask->annotate_ids('grouping', 'teamsubmissiongroupingid');
// Define file annotations.
// These file areas don't have an itemid.
$setask->annotate_files('mod_setask', 'intro', null);
$setask->annotate_files('mod_setask', 'introattachment', null);
// Return the root element (choice), wrapped into standard activity structure.
return $this->prepare_activity_structure($setask);
}
示例14: define_structure
protected function define_structure()
{
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated
$pcast = new backup_nested_element('pcast', array('id'), array('userid', 'name', 'intro', 'introformat', 'userscancomment', 'userscancategorize', 'userscanpost', 'requireapproval', 'displayauthor', 'displayviews', 'image', 'imageheight', 'imagewidth', 'rssepisodes', 'rsssortorder', 'enablerssfeed', 'enableitunes', 'visible', 'explicit', 'subtitle', 'keywords', 'topcategory', 'nestedcategory', 'assessed', 'assesstimestart', 'assesstimefinish', 'scale', 'timecreated', 'timemodified'));
$episodes = new backup_nested_element('episodes');
$episode = new backup_nested_element('episode', array('id'), array('userid', 'name', 'summary', 'mediafile', 'duration', 'explicit', 'subtitle', 'keywords', 'topcategory', 'nestedcategory', 'timecreated', 'timemodified', 'approved', 'sequencenumber'));
$views = new backup_nested_element('views');
$view = new backup_nested_element('view', array('id'), array('episodeid', 'userid', 'views', 'lastview'));
$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
$pcast->add_child($episodes);
$episodes->add_child($episode);
$episode->add_child($views);
$views->add_child($view);
$episode->add_child($ratings);
$ratings->add_child($rating);
// Define sources
$pcast->set_source_table('pcast', array('id' => backup::VAR_ACTIVITYID));
// All the rest of elements only happen if we are including user info
if ($userinfo) {
$episode->set_source_sql('
SELECT *
FROM {pcast_episodes}
WHERE pcastid = ?', array(backup::VAR_PARENTID));
$view->set_source_sql('
SELECT *
FROM {pcast_views}
WHERE episodeid = ?', array(backup::VAR_PARENTID));
$rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID, 'component' => 'mod_pcast', 'ratingarea' => 'episode'));
$rating->set_source_alias('rating', 'value');
}
// Define id annotations
$pcast->annotate_ids('user', 'userid');
$episode->annotate_ids('user', 'userid');
$view->annotate_ids('user', 'userid');
$rating->annotate_ids('scale', 'scaleid');
$rating->annotate_ids('user', 'userid');
// Define file annotations
$pcast->annotate_files('mod_pcast', 'intro', null);
// This file area hasn't itemid
$pcast->annotate_files('mod_pcast', 'logo', null);
$episode->annotate_files('mod_pcast', 'episode', 'id');
// Return the root element (pcast), wrapped into standard activity structure
return $this->prepare_activity_structure($pcast);
}
示例15: define_structure
protected function define_structure()
{
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated
$studyplan = new backup_nested_element('studyplan', array('id'), array("quiz", "name", "intro", "introformat", "standardblock", "timecreated", "timemodified"));
$blocks = new backup_nested_element('blocks');
$block = new backup_nested_element('block', array('id'), array("studyplan", "sequence", "type", "lookuptype", "keyname", "operator", "value", "label", "content", "contentformat", "activity", "completionactivity", "timecreated", "timemodified"));
$overrides = new backup_nested_element('overrides');
$override = new backup_nested_element('override', array('id'), array("studyplan", "block", "user", "timecreated", "timemodified"));
$progresses = new backup_nested_element('progresses');
$progress = new backup_nested_element('progress', array('id'), array("studyplan", "user", "percent", "timecreated", "timemodified"));
// Build the tree
$studyplan->add_child($blocks);
$blocks->add_child($block);
$studyplan->add_child($overrides);
$overrides->add_child($override);
$studyplan->add_child($progresses);
$progresses->add_child($progress);
// Define sources
$studyplan->set_source_table('studyplan', array('id' => backup::VAR_ACTIVITYID));
$block->set_source_sql('
SELECT *
FROM {studyplan_blocks}
WHERE studyplan = ?', array(backup::VAR_PARENTID));
// All the rest of elements only happen if we are including user info
if ($userinfo) {
$override->set_source_table('studyplan_overrides', array('studyplan' => '../../id'));
$override->annotate_ids('studyplan', 'studyplan');
$override->annotate_ids('studyplan_block', 'block');
$override->annotate_ids('user', 'user');
$progress->set_source_table('studyplan_progress', array('studyplan' => '../../id'));
$progress->annotate_ids('studyplan', 'studyplan');
$progress->annotate_ids('user', 'user');
}
// Define id annotations
$studyplan->annotate_ids('quiz', 'quiz');
$block->annotate_ids('studyplan', 'studyplan');
$block->annotate_ids('course_module', 'activity');
$block->annotate_ids('course_module', 'completionactivity');
// Define file annotations
// Return the root element (studyplan), wrapped into standard activity structure
return $this->prepare_activity_structure($studyplan);
}