本文整理汇总了PHP中backup_nested_element::fill_values方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_nested_element::fill_values方法的具体用法?PHP backup_nested_element::fill_values怎么用?PHP backup_nested_element::fill_values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backup_nested_element
的用法示例。
在下文中一共展示了backup_nested_element::fill_values方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define_structure
protected function define_structure()
{
global $CFG, $DB;
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated
$turnitintool = new backup_nested_element('turnitintool', array('id'), array('type', 'name', 'grade', 'numparts', 'tiiaccount', 'defaultdtstart', 'defaultdtdue', 'defaultdtpost', 'anon', 'portfolio', 'allowlate', 'reportgenspeed', 'submitpapersto', 'spapercheck', 'internetcheck', 'journalcheck', 'maxfilesize', 'intro', 'introformat', 'timecreated', 'timemodified', 'studentreports', 'dateformat', 'usegrademark', 'gradedisplay', 'autoupdates', 'commentedittime', 'commentmaxsize', 'autosubmission', 'shownonsubmission', 'excludebiblio', 'excludequoted', 'excludevalue', 'excludetype', 'erater', 'erater_handbook', 'erater_dictionary', 'erater_spelling', 'erater_grammar', 'erater_usage', 'erater_mechanics', 'erater_style', 'transmatch'));
$parts = new backup_nested_element('parts');
$part = new backup_nested_element('part', array('id'), array('turnitintoolid', 'partname', 'tiiassignid', 'dtstart', 'dtdue', 'dtpost', 'maxmarks', 'deleted'));
$courses = new backup_nested_element('courses');
$course = new backup_nested_element('course', array('id'), array('courseid', 'ownerid', 'ownertiiuid', 'owneremail', 'ownerfn', 'ownerln', 'ownerun', 'turnitin_ctl', 'turnitin_cid'));
$submissions = new backup_nested_element('submissions');
$submission = new backup_nested_element('submission', array('id'), array('userid', 'submission_part', 'submission_title', 'submission_type', 'submission_filename', 'submission_objectid', 'submission_score', 'submission_grade', 'submission_gmimaged', 'submission_status', 'submission_queued', 'submission_attempts', 'submission_modified', 'submission_parent', 'submission_nmuserid', 'submission_nmfirstname', 'submission_nmlastname', 'submission_unanon', 'submission_anonreason', 'submission_transmatch', 'tiiuserid'));
$comments = new backup_nested_element('comments');
$comment = new backup_nested_element('comment', array('id'), array('submissionid', 'userid', 'commenttext', 'dateupdated', 'deleted'));
// Build the tree
$comments->add_child($comment);
$submission->add_child($comments);
$submissions->add_child($submission);
$parts->add_child($part);
$turnitintool->add_child($parts);
$turnitintool->add_child($course);
$turnitintool->add_child($submissions);
// Define sources
$turnitintool->set_source_table('turnitintool', array('id' => backup::VAR_ACTIVITYID));
$values['tiiaccount'] = $CFG->turnitin_account_id;
$turnitintool->fill_values($values);
$part->set_source_table('turnitintool_parts', array('turnitintoolid' => backup::VAR_ACTIVITYID));
$course->set_source_sql('
SELECT t.id, t.courseid, t.ownerid, tu.turnitin_uid AS ownertiiuid,
u.email AS owneremail, u.firstname AS ownerfn, u.lastname AS ownerln,
u.username AS ownerun, t.turnitin_ctl, t.turnitin_cid
FROM {turnitintool_courses} t, {user} u, {turnitintool_users} tu
WHERE t.ownerid=u.id AND tu.userid=t.ownerid AND t.courseid = ?', array(backup::VAR_COURSEID));
// All the rest of elements only happen if we are including user info
if ($userinfo) {
$comment->set_source_table('turnitintool_comments', array('submissionid' => '../../id'));
//$submission->set_source_table('turnitintool_submissions', array('turnitintoolid' => '../../id'));
$submission->set_source_sql('
SELECT s.*, tu.turnitin_uid AS tiiuserid
FROM {turnitintool_submissions} s, {turnitintool_users} tu
WHERE s.userid=tu.userid AND s.turnitintoolid = ?', array(backup::VAR_ACTIVITYID));
}
// Define id annotations
$submission->annotate_ids('user', 'userid');
// Define file annotations
$turnitintool->annotate_files('mod_turnitintool', 'intro', null);
// This file area hasn't itemid
$submission->annotate_files('mod_turnitintool', 'submission', 'id');
// Return the root element (turnitintool), wrapped into standard activity structure
return $this->prepare_activity_structure($turnitintool);
}
示例2: fill_values
public function fill_values($values)
{
// Fill values
parent::fill_values($values);
// Do our own tasks (copy file from moodle to backup)
try {
backup_file_manager::copy_file_moodle2backup($this->backupid, $values);
} catch (file_exception $e) {
$this->add_result(array('missing_files_in_pool' => true));
// Build helpful log message with all information necessary to identify
// file location.
$context = context::instance_by_id($values->contextid, IGNORE_MISSING);
$contextname = '';
if ($context) {
$contextname = ' \'' . $context->get_context_name() . '\'';
}
$message = 'Missing file in pool: ' . $values->filepath . $values->filename . ' (context ' . $values->contextid . $contextname . ', component ' . $values->component . ', filearea ' . $values->filearea . ', itemid ' . $values->itemid . ') [' . $e->debuginfo . ']';
$this->add_log($message, backup::LOG_WARNING);
}
}
示例3: fill_values
public function fill_values($values)
{
// Fill values
parent::fill_values($values);
// Do our own tasks (copy file from moodle to backup)
backup_file_manager::copy_file_moodle2backup($this->backupid, $values);
}
示例4: fill_values
public function fill_values($values)
{
// Fill values
parent::fill_values($values);
// Do our own tasks (copy file from moodle to backup)
try {
backup_file_manager::copy_file_moodle2backup($this->backupid, $values);
} catch (file_exception $e) {
$this->add_result(array('missing_files_in_pool' => true));
$this->add_log('missing file in pool: ' . $e->debuginfo, backup::LOG_WARNING);
}
}