Completed
Pull Request — 1.11.x (#1458)
by José
138:44 queued 104:05
created
main/exercise/freeanswer.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@
 block discarded – undo
60 60
             $score['revised'] = false;
61 61
         }
62 62
         $header = parent::return_header($feedback_type, $counter, $score);
63
-        $header .= '<table class="' . $this->question_table_class . '" >
63
+        $header .= '<table class="'.$this->question_table_class.'" >
64 64
         <tr>
65
-        <th>' . get_lang("Answer") . '</th>
65
+        <th>' . get_lang("Answer").'</th>
66 66
         </tr>';
67 67
 
68 68
         return $header;
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_classes.php 3 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 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 ) {
11
+    die( '---' );
12
+}
11 13
 
12 14
 if (!function_exists('mime_content_type')) {
13 15
 	function mime_content_type($filename) {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 
12 12
 if (!function_exists('mime_content_type')) {
13 13
 
14
-	/**
15
-	 * @param string $filename
14
+    /**
15
+     * @param string $filename
16 16
      * @return string
17
-	 */
18
-	function mime_content_type($filename) {
19
-		return DocumentManager::file_get_mime_type((string)$filename);
20
-	}
17
+     */
18
+    function mime_content_type($filename) {
19
+        return DocumentManager::file_get_mime_type((string)$filename);
20
+    }
21 21
 }
22 22
 
23 23
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         {
35 35
             case MCUA :
36 36
                 $answer = new AikenAnswerMultipleChoice($this->id);
37
-            	return $answer;
37
+                return $answer;
38 38
             default :
39 39
                 $answer = null;
40 40
                 break;
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
     }
44 44
     function createAnswersForm($form)
45 45
     {
46
-    	return true;
46
+        return true;
47 47
     }
48 48
     function processAnswersCreation($form)
49 49
     {
50
-    	return true;
50
+        return true;
51 51
     }
52 52
 }
53 53
 
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_import.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@
 block discarded – undo
281 281
             $correct_answer_index = array_search($matches[1], $answers_array);
282 282
             $exercise_info['question'][$question_index]['title'] = $matches[1];
283 283
         } elseif (preg_match('/^TAGS:\s?([A-Z])\s?/', $info, $matches)) {
284
-             //TAGS for chamilo >= 1.10
284
+                //TAGS for chamilo >= 1.10
285 285
             $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]);
286 286
         } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) {
287 287
             //TAGS for chamilo >= 1.10 (Spanish e-ducativa format)
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Security check
12 12
  */
13
-if (count(get_included_files()) == 1)
13
+if (count(get_included_files()) == 1) {
14 14
     die('---');
15
+}
15 16
 
16 17
 /**
17 18
  * Creates a temporary directory
@@ -21,8 +22,9 @@  discard block
 block discarded – undo
21 22
  * @return string
22 23
  */
23 24
 function tempdir($dir, $prefix = 'tmp', $mode = 0777) {
24
-    if (substr($dir, -1) != '/')
25
-        $dir .= '/';
25
+    if (substr($dir, -1) != '/') {
26
+            $dir .= '/';
27
+    }
26 28
 
27 29
     do {
28 30
         $path = $dir . $prefix . mt_rand(0, 9999999);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 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;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 {
40 40
     $name_tools = get_lang('ImportAikenQuiz');
41 41
     $form  = '<div class="actions">';
42
-    $form .= '<a href="exercise.php?show=test&'.api_get_cidreq().'">' .
43
-        Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
42
+    $form .= '<a href="exercise.php?show=test&'.api_get_cidreq().'">'.
43
+        Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
44 44
     $form .= '</div>';
45 45
     $form_validator = new FormValidator(
46 46
         'aiken_upload',
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 function aiken_import_exercise($file)
94 94
 {
95 95
     global $exercise_info;
96
-    $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'aiken';
96
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'aiken';
97 97
     $baseWorkDir = $archive_path;
98 98
 
99 99
     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(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         }
217 217
 
218 218
         // Delete the temp dir where the exercise was unzipped
219
-        my_delete($baseWorkDir . $uploadPath);
219
+        my_delete($baseWorkDir.$uploadPath);
220 220
         $operation = $last_exercise_id;
221 221
     }
222 222
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile) {
240 240
     global $questionTempDir;
241 241
 
242
-    $questionTempDir = $exercisePath . '/' . $file . '/';
243
-    $questionFilePath = $questionTempDir . $questionFile;
242
+    $questionTempDir = $exercisePath.'/'.$file.'/';
243
+    $questionFilePath = $questionTempDir.$questionFile;
244 244
 
245 245
     if (!is_file($questionFilePath)) {
246 246
         return 'FileNotFound';
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
     $answers_array = array();
253 253
     $new_question = true;
254 254
     foreach ($data as $line => $info) {
255
-        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/',$info)) {
255
+        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/', $info)) {
256 256
             // double empty line
257 257
             continue;
258 258
         }
259 259
         $new_question = false;
260 260
         //make sure it is transformed from iso-8859-1 to utf-8 if in that form
261
-        if (!mb_check_encoding($info,'utf-8') && mb_check_encoding($info,'iso-8859-1')) {
261
+        if (!mb_check_encoding($info, 'utf-8') && mb_check_encoding($info, 'iso-8859-1')) {
262 262
             $info = utf8_encode($info);
263 263
         }
264 264
         $exercise_info['question'][$question_index]['type'] = 'MCUA';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) {
291 291
             //TAGS for chamilo >= 1.10 (Spanish e-ducativa format)
292 292
             $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]);
293
-        } elseif (preg_match('/^(\r)?\n/',$info)) {
293
+        } elseif (preg_match('/^(\r)?\n/', $info)) {
294 294
             //moving to next question (tolerate \r\n or just \n)
295 295
             if (empty($exercise_info['question'][$question_index]['correct_answers'])) {
296 296
                 error_log('Aiken: Error in question index '.$question_index.': no correct answer defined');
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     $exercise_info['question'][$question_index]['title'] = $info;
311 311
                 } else {
312 312
                     //Question itself (use a 100-chars long title and a larger description)
313
-                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)) . '...';
313
+                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)).'...';
314 314
                     $exercise_info['question'][$question_index]['description'] = $info;
315 315
                 }
316 316
             } else {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
     $total_questions = count($exercise_info['question']);
322 322
     $total_weight = (!empty($_POST['total_weight'])) ? intval($_POST['total_weight']) : 20;
323
-    foreach  ($exercise_info['question'] as $key => $question) {
323
+    foreach ($exercise_info['question'] as $key => $question) {
324 324
         $exercise_info['question'][$key]['weighting'][current(array_keys($exercise_info['question'][$key]['weighting']))] = $total_weight / $total_questions;
325 325
     }
326 326
     return true;
Please login to merge, or discard this patch.
main/exercise/export/exercise_import.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@
 block discarded – undo
74 74
 Display::display_introduction_section(
75 75
     TOOL_QUIZ,
76 76
     array(
77
-		'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
77
+        'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
78 78
         'CreateDocumentDir' => '../../..'.api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/',
79
-		'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
80
-	)
79
+        'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
80
+    )
81 81
 );
82 82
 
83 83
 // Display Forms or dialog box(if needed)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@  discard block
 block discarded – undo
29 29
 $interbredcrump[] = array('url' => '../exercise.php', 'name' => get_lang('Exercises'));
30 30
 
31 31
 // EXECUTE COMMAND
32
-$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import');
32
+$cmd = (isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'show_import');
33 33
 
34 34
 switch ($cmd) {
35 35
     case 'show_import' :
36 36
     {
37 37
         $display = '<p>'
38
-        .            get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . '<br>'
38
+        .            get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.').'<br>'
39 39
         .            '</p>'
40 40
         .            '<form enctype="multipart/form-data" action="" method="post">'
41 41
         .            '<input name="cmd" type="hidden" value="import" />'
42 42
         .            '<input name="uploadedExercise" type="file" /><br><br>'
43
-        .            get_lang('Import exercise') . ' : '
44
-        .            '<input value="' . get_lang('Ok') . '" type="submit" /> '
45
-        .            claro_html_button( $_SERVER['PHP_SELF'], get_lang('Cancel'))
43
+        .            get_lang('Import exercise').' : '
44
+        .            '<input value="'.get_lang('Ok').'" type="submit" /> '
45
+        .            claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel'))
46 46
         .            '<br><br>'
47
-        .            '<small>' . get_lang('Max file size') . ' :  2&nbsp;MB</small>'
47
+        .            '<small>'.get_lang('Max file size').' :  2&nbsp;MB</small>'
48 48
         .            '</form>';
49 49
     }
50 50
     break;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 
69 69
 // DISPLAY
70
-include api_get_path(SYS_INC_PATH) . '/header.inc.php';
70
+include api_get_path(SYS_INC_PATH).'/header.inc.php';
71 71
 
72 72
 // Tool introduction
73 73
 // TODO: These settings to be checked when it is possible.
@@ -91,4 +91,4 @@  discard block
 block discarded – undo
91 91
     echo $display;
92 92
 }
93 93
 
94
-include api_get_path(SYS_INC_PATH) . '/footer.inc.php';
94
+include api_get_path(SYS_INC_PATH).'/footer.inc.php';
Please login to merge, or discard this patch.
main/exercise/export/qti2/qti2_export.php 2 patches
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.
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @param Ims2Question $question Ims2Question object we want to export.
36 36
      */
37
-     function __construct($question)
38
-     {
37
+        function __construct($question)
38
+        {
39 39
         $this->question = $question;
40 40
         $this->answer = $this->question->setAnswer();
41 41
         $this->questionIdent = "QST_" . $question->id ;
42
-     }
43
-
44
-     /**
45
-      * Start the XML flow.
46
-      *
47
-      * This opens the <item> block, with correct attributes.
48
-      *
49
-      */
50
-      function start_item()
51
-      {
42
+        }
43
+
44
+        /**
45
+         * Start the XML flow.
46
+         *
47
+         * This opens the <item> block, with correct attributes.
48
+         *
49
+         */
50
+        function start_item()
51
+        {
52 52
         $string = '<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
53 53
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
54 54
                     xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 imsqti_v2p1.xsd"
@@ -56,55 +56,55 @@  discard block
 block discarded – undo
56 56
                     title="'.htmlspecialchars(formatExerciseQtiTitle($this->question->selectTitle())).'">'."\n";
57 57
 
58 58
         return $string;
59
-      }
60
-
61
-      /**
62
-       * End the XML flow, closing the </item> tag.
63
-       *
64
-       */
65
-      function end_item()
66
-      {
59
+        }
60
+
61
+        /**
62
+         * End the XML flow, closing the </item> tag.
63
+         *
64
+         */
65
+        function end_item()
66
+        {
67 67
         return "</assessmentItem>\n";
68
-      }
69
-
70
-     /**
71
-      * Start the itemBody
72
-      *
73
-      */
74
-     function start_item_body()
75
-     {
68
+        }
69
+
70
+        /**
71
+         * Start the itemBody
72
+         *
73
+         */
74
+        function start_item_body()
75
+        {
76 76
         return '  <itemBody>' . "\n";
77
-     }
78
-
79
-     /**
80
-      * End the itemBody part.
81
-      *
82
-      */
83
-     function end_item_body()
84
-     {
77
+        }
78
+
79
+        /**
80
+         * End the itemBody part.
81
+         *
82
+         */
83
+        function end_item_body()
84
+        {
85 85
         return "  </itemBody>\n";
86
-     }
87
-
88
-     /**
89
-      * add the response processing template used.
90
-      *
91
-      */
92
-
93
-      function add_response_processing()
94
-      {
95
-          return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
96
-      }
97
-
98
-     /**
99
-      * Export the question as an IMS/QTI Item.
100
-      *
101
-      * This is a default behaviour, some classes may want to override this.
102
-      *
103
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
104
-      * @return string string, the XML flow for an Item.
105
-      */
106
-     function export($standalone = false)
107
-     {
86
+        }
87
+
88
+        /**
89
+         * add the response processing template used.
90
+         *
91
+         */
92
+
93
+        function add_response_processing()
94
+        {
95
+            return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
96
+        }
97
+
98
+        /**
99
+         * Export the question as an IMS/QTI Item.
100
+         *
101
+         * This is a default behaviour, some classes may want to override this.
102
+         *
103
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
104
+         * @return string string, the XML flow for an Item.
105
+         */
106
+        function export($standalone = false)
107
+        {
108 108
         $head = $foot = "";
109 109
 
110 110
         if ($standalone) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             .$foot;
132 132
 
133 133
         return $res;
134
-     }
134
+        }
135 135
 }
136 136
 
137 137
 /**
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
     function export_presentation()
195 195
     {
196 196
         $out = "<presentation_material><flow_mat><material>\n"
197
-             . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
198
-             . "</material></flow_mat></presentation_material>\n";
197
+                . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
198
+                . "</material></flow_mat></presentation_material>\n";
199 199
         return $out;
200 200
     }
201 201
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
         $out = '';
210 210
         if ($n = $this->exercise->getShuffle()) {
211 211
             $out.= "<selection_ordering>"
212
-                 . "  <selection>\n"
213
-                 . "    <selection_number>" . $n . "</selection_number>\n"
214
-                 . "  </selection>\n"
215
-                 . '  <order order_type="Random" />'
216
-                 . "\n</selection_ordering>\n";
212
+                    . "  <selection>\n"
213
+                    . "    <selection_number>" . $n . "</selection_number>\n"
214
+                    . "  </selection>\n"
215
+                    . '  <order order_type="Random" />'
216
+                    . "\n</selection_ordering>\n";
217 217
         } else {
218 218
             $out.= '<selection_ordering sequence_type="Normal">' . "\n"
219
-                 . "  <selection />\n"
220
-                 . "</selection_ordering>\n";
219
+                    . "  <selection />\n"
220
+                    . "</selection_ordering>\n";
221 221
         }
222 222
 
223 223
         return $out;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     {
232 232
         $out = "";
233 233
         foreach ($this->exercise->selectQuestionList() as $q) {
234
-        	$out .= export_question_qti($q, false);
234
+            $out .= export_question_qti($q, false);
235 235
         }
236 236
         return $out;
237 237
     }
@@ -248,18 +248,18 @@  discard block
 block discarded – undo
248 248
         $head = $foot = "";
249 249
         if ($standalone) {
250 250
             $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n"
251
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
252
-                  . "<questestinterop>\n";
251
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
252
+                    . "<questestinterop>\n";
253 253
             $foot = "</questestinterop>\n";
254 254
         }
255 255
         $out = $head
256
-             . $this->start_section()
257
-             . $this->export_duration()
258
-             . $this->export_presentation()
259
-             . $this->export_ordering()
260
-             . $this->export_questions()
261
-             . $this->end_section()
262
-             . $foot;
256
+                . $this->start_section()
257
+                . $this->export_duration()
258
+                . $this->export_presentation()
259
+                . $this->export_ordering()
260
+                . $this->export_questions()
261
+                . $this->end_section()
262
+                . $foot;
263 263
 
264 264
         return $out;
265 265
     }
@@ -306,97 +306,97 @@  discard block
 block discarded – undo
306 306
      * @return ImsItem
307 307
      * @author Anamd Tihon
308 308
      */
309
-     function __construct($question)
310
-     {
309
+        function __construct($question)
310
+        {
311 311
         $this->question = $question;
312 312
         $this->answer = $question->answer;
313 313
         $this->questionIdent = "QST_" . $question->selectId() ;
314
-     }
315
-
316
-     /**
317
-      * Start the XML flow.
318
-      *
319
-      * This opens the <item> block, with correct attributes.
320
-      *
321
-      * @author Amand Tihon <[email protected]>
322
-      */
323
-      function start_item()
324
-      {
314
+        }
315
+
316
+        /**
317
+         * Start the XML flow.
318
+         *
319
+         * This opens the <item> block, with correct attributes.
320
+         *
321
+         * @author Amand Tihon <[email protected]>
322
+         */
323
+        function start_item()
324
+        {
325 325
         return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n";
326
-      }
327
-
328
-      /**
329
-       * End the XML flow, closing the </item> tag.
330
-       *
331
-       * @author Amand Tihon <[email protected]>
332
-       */
333
-      function end_item()
334
-      {
326
+        }
327
+
328
+        /**
329
+         * End the XML flow, closing the </item> tag.
330
+         *
331
+         * @author Amand Tihon <[email protected]>
332
+         */
333
+        function end_item()
334
+        {
335 335
         return "</item>\n";
336
-      }
337
-
338
-     /**
339
-      * Create the opening, with the question itself.
340
-      *
341
-      * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
342
-      * In between, the export_responses from the subclass should have been called.
343
-      *
344
-      * @author Amand Tihon <[email protected]>
345
-      */
346
-     function start_presentation()
347
-     {
336
+        }
337
+
338
+        /**
339
+         * Create the opening, with the question itself.
340
+         *
341
+         * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
342
+         * In between, the export_responses from the subclass should have been called.
343
+         *
344
+         * @author Amand Tihon <[email protected]>
345
+         */
346
+        function start_presentation()
347
+        {
348 348
         return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n"
349
-             . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
350
-     }
351
-
352
-     /**
353
-      * End the </presentation> part, opened by export_header.
354
-      *
355
-      * @author Amand Tihon <[email protected]>
356
-      */
357
-     function end_presentation()
358
-     {
349
+                . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
350
+        }
351
+
352
+        /**
353
+         * End the </presentation> part, opened by export_header.
354
+         *
355
+         * @author Amand Tihon <[email protected]>
356
+         */
357
+        function end_presentation()
358
+        {
359 359
         return "</flow></presentation>\n";
360
-     }
361
-
362
-     /**
363
-      * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
364
-      *
365
-      * @author Amand Tihon <[email protected]>
366
-      */
367
-     function start_processing()
368
-     {
360
+        }
361
+
362
+        /**
363
+         * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
364
+         *
365
+         * @author Amand Tihon <[email protected]>
366
+         */
367
+        function start_processing()
368
+        {
369 369
         return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n";
370
-     }
371
-
372
-     /**
373
-      * End the response processing part.
374
-      *
375
-      * @author Amand Tihon <[email protected]>
376
-      */
377
-     function end_processing()
378
-     {
370
+        }
371
+
372
+        /**
373
+         * End the response processing part.
374
+         *
375
+         * @author Amand Tihon <[email protected]>
376
+         */
377
+        function end_processing()
378
+        {
379 379
         return "</resprocessing>\n";
380
-     }
381
-
382
-     /**
383
-      * Export the question as an IMS/QTI Item.
384
-      *
385
-      * This is a default behaviour, some classes may want to override this.
386
-      *
387
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
388
-      * @return string string, the XML flow for an Item.
389
-      * @author Amand Tihon <[email protected]>
390
-      */
391
-     function export($standalone = False)
392
-     {
380
+        }
381
+
382
+        /**
383
+         * Export the question as an IMS/QTI Item.
384
+         *
385
+         * This is a default behaviour, some classes may want to override this.
386
+         *
387
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
388
+         * @return string string, the XML flow for an Item.
389
+         * @author Amand Tihon <[email protected]>
390
+         */
391
+        function export($standalone = False)
392
+        {
393 393
         global $charset;
394 394
         $head = $foot = "";
395 395
 
396 396
         if ($standalone) {
397 397
             $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n"
398
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
399
-                  . "<questestinterop>\n";
398
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
399
+                    . "<questestinterop>\n";
400 400
             $foot = "</questestinterop>\n";
401 401
         }
402 402
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
             . $this->answer->imsExportFeedback($this->questionIdent)
412 412
             . $this->end_item()
413 413
             . $foot;
414
-     }
414
+        }
415 415
 }
416 416
 
417 417
 /**
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
     $question->type = $qst->type;
451 451
     $question->question = $qst->question;
452 452
     $question->description = $qst->description;
453
-	$question->weighting=$qst->weighting;
454
-	$question->position=$qst->position;
455
-	$question->picture=$qst->picture;
453
+    $question->weighting=$qst->weighting;
454
+    $question->position=$qst->position;
455
+    $question->picture=$qst->picture;
456 456
     $ims = new ImsAssessmentItem($question);
457 457
 
458 458
     return $ims->export($standalone);
Please login to merge, or discard this patch.
main/exercise/Hpdownload.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 session_cache_limiter('public');
13 13
 
14 14
 require_once '../inc/global.inc.php';
15
-$this_section=SECTION_COURSES;
15
+$this_section = SECTION_COURSES;
16 16
 
17 17
 $tbl_document = Database::get_course_table(TABLE_DOCUMENT);
18 18
 
19
-$doc_url=str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldecode($_GET['doc_url']));
20
-$filename=basename($doc_url);
19
+$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($_GET['doc_url']));
20
+$filename = basename($doc_url);
21 21
 
22 22
 // launch event
23 23
 //Event::event_download($doc_url);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	$full_file_name = $course_path.Security::remove_XSS($doc_url);
30 30
 }
31 31
 
32
-if(!is_file($full_file_name)) {
32
+if (!is_file($full_file_name)) {
33 33
 	exit;
34 34
 }
35 35
 
@@ -37,26 +37,26 @@  discard block
 block discarded – undo
37 37
     exit;
38 38
 }
39 39
 
40
-$extension=explode('.',$filename);
41
-$extension=strtolower($extension[sizeof($extension)-1]);
42
-
43
-switch($extension) {
44
-	case 'gz':		$content_type='application/x-gzip';			break;
45
-	case 'zip':		$content_type='application/zip';			break;
46
-	case 'pdf':		$content_type='application/pdf';			break;
47
-	case 'png':		$content_type='image/png';					break;
48
-	case 'gif':		$content_type='image/gif';					break;
49
-	case 'jpg':		$content_type='image/jpeg';					break;
50
-	case 'txt':		$content_type='text/plain';					break;
51
-	case 'htm':		$content_type='text/html';					break;
52
-	case 'html':	$content_type='text/html';					break;
53
-	default:		$content_type='application/octet-stream';	break;
40
+$extension = explode('.', $filename);
41
+$extension = strtolower($extension[sizeof($extension) - 1]);
42
+
43
+switch ($extension) {
44
+	case 'gz':		$content_type = 'application/x-gzip'; break;
45
+	case 'zip':		$content_type = 'application/zip'; break;
46
+	case 'pdf':		$content_type = 'application/pdf'; break;
47
+	case 'png':		$content_type = 'image/png'; break;
48
+	case 'gif':		$content_type = 'image/gif'; break;
49
+	case 'jpg':		$content_type = 'image/jpeg'; break;
50
+	case 'txt':		$content_type = 'text/plain'; break;
51
+	case 'htm':		$content_type = 'text/html'; break;
52
+	case 'html':	$content_type = 'text/html'; break;
53
+	default:		$content_type = 'application/octet-stream'; break;
54 54
 }
55 55
 
56 56
 header('Content-disposition: filename='.$filename);
57 57
 header('Content-Type: '.$content_type);
58
-header('Expires: '.gmdate('D, d M Y H:i:s',time()+10).' GMT');
59
-header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()+10).' GMT');
58
+header('Expires: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT');
59
+header('Last-Modified: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT');
60 60
 
61 61
 /*
62 62
 	Dynamic parsing section
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 if ($content_type == 'text/html') {
71 71
 	$directory_name = dirname($full_file_name);
72 72
 
73
-	$dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name);
73
+	$dir = str_replace(array('\\', $_configuration['root_sys']."courses/".$_course['path'].'/document'), array('/', ''), $directory_name);
74 74
 
75
-	if($dir[strlen($dir)-1] != '/') {
76
-		$dir.='/';
75
+	if ($dir[strlen($dir) - 1] != '/') {
76
+		$dir .= '/';
77 77
 	}
78 78
 
79 79
 
80 80
 	//Parse whole file at one
81 81
 	$fp = fopen($full_file_name, "r");
82
-	$file_content = fread ($fp, filesize ($full_file_name));
82
+	$file_content = fread($fp, filesize($full_file_name));
83 83
 	fclose($fp);
84 84
 	//$file_content = api_replace_parameter($dir, $file_content, "src");
85 85
 	//$file_content = api_replace_parameter($dir, $file_content, "href");
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
 
100 100
     $exercisePath = api_get_self();
101
-  	$exfile = explode('/',$exercisePath);
102
-  	$exfile = $exfile[sizeof($exfile)-1];
103
-  	$exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile));
101
+  	$exfile = explode('/', $exercisePath);
102
+  	$exfile = $exfile[sizeof($exfile) - 1];
103
+  	$exercisePath = substr($exercisePath, 0, strpos($exercisePath, $exfile));
104 104
   	$exercisePath = $exercisePath;
105 105
 
106 106
 		$content = $file_content;
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 "// Must be included \n".
126 126
 "function Finish(){\n".
127 127
 " mySaveScore();";
128
-		$newcontent = str_replace($mit,$js_content,$content);
128
+		$newcontent = str_replace($mit, $js_content, $content);
129 129
 
130
-		$prehref="javascript:void(0);";
131
-		$posthref = api_get_path(WEB_CODE_PATH) . "main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
132
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
130
+		$prehref = "javascript:void(0);";
131
+		$posthref = api_get_path(WEB_CODE_PATH)."main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
132
+		$newcontent = str_replace($prehref, $posthref, $newcontent);
133 133
 
134 134
 
135
-		$prehref="class=\"GridNum\" onclick=";
136
-		$posthref="class=\"GridNum\" onMouseover=";
137
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
135
+		$prehref = "class=\"GridNum\" onclick=";
136
+		$posthref = "class=\"GridNum\" onMouseover=";
137
+		$newcontent = str_replace($prehref, $posthref, $newcontent);
138 138
 
139 139
 
140 140
 		header('Content-length: '.strlen($newcontent));
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 //normal case, all non-html files
148 148
 //header('Content-length: '.filesize($full_file_name));
149
-$fp=fopen($full_file_name,'rb');
149
+$fp = fopen($full_file_name, 'rb');
150 150
 fpassthru($fp);
151 151
 fclose($fp);
152 152
 ?>
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 //Event::event_download($doc_url);
24 24
 if (isset($_course['path'])) {
25 25
     $course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
26
-	$full_file_name = $course_path.Security::remove_XSS($doc_url);
26
+    $full_file_name = $course_path.Security::remove_XSS($doc_url);
27 27
 } else {
28 28
     $course_path = api_get_path(SYS_COURSE_PATH).$cid.'/document';
29
-	$full_file_name = $course_path.Security::remove_XSS($doc_url);
29
+    $full_file_name = $course_path.Security::remove_XSS($doc_url);
30 30
 }
31 31
 
32 32
 if(!is_file($full_file_name)) {
33
-	exit;
33
+    exit;
34 34
 }
35 35
 
36 36
 if (!Security::check_abs_path($full_file_name, $course_path.'/')) {
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 $extension=strtolower($extension[sizeof($extension)-1]);
42 42
 
43 43
 switch($extension) {
44
-	case 'gz':		$content_type='application/x-gzip';			break;
45
-	case 'zip':		$content_type='application/zip';			break;
46
-	case 'pdf':		$content_type='application/pdf';			break;
47
-	case 'png':		$content_type='image/png';					break;
48
-	case 'gif':		$content_type='image/gif';					break;
49
-	case 'jpg':		$content_type='image/jpeg';					break;
50
-	case 'txt':		$content_type='text/plain';					break;
51
-	case 'htm':		$content_type='text/html';					break;
52
-	case 'html':	$content_type='text/html';					break;
53
-	default:		$content_type='application/octet-stream';	break;
44
+    case 'gz':		$content_type='application/x-gzip';			break;
45
+    case 'zip':		$content_type='application/zip';			break;
46
+    case 'pdf':		$content_type='application/pdf';			break;
47
+    case 'png':		$content_type='image/png';					break;
48
+    case 'gif':		$content_type='image/gif';					break;
49
+    case 'jpg':		$content_type='image/jpeg';					break;
50
+    case 'txt':		$content_type='text/plain';					break;
51
+    case 'htm':		$content_type='text/html';					break;
52
+    case 'html':	$content_type='text/html';					break;
53
+    default:		$content_type='application/octet-stream';	break;
54 54
 }
55 55
 
56 56
 header('Content-disposition: filename='.$filename);
@@ -68,30 +68,30 @@  discard block
 block discarded – undo
68 68
 */
69 69
 
70 70
 if ($content_type == 'text/html') {
71
-	$directory_name = dirname($full_file_name);
71
+    $directory_name = dirname($full_file_name);
72 72
 
73
-	$dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name);
73
+    $dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name);
74 74
 
75
-	if($dir[strlen($dir)-1] != '/') {
76
-		$dir.='/';
77
-	}
75
+    if($dir[strlen($dir)-1] != '/') {
76
+        $dir.='/';
77
+    }
78 78
 
79 79
 
80
-	//Parse whole file at one
81
-	$fp = fopen($full_file_name, "r");
82
-	$file_content = fread ($fp, filesize ($full_file_name));
83
-	fclose($fp);
80
+    //Parse whole file at one
81
+    $fp = fopen($full_file_name, "r");
82
+    $file_content = fread ($fp, filesize ($full_file_name));
83
+    fclose($fp);
84 84
     $exercisePath = api_get_self();
85
-  	$exfile = explode('/',$exercisePath);
86
-  	$exfile = $exfile[sizeof($exfile)-1];
87
-  	$exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile));
88
-  	$exercisePath = $exercisePath;
85
+        $exfile = explode('/',$exercisePath);
86
+        $exfile = $exfile[sizeof($exfile)-1];
87
+        $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile));
88
+        $exercisePath = $exercisePath;
89 89
 
90
-		$content = $file_content;
91
-		$mit = "function Finish(){";
90
+        $content = $file_content;
91
+        $mit = "function Finish(){";
92 92
 
93
-		$js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n".
94
-		"function mySaveScore() // This function included by Dokeos System\n".
93
+        $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n".
94
+        "function mySaveScore() // This function included by Dokeos System\n".
95 95
 "{\n".
96 96
 "   if (SaveScoreVariable==0)\n".
97 97
 "		{\n".
@@ -109,23 +109,23 @@  discard block
 block discarded – undo
109 109
 "// Must be included \n".
110 110
 "function Finish(){\n".
111 111
 " mySaveScore();";
112
-		$newcontent = str_replace($mit,$js_content,$content);
112
+        $newcontent = str_replace($mit,$js_content,$content);
113 113
 
114
-		$prehref="javascript:void(0);";
115
-		$posthref = api_get_path(WEB_CODE_PATH) . "main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
116
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
114
+        $prehref="javascript:void(0);";
115
+        $posthref = api_get_path(WEB_CODE_PATH) . "main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
116
+        $newcontent = str_replace($prehref,$posthref,$newcontent);
117 117
 
118 118
 
119
-		$prehref="class=\"GridNum\" onclick=";
120
-		$posthref="class=\"GridNum\" onMouseover=";
121
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
119
+        $prehref="class=\"GridNum\" onclick=";
120
+        $posthref="class=\"GridNum\" onMouseover=";
121
+        $newcontent = str_replace($prehref,$posthref,$newcontent);
122 122
 
123 123
 
124
-		header('Content-length: '.strlen($newcontent));
125
-		// Dipsp.
126
-		echo $newcontent;
124
+        header('Content-length: '.strlen($newcontent));
125
+        // Dipsp.
126
+        echo $newcontent;
127 127
 
128
-	exit();
128
+    exit();
129 129
 }
130 130
 
131 131
 //normal case, all non-html files
Please login to merge, or discard this patch.
main/exercise/exercise_submit.php 3 patches
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     if (!$objExercise->read($exerciseId) ||
124 124
         (!$objExercise->selectStatus() && !$is_allowedToEdit && $origin != 'learnpath')
125 125
     ) {
126
-    	if ($debug) {error_log('1.1. Error while reading the exercise'); };
126
+        if ($debug) {error_log('1.1. Error while reading the exercise'); };
127 127
         unset ($objExercise);
128 128
         $error = get_lang('ExerciseNotFound');
129 129
     } else {
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 }
137 137
 //2. Checking if $objExercise is set
138 138
 if (!isset($objExercise) && isset($exerciseInSession)) {
139
-	if ($debug) { error_log('2. Loading $objExercise from session'); };
139
+    if ($debug) { error_log('2. Loading $objExercise from session'); };
140 140
     $objExercise = $exerciseInSession;
141 141
 }
142 142
 
143 143
 //3. $objExercise is not set, then return to the exercise list
144 144
 if (!is_object($objExercise)) {
145
-	if ($debug) {error_log('3. $objExercise was not set, kill the script'); };
145
+    if ($debug) {error_log('3. $objExercise was not set, kill the script'); };
146 146
     header('Location: exercise.php');
147 147
     exit;
148 148
 }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 $time_control = false;
165 165
 if ($objExercise->expired_time != 0) {
166
-	$time_control = true;
166
+    $time_control = true;
167 167
 }
168 168
 
169 169
 // Generating the time control key for the user
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
173 173
 
174 174
 if ($time_control) {
175
-	// Get the expired time of the current exercise in track_e_exercises
176
-	$total_seconds = $objExercise->expired_time*60;
175
+    // Get the expired time of the current exercise in track_e_exercises
176
+    $total_seconds = $objExercise->expired_time*60;
177 177
 }
178 178
 
179 179
 $show_clock = true;
180 180
 $user_id = api_get_user_id();
181 181
 if ($objExercise->selectAttempts() > 0) {
182
-	$attempt_html = '';
182
+    $attempt_html = '';
183 183
     $attempt_count = Event::get_attempt_count(
184 184
         $user_id,
185 185
         $exerciseId,
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
         $learnpath_item_view_id
189 189
     );
190 190
 
191
-	if ($attempt_count >= $objExercise->selectAttempts()) {
192
-		$show_clock = false;
193
-		if (!api_is_allowed_to_edit(null,true)) {
191
+    if ($attempt_count >= $objExercise->selectAttempts()) {
192
+        $show_clock = false;
193
+        if (!api_is_allowed_to_edit(null,true)) {
194 194
             if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
195 195
 
196 196
                 // Showing latest attempt according with task BT#1628
@@ -229,31 +229,31 @@  discard block
 block discarded – undo
229 229
                             $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore'));
230 230
                         }
231 231
                     }
232
-					$score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
233
-					$attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
234
-				} else {
235
-					$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
236
-				}
237
-			} else {
238
-				$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
239
-			}
240
-		} else {
241
-			$attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
242
-		}
232
+                    $score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
233
+                    $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
234
+                } else {
235
+                    $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
236
+                }
237
+            } else {
238
+                $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
239
+            }
240
+        } else {
241
+            $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
242
+        }
243 243
 
244
-		if ($origin == 'learnpath') {
245
-			Display :: display_reduced_header();
246
-		} else {
247
-			Display :: display_header(get_lang('Exercises'));
248
-		}
244
+        if ($origin == 'learnpath') {
245
+            Display :: display_reduced_header();
246
+        } else {
247
+            Display :: display_header(get_lang('Exercises'));
248
+        }
249 249
 
250
-		echo $attempt_html;
250
+        echo $attempt_html;
251 251
 
252 252
         if ($origin != 'learnpath') {
253 253
             Display:: display_footer();
254 254
         }
255
-		exit;
256
-	}
255
+        exit;
256
+    }
257 257
 }
258 258
 
259 259
 if ($debug) {
@@ -277,26 +277,26 @@  discard block
 block discarded – undo
277 277
 
278 278
 if (empty($exercise_stat_info)) {
279 279
     if ($debug)  error_log('5  $exercise_stat_info is empty ');
280
-	$total_weight = 0;
281
-	$questionList = $objExercise->get_validated_question_list();
282
-	foreach ($questionListUncompressed as $question_id) {
283
-		$objQuestionTmp = Question::read($question_id);
284
-		$total_weight += floatval($objQuestionTmp->weighting);
285
-	}
280
+    $total_weight = 0;
281
+    $questionList = $objExercise->get_validated_question_list();
282
+    foreach ($questionListUncompressed as $question_id) {
283
+        $objQuestionTmp = Question::read($question_id);
284
+        $total_weight += floatval($objQuestionTmp->weighting);
285
+    }
286 286
 
287
-	if ($time_control) {
288
-		$expected_time = $current_timestamp + $total_seconds;
287
+    if ($time_control) {
288
+        $expected_time = $current_timestamp + $total_seconds;
289 289
 
290
-		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
291
-		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
290
+        if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
291
+        if ($debug)  error_log('5.2. $expected_time '.$expected_time);
292 292
 
293
-		$clock_expired_time 	= api_get_utc_datetime($expected_time);
294
-		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
293
+        $clock_expired_time 	= api_get_utc_datetime($expected_time);
294
+        if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
295 295
 
296
-		//Sessions  that contain the expired time
297
-		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
298
-		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
299
-	}
296
+        //Sessions  that contain the expired time
297
+        $_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
298
+        if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
299
+    }
300 300
 
301 301
     $exe_id = $objExercise->save_stat_track_exercise_info(
302 302
         $clock_expired_time,
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     );
314 314
     if ($debug)  error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
315 315
 } else {
316
-	$exe_id = $exercise_stat_info['exe_id'];
316
+    $exe_id = $exercise_stat_info['exe_id'];
317 317
     // Remember last question id position.
318 318
     $isFirstTime = Session::read('firstTime');
319 319
     if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) {
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called::  '.print_r($exercise_stat_info, 1)); };
373 373
 
374 374
 if (!empty($exercise_stat_info['questions_to_check'])) {
375
-	$my_remind_list = $exercise_stat_info['questions_to_check'];
376
-	$my_remind_list = explode(',', $my_remind_list);
377
-	$my_remind_list = array_filter($my_remind_list);
375
+    $my_remind_list = $exercise_stat_info['questions_to_check'];
376
+    $my_remind_list = explode(',', $my_remind_list);
377
+    $my_remind_list = array_filter($my_remind_list);
378 378
 }
379 379
 
380 380
 $params = "exe_id=$exe_id&exerciseId=$exerciseId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id&".api_get_cidreq();
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 
383 383
 if ($reminder == 2 && empty($my_remind_list)) {
384 384
     if ($debug) { error_log("6.2 calling the exercise_reminder.php "); };
385
-	header('Location: exercise_reminder.php?'.$params);
386
-	exit;
385
+    header('Location: exercise_reminder.php?'.$params);
386
+    exit;
387 387
 }
388 388
 
389 389
 /*
@@ -391,56 +391,56 @@  discard block
 block discarded – undo
391 391
  * If the expired time is major that zero(0) then the expired time is compute on this time.
392 392
  */
393 393
 if ($time_control) {
394
-	if ($debug) error_log('7.1. Time control is enabled');
395
-	if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
396
-	if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
394
+    if ($debug) error_log('7.1. Time control is enabled');
395
+    if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
396
+    if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
397 397
 
398 398
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
399 399
         //Timer - Get expired_time for a student
400 400
         if (!empty($exercise_stat_info)) {
401
-        	if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); };
402
-	        $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
403
-			if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
404
-	        // Get the last attempt of an exercise
405
-	    	$last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
401
+            if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); };
402
+            $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
403
+            if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
404
+            // Get the last attempt of an exercise
405
+            $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
406 406
 
407
-	    	/* This means that the user enters the exam but do not answer the
407
+            /* This means that the user enters the exam but do not answer the
408 408
 	    	   first question we get the date from the track_e_exercises not from
409 409
 	    	   the track_et_attempt see #2069 */
410
-	    	if (empty($last_attempt_date)) {
411
-	    		$diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
412
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
413
-	    	} else {
414
-	    		//Recalculate the time control due #2069
415
-	    		$diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
416
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
417
-	    	}
418
-	        if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
419
-
420
-	        //New expired time - it is due to the possible closure of session
421
-	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
422
-	        if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
423
-
424
-	        $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
425
-	        if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
426
-
427
-	        $clock_expired_time  = api_get_utc_datetime($expected_time);
428
-	        if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
429
-
430
-			// First we update the attempt to today
431
-			/* How the expired time is changed into "track_e_exercises" table,
410
+            if (empty($last_attempt_date)) {
411
+                $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
412
+                $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
413
+            } else {
414
+                //Recalculate the time control due #2069
415
+                $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
416
+                $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
417
+            }
418
+            if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
419
+
420
+            //New expired time - it is due to the possible closure of session
421
+            $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
422
+            if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
423
+
424
+            $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
425
+            if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
426
+
427
+            $clock_expired_time  = api_get_utc_datetime($expected_time);
428
+            if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
429
+
430
+            // First we update the attempt to today
431
+            /* How the expired time is changed into "track_e_exercises" table,
432 432
                then the last attempt for this student should be changed too */
433
-	        $sql = "UPDATE $exercise_attempt_table SET
433
+            $sql = "UPDATE $exercise_attempt_table SET
434 434
 	                tms = '".api_get_utc_datetime()."'
435 435
 	                WHERE
436 436
 	                    exe_id = '".$exercise_stat_info['exe_id']."' AND
437 437
 	                    tms = '".$last_attempt_date."' ";
438
-	        if ($debug) {error_log('7.10. $sql: '.$sql); }
439
-	        Database::query($sql);
438
+            if ($debug) {error_log('7.10. $sql: '.$sql); }
439
+            Database::query($sql);
440 440
 
441
-	        //Sessions  that contain the expired time
442
-	        $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
443
-	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
441
+            //Sessions  that contain the expired time
442
+            $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
443
+            if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
444 444
         }
445 445
     } else {
446 446
         $clock_expired_time =  $_SESSION['expired_time'][$current_expired_time_key];
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
  * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock
458 458
  */
459 459
 if ($time_control) { //Sends the exercise form when the expired time is finished
460
-	$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
460
+    $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
461 461
 }
462 462
 
463 463
 // if the user has submitted the form
@@ -470,14 +470,14 @@  discard block
 block discarded – undo
470 470
     // selects the list of question ID
471 471
     $questionList = $objExercise->get_validated_question_list();
472 472
     if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) {
473
-    	$questionList = explode(',', $exercise_stat_info['data_tracking']);
473
+        $questionList = explode(',', $exercise_stat_info['data_tracking']);
474 474
     }
475 475
     Session::write('questionList', $questionList);
476 476
     if ($debug > 0) { error_log('$_SESSION[questionList] was set'); }
477 477
 } else {
478
-	if (isset($objExercise) && isset($_SESSION['objExercise'])) {
479
-    	$questionList = $_SESSION['questionList'];
480
-	}
478
+    if (isset($objExercise) && isset($_SESSION['objExercise'])) {
479
+        $questionList = $_SESSION['questionList'];
480
+    }
481 481
 }
482 482
 
483 483
 if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1));
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 //Real question count
486 486
 $question_count = 0;
487 487
 if (!empty($questionList)) {
488
-	$question_count = count($questionList);
488
+    $question_count = count($questionList);
489 489
 }
490 490
 
491 491
 if ($formSent && isset($_POST)) {
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
                 //saving each question
528 528
                 if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) {
529 529
                     $nro_question = $current_question; // - 1;
530
-                 	$questionId   = $key;
530
+                        $questionId   = $key;
531 531
                     // gets the student choice for this question
532 532
                     $choice = $exerciseResult[$questionId];
533 533
                     if (isset($exe_id)) {
534
-                    	// Manage the question and answer attempts
534
+                        // Manage the question and answer attempts
535 535
                         if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); }
536 536
                         $objExercise->manage_answer(
537 537
                             $exe_id,
@@ -620,58 +620,58 @@  discard block
 block discarded – undo
620 620
 }
621 621
 
622 622
 if ($question_count != 0) {
623
-	if (($objExercise->type == ALL_ON_ONE_PAGE ||
623
+    if (($objExercise->type == ALL_ON_ONE_PAGE ||
624 624
         $current_question > $question_count)
625 625
     ) {
626
-	    if (api_is_allowed_to_session_edit()) {
627
-	        // goes to the script that will show the result of the exercise
628
-	        if ($objExercise->type == ALL_ON_ONE_PAGE) {
629
-	            if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); }
630
-
631
-	            //We check if the user attempts before sending to the exercise_result.php
632
-	            if ($objExercise->selectAttempts() > 0) {
633
-	                $attempt_count = Event::get_attempt_count(
626
+        if (api_is_allowed_to_session_edit()) {
627
+            // goes to the script that will show the result of the exercise
628
+            if ($objExercise->type == ALL_ON_ONE_PAGE) {
629
+                if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); }
630
+
631
+                //We check if the user attempts before sending to the exercise_result.php
632
+                if ($objExercise->selectAttempts() > 0) {
633
+                    $attempt_count = Event::get_attempt_count(
634 634
                         api_get_user_id(),
635 635
                         $exerciseId,
636 636
                         $learnpath_id,
637 637
                         $learnpath_item_id,
638 638
                         $learnpath_item_view_id
639 639
                     );
640
-	                if ($attempt_count >= $objExercise->selectAttempts()) {
641
-	                    Display :: display_warning_message(
640
+                    if ($attempt_count >= $objExercise->selectAttempts()) {
641
+                        Display :: display_warning_message(
642 642
                             sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()),
643 643
                             false
644 644
                         );
645
-	                    if ($origin != 'learnpath') {
646
-	                        //so we are not in learnpath tool
647
-	                        echo '</div>'; //End glossary div
648
-	                        Display :: display_footer();
649
-	                    } else {
650
-	                        echo '</body></html>';
651
-	                    }
652
-	                    exit;
653
-	                }
654
-	            }
655
-	        } else {
656
-	            if ($objExercise->review_answers) {
657
-	            	header('Location: exercise_reminder.php?'.$params);
658
-	            	exit;
659
-	            } else {
645
+                        if ($origin != 'learnpath') {
646
+                            //so we are not in learnpath tool
647
+                            echo '</div>'; //End glossary div
648
+                            Display :: display_footer();
649
+                        } else {
650
+                            echo '</body></html>';
651
+                        }
652
+                        exit;
653
+                    }
654
+                }
655
+            } else {
656
+                if ($objExercise->review_answers) {
657
+                    header('Location: exercise_reminder.php?'.$params);
658
+                    exit;
659
+                } else {
660 660
                     header("Location: exercise_result.php?".api_get_cidreq()."&exe_id=$exe_id&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id");
661 661
                     exit;
662
-	            }
663
-	        }
664
-	    } else {
665
-	        if ($debug) { error_log('Redirecting to exercise_submit.php'); }
666
-	        exit;
667
-	    }
668
-	}
662
+                }
663
+            }
664
+        } else {
665
+            if ($debug) { error_log('Redirecting to exercise_submit.php'); }
666
+            exit;
667
+        }
668
+    }
669 669
 } else {
670
-	$error = get_lang('ThereAreNoQuestionsForThisExercise');
671
-	// if we are in the case where user select random by category, but didn't choose the number of random question
672
-	if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) {
673
-		$error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion');
674
-	}
670
+    $error = get_lang('ThereAreNoQuestionsForThisExercise');
671
+    // if we are in the case where user select random by category, but didn't choose the number of random question
672
+    if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) {
673
+        $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion');
674
+    }
675 675
 }
676 676
 
677 677
 if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
 if (api_is_course_admin() && $origin != 'learnpath') {
711 711
     echo '<div class="actions">';
712 712
     if ($show_quiz_edition == false) {
713
-    	echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">'.Display :: return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
713
+        echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">'.Display :: return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
714 714
     } else {
715
-    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
715
+        echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
716 716
     }
717 717
     echo '</div>';
718 718
 }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet');
756 756
             Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts()));
757 757
             if ($origin != 'learnpath') {
758
-            	Display :: display_footer();
758
+                Display :: display_footer();
759 759
             }
760 760
             exit;
761 761
         } else {
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 if (isset($_custom['exercises_hidden_when_no_start_date']) &&
771 771
     $_custom['exercises_hidden_when_no_start_date']
772 772
 ) {
773
-	if (empty($objExercise->start_time)) {
773
+    if (empty($objExercise->start_time)) {
774 774
         Display:: display_warning_message(
775 775
             sprintf(
776 776
                 get_lang('ExerciseNoStartedYet'),
@@ -778,20 +778,20 @@  discard block
 block discarded – undo
778 778
                 $objExercise->selectAttempts()
779 779
             )
780 780
         );
781
-		if ($origin != 'learnpath') {
782
-			Display :: display_footer();
783
-		}
784
-	}
781
+        if ($origin != 'learnpath') {
782
+            Display :: display_footer();
783
+        }
784
+    }
785 785
 }
786 786
 
787 787
 //Timer control
788 788
 if ($time_control) {
789 789
     echo $objExercise->return_time_left_div();
790
-	echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>';
790
+    echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>';
791 791
 }
792 792
 
793 793
 if ($origin != 'learnpath') {
794
-   echo '<div id="highlight-plugin" class="glossary-content">';
794
+    echo '<div id="highlight-plugin" class="glossary-content">';
795 795
 }
796 796
 
797 797
 if ($reminder == 2)  {
@@ -803,53 +803,53 @@  discard block
 block discarded – undo
803 803
     $current_question = 1; //set by default the 1st question
804 804
 
805 805
     if (!empty($my_remind_list)) {
806
-    	//Checking which questions we are going to call from the remind list
807
-		for ($i = 0; $i < count($data_tracking); $i++) {
808
-			for($j = 0; $j < count($my_remind_list); $j++) {
809
-
810
-				if (!empty($remind_question_id)) {
811
-					if ($remind_question_id == $my_remind_list[$j]) {
812
-
813
-			        	if ($remind_question_id == $data_tracking[$i]) {
814
-			        		if (isset($my_remind_list[$j+1])) {
815
-			        			$remind_question_id = $my_remind_list[$j+1];
816
-			        			$current_question = $i + 1;
817
-			        		} else {
806
+        //Checking which questions we are going to call from the remind list
807
+        for ($i = 0; $i < count($data_tracking); $i++) {
808
+            for($j = 0; $j < count($my_remind_list); $j++) {
809
+
810
+                if (!empty($remind_question_id)) {
811
+                    if ($remind_question_id == $my_remind_list[$j]) {
812
+
813
+                        if ($remind_question_id == $data_tracking[$i]) {
814
+                            if (isset($my_remind_list[$j+1])) {
815
+                                $remind_question_id = $my_remind_list[$j+1];
816
+                                $current_question = $i + 1;
817
+                            } else {
818 818
                                 // We end the remind list we go to the exercise_reminder.php please
819
-			        			$remind_question_id = -1;
820
-			        			$current_question = $i + 1; // last question
821
-			        		}
822
-			        		break 2;
823
-			            }
824
-					}
825
-				} else {
826
-					if ($my_remind_list[$j] == $data_tracking[$i]) {
827
-						if (isset($my_remind_list[$j+1])) {
828
-							$remind_question_id = $my_remind_list[$j+1];
829
-							$current_question = $i + 1; // last question
830
-						} else {
819
+                                $remind_question_id = -1;
820
+                                $current_question = $i + 1; // last question
821
+                            }
822
+                            break 2;
823
+                        }
824
+                    }
825
+                } else {
826
+                    if ($my_remind_list[$j] == $data_tracking[$i]) {
827
+                        if (isset($my_remind_list[$j+1])) {
828
+                            $remind_question_id = $my_remind_list[$j+1];
829
+                            $current_question = $i + 1; // last question
830
+                        } else {
831 831
                             // We end the remind list we go to the exercise_reminder.php please
832
-							$remind_question_id = -1;
833
-							$current_question = $i + 1; // last question
834
-						}
835
-						break 2;
836
-					}
837
-				}
838
-			}
832
+                            $remind_question_id = -1;
833
+                            $current_question = $i + 1; // last question
834
+                        }
835
+                        break 2;
836
+                    }
837
+                }
838
+            }
839 839
         }
840 840
     } else {
841
-    	if ($objExercise->review_answers) {
841
+        if ($objExercise->review_answers) {
842 842
             if ($debug) { error_log('. redirecting to exercise_reminder.php '); }
843
-	    	header("Location: exercise_reminder.php?$params");
844
-	    	exit;
845
-    	}
843
+            header("Location: exercise_reminder.php?$params");
844
+            exit;
845
+        }
846 846
     }
847 847
 }
848 848
 
849 849
 if ($objExercise->review_answers) {
850
-	$script_php = 'exercise_reminder.php';
850
+    $script_php = 'exercise_reminder.php';
851 851
 } else {
852
-	$script_php = 'exercise_result.php';
852
+    $script_php = 'exercise_result.php';
853 853
 }
854 854
 
855 855
 if (!empty($error)) {
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
          <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id . '" />
1090 1090
          <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />';
1091 1091
 
1092
-	// Show list of questions
1092
+    // Show list of questions
1093 1093
     $i = 1;
1094 1094
     $attempt_list = array();
1095 1095
     if (isset($exe_id)) {
@@ -1149,10 +1149,10 @@  discard block
 block discarded – undo
1149 1149
 
1150 1150
         $attributes = array('id' =>'remind_list['.$questionId.']');
1151 1151
         if (in_array($questionId, $remind_list)) {
1152
-        	$is_remind_on = true;
1153
-        	$attributes['checked'] = 1;
1154
-        	$remind_question = true;
1155
-        	$remind_highlight = ' remind_highlight ';
1152
+            $is_remind_on = true;
1153
+            $attributes['checked'] = 1;
1154
+            $remind_question = true;
1155
+            $remind_highlight = ' remind_highlight ';
1156 1156
         }
1157 1157
 
1158 1158
         // Showing the exercise description
@@ -1226,8 +1226,8 @@  discard block
 block discarded – undo
1226 1226
     }
1227 1227
     // end foreach()
1228 1228
     if ($objExercise->type == ALL_ON_ONE_PAGE) {
1229
-    	$exercise_actions =  $objExercise->show_button($questionId, $current_question);
1230
-    	echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1229
+        $exercise_actions =  $objExercise->show_button($questionId, $current_question);
1230
+        echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1231 1231
         echo '<br>';
1232 1232
     }
1233 1233
     echo '</form>';
Please login to merge, or discard this patch.
Braces   +32 added lines, -12 removed lines patch added patch discarded remove patch
@@ -269,7 +269,9 @@  discard block
 block discarded – undo
269 269
 $clock_expired_time = null;
270 270
 
271 271
 if (empty($exercise_stat_info)) {
272
-    if ($debug)  error_log('5  $exercise_stat_info is empty ');
272
+    if ($debug) {
273
+        error_log('5  $exercise_stat_info is empty ');
274
+    }
273 275
 	$total_weight = 0;
274 276
 	$questionList = $objExercise->get_validated_question_list();
275 277
 	foreach ($questionListUncompressed as $question_id) {
@@ -280,11 +282,17 @@  discard block
 block discarded – undo
280 282
 	if ($time_control) {
281 283
 		$expected_time = $current_timestamp + $total_seconds;
282 284
 
283
-		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
284
-		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
285
+		if ($debug) {
286
+		    error_log('5.1. $current_timestamp '.$current_timestamp);
287
+		}
288
+		if ($debug) {
289
+		    error_log('5.2. $expected_time '.$expected_time);
290
+		}
285 291
 
286 292
 		$clock_expired_time 	= api_get_utc_datetime($expected_time);
287
-		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
293
+		if ($debug) {
294
+		    error_log('5.3. $expected_time '.$clock_expired_time);
295
+		}
288 296
 
289 297
 		//Sessions  that contain the expired time
290 298
 		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
@@ -304,8 +312,10 @@  discard block
 block discarded – undo
304 312
         $learnpath_item_id,
305 313
         $learnpath_item_view_id
306 314
     );
307
-    if ($debug)  error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
308
-} else {
315
+    if ($debug) {
316
+        error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
317
+    }
318
+    } else {
309 319
 	$exe_id = $exercise_stat_info['exe_id'];
310 320
     // Remember last question id position.
311 321
     $isFirstTime = Session::read('firstTime');
@@ -327,8 +337,10 @@  discard block
 block discarded – undo
327 337
         }
328 338
     }
329 339
 
330
-    if ($debug)  error_log("5  exercise_stat_info[] exists getting exe_id $exe_id ");
331
-}
340
+    if ($debug) {
341
+        error_log("5  exercise_stat_info[] exists getting exe_id $exe_id ");
342
+    }
343
+    }
332 344
 
333 345
 $questionListInSession = Session::read('questionList');
334 346
 
@@ -384,9 +396,15 @@  discard block
 block discarded – undo
384 396
  * If the expired time is major that zero(0) then the expired time is compute on this time.
385 397
  */
386 398
 if ($time_control) {
387
-	if ($debug) error_log('7.1. Time control is enabled');
388
-	if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
389
-	if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
399
+	if ($debug) {
400
+	    error_log('7.1. Time control is enabled');
401
+	}
402
+	if ($debug) {
403
+	    error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
404
+	}
405
+	if ($debug) {
406
+	    error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
407
+	}
390 408
 
391 409
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
392 410
         //Timer - Get expired_time for a student
@@ -473,7 +491,9 @@  discard block
 block discarded – undo
473 491
 	}
474 492
 }
475 493
 
476
-if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1));
494
+if ($debug) {
495
+    error_log('8. Question list loaded '.print_r($questionList, 1));
496
+}
477 497
 
478 498
 //Real question count
479 499
 $question_count = 0;
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 use ChamiloSession as Session;
30 30
 
31 31
 require_once '../inc/global.inc.php';
32
-$current_course_tool  = TOOL_QUIZ;
32
+$current_course_tool = TOOL_QUIZ;
33 33
 $this_section = SECTION_COURSES;
34 34
 $debug = false;
35 35
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 $origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
40 40
 
41
-$is_allowedToEdit = api_is_allowed_to_edit(null,true);
41
+$is_allowedToEdit = api_is_allowed_to_edit(null, true);
42 42
 $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
43 43
 
44 44
 $showGlossary = in_array($glossaryExtraTools, array('true', 'exercise', 'exercise_and_lp'));
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
61 61
 $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
62 62
 $htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
63
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
64
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
63
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
64
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
65 65
 
66 66
 if (api_get_setting('enable_record_audio') === 'true') {
67
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>';
68
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>';
69
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>';
70
-    $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>';
67
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
68
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
69
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
70
+    $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
71 71
 }
72 72
 
73 73
 $template = new Template();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 $learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : 0;
78 78
 $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : 0;
79
-$learnpath_item_view_id	= isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0;
79
+$learnpath_item_view_id = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0;
80 80
 
81 81
 $reminder = isset($_REQUEST['reminder']) ? intval($_REQUEST['reminder']) : 0;
82 82
 $remind_question_id = isset($_REQUEST['remind_question_id']) ? intval($_REQUEST['remind_question_id']) : 0;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 /*  Teacher takes an exam and want to see a preview,
104 104
     we delete the objExercise from the session in order to get the latest
105 105
     changes in the exercise */
106
-if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['preview'] == 1 ) {
106
+if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['preview'] == 1) {
107 107
     Session::erase('objExercise');
108 108
 }
109 109
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 if ($time_control) {
175 175
 	// Get the expired time of the current exercise in track_e_exercises
176
-	$total_seconds = $objExercise->expired_time*60;
176
+	$total_seconds = $objExercise->expired_time * 60;
177 177
 }
178 178
 
179 179
 $show_clock = true;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 	if ($attempt_count >= $objExercise->selectAttempts()) {
192 192
 		$show_clock = false;
193
-		if (!api_is_allowed_to_edit(null,true)) {
193
+		if (!api_is_allowed_to_edit(null, true)) {
194 194
             if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
195 195
 
196 196
                 // Showing latest attempt according with task BT#1628
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                     );
221 221
 
222 222
                     if (!empty($last_attempt_info['question_list'])) {
223
-                        foreach($last_attempt_info['question_list'] as $question_data) {
223
+                        foreach ($last_attempt_info['question_list'] as $question_data) {
224 224
                             $question_id = $question_data['question_id'];
225 225
                             $marks       = $question_data['marks'];
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                             $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore'));
230 230
                         }
231 231
                     }
232
-					$score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
232
+					$score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
233 233
 					$attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
234 234
 				} else {
235 235
 					$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
 		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
291 291
 		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
292 292
 
293
-		$clock_expired_time 	= api_get_utc_datetime($expected_time);
293
+		$clock_expired_time = api_get_utc_datetime($expected_time);
294 294
 		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
295 295
 
296 296
 		//Sessions  that contain the expired time
297
-		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
298
-		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
297
+		$_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
298
+		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key]); };
299 299
 	}
300 300
 
301 301
     $exe_id = $objExercise->save_stat_track_exercise_info(
@@ -409,22 +409,22 @@  discard block
 block discarded – undo
409 409
 	    	   the track_et_attempt see #2069 */
410 410
 	    	if (empty($last_attempt_date)) {
411 411
 	    		$diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
412
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
412
+	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'], 'UTC') + $diff);
413 413
 	    	} else {
414 414
 	    		//Recalculate the time control due #2069
415
-	    		$diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
416
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
415
+	    		$diff = $current_timestamp - api_strtotime($last_attempt_date, 'UTC');
416
+	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date, 'UTC') + $diff);
417 417
 	    	}
418 418
 	        if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
419 419
 
420 420
 	        //New expired time - it is due to the possible closure of session
421
-	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
421
+	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date, 'UTC');
422 422
 	        if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
423 423
 
424
-	        $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
424
+	        $expected_time = $current_timestamp + $new_expired_time_in_seconds;
425 425
 	        if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
426 426
 
427
-	        $clock_expired_time  = api_get_utc_datetime($expected_time);
427
+	        $clock_expired_time = api_get_utc_datetime($expected_time);
428 428
 	        if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
429 429
 
430 430
 			// First we update the attempt to today
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
 
441 441
 	        //Sessions  that contain the expired time
442 442
 	        $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
443
-	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
443
+	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key]); };
444 444
         }
445 445
     } else {
446
-        $clock_expired_time =  $_SESSION['expired_time'][$current_expired_time_key];
446
+        $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key];
447 447
     }
448 448
 } else {
449 449
     if ($debug) { error_log("7 No time control"); };
450 450
 }
451 451
 
452 452
 // Get time left for expiring time
453
-$time_left = api_strtotime($clock_expired_time,'UTC') - time();
453
+$time_left = api_strtotime($clock_expired_time, 'UTC') - time();
454 454
 
455 455
 /*
456 456
  * The time control feature is enable here - this feature is enable for a jquery plugin called epiclock
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
     //Only for hotspot
501 501
     if (!isset($choice) && isset($_REQUEST['hidden_hotspot_id'])) {
502
-        $hotspot_id = (int)($_REQUEST['hidden_hotspot_id']);
502
+        $hotspot_id = (int) ($_REQUEST['hidden_hotspot_id']);
503 503
         $choice     = array($hotspot_id => '');
504 504
     }
505 505
 
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
                 //saving each question
528 528
                 if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) {
529 529
                     $nro_question = $current_question; // - 1;
530
-                 	$questionId   = $key;
530
+                 	$questionId = $key;
531 531
                     // gets the student choice for this question
532 532
                     $choice = $exerciseResult[$questionId];
533 533
                     if (isset($exe_id)) {
534 534
                     	// Manage the question and answer attempts
535 535
                         if ($debug) {
536
-                            error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1));
536
+                            error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice, 1));
537 537
                         }
538 538
                         $objExercise->manage_answer(
539 539
                             $exe_id,
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
             }
554 554
         }
555 555
         if ($debug) { error_log('9.3.  $choice is an array - end'); }
556
-        if ($debug) { error_log('9.4.  $exerciseResult '.print_r($exerciseResult,1)); }
556
+        if ($debug) { error_log('9.4.  $exerciseResult '.print_r($exerciseResult, 1)); }
557 557
     }
558 558
 
559 559
     // the script "exercise_result.php" will take the variable $exerciseResult from the session
560 560
     Session::write('exerciseResult', $exerciseResult);
561 561
     Session::write('remind_list', $remind_list);
562
-    Session::write('exerciseResultCoordinates',$exerciseResultCoordinates);
562
+    Session::write('exerciseResultCoordinates', $exerciseResultCoordinates);
563 563
 
564 564
     // if all questions on one page OR if it is the last question (only for an exercise with one question per page)
565 565
     if ($objExercise->type == ALL_ON_ONE_PAGE || $current_question >= $question_count) {
@@ -685,15 +685,15 @@  discard block
 block discarded – undo
685 685
 }
686 686
 
687 687
 if (!empty ($gradebook) && $gradebook == 'view') {
688
-    $interbreadcrumb[] = array ('url' => '../gradebook/' . Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
688
+    $interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook'));
689 689
 }
690 690
 
691
-$interbreadcrumb[] = array ("url" => "exercise.php?".api_get_cidreq(),	"name" => get_lang('Exercises'));
692
-$interbreadcrumb[] = array ("url" => "#", "name" => $objExercise->name);
691
+$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
692
+$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
693 693
 
694 694
 if ($origin != 'learnpath') { //so we are not in learnpath tool
695
-    Display :: display_header(null,'Exercises');
696
-    if (!api_is_allowed_to_session_edit() ) {
695
+    Display :: display_header(null, 'Exercises');
696
+    if (!api_is_allowed_to_session_edit()) {
697 697
         Display :: display_warning_message(get_lang('SessionIsReadOnly'));
698 698
     }
699 699
 } else {
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 if (api_is_course_admin() && $origin != 'learnpath') {
713 713
     echo '<div class="actions">';
714 714
     if ($show_quiz_edition == false) {
715
-    	echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">'.Display :: return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
715
+    	echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.Display :: return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>';
716 716
     } else {
717
-    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
717
+    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>';
718 718
     }
719 719
     echo '</div>';
720 720
 }
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
     }
754 754
 
755 755
     if (!$permission_to_start || $exercise_timeover) {
756
-        if (!api_is_allowed_to_edit(null,true)) {
756
+        if (!api_is_allowed_to_edit(null, true)) {
757 757
             $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet');
758 758
             Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts()));
759 759
             if ($origin != 'learnpath') {
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
    echo '<div id="highlight-plugin" class="glossary-content">';
797 797
 }
798 798
 
799
-if ($reminder == 2)  {
799
+if ($reminder == 2) {
800 800
     if ($debug) { error_log(' $reminder == 2'); }
801 801
 
802 802
     $data_tracking  = $exercise_stat_info['data_tracking'];
@@ -807,14 +807,14 @@  discard block
 block discarded – undo
807 807
     if (!empty($my_remind_list)) {
808 808
     	//Checking which questions we are going to call from the remind list
809 809
 		for ($i = 0; $i < count($data_tracking); $i++) {
810
-			for($j = 0; $j < count($my_remind_list); $j++) {
810
+			for ($j = 0; $j < count($my_remind_list); $j++) {
811 811
 
812 812
 				if (!empty($remind_question_id)) {
813 813
 					if ($remind_question_id == $my_remind_list[$j]) {
814 814
 
815 815
 			        	if ($remind_question_id == $data_tracking[$i]) {
816
-			        		if (isset($my_remind_list[$j+1])) {
817
-			        			$remind_question_id = $my_remind_list[$j+1];
816
+			        		if (isset($my_remind_list[$j + 1])) {
817
+			        			$remind_question_id = $my_remind_list[$j + 1];
818 818
 			        			$current_question = $i + 1;
819 819
 			        		} else {
820 820
                                 // We end the remind list we go to the exercise_reminder.php please
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
 					}
827 827
 				} else {
828 828
 					if ($my_remind_list[$j] == $data_tracking[$i]) {
829
-						if (isset($my_remind_list[$j+1])) {
830
-							$remind_question_id = $my_remind_list[$j+1];
829
+						if (isset($my_remind_list[$j + 1])) {
830
+							$remind_question_id = $my_remind_list[$j + 1];
831 831
 							$current_question = $i + 1; // last question
832 832
 						} else {
833 833
                             // We end the remind list we go to the exercise_reminder.php please
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
     Display :: display_error_message($error, false);
859 859
 } else {
860 860
     if (!empty ($exercise_sound)) {
861
-        echo "<a href=\"../document/download.php?doc_url=%2Faudio%2F" . Security::remove_XSS($exercise_sound) . "\" target=\"_blank\">", "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound') . "\" /></a>";
861
+        echo "<a href=\"../document/download.php?doc_url=%2Faudio%2F".Security::remove_XSS($exercise_sound)."\" target=\"_blank\">", "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound')."\" /></a>";
862 862
     }
863 863
     // Get number of hotspot questions for javascript validation
864 864
     $number_of_hotspot_questions = 0;
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     }
890 890
 
891 891
     if ($number_of_hotspot_questions > 0) {
892
-        $onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\"";
892
+        $onsubmit = "onsubmit=\"return validateFlashVar('".$number_of_hotspot_questions."', '".get_lang('HotspotValidateError1')."', '".get_lang('HotspotValidateError2')."');\"";
893 893
     }
894 894
 
895 895
     echo '<script>
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
                 ICON_SIZE_SMALL,
904 904
                 false,
905 905
                 true
906
-            ) . '\';
906
+            ).'\';
907 907
 
908 908
             // Block form submition on enter
909 909
             $(".block_on_enter").keypress(function(event) {
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
             } else {
956 956
                 url = "exercise_submit.php?'.$params.'&num='.$current_question.'&remind_question_id='.$remind_question_id.'";
957 957
             }
958
-            //$("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\');
958
+            //$("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\');
959 959
             window.location = url;
960 960
         }
961 961
 
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 
988 988
             // Only for the first time
989 989
 
990
-            $("#save_for_now_"+question_id).html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin') . '\');
990
+            $("#save_for_now_"+question_id).html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\');
991 991
             $.ajax({
992 992
                 type:"post",
993 993
                 async: false,
@@ -995,9 +995,9 @@  discard block
 block discarded – undo
995 995
                 data: "'.$params.'&type=simple&question_id="+question_id+"&"+my_choice+"&"+hotspot+"&"+remind_list,
996 996
                 success: function(return_value) {
997 997
                     if (return_value == "ok") {
998
-                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\');
998
+                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\');
999 999
                     } else if (return_value == "error") {
1000
-                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL) . '\');
1000
+                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL).'\');
1001 1001
                     } else if (return_value == "one_per_page") {
1002 1002
                         var url = "";
1003 1003
                         if ('.$reminder.' == 1 ) {
@@ -1012,13 +1012,13 @@  discard block
 block discarded – undo
1012 1012
                             url = url_extra;
1013 1013
                         }
1014 1014
 
1015
-                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\');
1015
+                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\');
1016 1016
 
1017 1017
                         window.location = url;
1018 1018
                     }
1019 1019
                 },
1020 1020
                 error: function() {
1021
-                    $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL) . '\');
1021
+                    $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL).'\');
1022 1022
                 }
1023 1023
             });
1024 1024
             return false;
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
             free_answers = $.param(free_answers);
1053 1053
 
1054
-            $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin') . '\');
1054
+            $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\');
1055 1055
 
1056 1056
             $.ajax({
1057 1057
                 type:"post",
@@ -1060,14 +1060,14 @@  discard block
 block discarded – undo
1060 1060
                 data: "'.$params.'&type=all&"+my_choice+"&"+hotspot+"&"+free_answers+"&"+remind_list,
1061 1061
                 success: function(return_value) {
1062 1062
                     if (return_value == "ok") {
1063
-                        //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\');
1063
+                        //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png').'\');
1064 1064
                         if (validate == "validate") {
1065 1065
                             window.location = "'.$script_php.'?'.$params.'";
1066 1066
                         } else {
1067
-                            $("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\');
1067
+                            $("#save_all_reponse").html(\'' . Display::return_icon('accept.png').'\');
1068 1068
                         }
1069 1069
                     } else {
1070
-                        $("#save_all_reponse").html(\'' . Display::return_icon('wrong.gif') . '\');
1070
+                        $("#save_all_reponse").html(\'' . Display::return_icon('wrong.gif').'\');
1071 1071
                     }
1072 1072
                 }
1073 1073
             });
@@ -1080,16 +1080,16 @@  discard block
 block discarded – undo
1080 1080
         }
1081 1081
     </script>';
1082 1082
 
1083
-    echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId .'" name="frm_exercise" '.$onsubmit.'>
1083
+    echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId.'" name="frm_exercise" '.$onsubmit.'>
1084 1084
          <input type="hidden" name="formSent"				value="1" />
1085
-         <input type="hidden" name="exerciseId" 			value="'.$exerciseId . '" />
1085
+         <input type="hidden" name="exerciseId" 			value="'.$exerciseId.'" />
1086 1086
          <input type="hidden" name="num" 					value="'.$current_question.'" id="num_current_id" />
1087 1087
          <input type="hidden" name="num_answer"             value="'.$currentAnswer.'" id="num_current_answer_id" />
1088
-         <input type="hidden" name="exe_id" 				value="'.$exe_id . '" />
1089
-         <input type="hidden" name="origin" 				value="'.$origin . '" />
1090
-         <input type="hidden" name="learnpath_id" 			value="'.$learnpath_id . '" />
1091
-         <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id . '" />
1092
-         <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />';
1088
+         <input type="hidden" name="exe_id" 				value="'.$exe_id.'" />
1089
+         <input type="hidden" name="origin" 				value="'.$origin.'" />
1090
+         <input type="hidden" name="learnpath_id" 			value="'.$learnpath_id.'" />
1091
+         <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id.'" />
1092
+         <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id.'" />';
1093 1093
 
1094 1094
 	// Show list of questions
1095 1095
     $i = 1;
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
         $attempt_list = Event::getAllExerciseEventByExeId($exe_id);
1099 1099
     }
1100 1100
 
1101
-    $remind_list  = array();
1101
+    $remind_list = array();
1102 1102
     if (isset($exercise_stat_info['questions_to_check']) && !empty($exercise_stat_info['questions_to_check'])) {
1103 1103
         $remind_list = explode(',', $exercise_stat_info['questions_to_check']);
1104 1104
     }
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
             $remind_highlight = 'no_remind_highlight';
1147 1147
         }
1148 1148
 
1149
-        $exercise_actions  = '';
1149
+        $exercise_actions = '';
1150 1150
         $is_remind_on = false;
1151 1151
 
1152 1152
         $attributes = array('id' =>'remind_list['.$questionId.']');
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
         }
1159 1159
 
1160 1160
         // Showing the exercise description
1161
-        if (!empty($objExercise->description)){
1162
-            if ($objExercise->type == ONE_PER_PAGE || ($objExercise->type != ONE_PER_PAGE && $i==1)) {
1161
+        if (!empty($objExercise->description)) {
1162
+            if ($objExercise->type == ONE_PER_PAGE || ($objExercise->type != ONE_PER_PAGE && $i == 1)) {
1163 1163
                 echo Display::panelCollapse('<span>'.
1164 1164
                     get_lang('ExerciseDescriptionLabel').'</span>',
1165 1165
                     $objExercise->description,
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
             case ALL_ON_ONE_PAGE :
1196 1196
                 $button  = '<a href="javascript://" class="btn btn-info" onclick="save_now(\''.$questionId.'\'); ">'.get_lang('SaveForNow').'</a>';
1197 1197
                 $button .= '<span id="save_for_now_'.$questionId.'"></span>&nbsp;';
1198
-                $exercise_actions  .= Display::div($button, array('class'=>'exercise_save_now_button'));
1198
+                $exercise_actions .= Display::div($button, array('class'=>'exercise_save_now_button'));
1199 1199
                 break;
1200 1200
         }
1201 1201
 
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
                 'label',
1206 1206
                 Display::input(
1207 1207
                     'checkbox',
1208
-                    'remind_list[' . $questionId . ']',
1208
+                    'remind_list['.$questionId.']',
1209 1209
                     '',
1210 1210
                     $attributes
1211
-                ) . get_lang('ReviewQuestionLater'),
1211
+                ).get_lang('ReviewQuestionLater'),
1212 1212
                 array(
1213 1213
                     'class' => 'checkbox',
1214
-                    'for' => 'remind_list[' . $questionId . ']'
1214
+                    'for' => 'remind_list['.$questionId.']'
1215 1215
                 )
1216 1216
             );
1217 1217
             $exercise_actions .= Display::div($remind_question_div, array('class'=>'exercise_save_now_button'));
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
     }
1229 1229
     // end foreach()
1230 1230
     if ($objExercise->type == ALL_ON_ONE_PAGE) {
1231
-    	$exercise_actions =  $objExercise->show_button($questionId, $current_question);
1231
+    	$exercise_actions = $objExercise->show_button($questionId, $current_question);
1232 1232
     	echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1233 1233
         echo '<br>';
1234 1234
     }
Please login to merge, or discard this patch.
main/exercise/UniqueAnswerImage.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 
41 41
         if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
42 42
             //Scenario
43
-            $commentTitle = '<th>' . get_lang('Comment') . '</th>';
44
-            $feedbackTitle = '<th>' . get_lang('Scenario') . '</th>';
43
+            $commentTitle = '<th>'.get_lang('Comment').'</th>';
44
+            $feedbackTitle = '<th>'.get_lang('Scenario').'</th>';
45 45
         } else {
46
-            $commentTitle = '<th >' . get_lang('Comment') . '</th>';
46
+            $commentTitle = '<th >'.get_lang('Comment').'</th>';
47 47
         }
48 48
 
49 49
         $html = '<div class="alert alert-success" role="alert">'.get_lang('UniqueAnswerImagePreferredSize200x150').'</div>';
50 50
         $html .= '<table class="table table-striped table-hover">
51 51
             <thead>
52 52
                 <tr style="text-align: center;">
53
-                    <th width="10">' . get_lang('Number') . '</th>
54
-                    <th>' . get_lang('True') . '</th>
55
-                    <th>' . get_lang('Answer') . '</th>
56
-                        ' . $commentTitle . '
57
-                        ' . $feedbackTitle . '
58
-                    <th width="15">' . get_lang('Weighting') . '</th>
53
+                    <th width="10">' . get_lang('Number').'</th>
54
+                    <th>' . get_lang('True').'</th>
55
+                    <th>' . get_lang('Answer').'</th>
56
+                        ' . $commentTitle.'
57
+                        ' . $feedbackTitle.'
58
+                    <th width="15">' . get_lang('Weighting').'</th>
59 59
                 </tr>
60 60
             </thead>
61 61
             <tbody>';
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 }
91 91
 
92 92
                 $question = Question::read($questionid);
93
-                $selectQuestion[$questionid] = 'Q' . $key . ' :' . cut(
93
+                $selectQuestion[$questionid] = 'Q'.$key.' :'.cut(
94 94
                     $question->selectTitle(), 20
95 95
                 );
96 96
             }
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
                     $correct = $i;
124 124
                 }
125 125
 
126
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
127
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
128
-                $defaults['weighting[' . $i . ']'] = float_format(
126
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
127
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
128
+                $defaults['weighting['.$i.']'] = float_format(
129 129
                     $answer->weighting[$i], 1
130 130
                 );
131 131
 
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
                     $urlResult = $url;
149 149
                 }
150 150
 
151
-                $tempScenario['url' . $i] = $urlResult;
152
-                $tempScenario['try' . $i] = $tryResult;
153
-                $tempScenario['lp' . $i] = $lp;
154
-                $tempScenario['destination' . $i] = $listDestination;
151
+                $tempScenario['url'.$i] = $urlResult;
152
+                $tempScenario['try'.$i] = $tryResult;
153
+                $tempScenario['lp'.$i] = $lp;
154
+                $tempScenario['destination'.$i] = $listDestination;
155 155
             } else {
156 156
                 $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1');
157 157
                 $defaults['weighting[1]'] = 10;
158 158
                 $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
159 159
                 $defaults['weighting[2]'] = 0;
160 160
 
161
-                $tempScenario['destination' . $i] = array('0');
162
-                $tempScenario['lp' . $i] = array('0');
161
+                $tempScenario['destination'.$i] = array('0');
162
+                $tempScenario['lp'.$i] = array('0');
163 163
             }
164 164
 
165 165
             $defaults['scenario'] = $tempScenario;
@@ -172,50 +172,50 @@  discard block
 block discarded – undo
172 172
             );
173 173
             $renderer->setElementTemplate(
174 174
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
175
-                'counter[' . $i . ']'
175
+                'counter['.$i.']'
176 176
             );
177 177
             $renderer->setElementTemplate(
178 178
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
179
-                'answer[' . $i . ']'
179
+                'answer['.$i.']'
180 180
             );
181 181
             $renderer->setElementTemplate(
182 182
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
183
-                'comment[' . $i . ']'
183
+                'comment['.$i.']'
184 184
             );
185 185
             $renderer->setElementTemplate(
186 186
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
187
-                'weighting[' . $i . ']'
187
+                'weighting['.$i.']'
188 188
             );
189 189
 
190
-            $answerNumber = $form->addElement('text', 'counter[' . $i . ']', null, ' value = "' . $i . '"');
190
+            $answerNumber = $form->addElement('text', 'counter['.$i.']', null, ' value = "'.$i.'"');
191 191
             $answerNumber->freeze();
192 192
 
193 193
             $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox"');
194
-            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editorConfig);
194
+            $form->addHtmlEditor('answer['.$i.']', null, null, true, $editorConfig);
195 195
 
196
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
196
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
197 197
 
198 198
             if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
199
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig);
199
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editorConfig);
200 200
                 // Direct feedback
201 201
                 //Adding extra feedback fields
202 202
                 $group = array();
203
-                $group['try' . $i] = $form->createElement('checkbox', 'try' . $i, null, get_lang('TryAgain'));
204
-                $group['lp' . $i] = $form->createElement(
203
+                $group['try'.$i] = $form->createElement('checkbox', 'try'.$i, null, get_lang('TryAgain'));
204
+                $group['lp'.$i] = $form->createElement(
205 205
                     'select',
206
-                    'lp' . $i,
207
-                    get_lang('SeeTheory') . ': ',
206
+                    'lp'.$i,
207
+                    get_lang('SeeTheory').': ',
208 208
                     $selectLpId
209 209
                 );
210
-                $group['destination' . $i] = $form->createElement(
210
+                $group['destination'.$i] = $form->createElement(
211 211
                     'select',
212
-                    'destination' . $i,
213
-                    get_lang('GoToQuestion') . ': ',
212
+                    'destination'.$i,
213
+                    get_lang('GoToQuestion').': ',
214 214
                     $selectQuestion
215 215
                 );
216
-                $group['url' . $i] = $form->createElement(
217
-                    'text', 'url' . $i,
218
-                    get_lang('Other') . ': ',
216
+                $group['url'.$i] = $form->createElement(
217
+                    'text', 'url'.$i,
218
+                    get_lang('Other').': ',
219 219
                     array(
220 220
                         'class' => 'col-md-2',
221 221
                         'placeholder' => get_lang('Other')
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
                     'scenario'
229 229
                 );
230 230
             } else {
231
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig);
231
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editorConfig);
232 232
             }
233
-            $form->addText('weighting[' . $i . ']', null, null, array('class' => "col-md-1", 'value' => '0'));
233
+            $form->addText('weighting['.$i.']', null, null, array('class' => "col-md-1", 'value' => '0'));
234 234
             $form->addHtml('</tr>');
235 235
         }
236 236
 
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
         $numberAnswers = $form->getSubmitValue('nb_answers');
280 280
 
281 281
         for ($i = 1; $i <= $numberAnswers; $i++) {
282
-            $answer = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('answer[' . $i . ']')));
283
-            $comment = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('comment[' . $i . ']')));
284
-            $weighting = trim($form->getSubmitValue('weighting[' . $i . ']'));
282
+            $answer = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('answer['.$i.']')));
283
+            $comment = trim(str_replace(['<p>', '</p>'], '', $form->getSubmitValue('comment['.$i.']')));
284
+            $weighting = trim($form->getSubmitValue('weighting['.$i.']'));
285 285
 
286 286
             $scenario = $form->getSubmitValue('scenario');
287 287
 
288 288
             //$listDestination = $form -> getSubmitValue('destination'.$i);
289 289
             //$destinationStr = $form -> getSubmitValue('destination'.$i);
290 290
 
291
-            $try = $scenario['try' . $i];
292
-            $lp = $scenario['lp' . $i];
293
-            $destination = $scenario['destination' . $i];
294
-            $url = trim($scenario['url' . $i]);
291
+            $try = $scenario['try'.$i];
292
+            $lp = $scenario['lp'.$i];
293
+            $destination = $scenario['destination'.$i];
294
+            $url = trim($scenario['url'.$i]);
295 295
 
296 296
             /*
297 297
               How we are going to parse the destination value
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             //1@@1;2;@@2;4;4;@@http://www.chamilo.org
343
-            $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url;
343
+            $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
344 344
 
345 345
             $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i, null, null, $dest);
346 346
         }
Please login to merge, or discard this patch.
main/exercise/hotspot_answers.as.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
 $objExercise = new Exercise(api_get_course_int_id());
19 19
 $objExercise->read($trackExerciseInfo['exe_exo_id']);
20 20
 $em = Database::getManager();
21
-$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
22
-$picturePath = $documentPath . '/images';
21
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
22
+$picturePath = $documentPath.'/images';
23 23
 $pictureName = $objQuestion->selectPicture();
24
-$pictureSize = getimagesize($picturePath . '/' . $objQuestion->selectPicture());
24
+$pictureSize = getimagesize($picturePath.'/'.$objQuestion->selectPicture());
25 25
 $pictureWidth = $pictureSize[0];
26 26
 $pictureHeight = $pictureSize[1];
27 27
 $course_id = api_get_course_int_id();
Please login to merge, or discard this patch.