本文整理汇总了PHP中backup_nested_element类的典型用法代码示例。如果您正苦于以下问题:PHP backup_nested_element类的具体用法?PHP backup_nested_element怎么用?PHP backup_nested_element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了backup_nested_element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define_grade_subplugin_structure
/**
* 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;
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:30,代码来源:backup_assignfeedback_editpdf_subplugin.class.php
示例2: define_structure
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);
}
示例3: define_structure
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);
}
示例4: define_structure
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;
}
示例5: define_structure
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);
}
示例6: define_structure
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);
}
示例7: define_structure
/**
* Define the structure of the backup file.
*
* @return backup_nested_element
*/
protected function define_structure()
{
// The instance.
$customcert = new backup_nested_element('customcert', array('id'), array('name', 'intro', 'introformat', 'requiredtime', 'protection', 'timecreated', 'timemodified'));
// The issues.
$issues = new backup_nested_element('issues');
$issue = new backup_nested_element('issue', array('id'), array('customcertid', 'userid', 'timecreated', 'code'));
// The pages.
$pages = new backup_nested_element('pages');
$page = new backup_nested_element('page', array('id'), array('customcertid', 'width', 'height', 'margin', 'pagenumber', 'timecreated', 'timemodified'));
// The elements.
$element = new backup_nested_element('element', array('id'), array('pageid', 'name', 'element', 'data', 'font', 'size', 'colour', 'width', 'refpoint', 'align', 'posx', 'posy', 'sequence', 'timecreated', 'timemodified'));
// Build the tree.
$customcert->add_child($issues);
$issues->add_child($issue);
$customcert->add_child($pages);
$pages->add_child($page);
$page->add_child($element);
// Define sources.
$customcert->set_source_table('customcert', array('id' => backup::VAR_ACTIVITYID));
// Define page source.
$page->set_source_table('customcert_pages', array('customcertid' => backup::VAR_ACTIVITYID));
// Define element source, each element belongs to a page.
$element->set_source_table('customcert_elements', array('pageid' => backup::VAR_PARENTID));
// If we are including user info then save the issues.
if ($this->get_setting_value('userinfo')) {
$issue->set_source_table('customcert_issues', array('customcertid' => backup::VAR_ACTIVITYID));
}
// Annotate the user id's where required.
$issue->annotate_ids('user', 'userid');
// Return the root element (customcert), wrapped into standard activity structure.
return $this->prepare_activity_structure($customcert);
}
示例8: define_structure
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);
}
示例9: define_structure
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);
}
示例10: define_structure
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);
}
示例11: define_structure
/**
* 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);
}
示例12: define_structure
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);
}
示例13: define_structure
protected function define_structure()
{
// Define each element separated
$attendance = new backup_nested_element('attendance');
$block = new backup_nested_element('block', array('id'), array('course', 'name', 'grade'));
$statuses = new backup_nested_element('statuses');
$status = new backup_nested_element('status', array('id'), array('courseid', 'acronym', 'description', 'grade', 'visible', 'deleted'));
$sessions = new backup_nested_element('session', array('id'), array('courseid', 'sessdate', 'duration', 'lasttaken', 'lasttakenby', 'description', 'timemodified'));
$logs = new backup_nested_element('logs');
$log = new backup_nested_element('log', array('id'), array('sessionid', 'studentid', 'statusid', 'statusset', 'timetaken', 'takenby', 'remarks'));
// Build the tree
$attendance->add_child($block);
$attendance->add_child($statuses);
$statuses->add_child($status);
$attendance->add_child($sessions);
$sessions->add_child($logs);
$logs->add_child($log);
/*
$sessions->add_child($logs);
$logs->add_child($log);
$sessions->add_child($status);
$sessions->add_child($block);
*/
// Define sources
$block->set_source_table('attforblock', array('id' => backup::VAR_ACTIVITYID));
$status->set_source_table('attendance_statuses', array('courseid' => backup::VAR_COURSEID));
$sessions->set_source_table('attendance_sessions', array('courseid' => backup::VAR_COURSEID));
$log->set_source_table('attendance_log', array('sessionid' => backup::VAR_PARENTID));
// Define id annotations
$log->annotate_ids('user', 'studentid');
// Return the root element (chat), wrapped into standard activity structure
return $this->prepare_activity_structure($attendance);
}
示例14: define_structure
/**
* 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);
}
示例15: define_structure
/**
* 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;
}