Merge branch 'MDL-39876-master' of git://github.com/sammarshallou/moodle

Conflicts:
	course/lib.php
This commit is contained in:
Sam Hemelryk 2013-08-21 12:08:46 +12:00
commit 6eee89bc8f
191 changed files with 280 additions and 274 deletions

View file

@ -40,7 +40,7 @@ $PAGE->set_pagelayout('admin');
$id = $courseid;
$cm = null;
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$type = backup::TYPE_1COURSE;
if (!is_null($sectionid)) {
$section = $DB->get_record('course_sections', array('course'=>$course->id, 'id'=>$sectionid), '*', MUST_EXIST);

View file

@ -17,7 +17,7 @@ $searchcourses = optional_param('searchcourses', false, PARAM_BOOL);
$restoretarget = optional_param('target', backup::TARGET_CURRENT_ADDING, PARAM_INT);
// Load the course and context
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$context = context_course::instance($courseid);
// Must pass login
@ -51,7 +51,7 @@ if ($importcourseid === false || $searchcourses) {
}
// Load the course +context to import from
$importcourse = $DB->get_record('course', array('id'=>$importcourseid), '*', MUST_EXIST);
$importcourse = get_course($importcourseid);
$importcontext = context_course::instance($importcourseid);
// Make sure the user can backup from that course

View file

@ -148,7 +148,7 @@ class backup_section_task extends backup_task {
// All these are common settings to be shared by all sections
$section = $DB->get_record('course_sections', array('id' => $this->sectionid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $section->course), '*', MUST_EXIST);
$course = get_course($section->course);
// Define section_included (to decide if the whole task must be really executed)
$settingname = $settingprefix . 'included';

View file

@ -1422,7 +1422,7 @@ class restore_course_structure_step extends restore_structure_step {
}
// Course record ready, update it
$DB->update_record('course', $data);
update_course_record($data);
course_get_format($data)->update_course_format_options($data);
@ -1632,7 +1632,7 @@ class restore_default_enrolments_step extends restore_execution_step {
public function define_execution() {
global $DB;
$course = $DB->get_record('course', array('id'=>$this->get_courseid()), '*', MUST_EXIST);
$course = get_course($this->get_courseid());
if ($DB->record_exists('enrol', array('courseid'=>$this->get_courseid(), 'enrol'=>'manual'))) {
// Something already added instances, do not add default instances.
@ -1849,7 +1849,7 @@ class restore_fix_restorer_access_step extends restore_execution_step {
return;
}
if (!$DB->record_exists('enrol', array('enrol'=>'manual', 'courseid'=>$courseid))) {
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$fields = array('status'=>ENROL_INSTANCE_ENABLED, 'enrolperiod'=>$enrol->get_config('enrolperiod', 0), 'roleid'=>$enrol->get_config('roleid', 0));
$enrol->add_instance($course, $fields);
}

View file

@ -109,7 +109,7 @@ abstract class backup_check {
$typecapstocheck = array();
switch ($type) {
case backup::TYPE_1COURSE :
$DB->get_record('course', array('id' => $id), '*', MUST_EXIST); // course exists
get_course($id); // course exists
$typecapstocheck['moodle/backup:backupcourse'] = $coursectx;
break;
case backup::TYPE_1SECTION :