Skip to content

Commit 1326c86

Browse files
committed
Add "allow_import_scorm_package_in_course_builder" see BT#14324
- When export a course backup file the course/ABC/scorm/ folder is added in the zip packages. - This setting imports that folder example: course/ABC/scorm/my_scorm is saved in the new location course/DESTINATION/scorm/my_scorm/
1 parent 7b138d7 commit 1326c86

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

main/install/configuration.dist.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -839,16 +839,19 @@
839839
// My courses session order. Possible field values: "start_date" or "end_date". Order values: "asc" or "desc"
840840
// $_configuration['my_courses_session_order'] = ['field' => 'end_date', 'order' => 'desc'];
841841

842+
// Allow set courses in session in read-only mode. Require DB changes:
843+
/*
844+
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible_to_self, changeable, filter, created_at)
845+
VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1, 1, NOW());
846+
*/
847+
// $_configuration['session_courses_read_only_mode'] = false;
848+
849+
// Allow SCORM packages when importing a course
850+
// $_configuration['allow_import_scorm_package_in_course_builder'] = false;
851+
842852
// ------ Custom DB changes (keep this at the end)
843853
// Add user activation by confirmation email
844854
// This option prevents the new user to login in the platform if your account is not confirmed via email
845855
// You need add a new option called "confirmation" to the registration settings
846856
//INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_registration', 'confirmation', 'MailConfirmation');
847857
// ------ (End) Custom DB changes
848-
849-
// Allow set courses in session in read-only mode. Require DB changes:
850-
/*
851-
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible_to_self, changeable, filter, created_at)
852-
VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1, 1, NOW());
853-
*/
854-
//$_configuration['session_courses_read_only_mode'] = false;

src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ public function __construct($course)
8888
$this->file_option = FILE_RENAME;
8989
$this->set_tools_invisible_by_default = false;
9090
$this->skip_content = [];
91+
92+
$forceImport = api_get_configuration_value('allow_import_scorm_package_in_course_builder');
93+
if ($forceImport) {
94+
$this->tools_to_restore[] = 'scorm_documents';
95+
}
9196
}
9297

9398
/**
@@ -999,20 +1004,18 @@ public function restore_documents(
9991004
public function restore_scorm_documents()
10001005
{
10011006
$perm = api_get_permissions_for_new_directories();
1002-
10031007
if ($this->course->has_resources(RESOURCE_SCORM)) {
10041008
$resources = $this->course->resources;
10051009
foreach ($resources[RESOURCE_SCORM] as $document) {
10061010
$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
10071011
@mkdir(dirname($path.$document->path), $perm, true);
1008-
10091012
if (file_exists($path.$document->path)) {
10101013
switch ($this->file_option) {
10111014
case FILE_OVERWRITE:
10121015
rmdirr($path.$document->path);
10131016
copyDirTo(
10141017
$this->course->backup_path.'/'.$document->path,
1015-
$path.dirname($document->path),
1018+
$path.$document->path,
10161019
false
10171020
);
10181021
break;
@@ -1058,7 +1061,7 @@ public function restore_scorm_documents()
10581061
// end if file exists
10591062
copyDirTo(
10601063
$this->course->backup_path.'/'.$document->path,
1061-
$path.dirname($document->path),
1064+
$path.$document->path,
10621065
false
10631066
);
10641067
}

0 commit comments

Comments
 (0)