本文整理汇总了PHP中backup_nested_element::add_child方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_nested_element::add_child方法的具体用法?PHP backup_nested_element::add_child怎么用?PHP backup_nested_element::add_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backup_nested_element
的用法示例。
在下文中一共展示了backup_nested_element::add_child方法的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
$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);
}
示例2: define_structure
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);
}
示例3: define_structure
/**
* 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);
}
示例4: define_structure
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);
}
示例5: define_structure
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);
}
示例6: define_structure
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);
}
示例7: 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);
}
示例8: 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);
}
示例9: define_structure
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);
}
示例10: define_structure
/**
* 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);
}
示例11: define_structure
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);
}
示例12: 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);
}
示例13: define_structure
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);
}
示例14: define_structure
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);
}
示例15: define_structure
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);
}