Completed
Push — 1.10.x ( ad23de...73a570 )
by Yannick
448:11 queued 407:15
created
main/exercice/exercise_result.class.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $course_id = api_get_course_int_id();
60 60
         $user_id = intval($user_id);
61 61
         $sessionId = api_get_session_id();
62
-        $session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
62
+        $session_id_and = ' AND te.session_id = '.$sessionId.' ';
63 63
         $exercise_id = intval($exercise_id);
64 64
 
65 65
         if (!empty($exercise_id)) {
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
                     te.c_id = ce.c_id $user_id_and  $session_id_and AND
93 93
                     ce.active <>-1";
94 94
 		} else {
95
-            $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
95
+            $user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' ';
96 96
 			// get only this user's results
97
-            $sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
97
+            $sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
98 98
                     official_code,
99 99
                     ce.title as extitle,
100 100
                     te.exe_result as exresult,
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		$results = array();
125 125
 		$resx = Database::query($sql);
126 126
         $bestAttemptPerUser = array();
127
-		while ($rowx = Database::fetch_array($resx,'ASSOC')) {
127
+		while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
128 128
             if ($this->onlyBestAttempts) {
129 129
                 if (!isset($bestAttemptPerUser[$rowx['excruid']])) {
130 130
                     $bestAttemptPerUser[$rowx['excruid']] = $rowx;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 				$return[$i] = array();
194 194
 				if (empty($user_id)) {
195
-                    $return[$i]['official_code']   = $result['official_code'];
195
+                    $return[$i]['official_code'] = $result['official_code'];
196 196
                     if (api_is_western_name_order()) {
197 197
                         $return[$i]['first_name']   = $results[$i]['userpart1'];
198 198
                         $return[$i]['last_name']    = $results[$i]['userpart2'];
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                         $isWestern = api_is_western_name_order();
237 237
 
238 238
                         if (empty($user_id)) {
239
-                            $return[$i]['official_code']   = $student['official_code'];
239
+                            $return[$i]['official_code'] = $student['official_code'];
240 240
                             if ($isWestern) {
241 241
                                 $return[$i]['first_name']   = $student['firstname'];
242 242
                                 $return[$i]['last_name']    = $student['lastname'];
@@ -289,22 +289,22 @@  discard block
 block discarded – undo
289 289
 		$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
290 290
 
291 291
 		$filename = 'exercise_results_'.date('YmdGis').'.csv';
292
-		if(!empty($user_id)) {
292
+		if (!empty($user_id)) {
293 293
 			$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
294 294
 		}
295 295
 		$data = '';
296 296
         if (api_is_western_name_order()) {
297
-            if(!empty($this->results[0]['first_name'])) {
297
+            if (!empty($this->results[0]['first_name'])) {
298 298
                 $data .= get_lang('FirstName').';';
299 299
             }
300
-            if(!empty($this->results[0]['last_name'])) {
300
+            if (!empty($this->results[0]['last_name'])) {
301 301
                 $data .= get_lang('LastName').';';
302 302
             }
303 303
         } else {
304
-            if(!empty($this->results[0]['last_name'])) {
304
+            if (!empty($this->results[0]['last_name'])) {
305 305
                 $data .= get_lang('LastName').';';
306 306
             }
307
-            if(!empty($this->results[0]['first_name'])) {
307
+            if (!empty($this->results[0]['first_name'])) {
308 308
                 $data .= get_lang('FirstName').';';
309 309
             }
310 310
         }
@@ -318,17 +318,17 @@  discard block
 block discarded – undo
318 318
 
319 319
 		if ($export_user_fields) {
320 320
 			//show user fields section with a big th colspan that spans over all fields
321
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
321
+			$extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1);
322 322
 			$num = count($extra_user_fields);
323
-			foreach($extra_user_fields as $field) {
324
-				$data .= '"'.str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";';
323
+			foreach ($extra_user_fields as $field) {
324
+				$data .= '"'.str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";';
325 325
 			}
326 326
 		}
327 327
 
328 328
 		$data .= get_lang('Title').';';
329 329
 		$data .= get_lang('StartDate').';';
330 330
         $data .= get_lang('EndDate').';';
331
-        $data .= get_lang('Duration'). ' ('.get_lang('MinMinutes').') ;';
331
+        $data .= get_lang('Duration').' ('.get_lang('MinMinutes').') ;';
332 332
 		$data .= get_lang('Score').';';
333 333
 		$data .= get_lang('Total').';';
334 334
         $data .= get_lang('Status').';';
@@ -340,37 +340,37 @@  discard block
 block discarded – undo
340 340
 		foreach ($this->results as $row) {
341 341
 
342 342
             if (api_is_western_name_order()) {
343
-                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
344
-                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
343
+                $data .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
344
+                $data .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
345 345
             } else {
346
-                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
347
-                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
346
+                $data .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
347
+                $data .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
348 348
             }
349 349
 
350 350
             if ($officialCodeInList) {
351 351
                 $data .= $row['official_code'].';';
352 352
             }
353 353
 
354
-            $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
355
-            $data .= str_replace("\r\n",'  ',implode(", ", GroupManager :: get_user_group_name($row['user_id']))).';';
354
+            $data .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
355
+            $data .= str_replace("\r\n", '  ', implode(", ", GroupManager :: get_user_group_name($row['user_id']))).';';
356 356
 
357 357
 			if ($export_user_fields) {
358 358
 				//show user fields data, if any, for this user
359
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
360
-				foreach($user_fields_values as $value) {
361
-					$data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
359
+				$user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true);
360
+				foreach ($user_fields_values as $value) {
361
+					$data .= '"'.str_replace('"', '""', api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
362 362
 				}
363 363
 			}
364 364
 
365
-			$data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
366
-			$data .= str_replace("\r\n",'  ',$row['start_date']).';';
367
-            $data .= str_replace("\r\n",'  ',$row['end_date']).';';
368
-            $data .= str_replace("\r\n",'  ',$row['duration']).';';
369
-			$data .= str_replace("\r\n",'  ',$row['result']).';';
370
-			$data .= str_replace("\r\n",'  ',$row['max']).';';
371
-            $data .= str_replace("\r\n",'  ',$row['status']).';';
372
-            $data .= str_replace("\r\n",'  ',$row['lp_name']).';';
373
-            $data .= str_replace("\r\n",'  ',$row['is_user_subscribed']).';';
365
+			$data .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
366
+			$data .= str_replace("\r\n", '  ', $row['start_date']).';';
367
+            $data .= str_replace("\r\n", '  ', $row['end_date']).';';
368
+            $data .= str_replace("\r\n", '  ', $row['duration']).';';
369
+			$data .= str_replace("\r\n", '  ', $row['result']).';';
370
+			$data .= str_replace("\r\n", '  ', $row['max']).';';
371
+            $data .= str_replace("\r\n", '  ', $row['status']).';';
372
+            $data .= str_replace("\r\n", '  ', $row['lp_name']).';';
373
+            $data .= str_replace("\r\n", '  ', $row['is_user_subscribed']).';';
374 374
 			$data .= "\n";
375 375
 		}
376 376
 
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
 
435 435
 		if ($with_column_user) {
436 436
             if (api_is_western_name_order()) {
437
-    			$worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName'));
437
+    			$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName'));
438 438
     			$column++;
439
-                $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('LastName'));
439
+                $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName'));
440 440
                 $column++;
441 441
             } else {
442
-                $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('LastName'));
442
+                $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName'));
443 443
                 $column++;
444
-                $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName'));
444
+                $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName'));
445 445
                 $column++;
446 446
             }
447 447
 
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 
459 459
 		if ($export_user_fields) {
460 460
 			//show user fields section with a big th colspan that spans over all fields
461
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
461
+			$extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1);
462 462
 
463 463
 			//show the fields names for user fields
464 464
 			foreach ($extra_user_fields as $field) {
465
-				$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
465
+				$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
466 466
 				$column++;
467 467
 			}
468 468
 		}
@@ -491,39 +491,39 @@  discard block
 block discarded – undo
491 491
 
492 492
             if ($with_column_user) {
493 493
                 if (api_is_western_name_order()) {
494
-                    $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
494
+                    $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
495 495
                     $column++;
496
-                    $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
496
+                    $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
497 497
                     $column++;
498 498
                 } else {
499
-                    $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
499
+                    $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
500 500
                     $column++;
501
-                    $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
501
+                    $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
502 502
                     $column++;
503 503
                 }
504 504
 
505 505
                 if ($officialCodeInList === 'true') {
506
-                    $worksheet->SetCellValueByColumnAndRow($line, $column,api_html_entity_decode(strip_tags($row['official_code']), ENT_QUOTES, $charset));
506
+                    $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['official_code']), ENT_QUOTES, $charset));
507 507
                     $column++;
508 508
                 }
509 509
 
510
-                $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
510
+                $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
511 511
                 $column++;
512 512
 			}
513 513
 
514
-            $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset));
514
+            $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset));
515 515
             $column++;
516 516
 
517 517
 			if ($export_user_fields) {
518 518
 				//show user fields data, if any, for this user
519
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
520
-				foreach($user_fields_values as $value) {
521
-					$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
519
+				$user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true);
520
+				foreach ($user_fields_values as $value) {
521
+					$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
522 522
 					$column++;
523 523
 				}
524 524
 			}
525 525
 
526
-			$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
526
+			$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
527 527
 			$column++;
528 528
             $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']);
529 529
             $column++;
Please login to merge, or discard this patch.
main/exercice/addlimits.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
     $objExercise = $_SESSION['objExercise'];
52 52
 }
53 53
 $exercise_id = intval($_GET['exercise_id']);
54
-$is_allowedToEdit=$is_courseAdmin;
54
+$is_allowedToEdit = $is_courseAdmin;
55 55
 
56
-if (isset($_SESSION['gradebook'])){
57
-	$gradebook=	$_SESSION['gradebook'];
56
+if (isset($_SESSION['gradebook'])) {
57
+	$gradebook = $_SESSION['gradebook'];
58 58
 }
59 59
 
60
-if (!empty($gradebook) && $gradebook=='view') {
61
-	$interbreadcrumb[]= array (
60
+if (!empty($gradebook) && $gradebook == 'view') {
61
+	$interbreadcrumb[] = array(
62 62
 			'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
63 63
 			'name' => get_lang('ToolGradebook')
64 64
 		);
65 65
 }
66
-$nameTools=get_lang('Exercises');
66
+$nameTools = get_lang('Exercises');
67 67
 $interbreadcrumb[] = array(
68 68
     "url" => "exercise.php",
69 69
     "name" => get_lang('Exercises'),
70 70
 );
71
-Display::display_header($nameTools,"Exercises");
71
+Display::display_header($nameTools, "Exercises");
72 72
 
73 73
 if (isset($_POST['ok'])) {
74 74
 	$message = get_lang('TestLimitsAdded');
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  */
141 141
 if (isset($_POST['ok'])) {
142 142
 	$exercise_id = intval($_POST['exe_id']);
143
-	if ($_POST['limit']==1) {
143
+	if ($_POST['limit'] == 1) {
144 144
 		$minutes = intval($_POST['minutes']);
145 145
 		$query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id";
146 146
 		Database::query($query);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		Database::query($query);
150 150
 	}
151 151
 
152
-	if ($_POST['attempt']==1) {
152
+	if ($_POST['attempt'] == 1) {
153 153
 		$attempts = intval($_POST['attempts']);
154 154
 		$query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id";
155 155
 		Database::query($query);
Please login to merge, or discard this patch.
main/exercice/upload_exercise.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 require_once '../inc/global.inc.php';
16 16
 
17
-require_once api_get_path(LIBRARY_PATH) . 'pear/excelreader/reader.php';
17
+require_once api_get_path(LIBRARY_PATH).'pear/excelreader/reader.php';
18 18
 
19 19
 // Security check
20 20
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 function lp_upload_quiz_actions()
60 60
 {
61 61
     $return = '<a href="exercise.php?'.api_get_cidReq().'">'.
62
-        Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
62
+        Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
63 63
     return $return;
64 64
 }
65 65
 
66 66
 function lp_upload_quiz_secondary_actions()
67 67
 {
68
-    $return = '<a href="exercise_report.php?' . api_get_cidreq() . '">' .
69
-        Display :: return_icon('reporting32.png', get_lang('Tracking')) . get_lang('Tracking') . '</a>';
68
+    $return = '<a href="exercise_report.php?'.api_get_cidreq().'">'.
69
+        Display :: return_icon('reporting32.png', get_lang('Tracking')).get_lang('Tracking').'</a>';
70 70
     return $return;
71 71
 }
72 72
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     $table->setHeaderContents(0, 1, '#');
105 105
 
106 106
     $row = 1;
107
-    foreach ($tableList as $key => $label ) {
107
+    foreach ($tableList as $key => $label) {
108 108
         $table->setCellContents($row, 0, $label);
109 109
         $table->setCellContents($row, 1, $key);
110 110
         $row++;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                                     $comment = $feedback_true_list[$i][2];
444 444
                                 } else {
445 445
                                     $comment = $feedback_false_list[$i][2];
446
-                                    $floatVal = (float)$answer_data[3];
446
+                                    $floatVal = (float) $answer_data[3];
447 447
                                     if (is_numeric($floatVal)) {
448 448
                                         $score = $answer_data[3];
449 449
                                     }
Please login to merge, or discard this patch.
main/exercice/export/exercise_import.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
 // EXECUTE COMMAND
40 40
 //----------------------------------
41 41
 
42
-$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import');
42
+$cmd = (isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'show_import');
43 43
 
44 44
 switch ($cmd) {
45 45
     case 'show_import' :
46 46
     {
47 47
         $display = '<p>'
48
-        .            get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . '<br>'
48
+        .            get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.').'<br>'
49 49
         .            '</p>'
50 50
         .            '<form enctype="multipart/form-data" action="" method="post">'
51 51
         .            '<input name="cmd" type="hidden" value="import" />'
52 52
         .            '<input name="uploadedExercise" type="file" /><br><br>'
53
-        .            get_lang('Import exercise') . ' : '
54
-        .            '<input value="' . get_lang('Ok') . '" type="submit" /> '
55
-        .            claro_html_button( $_SERVER['PHP_SELF'], get_lang('Cancel'))
53
+        .            get_lang('Import exercise').' : '
54
+        .            '<input value="'.get_lang('Ok').'" type="submit" /> '
55
+        .            claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel'))
56 56
         .            '<br><br>'
57
-        .            '<small>' . get_lang('Max file size') . ' :  2&nbsp;MB</small>'
57
+        .            '<small>'.get_lang('Max file size').' :  2&nbsp;MB</small>'
58 58
         .            '</form>';
59 59
     }
60 60
     break;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 // DISPLAY
86 86
 //----------------------------------
87 87
 
88
-include api_get_path(INCLUDE_PATH) . '/header.inc.php';
88
+include api_get_path(INCLUDE_PATH).'/header.inc.php';
89 89
 
90 90
 //display title
91 91
 
@@ -114,5 +114,5 @@  discard block
 block discarded – undo
114 114
 
115 115
 //footer display
116 116
 
117
-include api_get_path(INCLUDE_PATH) . '/footer.inc.php';
117
+include api_get_path(INCLUDE_PATH).'/footer.inc.php';
118 118
 ?>
Please login to merge, or discard this patch.
main/exercice/export/qti2/qti2_export.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 /**
9 9
  * Code
10 10
  */
11
-require dirname(__FILE__) . '/qti2_classes.php';
11
+require dirname(__FILE__).'/qti2_classes.php';
12 12
 /**
13 13
  * Classes
14 14
 */
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      {
39 39
         $this->question = $question;
40 40
         $this->answer = $this->question->setAnswer();
41
-        $this->questionIdent = "QST_" . $question->id ;
41
+        $this->questionIdent = "QST_".$question->id;
42 42
      }
43 43
 
44 44
      /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
       */
74 74
      function start_item_body()
75 75
      {
76
-        return '  <itemBody>' . "\n";
76
+        return '  <itemBody>'."\n";
77 77
      }
78 78
 
79 79
      /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
       function add_response_processing()
94 94
       {
95
-          return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
95
+          return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>'."\n";
96 96
       }
97 97
 
98 98
      /**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $head = $foot = "";
109 109
 
110 110
         if ($standalone) {
111
-            $head = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . "\n";
111
+            $head = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'."\n";
112 112
         }
113 113
         //TODO understand why answer might be a non-object sometimes
114 114
         if (!is_object($this->answer)) {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
     function start_section()
166 166
     {
167
-        $out = '<section ident="EXO_' . $this->exercise->selectId() . '" title="' .cleanAttribute(formatExerciseQtiDescription($this->exercise->selectTitle())) . '">' . "\n";
167
+        $out = '<section ident="EXO_'.$this->exercise->selectId().'" title="'.cleanAttribute(formatExerciseQtiDescription($this->exercise->selectTitle())).'">'."\n";
168 168
         return $out;
169 169
     }
170 170
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             // return exercise duration in ISO8601 format.
181 181
             $minutes = floor($max_time / 60);
182 182
             $seconds = $max_time % 60;
183
-            return '<duration>PT' . $minutes . 'M' . $seconds . "S</duration>\n";
183
+            return '<duration>PT'.$minutes.'M'.$seconds."S</duration>\n";
184 184
         } else {
185 185
             return '';
186 186
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     function export_presentation()
194 194
     {
195 195
         $out = "<presentation_material><flow_mat><material>\n"
196
-             . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
196
+             . "  <mattext><![CDATA[".formatExerciseQtiDescription($this->exercise->selectDescription())."]]></mattext>\n"
197 197
              . "</material></flow_mat></presentation_material>\n";
198 198
         return $out;
199 199
     }
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
     {
208 208
         $out = '';
209 209
         if ($n = $this->exercise->getShuffle()) {
210
-            $out.= "<selection_ordering>"
210
+            $out .= "<selection_ordering>"
211 211
                  . "  <selection>\n"
212
-                 . "    <selection_number>" . $n . "</selection_number>\n"
212
+                 . "    <selection_number>".$n."</selection_number>\n"
213 213
                  . "  </selection>\n"
214 214
                  . '  <order order_type="Random" />'
215 215
                  . "\n</selection_ordering>\n";
216 216
         } else {
217
-            $out.= '<selection_ordering sequence_type="Normal">' . "\n"
217
+            $out .= '<selection_ordering sequence_type="Normal">'."\n"
218 218
                  . "  <selection />\n"
219 219
                  . "</selection_ordering>\n";
220 220
         }
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
     {
247 247
         $head = $foot = "";
248 248
         if ($standalone) {
249
-            $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n"
250
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
249
+            $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>'."\n"
250
+                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">'."\n"
251 251
                   . "<questestinterop>\n";
252 252
             $foot = "</questestinterop>\n";
253 253
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      {
309 309
         $this->question = $question;
310 310
         $this->answer = $question->answer;
311
-        $this->questionIdent = "QST_" . $question->selectId() ;
311
+        $this->questionIdent = "QST_".$question->selectId();
312 312
      }
313 313
 
314 314
      /**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
       */
321 321
       function start_item()
322 322
       {
323
-        return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n";
323
+        return '<item title="'.cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())).'" ident="'.$this->questionIdent.'">'."\n";
324 324
       }
325 325
 
326 326
       /**
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
       */
344 344
      function start_presentation()
345 345
      {
346
-        return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n"
347
-             . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
346
+        return '<presentation label="'.$this->questionIdent.'"><flow>'."\n"
347
+             . '<material><mattext>'.formatExerciseQtiDescription($this->question->selectDescription())."</mattext></material>\n";
348 348
      }
349 349
 
350 350
      /**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
       */
365 365
      function start_processing()
366 366
      {
367
-        return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n";
367
+        return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>'."\n";
368 368
      }
369 369
 
370 370
      /**
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
         $head = $foot = "";
393 393
 
394 394
         if ($standalone) {
395
-            $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n"
396
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
395
+            $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>'."\n"
396
+                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">'."\n"
397 397
                   . "<questestinterop>\n";
398 398
             $foot = "</questestinterop>\n";
399 399
         }
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
     $question->type = $qst->type;
448 448
     $question->question = $qst->question;
449 449
     $question->description = $qst->description;
450
-	$question->weighting=$qst->weighting;
451
-	$question->position=$qst->position;
452
-	$question->picture=$qst->picture;
450
+	$question->weighting = $qst->weighting;
451
+	$question->position = $qst->position;
452
+	$question->picture = $qst->picture;
453 453
     $ims = new ImsAssessmentItem($question);
454 454
 
455 455
     return $ims->export($standalone);
Please login to merge, or discard this patch.
main/exercice/export/qti2/qti2_classes.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function setAnswer()
16 16
     {
17
-        switch($this->type) {
17
+        switch ($this->type) {
18 18
             case MCUA:
19 19
                 $answer = new ImsAnswerMultipleChoice($this->id);
20 20
 
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
     {
78 78
         // @todo getAnswersList() converts the answers using api_html_entity_decode()
79 79
 		$this->answerList = $this->getAnswersList(true);
80
-        $out  = '    <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n";
81
-        $out .= '      <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n";
80
+        $out  = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";
81
+        $out .= '      <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment).']]></prompt>'."\n";
82 82
 		if (is_array($this->answerList)) {
83 83
 	        foreach ($this->answerList as $current_answer) {
84
-	            $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false">
84
+	            $out .= '<simpleChoice identifier="answer_'.$current_answer['id'].'" fixed="false">
85 85
                          <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>';
86 86
 	            if (isset($current_answer['comment']) && $current_answer['comment'] != '') {
87
-	                $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '">
87
+	                $out .= '<feedbackInline identifier="answer_'.$current_answer['id'].'">
88 88
 	                         <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]>
89 89
 	                         </feedbackInline>';
90 90
 	            }
91
-	            $out .= '</simpleChoice>'. "\n";
91
+	            $out .= '</simpleChoice>'."\n";
92 92
 	        }
93 93
 		}
94
-        $out .= '    </choiceInteraction>'. "\n";
94
+        $out .= '    </choiceInteraction>'."\n";
95 95
 
96 96
         return $out;
97 97
     }
@@ -106,32 +106,32 @@  discard block
 block discarded – undo
106 106
 		$type = $this->getQuestionType();
107 107
         if ($type == MCMA)  $cardinality = 'multiple'; else $cardinality = 'single';
108 108
 
109
-        $out = '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n";
109
+        $out = '  <responseDeclaration identifier="'.$questionIdent.'" cardinality="'.$cardinality.'" baseType="identifier">'."\n";
110 110
 
111 111
         // Match the correct answers.
112 112
 
113
-        $out .= '    <correctResponse>'. "\n";
113
+        $out .= '    <correctResponse>'."\n";
114 114
 		if (is_array($this->answerList)) {
115
-	        foreach($this->answerList as $current_answer) {
115
+	        foreach ($this->answerList as $current_answer) {
116 116
 	            if ($current_answer['correct']) {
117
-	                $out .= '      <value>answer_'. $current_answer['id'] .'</value>'. "\n";
117
+	                $out .= '      <value>answer_'.$current_answer['id'].'</value>'."\n";
118 118
 	            }
119 119
 	        }
120 120
 		}
121
-        $out .= '    </correctResponse>'. "\n";
121
+        $out .= '    </correctResponse>'."\n";
122 122
 
123 123
         //Add the grading
124 124
 
125
-        $out .= '    <mapping>'. "\n";
125
+        $out .= '    <mapping>'."\n";
126 126
 		if (is_array($this->answerList)) {
127
-	        foreach($this->answerList as $current_answer) {
127
+	        foreach ($this->answerList as $current_answer) {
128 128
 	            if (isset($current_answer['grade'])) {
129
-	                $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n";
129
+	                $out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";
130 130
 	            }
131 131
 	        }
132 132
 		}
133
-        $out .= '    </mapping>'. "\n";
134
-        $out .= '  </responseDeclaration>'. "\n";
133
+        $out .= '    </mapping>'."\n";
134
+        $out .= '  </responseDeclaration>'."\n";
135 135
 
136 136
         return $out;
137 137
     }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 $key = $answer['id'];
159 159
                 $answer = $answer['answer'];
160 160
                 $len = api_strlen($answer);
161
-                $text = str_replace('['.$answer.']','<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text);
161
+                $text = str_replace('['.$answer.']', '<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text);
162 162
             }
163 163
         }
164 164
         $out = $text;
@@ -178,17 +178,17 @@  discard block
 block discarded – undo
178 178
 	        foreach ($this->answerList as $answer) {
179 179
 	        	$answerKey = $answer['id'];
180 180
 	        	$answer = $answer['answer'];
181
-	            $out .= '  <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n";
182
-	            $out .= '    <correctResponse>'. "\n";
183
-                $out .= '      <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n";
184
-	            $out .= '    </correctResponse>'. "\n";
181
+	            $out .= '  <responseDeclaration identifier="fill_'.$answerKey.'" cardinality="single" baseType="identifier">'."\n";
182
+	            $out .= '    <correctResponse>'."\n";
183
+                $out .= '      <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'."\n";
184
+	            $out .= '    </correctResponse>'."\n";
185 185
 	            if (isset($this->gradeList[$answerKey])) {
186
-	                $out .= '    <mapping>'. "\n";
187
-	                $out .= '      <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n";
188
-	                $out .= '    </mapping>'. "\n";
186
+	                $out .= '    <mapping>'."\n";
187
+	                $out .= '      <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'."\n";
188
+	                $out .= '    </mapping>'."\n";
189 189
 	            }
190 190
 
191
-	            $out .= '  </responseDeclaration>'. "\n";
191
+	            $out .= '  </responseDeclaration>'."\n";
192 192
 	        }
193 193
 		}
194 194
 
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
 
213 213
         $out = "";
214 214
 
215
-        $out .= '<matchInteraction responseIdentifier="' . $questionIdent . '" maxAssociations="'. $maxAssociation .'">'. "\n";
215
+        $out .= '<matchInteraction responseIdentifier="'.$questionIdent.'" maxAssociations="'.$maxAssociation.'">'."\n";
216 216
         $out .= $questionStatment;
217 217
 
218 218
         //add left column
219 219
 
220
-        $out .= '  <simpleMatchSet>'. "\n";
220
+        $out .= '  <simpleMatchSet>'."\n";
221 221
 		if (is_array($this->leftList)) {
222 222
 	        foreach ($this->leftList as $leftKey=>$leftElement) {
223 223
 	            $out .= '
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	        }
228 228
     	}
229 229
 
230
-        $out .= '  </simpleMatchSet>'. "\n";
230
+        $out .= '  </simpleMatchSet>'."\n";
231 231
 
232 232
         //add right column
233 233
 
234
-        $out .= '  <simpleMatchSet>'. "\n";
234
+        $out .= '  <simpleMatchSet>'."\n";
235 235
 
236 236
         $i = 0;
237 237
 
238 238
 		if (is_array($this->rightList)) {
239
-	        foreach($this->rightList as $rightKey=>$rightElement) {
239
+	        foreach ($this->rightList as $rightKey=>$rightElement) {
240 240
 	            $out .= '<simpleAssociableChoice identifier="right_'.$i.'" >
241 241
 	                    <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]>
242 242
 	                    </simpleAssociableChoice>'. "\n";
243 243
 	            $i++;
244 244
 	        }
245 245
 		}
246
-        $out .= '  </simpleMatchSet>'. "\n";
247
-        $out .= '</matchInteraction>'. "\n";
246
+        $out .= '  </simpleMatchSet>'."\n";
247
+        $out .= '</matchInteraction>'."\n";
248 248
 
249 249
         return $out;
250 250
     }
@@ -255,32 +255,32 @@  discard block
 block discarded – undo
255 255
     public function imsExportResponsesDeclaration($questionIdent)
256 256
     {
257 257
 		$this->answerList = $this->getAnswersList(true);
258
-        $out =  '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n";
259
-        $out .= '    <correctResponse>' . "\n";
258
+        $out = '  <responseDeclaration identifier="'.$questionIdent.'" cardinality="single" baseType="identifier">'."\n";
259
+        $out .= '    <correctResponse>'."\n";
260 260
 
261 261
         $gradeArray = array();
262 262
 		if (is_array($this->leftList)) {
263 263
 	        foreach ($this->leftList as $leftKey=>$leftElement) {
264
-	            $i=0;
264
+	            $i = 0;
265 265
 	            foreach ($this->rightList as $rightKey=>$rightElement) {
266 266
 	                if (($leftElement['match'] == $rightElement['code'])) {
267
-	                    $out .= '      <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n";
267
+	                    $out .= '      <value>left_'.$leftKey.' right_'.$i.'</value>'."\n";
268 268
 
269
-	                    $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade'];
269
+	                    $gradeArray['left_'.$leftKey.' right_'.$i] = $leftElement['grade'];
270 270
 	                }
271 271
 	                $i++;
272 272
 	            }
273 273
 	        }
274 274
 		}
275
-        $out .= '    </correctResponse>'. "\n";
276
-        $out .= '    <mapping>' . "\n";
275
+        $out .= '    </correctResponse>'."\n";
276
+        $out .= '    <mapping>'."\n";
277 277
         if (is_array($gradeArray)) {
278 278
 	        foreach ($gradeArray as $gradeKey=>$grade) {
279
-	            $out .= '          <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n";
279
+	            $out .= '          <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>'."\n";
280 280
 	        }
281 281
         }
282
-        $out .= '    </mapping>' . "\n";
283
-        $out .= '  </responseDeclaration>'. "\n";
282
+        $out .= '    </mapping>'."\n";
283
+        $out .= '  </responseDeclaration>'."\n";
284 284
 
285 285
         return $out;
286 286
     }
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
      * TODO update this to match hot spots instead of copying matching
297 297
      * Export the question part as a matrix-choice, with only one possible answer per line.
298 298
      */
299
-    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='')
299
+    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
300 300
     {
301 301
 		$this->answerList = $this->getAnswersList(true);
302 302
 		$questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia;
303 303
 		$mimetype = mime_content_type($questionMedia);
304
-		if(empty($mimetype)){
304
+		if (empty($mimetype)) {
305 305
 			$mimetype = 'image/jpeg';
306 306
 		}
307 307
 
@@ -317,26 +317,26 @@  discard block
 block discarded – undo
317 317
 	        	//coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663
318 318
 	        	$coords = '';
319 319
 	        	$type = 'default';
320
-	        	switch($answer['hotspot_type']){
320
+	        	switch ($answer['hotspot_type']) {
321 321
 	        		case 'square':
322 322
 	        			$type = 'rect';
323 323
 						$res = array();
324
-						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
325
-						$coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]);
324
+						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res);
325
+						$coords = $res[1].','.$res[2].','.((int) $res[1] + (int) $res[3]).",".((int) $res[2] + (int) $res[4]);
326 326
 	        			break;
327 327
 	        		case 'circle':
328 328
 	        			$type = 'circle';
329 329
 			 			$res = array();
330
-						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res);
331
-						$coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4])));
330
+						$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res);
331
+						$coords = $res[1].','.$res[2].','.sqrt(pow(($res[1] - $res[3]), 2) + pow(($res[2] - $res[4])));
332 332
 	        			break;
333 333
 	        		case 'poly':
334 334
 	        			$type = 'poly';
335
-						$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
335
+						$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
336 336
 	        			break;
337 337
 	        		 case 'delineation' :
338 338
 	        			$type = 'delineation';
339
-						$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']);
339
+						$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
340 340
 	        			break;
341 341
 	        	}
342 342
 	            $text .= '        <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n";
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
 		$this->answerList = $this->getAnswersList(true);
357 357
 		$this->gradeList = $this->getGradesList();
358 358
         $out = '';
359
-        $out .= '  <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n";
360
-        $out .= '    <correctResponse>'. "\n";
359
+        $out .= '  <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">'."\n";
360
+        $out .= '    <correctResponse>'."\n";
361 361
 
362 362
 		if (is_array($this->answerList)) {
363
-	        foreach ($this->answerList as $answerKey=>$answer)  {
363
+	        foreach ($this->answerList as $answerKey=>$answer) {
364 364
 	        	$answerKey = $answer['id'];
365 365
 	        	$answer = $answer['answer'];
366 366
 	            $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>';
367 367
 	        }
368 368
 		}
369
-        $out .= '    </correctResponse>'. "\n";
370
-        $out .= '  </responseDeclaration>'. "\n";
369
+        $out .= '    </correctResponse>'."\n";
370
+        $out .= '  </responseDeclaration>'."\n";
371 371
 
372 372
        return $out;
373 373
     }
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * TODO implement
384 384
      * Export the question part as a matrix-choice, with only one possible answer per line.
385 385
      */
386
-    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='')
386
+    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
387 387
 	{
388 388
 		return '';
389 389
 	}
Please login to merge, or discard this patch.
main/exercice/export/exercise_import.inc.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
 
22 22
     do {
23
-        $path = $dir . $prefix . mt_rand(0, 9999999);
23
+        $path = $dir.$prefix.mt_rand(0, 9999999);
24 24
     } while (!mkdir($path, $mode));
25 25
 
26 26
     return $path;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     // used to specify the question directory where files could be found in relation in any question
75 75
     global $questionTempDir;
76 76
 
77
-    $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'qti2';
77
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'qti2';
78 78
     $baseWorkDir = $archive_path;
79 79
 
80 80
     if (!is_dir($baseWorkDir)) {
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
     // parse every subdirectory to search xml question files
119 119
     while (false !== ($file = readdir($exerciseHandle))) {
120 120
 
121
-        if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
121
+        if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") {
122 122
 
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:: display_error_message(get_lang('Error opening question\'s XML file'));
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
     if ($record_item_body) {
327 327
 
328 328
         if ((!in_array($current_element, $non_HTML_tag_to_avoid))) {
329
-            $current_question_item_body .= "<" . $name;
329
+            $current_question_item_body .= "<".$name;
330 330
 
331 331
             foreach ($attributes as $attribute_name => $attribute_value) {
332
-                $current_question_item_body .= " " . $attribute_name . "=\"" . $attribute_value . "\"";
332
+                $current_question_item_body .= " ".$attribute_name."=\"".$attribute_value."\"";
333 333
             }
334 334
             $current_question_item_body .= ">";
335 335
         } else {
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 
339 339
             if ($current_element == 'INLINECHOICEINTERACTION') {
340 340
 
341
-                $current_question_item_body .= "**claroline_start**" . $attributes['RESPONSEIDENTIFIER'] . "**claroline_end**";
341
+                $current_question_item_body .= "**claroline_start**".$attributes['RESPONSEIDENTIFIER']."**claroline_end**";
342 342
             }
343 343
             if ($current_element == 'TEXTENTRYINTERACTION') {
344 344
                 $correct_answer_value = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
345
-                $current_question_item_body .= "[" . $correct_answer_value . "]";
345
+                $current_question_item_body .= "[".$correct_answer_value."]";
346 346
 
347 347
             }
348 348
             if ($current_element == 'BR') {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     //treat the record of the full content of itembody tag :
458 458
 
459 459
     if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) {
460
-        $current_question_item_body .= "</" . $name . ">";
460
+        $current_question_item_body .= "</".$name.">";
461 461
     }
462 462
 
463 463
     switch ($name) {
@@ -515,14 +515,14 @@  discard block
 block discarded – undo
515 515
             if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'])) {
516 516
                 $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] = trim($data);
517 517
             } else {
518
-                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= '' . trim($data);
518
+                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= ''.trim($data);
519 519
             }
520 520
             break;
521 521
         case 'FEEDBACKINLINE':
522 522
             if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'])) {
523 523
                 $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] = trim($data);
524 524
             } else {
525
-                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' ' . trim($data);
525
+                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' '.trim($data);
526 526
             }
527 527
             break;
528 528
         case 'SIMPLEASSOCIABLECHOICE':
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
             $answer_identifier = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
547 547
             if ($current_inlinechoice_id == $answer_identifier) {
548 548
                 $current_question_item_body = str_replace(
549
-                    "**claroline_start**" . $current_answer_id . "**claroline_end**",
550
-                    "[" . $data . "]",
549
+                    "**claroline_start**".$current_answer_id."**claroline_end**",
550
+                    "[".$data."]",
551 551
                     $current_question_item_body
552 552
                 );
553 553
             } else {
Please login to merge, or discard this patch.
main/exercice/export/aiken/aiken_import.inc.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $dir .= '/';
26 26
 
27 27
     do {
28
-        $path = $dir . $prefix . mt_rand(0, 9999999);
28
+        $path = $dir.$prefix.mt_rand(0, 9999999);
29 29
     } while (!mkdir($path, $mode));
30 30
 
31 31
     return $path;
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 function aiken_display_form($msg = '') {
39 39
     $name_tools = get_lang('ImportAikenQuiz');
40 40
     $form  = '<div class="actions">';
41
-    $form .= '<a href="exercise.php?show=test">' . Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
41
+    $form .= '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
42 42
     $form .= '</div>';
43 43
     $form .= $msg;
44
-    $form_validator  = new FormValidator('aiken_upload', 'post',api_get_self()."?".api_get_cidreq(), null, array('enctype' => 'multipart/form-data') );
44
+    $form_validator = new FormValidator('aiken_upload', 'post', api_get_self()."?".api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
45 45
     $form_validator->addElement('header', $name_tools);
46 46
     $form_validator->addElement('text', 'total_weight', get_lang('TotalWeight'));
47 47
     $form_validator->addElement('file', 'userFile', get_lang('DownloadFile'));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     global $record_item_body;
90 90
     // used to specify the question directory where files could be found in relation in any question
91 91
     global $questionTempDir;
92
-    $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'aiken';
92
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'aiken';
93 93
     $baseWorkDir = $archive_path;
94 94
 
95 95
     if (!is_dir($baseWorkDir)) {
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
     // Parse every subdirectory to search txt question files
132 132
     while (false !== ($file = readdir($exerciseHandle))) {
133
-        if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
133
+        if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") {
134 134
             //find each manifest for each question repository found
135
-            $questionHandle = opendir($baseWorkDir . '/' . $file);
135
+            $questionHandle = opendir($baseWorkDir.'/'.$file);
136 136
             while (false !== ($questionFile = readdir($questionHandle))) {
137 137
                 if (preg_match('/.txt$/i', $questionFile)) {
138 138
                     $result = aiken_parse_file(
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $result = 'NoTxtFileFoundInTheZip';
155 155
     }
156 156
 
157
-    if ($result !== true ) {
157
+    if ($result !== true) {
158 158
         return $result;
159 159
     }
160 160
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         }
216 216
 
217 217
         // Delete the temp dir where the exercise was unzipped
218
-        my_delete($baseWorkDir . $uploadPath);
218
+        my_delete($baseWorkDir.$uploadPath);
219 219
         $operation = $last_exercise_id;
220 220
     }
221 221
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile) {
236 236
     global $questionTempDir;
237 237
 
238
-    $questionTempDir = $exercisePath . '/' . $file . '/';
239
-    $questionFilePath = $questionTempDir . $questionFile;
238
+    $questionTempDir = $exercisePath.'/'.$file.'/';
239
+    $questionFilePath = $questionTempDir.$questionFile;
240 240
 
241 241
     if (!is_file($questionFilePath)) {
242 242
         return 'FileNotFound';
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
     $answers_array = array();
249 249
     $new_question = true;
250 250
     foreach ($data as $line => $info) {
251
-        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/',$info)) {
251
+        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/', $info)) {
252 252
             // double empty line
253 253
             continue;
254 254
         }
255 255
         $new_question = false;
256 256
         //make sure it is transformed from iso-8859-1 to utf-8 if in that form
257
-        if (!mb_check_encoding($info,'utf-8') && mb_check_encoding($info,'iso-8859-1')) {
257
+        if (!mb_check_encoding($info, 'utf-8') && mb_check_encoding($info, 'iso-8859-1')) {
258 258
             $info = utf8_encode($info);
259 259
         }
260 260
         $exercise_info['question'][$question_index]['type'] = 'MCUA';
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) {
287 287
             //TAGS for chamilo >= 1.10 (Spanish e-ducativa format)
288 288
             $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]);
289
-        } elseif (preg_match('/^(\r)?\n/',$info)) {
289
+        } elseif (preg_match('/^(\r)?\n/', $info)) {
290 290
             //moving to next question (tolerate \r\n or just \n)
291 291
             if (empty($exercise_info['question'][$question_index]['correct_answers'])) {
292 292
                 error_log('Aiken: Error in question index '.$question_index.': no correct answer defined');
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                     $exercise_info['question'][$question_index]['title'] = $info;
307 307
                 } else {
308 308
                     //Question itself (use a 100-chars long title and a larger description)
309
-                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)) . '...';
309
+                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)).'...';
310 310
                     $exercise_info['question'][$question_index]['description'] = $info;
311 311
                 }
312 312
             } else {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     }
317 317
     $total_questions = count($exercise_info['question']);
318 318
     $total_weight = (!empty($_POST['total_weight'])) ? intval($_POST['total_weight']) : 20;
319
-    foreach  ($exercise_info['question'] as $key => $question) {
319
+    foreach ($exercise_info['question'] as $key => $question) {
320 320
         $exercise_info['question'][$key]['weighting'][current(array_keys($exercise_info['question'][$key]['weighting']))] = $total_weight / $total_questions;
321 321
     }
322 322
     return true;
Please login to merge, or discard this patch.
main/exercice/export/aiken/aiken_classes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
  * @package chamilo.exercise
8 8
  */
9 9
 
10
-if ( count( get_included_files() ) == 1 ) die( '---' );
10
+if (count(get_included_files()) == 1) die('---');
11 11
 
12 12
 if (!function_exists('mime_content_type')) {
13 13
 	function mime_content_type($filename) {
14
-		return DocumentManager::file_get_mime_type((string)$filename);
14
+		return DocumentManager::file_get_mime_type((string) $filename);
15 15
 	}
16 16
 }
17 17
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     function setAnswer()
27 27
     {
28
-        switch($this->type)
28
+        switch ($this->type)
29 29
         {
30 30
             case MCUA :
31 31
                 $answer = new AikenAnswerMultipleChoice($this->id);
Please login to merge, or discard this patch.