Skip to content

Commit c135db0

Browse files
committed
Add setting "add_all_files_in_lp_export" see BT#11920
1 parent 048bd31 commit c135db0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

main/newscorm/learnpath.class.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
use Chamilo\CourseBundle\Entity\CLpCategory;
55
use ChamiloSession as Session;
6+
use Symfony\Component\Filesystem\Filesystem;
7+
use Symfony\Component\Finder\Finder;
68

79
/**
810
* Class learnpath
@@ -9730,6 +9732,8 @@ public function scorm_export()
97309732
$root->appendChild($resources);
97319733
$xmldoc->appendChild($root);
97329734

9735+
$copyAll = api_get_configuration_value('add_all_files_in_lp_export');
9736+
97339737
// TODO: Add a readme file here, with a short description and a link to the Reload player
97349738
// then add the file to the zip, then destroy the file (this is done automatically).
97359739
// http://www.reload.ac.uk/scormplayer.html - once done, don't forget to close FS#138
@@ -9777,6 +9781,29 @@ public function scorm_export()
97779781
}
97789782
file_put_contents($dest_file, $string);
97799783
}
9784+
9785+
if (file_exists($filePath) && $copyAll) {
9786+
$extension = $this->get_extension($filePath);
9787+
if (in_array($extension, ['html', 'html'])) {
9788+
$containerOrigin = dirname($filePath);
9789+
$containerDestination = dirname($dest_file);
9790+
9791+
$finder = new Finder();
9792+
$finder->files()->in($containerOrigin)
9793+
->exclude('share_folder')
9794+
->exclude('chat_files')
9795+
->exclude('certificates');
9796+
9797+
if (is_dir($containerOrigin) && is_dir($containerDestination)) {
9798+
$fs = new Filesystem();
9799+
$fs->mirror(
9800+
$containerOrigin,
9801+
$containerDestination,
9802+
$finder
9803+
);
9804+
}
9805+
}
9806+
}
97809807
}
97819808

97829809
foreach ($zip_files_abs as $file_path) {

0 commit comments

Comments
 (0)