本文整理汇总了PHP中backup_controller_dbops::backup_get_original_course_info方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_controller_dbops::backup_get_original_course_info方法的具体用法?PHP backup_controller_dbops::backup_get_original_course_info怎么用?PHP backup_controller_dbops::backup_get_original_course_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backup_controller_dbops
的用法示例。
在下文中一共展示了backup_controller_dbops::backup_get_original_course_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define_structure
protected function define_structure()
{
global $CFG;
$info = array();
$info['name'] = $this->get_setting_value('filename');
$info['moodle_version'] = $CFG->version;
$info['moodle_release'] = $CFG->release;
$info['backup_version'] = $CFG->backup_version;
$info['backup_release'] = $CFG->backup_release;
$info['backup_date'] = time();
$info['backup_uniqueid'] = $this->get_backupid();
$info['mnet_remoteusers'] = backup_controller_dbops::backup_includes_mnet_remote_users($this->get_backupid());
$info['original_wwwroot'] = $CFG->wwwroot;
$info['original_site_identifier_hash'] = md5(get_site_identifier());
$info['original_course_id'] = $this->get_courseid();
$originalcourseinfo = backup_controller_dbops::backup_get_original_course_info($this->get_courseid());
$info['original_course_fullname'] = $originalcourseinfo->fullname;
$info['original_course_shortname'] = $originalcourseinfo->shortname;
$info['original_course_startdate'] = $originalcourseinfo->startdate;
$info['original_course_contextid'] = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
$info['original_system_contextid'] = get_context_instance(CONTEXT_SYSTEM)->id;
// Get more information from controller
list($dinfo, $cinfo, $sinfo) = backup_controller_dbops::get_moodle_backup_information($this->get_backupid());
// Define elements
$moodle_backup = new backup_nested_element('moodle_backup');
$information = new backup_nested_element('information', null, array('name', 'moodle_version', 'moodle_release', 'backup_version', 'backup_release', 'backup_date', 'mnet_remoteusers', 'original_wwwroot', 'original_site_identifier_hash', 'original_course_id', 'original_course_fullname', 'original_course_shortname', 'original_course_startdate', 'original_course_contextid', 'original_system_contextid'));
$details = new backup_nested_element('details');
$detail = new backup_nested_element('detail', array('backup_id'), array('type', 'format', 'interactive', 'mode', 'execution', 'executiontime'));
$contents = new backup_nested_element('contents');
$activities = new backup_nested_element('activities');
$activity = new backup_nested_element('activity', null, array('moduleid', 'sectionid', 'modulename', 'title', 'directory'));
$sections = new backup_nested_element('sections');
$section = new backup_nested_element('section', null, array('sectionid', 'title', 'directory'));
$course = new backup_nested_element('course', null, array('courseid', 'title', 'directory'));
$settings = new backup_nested_element('settings');
$setting = new backup_nested_element('setting', null, array('level', 'section', 'activity', 'name', 'value'));
// Build the tree
$moodle_backup->add_child($information);
$information->add_child($details);
$details->add_child($detail);
$information->add_child($contents);
if (!empty($cinfo['activities'])) {
$contents->add_child($activities);
$activities->add_child($activity);
}
if (!empty($cinfo['sections'])) {
$contents->add_child($sections);
$sections->add_child($section);
}
if (!empty($cinfo['course'])) {
$contents->add_child($course);
}
$information->add_child($settings);
$settings->add_child($setting);
// Set the sources
$information->set_source_array(array((object) $info));
$detail->set_source_array($dinfo);
$activity->set_source_array($cinfo['activities']);
$section->set_source_array($cinfo['sections']);
$course->set_source_array($cinfo['course']);
$setting->set_source_array($sinfo);
// Prepare some information to be sent to main moodle_backup.xml file
return $moodle_backup;
}