Completed
Push — 1.10.x ( 187186...b81691 )
by Julito
64:50 queued 17:20
created
main/exercice/export/exercise_import.inc.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // used to specify the question directory where files could be found in relation in any question
77 77
     global $questionTempDir;
78 78
 
79
-    $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'qti2';
79
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'qti2';
80 80
     $baseWorkDir = $archive_path;
81 81
 
82 82
     if (!is_dir($baseWorkDir)) {
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 
120 120
     // parse every subdirectory to search xml question files
121 121
     while (false !== ($file = readdir($exerciseHandle))) {
122
-        if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
122
+        if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") {
123 123
             // Find each manifest for each question repository found
124
-            $questionHandle = opendir($baseWorkDir . '/' . $file);
124
+            $questionHandle = opendir($baseWorkDir.'/'.$file);
125 125
             while (false !== ($questionFile = readdir($questionHandle))) {
126 126
                 if (preg_match('/.xml$/i', $questionFile)) {
127 127
                     $result = parse_file($baseWorkDir, $file, $questionFile);
128
-                    $filePath = $baseWorkDir . $file;
128
+                    $filePath = $baseWorkDir.$file;
129 129
                     $file_found = true;
130 130
                 }
131 131
             }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
             // Else ignore file
135 135
             $result = parse_file($baseWorkDir, '', $file);
136
-            $filePath = $baseWorkDir . '/' . $file;
136
+            $filePath = $baseWorkDir.'/'.$file;
137 137
             $file_found = true;
138 138
         }
139 139
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         }
201 201
 
202 202
         // delete the temp dir where the exercise was unzipped
203
-        my_delete($baseWorkDir . $uploadPath);
203
+        my_delete($baseWorkDir.$uploadPath);
204 204
         return $last_exercise_id;
205 205
     }
206 206
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
     global $record_item_body;
229 229
     global $questionTempDir;
230 230
 
231
-    $questionTempDir = $exercisePath . '/' . $file . '/';
232
-    $questionFilePath = $questionTempDir . $questionFile;
231
+    $questionTempDir = $exercisePath.'/'.$file.'/';
232
+    $questionFilePath = $questionTempDir.$questionFile;
233 233
 
234 234
     if (!($fp = fopen($questionFilePath, 'r'))) {
235 235
         Display::addFlash(Display::return_message(get_lang('Error opening question\'s XML file'), 'error'));
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
     if ($record_item_body) {
331 331
 
332 332
         if ((!in_array($current_element, $non_HTML_tag_to_avoid))) {
333
-            $current_question_item_body .= "<" . $name;
333
+            $current_question_item_body .= "<".$name;
334 334
             foreach ($attributes as $attribute_name => $attribute_value) {
335
-                $current_question_item_body .= " " . $attribute_name . "=\"" . $attribute_value . "\"";
335
+                $current_question_item_body .= " ".$attribute_name."=\"".$attribute_value."\"";
336 336
             }
337 337
             $current_question_item_body .= ">";
338 338
         } else {
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 
342 342
             if ($current_element == 'INLINECHOICEINTERACTION') {
343 343
 
344
-                $current_question_item_body .= "**claroline_start**" . $attributes['RESPONSEIDENTIFIER'] . "**claroline_end**";
344
+                $current_question_item_body .= "**claroline_start**".$attributes['RESPONSEIDENTIFIER']."**claroline_end**";
345 345
             }
346 346
             if ($current_element == 'TEXTENTRYINTERACTION') {
347 347
                 $correct_answer_value = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
348
-                $current_question_item_body .= "[" . $correct_answer_value . "]";
348
+                $current_question_item_body .= "[".$correct_answer_value."]";
349 349
 
350 350
             }
351 351
             if ($current_element == 'BR') {
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
     //treat the record of the full content of itembody tag :
462 462
 
463 463
     if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) {
464
-        $current_question_item_body .= "</" . $name . ">";
464
+        $current_question_item_body .= "</".$name.">";
465 465
     }
466 466
 
467 467
     switch ($name) {
@@ -518,14 +518,14 @@  discard block
 block discarded – undo
518 518
             if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'])) {
519 519
                 $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] = trim($data);
520 520
             } else {
521
-                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= '' . trim($data);
521
+                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= ''.trim($data);
522 522
             }
523 523
             break;
524 524
         case 'FEEDBACKINLINE':
525 525
             if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'])) {
526 526
                 $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] = trim($data);
527 527
             } else {
528
-                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' ' . trim($data);
528
+                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' '.trim($data);
529 529
             }
530 530
             break;
531 531
         case 'SIMPLEASSOCIABLECHOICE':
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
             $answer_identifier = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
549 549
             if ($current_inlinechoice_id == $answer_identifier) {
550 550
                 $current_question_item_body = str_replace(
551
-                    "**claroline_start**" . $current_answer_id . "**claroline_end**",
552
-                    "[" . $data . "]",
551
+                    "**claroline_start**".$current_answer_id."**claroline_end**",
552
+                    "[".$data."]",
553 553
                     $current_question_item_body
554 554
                 );
555 555
             } else {
Please login to merge, or discard this patch.