Browse Source

Corrections mineures

Mael ETIENNE 3 years ago
parent
commit
acd5622e4c
4 changed files with 12 additions and 12 deletions
  1. 3
    1
      Entity/ZipFile.php
  2. 2
    6
      LearningModels/DOMSCORM.php
  3. 5
    0
      Package/PackageValidator.php
  4. 2
    5
      Services/ScormEngine.php

+ 3
- 1
Entity/ZipFile.php View File

@@ -12,6 +12,8 @@ namespace Logipro\Bundle\SCORMBundle\Entity;
12 12
 use Logipro\Bundle\SCORMBundle\Entity\ZipFile;
13 13
 use Logipro\Bundle\SCORMBundle\Entity\MapCourseZipfile;
14 14
 use Logipro\Bundle\SCORMBundle\LearningModels\DOMSCORM;
15
+use Logipro\Bundle\SCORMBundle\LearningModels\DOMSCORM12;
16
+use Logipro\Bundle\SCORMBundle\LearningModels\DOMSCORM2004;
15 17
 use Logipro\Bundle\SCORMBundle\Entity\Common\AbstractEntity;
16 18
 use Logipro\Bundle\SCORMBundle\LearningModels\DOMLearningModel;
17 19
 use Logipro\Bundle\SCORMBundle\Package\Exception\PackageException;
@@ -67,7 +69,7 @@ class ZipFile extends AbstractEntity
67 69
      *
68 70
      * @var string
69 71
      */
70
-    protected $standard = DOMSCORM::SCORM_2004;
72
+    protected $standard = DOMSCORM2004::SCORM_2004;
71 73
 
72 74
     /**
73 75
      * Status d'import

+ 2
- 6
LearningModels/DOMSCORM.php View File

@@ -74,12 +74,8 @@ abstract class DOMSCORM implements DOMPackageInterface
74 74
         $value = null; // valeur de l'attribut
75 75
         $nodeList = $this->xpath->query('//*[name()="title"]');
76 76
         
77
-        $count = $nodeList->length;
78
-        for ($i = 0; $i < $count; ++$i) {
79
-            $value = $nodeList->item($i);
80
-            if (!empty($value)) {
81
-                break;
82
-            }
77
+        if ($nodeList->count() > 0) {
78
+            $value = $nodeList->item(0)->textContent;
83 79
         }
84 80
 
85 81
         return $value;

+ 5
- 0
Package/PackageValidator.php View File

@@ -2,6 +2,11 @@
2 2
 
3 3
 namespace Logipro\Bundle\SCORMBundle\Package;
4 4
 
5
+use Logipro\Bundle\SCORMBundle\LearningModels\DOMSCORM;
6
+use Logipro\Bundle\SCORMBundle\LearningModels\DOMSCORM12;
7
+use Logipro\Bundle\SCORMBundle\LearningModels\DOMSCORM2004;
8
+use Logipro\Bundle\SCORMBundle\LearningModels\DOMLearningModel;
9
+
5 10
 class PackageValidator
6 11
 {
7 12
     /**

+ 2
- 5
Services/ScormEngine.php View File

@@ -43,7 +43,7 @@ class ScormEngine implements ContainerAwareInterface
43 43
      *
44 44
      * @return int
45 45
      */
46
-    public function createCourse(string $courseKey, string $zipPath, bool $analyse, string $versioningRule = Course::VERSIONING_RULE_DEFAULT)
46
+    public function createCourse(string $courseKey, string $zipPath, bool $analyse = false, string $versioningRule = Course::VERSIONING_RULE_DEFAULT)
47 47
     {
48 48
         // Création de la réponse
49 49
         $response = array(
@@ -114,11 +114,8 @@ class ScormEngine implements ContainerAwareInterface
114 114
 
115 115
                 //upload du fichier coté moteur
116 116
                 $uploadDate = new \DateTime('NOW');
117
-// A remplacer par les config
118
-                //$uploadPath = $this->container->getParameter('kernel.root_dir');
119
-                $uploadPath = '';
120 117
                 $fileName = pathinfo($zipPath)['filename'];
121
-                $filePath = $uploadPath . $fileName;
118
+                $filePath = $this->packageFolder . '/' . $fileName;
122 119
                 if (copy($zipPath, $filePath) === false) {
123 120
                     // Si la copie plante, on retourne une erreur
124 121
                     $response['code'] = 400;

Loading…
Cancel
Save