Browse Source

Gestion de champs null sur les interactoins

Mael ETIENNE 3 years ago
parent
commit
4f406fa7fd

+ 6
- 6
Resources/config/doctrine/Scorm2004.Scorm2004Interaction.orm.xml View File

@@ -11,12 +11,12 @@
11 11
     <field name="identifier" type="string" column="identifier" length="255" nullable="false"/>
12 12
     <field name="type" type="string" column="type" length="50" nullable="false"/>
13 13
     <field name="weighting" type="float" column="weighting" nullable="false"/>
14
-    <field name="result" type="string" column="result" length="50" nullable="false"/>
15
-    <field name="description" type="text" column="description" nullable="false"/>
16
-    <field name="student_response" type="text" column="student_response" nullable="false"/>
17
-    <field name="correct_responses" type="text" column="correct_responses" nullable="false"/>
18
-    <field name="time" type="datetime" column="time" nullable="false"/>
19
-    <field name="latency" type="float" column="latency" nullable="false"/>
14
+    <field name="result" type="string" column="result" length="50" nullable="true"/>
15
+    <field name="description" type="text" column="description" nullable="true"/>
16
+    <field name="student_response" type="text" column="student_response" nullable="true"/>
17
+    <field name="correct_responses" type="text" column="correct_responses" nullable="true"/>
18
+    <field name="time" type="datetime" column="time" nullable="true"/>
19
+    <field name="latency" type="float" column="latency" nullable="true"/>
20 20
     
21 21
     <!-- item sur lequel l'essai est tenté -->
22 22
     <field name="itemIdentifier" type="string" column="item_identifier" length="255" nullable="false"/>

+ 8
- 6
Tools/UnicodeTools.php View File

@@ -7,14 +7,16 @@ class UnicodeTools
7 7
 
8 8
     public static function strToUTF8($value)
9 9
     {
10
-        $encoding = self::getEncoding($value);
11
-
12
-        if ($encoding == 'UTF-8') {
13
-            return $value;
10
+        if (!empty($value)) {
11
+            $encoding = self::getEncoding($value);
12
+
13
+            if ($encoding == 'UTF-8') {
14
+                return $value;
15
+            }
16
+            
17
+            $value = @mb_convert_encoding($value, 'UTF-8', $encoding);
14 18
         }
15 19
         
16
-        $value = @mb_convert_encoding($value, 'UTF-8', $encoding);
17
-        
18 20
         return $value;
19 21
     }
20 22
 

Loading…
Cancel
Save