/** * 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() { $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); }
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() { // Create really simple structure (1 nested with 1 attr and 2 fields) $test = new backup_nested_element('test', array('id'), array('field1', 'field2')); $test->set_source_array(array(array('id' => 1, 'field1' => 'value1', 'field2' => 'value2'))); return $test; }
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); }
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); }
/** * 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() { $equella = new backup_nested_element('equella', array('id'), array('course', 'name', 'intro', 'introformat', 'timecreated', 'timemodified', 'url', 'mimetype', 'popup', 'activation', 'uuid', 'version', 'path', 'attachmentuuid', 'ltisalt')); $equella->set_source_table('equella', array('id' => backup::VAR_ACTIVITYID)); $equella->annotate_files('mod_equella', 'intro', null); return $this->prepare_activity_structure($equella); }
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); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $folder = new backup_nested_element('folder', array('id'), array( 'name', 'intro', 'introformat', 'revision', 'timemodified')); // Build the tree // (nice mono-tree, lol) // Define sources $folder->set_source_table('folder', array('id' => backup::VAR_ACTIVITYID)); // Define id annotations // (none) // Define file annotations $folder->annotate_files('mod_folder', 'intro', null); $folder->annotate_files('mod_folder', 'content', null); // Return the root element (folder), wrapped into standard activity structure return $this->prepare_activity_structure($folder); }
/** * 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() { // 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); }
/** * The settings table is a bit simpler, since no files are used. * Simply create the backup element and then grab the information * from the database. * */ protected function define_structure() { // Notice the use of 'setting' here rather than 'settings', this is how it gets written to the XML file. $nursnavigationsettings = new backup_nested_element('nurs_navigation_setting', array('id'), array('courseid', 'sectionname', 'disableicon', 'customlabel')); $nursnavigationsettings->set_source_table('nurs_navigation_settings', array('courseid' => backup::VAR_COURSEID)); return $this->prepare_block_structure($nursnavigationsettings); }
/** * 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() { // 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 $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() { $userinfo = $this->get_setting_value('userinfo'); $bootstrapelements = new backup_nested_element('bootstrapelements', array('id'), array('name', 'intro', 'introformat', 'timemodified', 'title', 'bootstraptype', 'bootstrapicon')); $bootstrapelements->set_source_table('bootstrapelements', array('id' => backup::VAR_ACTIVITYID)); $bootstrapelements->annotate_files('mod_bootstrapelements', 'intro', null); return $this->prepare_activity_structure($bootstrapelements); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $webinar = new backup_nested_element('webinar', array('id'), array('course', 'name', 'description', 'agenda', 'sitexmlapiurl', 'adminpassword', 'adminemail')); $sessions = new backup_nested_element('sessions'); $session = new backup_nested_element('session', array('id'), array('webinar', 'capacity', 'presenter', 'scoid', 'urlpath', 'timecreated', 'timemodified')); $signups = new backup_nested_element('signups'); $signup = new backup_nested_element('signup', array('id'), array('sessionid', 'userid', 'mailedreminder', 'discountcode', 'notificationtype')); $signups_status = new backup_nested_element('signups_status'); $signup_status = new backup_nested_element('signup_status', array('id'), array('signupid', 'statuscode', 'superceded', 'grade', 'note', 'advice', 'createdby', 'timecreated')); $session_roles = new backup_nested_element('session_roles'); $session_role = new backup_nested_element('session_role', array('id'), array('sessionid', 'roleid', 'userid')); $session_data = new backup_nested_element('session_data'); //May need to replace first item 'data' with better value $session_data_element = new backup_nested_element('data', array('id'), array('fieldid', 'sessionid', 'data')); //$session_field = new backup_nested_element('session_field'); //May need to replace first item 'field' with better value /*$session_field_element = new backup_nested_element('field', array('id'), array( 'name', 'shortname', 'type', 'possiblevalues', 'required', 'defaultvalue', 'isfilter', 'showinsummary'));*/ $sessions_dates = new backup_nested_element('sessions_dates'); $sessions_date = new backup_nested_element('sessions_date', array('id'), array('sessionid', 'timestart', 'timefinish')); // Build the tree $webinar->add_child($sessions); $sessions->add_child($session); $session->add_child($signups); $signups->add_child($signup); $signup->add_child($signups_status); $signups_status->add_child($signup_status); $session->add_child($session_roles); $session_roles->add_child($session_role); $session->add_child($session_data); $session_data->add_child($session_data_element); /*$session->add_child($session_field); $session_field->add_child($session_field_element);*/ $session->add_child($sessions_dates); $sessions_dates->add_child($sessions_date); // Define sources $webinar->set_source_table('webinar', array('id' => backup::VAR_ACTIVITYID)); $session->set_source_table('webinar_sessions', array('webinar' => backup::VAR_PARENTID)); $sessions_date->set_source_table('webinar_sessions_dates', array('sessionid' => backup::VAR_PARENTID)); if ($userinfo) { $signup->set_source_table('webinar_signups', array('sessionid' => backup::VAR_PARENTID)); $signup_status->set_source_table('webinar_signups_status', array('signupid' => backup::VAR_PARENTID)); $session_role->set_source_table('webinar_session_roles', array('sessionid' => backup::VAR_PARENTID)); $session_data_element->set_source_table('webinar_session_data', array('sessionid' => backup::VAR_PARENTID)); } // Define id annotations $signup->annotate_ids('user', 'userid'); $session_role->annotate_ids('role', 'roleid'); $session_role->annotate_ids('user', 'userid'); $session_data_element->annotate_ids('webinar_session_field', 'fieldid'); // Define file annotations // None for F2F // Return the root element (webinar), wrapped into standard activity structure return $this->prepare_activity_structure($webinar); }
/** * Define the structure for the links block. * @return void */ protected function define_structure() { // Define each element separated. $link = new backup_nested_element('link', null, array('id', 'linktext', 'url', 'notes', 'defaultshow', 'department')); // Define sources. $link->set_source_sql("SELECT * FROM {block_links}", array()); // Annotations (none). // Return the root element (links), wrapped into standard block structure. return $this->prepare_block_structure($link); }
protected function define_structure() { $lockdownbrowser = new backup_nested_element("lockdownbrowser", array("id"), array("course", "name", "intro", "introformat", "timecreated", "timemodified")); $settings = new backup_nested_element("settings", array("id"), array("course", "quizid", "attempts", "reviews", "password", "monitor")); $lockdownbrowser->add_child($settings); $lockdownbrowser->set_source_table("block_lockdownbrowser", array("id" => backup::VAR_BLOCKID)); $lockdownbrowser->set_source_table("block_lockdownbrowser_sett", array("course" => backup::VAR_COURSEID)); $settings->annotate_ids("quiz", "quizid"); return $this->prepare_block_structure($lockdownbrowser); }
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); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $wwassignment = new backup_nested_element('wwassignment', array('id', 'course'), array('name', 'description', 'webwork_set', 'grade', 'timemodified')); // Define sources $wwassignment->set_source_table('wwassignment', array('id' => backup::VAR_ACTIVITYID, 'course' => backup::VAR_COURSEID)); // Return the root element (choice), wrapped into standard activity structure return $this->prepare_activity_structure($wwassignment); }
protected function define_structure() { // Define each element separated $opendesktop = new backup_nested_element('opendesktop', array('id'), array('name', 'intro', 'introformat', 'timecreated', 'timemodified', 'languagesetting', 'desktopsize', 'quality')); // Define sources $opendesktop->set_source_table('opendesktop', array('id' => backup::VAR_ACTIVITYID)); // Define file annotations $opendesktop->annotate_files('mod_opendesktop', 'intro', null); // This file area hasn't itemid // Return the root element (opendesktop), wrapped into standard activity structure return $this->prepare_activity_structure($opendesktop); }
protected function define_structure() { // Define each element separated $opencast = new backup_nested_element('opencast', ['id'], ['ext_id', 'name', 'intro', 'introformat', 'is_ivt', 'inviting', 'organization_domain']); // Define sources $opencast->set_source_table('opencast', ['id' => backup::VAR_ACTIVITYID]); // Define file annotations $opencast->annotate_files('mod_opencast', 'intro', null); // This file area hasn't itemid // Return the root element (opencast), wrapped into standard activity structure return $this->prepare_activity_structure($opencast); }
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() { // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. $facetoface = new backup_nested_element('facetoface', array('id'), array('name', 'thirdparty', 'thirdpartywaitlist', 'display', 'confirmationsubject', 'confirmationinstrmngr', 'confirmationmessage', 'waitlistedsubject', 'waitlistedmessage', 'cancellationsubject', 'cancellationmessage', 'remindersubject', 'reminderinstrmngr', 'remindermessage', 'reminderperiod', 'requestsubject', 'requestinstrmngr', 'requestmessage', 'timecreated', 'timemodified', 'shortname', 'description', 'showoncalendar', 'approvalreqd', 'usercalentry')); $sessions = new backup_nested_element('sessions'); $session = new backup_nested_element('session', array('id'), array('facetoface', 'capacity', 'allowoverbook', 'details', 'datetimeknown', 'duration', 'normalcost', 'discountcost', 'timecreated', 'timemodified')); $signups = new backup_nested_element('signups'); $signup = new backup_nested_element('signup', array('id'), array('sessionid', 'userid', 'mailedreminder', 'discountcode', 'notificationtype')); $signupsstatus = new backup_nested_element('signups_status'); $signupstatus = new backup_nested_element('signup_status', array('id'), array('signupid', 'statuscode', 'superceded', 'grade', 'note', 'advice', 'createdby', 'timecreated')); $sessionroles = new backup_nested_element('session_roles'); $sessionrole = new backup_nested_element('session_role', array('id'), array('sessionid', 'roleid', 'userid')); $sessiondata = new backup_nested_element('session_data'); // May need to replace first item 'data' with better value. $sessiondataelement = new backup_nested_element('data', array('id'), array('fieldid', 'sessionid', 'data')); $sessionsdates = new backup_nested_element('sessions_dates'); $sessionsdate = new backup_nested_element('sessions_date', array('id'), array('sessionid', 'timestart', 'timefinish')); // Build the tree. $facetoface->add_child($sessions); $sessions->add_child($session); $session->add_child($signups); $signups->add_child($signup); $signup->add_child($signupsstatus); $signupsstatus->add_child($signupstatus); $session->add_child($sessionroles); $sessionroles->add_child($sessionrole); $session->add_child($sessiondata); $sessiondata->add_child($sessiondataelement); $session->add_child($sessionsdates); $sessionsdates->add_child($sessionsdate); // Define sources. $facetoface->set_source_table('facetoface', array('id' => backup::VAR_ACTIVITYID)); $session->set_source_table('facetoface_sessions', array('facetoface' => backup::VAR_PARENTID)); $sessionsdate->set_source_table('facetoface_sessions_dates', array('sessionid' => backup::VAR_PARENTID)); if ($userinfo) { $signup->set_source_table('facetoface_signups', array('sessionid' => backup::VAR_PARENTID)); $signupstatus->set_source_table('facetoface_signups_status', array('signupid' => backup::VAR_PARENTID)); $sessionrole->set_source_table('facetoface_session_roles', array('sessionid' => backup::VAR_PARENTID)); $sessiondataelement->set_source_table('facetoface_session_data', array('sessionid' => backup::VAR_PARENTID)); } // Define id annotations. $signup->annotate_ids('user', 'userid'); $sessionrole->annotate_ids('role', 'roleid'); $sessionrole->annotate_ids('user', 'userid'); $sessiondataelement->annotate_ids('facetoface_session_field', 'fieldid'); // Define file annotations. // None for F2F. // Return the root element (facetoface), wrapped into standard activity structure. return $this->prepare_activity_structure($facetoface); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $reader = new backup_nested_element('reader', array('id'), array('course', 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'optionflags', 'penaltyscheme', 'attempts', 'attemptonlast', 'grademethod', 'decimalpoints', 'review', 'questionsperpage', 'shufflequestions', 'shuffleanswers', 'questions', 'sumgrades', 'grade', 'usecourse', 'timecreated', 'timemodified', 'timelimit', 'password', 'subnet', 'popup', 'individualstrictip', 'delay1', 'delay2', 'percentforreading', 'nextlevel', 'quizpreviouslevel', 'quiznextlevel', 'pointreport', 'questionmark', 'bookcovers', 'attemptsofday', 'ignordate', 'goal', 'wordsorpoints', 'secmeass', 'promotionstop', 'levelcheck', 'reportwordspoints', 'wordsprogressbar', 'individualbooks', 'sendmessagesaboutcheating', 'cheated_message', 'not_cheated_message', 'checkbox')); // Build the tree // Define sources $reader->set_source_table('reader', array('id' => backup::VAR_ACTIVITYID, 'course' => backup::VAR_COURSEID)); // Define id annotations // Return the root element (reader), wrapped into standard activity structure return $this->prepare_activity_structure($reader); }
protected function define_structure() { // To know if we are including userinfo $userinfo = $this->get_setting_value('userinfo'); // Define each element separated $ouwiki = new backup_nested_element('ouwiki', array('id'), array('name', 'subwikis', 'intro', 'editbegin', 'editend', 'annotation', 'introformat', 'completionedits', 'completionpages', 'enablewordcount')); $subwikis = new backup_nested_element('subs'); $subwiki = new backup_nested_element('subwiki', array('id'), array('groupid', 'userid', 'magic')); $pages = new backup_nested_element('pages'); $page = new backup_nested_element('page', array('id'), array('title', 'currentversionid', 'locked')); $versions = new backup_nested_element('versions'); $version = new backup_nested_element('version', array('id'), array('xhtml', 'changestart', 'changesize', 'changeprevsize', 'deletedat', 'timecreated', 'userid', 'wordcount')); $annotations = new backup_nested_element('annotations'); $annotation = new backup_nested_element('annotation', array('id'), array('userid', 'timemodified', 'content')); $links = new backup_nested_element('links'); $link = new backup_nested_element('link', array('id'), array('topageid', 'tomissingpage', 'tourl')); // Build the tree $ouwiki->add_child($subwikis); $subwikis->add_child($subwiki); $subwiki->add_child($pages); $pages->add_child($page); $page->add_child($versions); $versions->add_child($version); $version->add_child($links); $links->add_child($link); $page->add_child($annotations); $annotations->add_child($annotation); // Define sources $ouwiki->set_source_table('ouwiki', array('id' => backup::VAR_ACTIVITYID)); // All these source definitions only happen if we are including user info if ($userinfo) { $subwiki->set_source_table('ouwiki_subwikis', array('wikiid' => backup::VAR_PARENTID)); $page->set_source_table('ouwiki_pages', array('subwikiid' => backup::VAR_PARENTID)); $version->set_source_table('ouwiki_versions', array('pageid' => backup::VAR_PARENTID)); $link->set_source_table('ouwiki_links', array('fromversionid' => backup::VAR_PARENTID)); $annotation->set_source_table('ouwiki_annotations', array('pageid' => backup::VAR_PARENTID)); } // Define id annotations $subwiki->annotate_ids('group', 'groupid'); $subwiki->annotate_ids('user', 'userid'); $version->annotate_ids('user', 'userid'); $annotation->annotate_ids('user', 'userid'); // Define file annotations $ouwiki->annotate_files('mod_ouwiki', 'intro', null); // This file area hasn't itemid $version->annotate_files('mod_ouwiki', 'attachment', 'id'); $version->annotate_files('mod_ouwiki', 'content', 'id'); // Return the root element (wiki), wrapped into standard activity structure return $this->prepare_activity_structure($ouwiki); }
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); }