]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5566 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 4 Nov 2022 16:11:32 +0000 (17:11 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 4 Nov 2022 16:11:32 +0000 (17:11 +0100)
app/Models/ELearningMedia.php

index 7a06b94508d5f9a8b3cf1387157b0dce591fdba3..a7e5fd1241e32b2e7fc7d9d23605cf83714e2ba5 100644 (file)
@@ -11,7 +11,6 @@ use App\Models\Traits\SCORMVersionTrait;
 use Cubist\Backpack\Magic\Fields\Files;
 use Cubist\Backpack\Magic\Fields\Hidden;
 use Cubist\Backpack\Magic\Fields\Percent;
-use Cubist\Backpack\Magic\Fields\StaticValue;
 use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Scorm\Manifest;
 use Cubist\Scorm\Version;
@@ -87,7 +86,7 @@ class ELearningMedia extends ToolboxModel
 
         /** @var Media $file */
         $file = $this->getMediaInField('file')->first()->getPath();
-        self::compileFromFile($file, $dest, $this->title, $organization, 'MEDIA_' . $this->id, 75);
+        self::compileFromFile($file, $dest, $this->title, $organization, 'MEDIA_' . $this->id, $this->scorm_version, 75);
     }
 
     /**
@@ -100,7 +99,7 @@ class ELearningMedia extends ToolboxModel
      * @return string
      * @throws \Exception
      */
-    public static function compileFromFile($file, $dest, $title, $organization, $reference, $complete_pct = 75)
+    public static function compileFromFile($file, $dest, $title, $organization, $reference, $scorm_version = Version::SCORM_2004, $complete_pct = 75)
     {
         $spl = new \SplFileInfo($file);
         $ext = mb_strtolower($spl->getExtension());
@@ -111,7 +110,7 @@ class ELearningMedia extends ToolboxModel
         $type = self::getType($ext);
 
         $vdir = new VirtualDirectory($dest);
-        $vdir->file_put_contents('imsmanifest.xml', new Manifest($title, Version::SCORM_2004, $organization, $reference));
+        $vdir->file_put_contents('imsmanifest.xml', new Manifest($title, $scorm_version, $organization, $reference));
         $vdir->copyDirectory(resource_path('elearningmedia/dist/css'), 'css');
         $vdir->copyDirectory(resource_path('elearningmedia/dist/js'), 'js');
         if ($type === 'pdf') {