mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-40122 SCORM: replace SCORM course format with singleactivity
This commit is contained in:
parent
838d78a9ff
commit
3d1808c6e2
10 changed files with 35 additions and 234 deletions
|
@ -2327,5 +2327,29 @@ function xmldb_main_upgrade($oldversion) {
|
|||
upgrade_main_savepoint(true, 2013081200.00);
|
||||
}
|
||||
|
||||
// Convert SCORM course format courses to singleactivity.
|
||||
if ($oldversion < 2013081500.01) {
|
||||
// First set relevant singleactivity settings.
|
||||
$formatoptions = new stdClass();
|
||||
$formatoptions->format = 'singleactivity';
|
||||
$formatoptions->sectionid = 0;
|
||||
$formatoptions->name = 'activitytype';
|
||||
$formatoptions->value = 'scorm';
|
||||
|
||||
$courses = $DB->get_recordset('course', array('format' => 'scorm'), 'id');
|
||||
foreach ($courses as $course) {
|
||||
$formatoptions->courseid = $course->id;
|
||||
$DB->insert_record('course_format_options', $formatoptions);
|
||||
}
|
||||
$courses->close();
|
||||
|
||||
// Now update course format for these courses.
|
||||
$sql = "UPDATE {course}
|
||||
SET format = 'singleactivity', modinfo = '', sectioncache = ''
|
||||
WHERE format = 'scorm'";
|
||||
$DB->execute($sql);
|
||||
upgrade_main_savepoint(true, 2013081500.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue