]> _ Git - cubist_scorm.git/commitdiff
wip #5319 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 28 Jun 2022 07:27:18 +0000 (09:27 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 28 Jun 2022 07:27:18 +0000 (09:27 +0200)
.gitignore
src/Manifest.php
src/Version.php [new file with mode: 0644]

index d85eee5599d52395129d6250bf4c392d9389c427..5658e220997eeadb7859f2d3d1a1e1a1d2a4ea38 100644 (file)
@@ -23,3 +23,4 @@ Homestead.json
 /.vagrant
 .phpunit.result.cache
 
+.idea
\ No newline at end of file
index 17fd2ab2ba9568ac6bdb66afcd8b9432404b3191..519bd9b7782b8f3c9d72cfee4f6713f03a3f5481 100644 (file)
@@ -4,10 +4,7 @@ namespace Cubist\Scorm;
 
 class Manifest
 {
-    const SCORM_1_2 = "1.2";
-    const SCORM_2004 = "2004";
-
-    protected $version = self::SCORM_2004;
+    protected $version = Version::SCORM_2004;
 
     /**
      * @var string
@@ -29,7 +26,7 @@ class Manifest
      */
     protected $start = 'index.html';
 
-    public function __construct($title, $version = self::SCORM_2004, $organization = null, $reference = null, $start = 'index.html')
+    public function __construct($title, $version = Version::SCORM_2004, $organization = null, $reference = null, $start = 'index.html')
     {
         $this->setVersion($version);
         $this->setTitle($title);
@@ -44,7 +41,7 @@ class Manifest
 
     public function __toString()
     {
-        if ($this->getVersion() === self::SCORM_1_2) {
+        if ($this->getVersion() === Version::SCORM_1_2) {
             return $this->_render12();
         } else {
             return $this->_render2004();
@@ -60,6 +57,12 @@ class Manifest
 
     protected function _render2004()
     {
+        if ($this->version === Version::SCORM_2004) {
+            $v = '4th';
+        } else if ($this->version === Version::SCORM_2004_3) {
+            $v = '3rd';
+        }
+
         return '<?xml version="1.0" standalone="no" ?>
 <manifest identifier="' . $this->_escape($this->getManifestID()) . '" version="1.3"
           xmlns="http://www.imsglobal.org/xsd/imscp_v1p1"
@@ -75,7 +78,7 @@ class Manifest
                               http://www.imsglobal.org/xsd/imsss imsss_v1p0.xsd">
     <metadata>
         <schema>ADL SCORM</schema>
-        <schemaversion>2004 4th Edition</schemaversion>
+        <schemaversion>2004 ' . $v . ' Edition</schemaversion>
     </metadata>
     <organizations default="' . $this->_escapeAttr($this->getOrganization()) . '">
         <organization identifier="' . $this->_escapeAttr($this->getOrganization()) . '" adlseq:objectivesGlobalToSystem="false">
diff --git a/src/Version.php b/src/Version.php
new file mode 100644 (file)
index 0000000..c72ecb9
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace Cubist\Scorm;
+
+class Version
+{
+    const SCORM_1_2 = "1.2";
+    const SCORM_2004 = "2004";
+    const SCORM_2004_3 = "2004-3";
+}
\ No newline at end of file