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);
 }
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $imscp = new backup_nested_element('imscp', array('id'), array('name', 'intro', 'introformat', 'revision', 'keepold', 'structure', 'timemodified'));
     // Build the tree
     // (love this)
     // Define sources
     $imscp->set_source_table('imscp', array('id' => backup::VAR_ACTIVITYID));
     // Define id annotations
     // (none)
     // Define file annotations
     $imscp->annotate_files('mod_imscp', 'intro', null);
     // This file area hasn't itemid
     $imscp->annotate_files('mod_imscp', 'backup', null);
     // This file area hasn't itemid
     /**
      * I don't like itemid used for "imaginative" things like "revisions"!
      * I don't like itemid used for "imaginative" things like "revisions"!
      * I don't like itemid used for "imaginative" things like "revisions"!
      */
     $imscp->annotate_files('mod_imscp', 'content', null);
     // Horrible use of itemid here. Ignoring for backup/restore purposes
     // Return the root element (imscp), wrapped into standard activity structure
     return $this->prepare_activity_structure($imscp);
 }
 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);
 }
 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);
 }
Ejemplo n.º 5
0
    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);
    }
 /**
  * Used in activity_task
  *
  * @return prepared structure of elang for activity task
  */
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $elang = new backup_nested_element('elang', array('id'), array('course', 'name', 'intro', 'introformat', 'timecreated', 'timemodified', 'language', 'options'));
     $cues = new backup_nested_element('cues');
     $cue = new backup_nested_element('cue', array('id'), array('id_elang', 'number', 'begin', 'end', 'title', 'json'));
     $users = new backup_nested_element('users');
     $user = new backup_nested_element('user', array('id'), array('id_user', 'json'));
     // Build the tree
     $elang->add_child($cues);
     $cues->add_child($cue);
     $cue->add_child($users);
     $users->add_child($user);
     // Define sources
     $elang->set_source_table('elang', array('id' => backup::VAR_ACTIVITYID));
     $cue->set_source_table('elang_cues', array('id_elang' => backup::VAR_PARENTID), 'id ASC');
     // Define source for users if userinfo is set
     if ($userinfo) {
         $user->set_source_table('elang_users', array('id_cue' => backup::VAR_PARENTID), 'id ASC');
     }
     // Define id annotations
     $user->annotate_ids('user', 'id_user');
     // Define file annotations-These files areas haven't itemid
     $elang->annotate_files('mod_elang', 'videos', null);
     $elang->annotate_files('mod_elang', 'poster', null);
     $elang->annotate_files('mod_elang', 'subtitle', null);
     // Return the root element (elang), wrapped into standard activity structure
     return $this->prepare_activity_structure($elang);
 }
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     $els = array('name', 'subwikis', 'intro', 'editbegin', 'editend', 'annotation', 'introformat', 'completionedits', 'completionpages', 'enablewordcount', 'allowimport');
     if (!$userinfo) {
         $els[] = 'template';
     }
     // Define each element separated
     $ouwiki = new backup_nested_element('ouwiki', array('id'), $els);
     $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
     if (!$userinfo) {
         $ouwiki->annotate_files('mod_ouwiki', 'template', 'id');
     }
     $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);
 }
 /**
  * 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);
 }
 protected function define_structure()
 {
     // Define each element separated.
     $videofile = new backup_nested_element('videofile', array('id'), array('name', 'intro', 'introformat', 'width', 'height', 'timecreated', 'timemodified'));
     // Define sources.
     $videofile->set_source_table('videofile', array('id' => backup::VAR_ACTIVITYID));
     // Define file annotations.
     $videofile->annotate_files('mod_videofile', 'intro', null);
     $videofile->annotate_files('mod_videofile', 'videos', null);
     $videofile->annotate_files('mod_videofile', 'posters', null);
     $videofile->annotate_files('mod_videofile', 'captions', null);
     // Return the root element (videofile), wrapped into standard
     // activity structure.
     return $this->prepare_activity_structure($videofile);
 }
 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);
 }
 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);
 }
 /**
  * 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()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $groupselect = new backup_nested_element('groupselect', array('id'), array('name', 'intro', 'introformat', 'targetgrouping', 'maxmembers', 'timeavailable', 'timedue', 'timecreated', 'timemodified', 'hidefullgroups', 'deleteemptygroups', 'studentcancreate', 'minmembers', 'assignteachers', 'studentcansetdesc', 'showassignedteacher', 'studentcansetenrolmentkey', 'studentcansetgroupname', 'notifyexpiredselection'));
     $passwords = new backup_nested_element('passwords');
     $password = new backup_nested_element('password', array('id'), array('groupid', 'password'));
     $groupteachers = new backup_nested_element('groupteachers');
     $groupteacher = new backup_nested_element('groupteacher', array('id'), array('groupid', 'teacherid'));
     // Build the tree
     $groupselect->add_child($passwords);
     $passwords->add_child($password);
     $groupselect->add_child($groupteachers);
     $groupteachers->add_child($groupteacher);
     // Define sources
     $groupselect->set_source_table('groupselect', array('id' => backup::VAR_ACTIVITYID));
     $password->set_source_table('groupselect_passwords', array('instance_id' => backup::VAR_ACTIVITYID));
     if ($userinfo) {
         $groupteacher->set_source_table('groupselect_groups_teachers', array('instance_id' => backup::VAR_ACTIVITYID));
     }
     // Define id annotations
     $groupselect->annotate_ids('grouping', 'targetgrouping');
     $password->annotate_ids('group', 'groupid');
     $groupteacher->annotate_ids('group', 'groupid');
     $groupteacher->annotate_ids('user', 'teacherid');
     // Define file annotations
     $groupselect->annotate_files('mod_groupselect', 'intro', null);
     // This file areas haven't itemid
     // Return the root element (groupselect), wrapped into standard activity structure
     return $this->prepare_activity_structure($groupselect);
 }
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $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);
 }
 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);
 }
 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);
 }
 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 separated
     $hvp = new backup_nested_element('hvp', array('id'), array('course', 'name', 'json_content', 'embed_type', 'disable', 'main_library_id', 'content_type', 'author', 'license', 'meta_keywords', 'meta_description', 'filtered', 'slug', 'timecreated', 'timemodified'));
     $hvp_libraries = new backup_nested_element('libraries');
     $hvp_library = new backup_nested_element('library', null, array('machine_name', 'major_version', 'minor_version', 'patch_version', 'dependency_type', 'drop_css', 'weight'));
     $content_user_data_entries = new backup_nested_element('content_user_data');
     $content_user_data = new backup_nested_element('entry', array('id'), array('user_id', 'hvp_id', 'sub_content_id', 'data_id', 'data', 'preloaded', 'delete_on_content_change'));
     // Build the tree
     $hvp->add_child($content_user_data_entries);
     $content_user_data_entries->add_child($content_user_data);
     $hvp->add_child($hvp_libraries);
     $hvp_libraries->add_child($hvp_library);
     // Define sources
     $hvp->set_source_table('hvp', array('id' => backup::VAR_ACTIVITYID));
     $lib_sql = "SELECT\n                machine_name,\n                major_version,\n                minor_version,\n                patch_version,\n                dependency_type,\n                drop_css,\n                weight\n            FROM {hvp_libraries} hl\n            JOIN {hvp_contents_libraries} hcl\n                ON hl.id = hcl.library_id\n            JOIN {hvp} h\n                ON h.id = hcl.hvp_id\n            WHERE h.id = ?";
     $hvp_library->set_source_sql($lib_sql, array(backup::VAR_ACTIVITYID));
     // All the rest of elements only happen if we are including user info
     if ($userinfo) {
         $content_user_data->set_source_table('hvp_content_user_data', array('hvp_id' => backup::VAR_PARENTID), 'id ASC');
     }
     // Define id annotations
     $content_user_data->annotate_ids('user', 'user_id');
     // Define file annotations
     $hvp->annotate_files('mod_hvp', 'content', null);
     // Return the root element (hvp), wrapped into standard activity structure
     return $this->prepare_activity_structure($hvp);
 }
 /**
  * Define the structure 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);
 }
Ejemplo n.º 20
0
 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()
 {
     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);
 }
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $certificate = new backup_nested_element('certificate', array('id'), array('name', 'intro', 'introformat', 'emailteachers', 'emailothers', 'savecert', 'reportcert', 'delivery', 'certificatetype', 'orientation', 'borderstyle', 'bordercolor', 'printwmark', 'printdate', 'datefmt', 'printnumber', 'printgrade', 'gradefmt', 'printoutcome', 'printhours', 'printteacher', 'customtext', 'printsignature', 'printseal', 'timecreated', 'timemodified'));
     $issues = new backup_nested_element('issues');
     $issue = new backup_nested_element('issue', array('id'), array('certificateid', 'userid', 'timecreated', 'code'));
     // Build the tree
     $certificate->add_child($issues);
     $issues->add_child($issue);
     // Define sources
     $certificate->set_source_table('certificate', array('id' => backup::VAR_ACTIVITYID));
     // All the rest of elements only happen if we are including user info
     if ($userinfo) {
         $issue->set_source_table('certificate_issues', array('certificateid' => backup::VAR_PARENTID));
     }
     // Annotate the user id's where required.
     $issue->annotate_ids('user', 'userid');
     // Define file annotations
     $certificate->annotate_files('mod_certificate', 'intro', null);
     // This file area hasn't itemid
     $issue->annotate_files('mod_certificate', 'issue', 'id');
     // Return the root element (certificate), wrapped into standard activity structure
     return $this->prepare_activity_structure($certificate);
 }
 protected function define_structure()
 {
     $journal = new backup_nested_element('journal', array('id'), array('name', 'intro', 'introformat', 'days', 'grade', 'timemodified'));
     $entries = new backup_nested_element('entries');
     $entry = new backup_nested_element('entry', array('id'), array('userid', 'modified', 'text', 'format', 'rating', 'entrycomment', 'teacher', 'timemarked', 'mailed'));
     // journal -> entries -> entry
     $journal->add_child($entries);
     $entries->add_child($entry);
     // Sources
     $journal->set_source_table('journal', array('id' => backup::VAR_ACTIVITYID));
     if ($this->get_setting_value('userinfo')) {
         $entry->set_source_table('journal_entries', array('journal' => backup::VAR_PARENTID));
     }
     // Define id annotations
     $entry->annotate_ids('user', 'userid');
     $entry->annotate_ids('user', 'teacher');
     // Define file annotations
     $journal->annotate_files('mod_journal', 'intro', null);
     // This file areas haven't itemid
     $entry->annotate_files('mod_journal_entries', 'text', null);
     // This file areas haven't itemid
     $entry->annotate_files('mod_journal_entries', 'entrycomment', null);
     // This file areas haven't itemid
     return $this->prepare_activity_structure($journal);
 }
Ejemplo n.º 24
0
 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);
 }
Ejemplo n.º 25
0
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $survey = new backup_nested_element('survey', array('id'), array('name', 'intro', 'introformat', 'template', 'questions', 'days', 'timecreated', 'timemodified', 'completionsubmit'));
     $answers = new backup_nested_element('answers');
     $answer = new backup_nested_element('answer', array('id'), array('userid', 'question', 'time', 'answer1', 'answer2'));
     $analysis = new backup_nested_element('analysis');
     $analys = new backup_nested_element('analys', array('id'), array('userid', 'notes'));
     // Build the tree
     $survey->add_child($answers);
     $answers->add_child($answer);
     $survey->add_child($analysis);
     $analysis->add_child($analys);
     // Define sources
     $survey->set_source_table('survey', array('id' => backup::VAR_ACTIVITYID));
     $answer->set_source_table('survey_answers', array('survey' => backup::VAR_PARENTID));
     $analys->set_source_table('survey_analysis', array('survey' => backup::VAR_PARENTID));
     // Define id annotations
     $answer->annotate_ids('user', 'userid');
     $analys->annotate_ids('user', 'userid');
     // Define file annotations
     $survey->annotate_files('mod_survey', 'intro', null);
     // This file area hasn't itemid
     // Return the root element (survey), wrapped into standard activity structure
     return $this->prepare_activity_structure($survey);
 }
 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element
     $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
     $feedback = new backup_nested_element('feedback', array('id'), array('name', 'intro', 'introformat', 'anonymous', 'email_notification', 'multiple_submit', 'autonumbering', 'site_after_submit', 'page_after_submit', 'page_after_submitformat', 'publish_stats', 'timeopen', 'timeclose', 'timemodified', 'completionsubmit'));
     $completeds = new backup_nested_element('completeds');
     $completed = new backup_nested_element('completed', array('id'), array('userid', 'timemodified', 'random_response', 'anonymous_response'));
     $items = new backup_nested_element('items');
     $item = new backup_nested_element('item', array('id'), array('template', 'name', 'label', 'presentation', 'typ', 'hasvalue', 'position', 'required', 'dependitem', 'dependvalue', 'options'));
     $trackings = new backup_nested_element('trackings');
     $tracking = new backup_nested_element('tracking', array('id'), array('userid', 'completed'));
     $values = new backup_nested_element('values');
     $value = new backup_nested_element('value', array('id'), array('item', 'template', 'completed', 'value'));
     // Build the tree
     $feedback->add_child($items);
     $items->add_child($item);
     $feedback->add_child($completeds);
     $completeds->add_child($completed);
     $completed->add_child($values);
     $values->add_child($value);
     $feedback->add_child($trackings);
     $trackings->add_child($tracking);
     // Define sources
     $feedback->set_source_table('feedback', array('id' => backup::VAR_ACTIVITYID));
     $item->set_source_table('feedback_item', array('feedback' => backup::VAR_PARENTID));
     // All these source definitions only happen if we are including user info
     if ($userinfo) {
         $completed->set_source_sql('
             SELECT *
               FROM {feedback_completed}
              WHERE feedback = ?', array(backup::VAR_PARENTID));
         $value->set_source_table('feedback_value', array('completed' => backup::VAR_PARENTID));
         $tracking->set_source_table('feedback_tracking', array('feedback' => backup::VAR_PARENTID));
     }
     // Define id annotations
     $completed->annotate_ids('user', 'userid');
     $tracking->annotate_ids('user', 'userid');
     // Define file annotations
     $feedback->annotate_files('mod_feedback', 'intro', null);
     // This file area hasn't itemid
     $feedback->annotate_files('mod_feedback', 'page_after_submit', null);
     // This file area hasn't itemid
     $item->annotate_files('mod_feedback', 'item', 'id');
     // Return the root element (feedback), wrapped into standard activity structure
     return $this->prepare_activity_structure($feedback);
 }
 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);
 }
 /**
  * This method creates the backup element and ensures that all
  * course related records existing in the database are stored to
  * be used later in the restore process.  There are a number of
  * other optional steps, but none were required.
  *
  */
 protected function define_structure()
 {
     $nursnavigation = new backup_nested_element('nurs_navigation', array('id'), array('courseid', 'fileid', 'sectionname'));
     $nursnavigation->set_source_table('nurs_navigation', array('courseid' => backup::VAR_COURSEID));
     // No context needed (optional 4th parameter), default block context used.
     $nursnavigation->annotate_files(BNN_BLOCK_SAVE_COMPONENT, BNN_BLOCK_SAVE_AREA, null);
     return $this->prepare_block_structure($nursnavigation);
 }