Passed
Push — 1.10.x ( a2cc02...b21e58 )
by Yannick
608:36 queued 565:17
created
main/exercice/hotspot_actionscript.as.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 
31 31
 // Query db for answers
32 32
 if ($answer_type==HOT_SPOT_DELINEATION) {
33
-	$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
33
+    $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
34 34
 	        WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id";
35 35
 } else {
36
-	$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
36
+    $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
37 37
 	        WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id";
38 38
 }
39 39
 $result = Database::query($sql);
@@ -74,37 +74,37 @@  discard block
 block discarded – undo
74 74
     $hotSpot['id'] = $hotspot['id'];
75 75
     $hotSpot['answer'] = $hotspot['answer'];
76 76
 
77
-	// Square or rectancle
78
-	if ($hotspot['hotspot_type'] == 'square' )
79
-	{
77
+    // Square or rectancle
78
+    if ($hotspot['hotspot_type'] == 'square' )
79
+    {
80 80
         $hotSpot['type'] = 'square';
81
-	}
82
-	// Circle or ovale
83
-	if ($hotspot['hotspot_type'] == 'circle')
84
-	{
81
+    }
82
+    // Circle or ovale
83
+    if ($hotspot['hotspot_type'] == 'circle')
84
+    {
85 85
         $hotSpot['type'] = 'circle';
86
-	}
87
-	// Polygon
88
-	if ($hotspot['hotspot_type'] == 'poly')
89
-	{
86
+    }
87
+    // Polygon
88
+    if ($hotspot['hotspot_type'] == 'poly')
89
+    {
90 90
         $hotSpot['type'] = 'poly';
91
-	}
92
-	// Delineation
93
-	if ($hotspot['hotspot_type'] == 'delineation')
94
-	{
91
+    }
92
+    // Delineation
93
+    if ($hotspot['hotspot_type'] == 'delineation')
94
+    {
95 95
         $hotSpot['type'] = 'delineation';
96
-	}
97
-	// No error
98
-	if ($hotspot['hotspot_type'] == 'noerror')
99
-	{
96
+    }
97
+    // No error
98
+    if ($hotspot['hotspot_type'] == 'noerror')
99
+    {
100 100
         $hotSpot['type'] = 'noerror';
101
-	}
101
+    }
102 102
 
103
-	// This is a good answer, count + 1 for nmbr of clicks
104
-	if ($hotspot['hotspot_type'] > 0)
105
-	{
106
-		$nmbrTries++;
107
-	}
103
+    // This is a good answer, count + 1 for nmbr of clicks
104
+    if ($hotspot['hotspot_type'] > 0)
105
+    {
106
+        $nmbrTries++;
107
+    }
108 108
 
109 109
     $hotSpot['coord'] = $hotspot['hotspot_coordinates'];
110 110
 
Please login to merge, or discard this patch.
main/exercice/hotpotatoes_exercise_result.class.php 1 patch
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
     //stores the results
15 15
     private $results = array();
16 16
 
17
-	/**
18
-	 * Gets the results of all students (or just one student if access is limited)
19
-	 * @param	string		The document path (for HotPotatoes retrieval)
20
-	 * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
21
-	 */
22
-	public function getExercisesReporting($document_path, $hotpotato_name)
17
+    /**
18
+     * Gets the results of all students (or just one student if access is limited)
19
+     * @param	string		The document path (for HotPotatoes retrieval)
20
+     * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
21
+     */
22
+    public function getExercisesReporting($document_path, $hotpotato_name)
23 23
     {
24
-		$return = array();
24
+        $return = array();
25 25
         $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
26 26
         $TBL_TRACK_HOTPOTATOES	= Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
27 27
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $hotpotato_name  = Database::escape_string($hotpotato_name);
34 34
 
35 35
         if (!empty($exercise_id)) {
36
-          $session_id_and .= " AND exe_exo_id = $exercise_id ";
36
+            $session_id_and .= " AND exe_exo_id = $exercise_id ";
37 37
         }
38 38
 
39 39
         if (empty($user_id)) {
@@ -110,25 +110,25 @@  discard block
 block discarded – undo
110 110
         $this->results = $return;
111 111
 
112 112
         return true;
113
-	}
113
+    }
114 114
 
115 115
 
116
-	/**
117
-	 * Exports the complete report as a CSV file
118
-	 * @param	string		Document path inside the document tool
119
-	 * @param	integer		Optional user ID
120
-	 * @param	boolean		Whether to include user fields or not
121
-	 * @return	boolean		False on error
122
-	 */
123
-	public function exportCompleteReportCSV($document_path='', $hotpotato_name)
116
+    /**
117
+     * Exports the complete report as a CSV file
118
+     * @param	string		Document path inside the document tool
119
+     * @param	integer		Optional user ID
120
+     * @param	boolean		Whether to include user fields or not
121
+     * @return	boolean		False on error
122
+     */
123
+    public function exportCompleteReportCSV($document_path='', $hotpotato_name)
124 124
     {
125
-		global $charset;
126
-		$this->getExercisesReporting($document_path, $hotpotato_name);
127
-		$filename = 'exercise_results_'.date('YmdGis').'.csv';
128
-		if (!empty($user_id)) {
129
-			$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
130
-		}
131
-		$data = '';
125
+        global $charset;
126
+        $this->getExercisesReporting($document_path, $hotpotato_name);
127
+        $filename = 'exercise_results_'.date('YmdGis').'.csv';
128
+        if (!empty($user_id)) {
129
+            $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
130
+        }
131
+        $data = '';
132 132
 
133 133
         if (api_is_western_name_order()) {
134 134
             if(!empty($this->results[0]['first_name'])) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $data .= get_lang('Email').';';
149 149
 
150
-		/*if ($export_user_fields) {
150
+        /*if ($export_user_fields) {
151 151
 			//show user fields section with a big th colspan that spans over all fields
152 152
 			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
153 153
 			$num = count($extra_user_fields);
@@ -156,25 +156,25 @@  discard block
 block discarded – undo
156 156
 			}
157 157
 		}*/
158 158
 
159
-		$data .= get_lang('Title').';';
160
-		$data .= get_lang('StartDate').';';
161
-		$data .= get_lang('Score').';';
162
-		$data .= get_lang('Total').';';
163
-		$data .= "\n";
159
+        $data .= get_lang('Title').';';
160
+        $data .= get_lang('StartDate').';';
161
+        $data .= get_lang('Score').';';
162
+        $data .= get_lang('Total').';';
163
+        $data .= "\n";
164 164
 
165
-		//results
166
-		foreach($this->results as $row) {
165
+        //results
166
+        foreach($this->results as $row) {
167 167
             if (api_is_western_name_order()) {
168
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
169
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
168
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
169
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
170 170
             } else {
171
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
172
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
171
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
172
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
173 173
             }
174 174
 
175 175
             $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
176 176
 
177
-			/*if ($export_user_fields) {
177
+            /*if ($export_user_fields) {
178 178
 				//show user fields data, if any, for this user
179 179
 				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
180 180
 				foreach($user_fields_values as $value) {
@@ -182,40 +182,40 @@  discard block
 block discarded – undo
182 182
 				}
183 183
 			}*/
184 184
 
185
-			$data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
186
-			$data .= str_replace("\r\n",'  ',$row['exe_date']).';';
187
-			$data .= str_replace("\r\n",'  ',$row['result']).';';
188
-			$data .= str_replace("\r\n",'  ',$row['max']).';';
189
-			$data .= "\n";
190
-		}
191
-
192
-		//output the results
193
-		$len = strlen($data);
194
-		header('Content-type: application/octet-stream');
195
-		header('Content-Type: application/force-download');
196
-		header('Content-length: '.$len);
197
-		if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
198
-			header('Content-Disposition: filename= '.$filename);
199
-		} else {
200
-			header('Content-Disposition: attachment; filename= '.$filename);
201
-		}
202
-		if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
203
-			header('Pragma: ');
204
-			header('Cache-Control: ');
205
-			header('Cache-Control: public'); // IE cannot download from sessions without a cache
206
-		}
207
-		header('Content-Description: '.$filename);
208
-		header('Content-transfer-encoding: binary');
209
-		// @todo add this utf-8 header for all csv files
210
-		echo "\xEF\xBB\xBF";  // force utf-8 header of csv file
211
-		echo $data;
212
-		return true;
213
-	}
214
-
215
-	/**
216
-	 * Exports the complete report as an XLS file
217
-	 * @return	boolean		False on error
218
-	 */
185
+            $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
186
+            $data .= str_replace("\r\n",'  ',$row['exe_date']).';';
187
+            $data .= str_replace("\r\n",'  ',$row['result']).';';
188
+            $data .= str_replace("\r\n",'  ',$row['max']).';';
189
+            $data .= "\n";
190
+        }
191
+
192
+        //output the results
193
+        $len = strlen($data);
194
+        header('Content-type: application/octet-stream');
195
+        header('Content-Type: application/force-download');
196
+        header('Content-length: '.$len);
197
+        if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
198
+            header('Content-Disposition: filename= '.$filename);
199
+        } else {
200
+            header('Content-Disposition: attachment; filename= '.$filename);
201
+        }
202
+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
203
+            header('Pragma: ');
204
+            header('Cache-Control: ');
205
+            header('Cache-Control: public'); // IE cannot download from sessions without a cache
206
+        }
207
+        header('Content-Description: '.$filename);
208
+        header('Content-transfer-encoding: binary');
209
+        // @todo add this utf-8 header for all csv files
210
+        echo "\xEF\xBB\xBF";  // force utf-8 header of csv file
211
+        echo $data;
212
+        return true;
213
+    }
214
+
215
+    /**
216
+     * Exports the complete report as an XLS file
217
+     * @return	boolean		False on error
218
+     */
219 219
     public function exportCompleteReportXLS(
220 220
         $document_path = '',
221 221
         $user_id = null,
@@ -224,37 +224,37 @@  discard block
 block discarded – undo
224 224
         $exercise_id = 0,
225 225
         $hotpotato_name = null
226 226
     ) {
227
-		global $charset;
228
-		$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
229
-		$filename = 'exercise_results_'.api_get_local_time().'.xls';
230
-		if (!empty($user_id)) {
231
-			$filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
232
-		}
227
+        global $charset;
228
+        $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
229
+        $filename = 'exercise_results_'.api_get_local_time().'.xls';
230
+        if (!empty($user_id)) {
231
+            $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
232
+        }
233 233
 
234 234
         $spreadsheet = new PHPExcel();
235 235
         $spreadsheet->setActiveSheetIndex(0);
236 236
         $worksheet = $spreadsheet->getActiveSheet();
237 237
 
238 238
 
239
-		$line = 0;
240
-		$column = 0; //skip the first column (row titles)
239
+        $line = 0;
240
+        $column = 0; //skip the first column (row titles)
241 241
 
242
-		// check if exists column 'user'
243
-		$with_column_user = false;
244
-		foreach ($this->results as $result) {
245
-			if (!empty($result['last_name']) && !empty($result['first_name'])) {
246
-				$with_column_user = true;
247
-				break;
248
-			}
249
-		}
242
+        // check if exists column 'user'
243
+        $with_column_user = false;
244
+        foreach ($this->results as $result) {
245
+            if (!empty($result['last_name']) && !empty($result['first_name'])) {
246
+                $with_column_user = true;
247
+                break;
248
+            }
249
+        }
250 250
 
251
-		if ($with_column_user) {
252
-		    $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
253
-		    $column++;
251
+        if ($with_column_user) {
252
+            $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
253
+            $column++;
254 254
 
255 255
             if (api_is_western_name_order()) {
256
-    			$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
257
-    			$column++;
256
+                $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
257
+                $column++;
258 258
                 $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName'));
259 259
                 $column++;
260 260
             } else {
@@ -263,36 +263,36 @@  discard block
 block discarded – undo
263 263
                 $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
264 264
                 $column++;
265 265
             }
266
-		}
266
+        }
267 267
 
268
-		if ($export_user_fields) {
269
-			//show user fields section with a big th colspan that spans over all fields
270
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
268
+        if ($export_user_fields) {
269
+            //show user fields section with a big th colspan that spans over all fields
270
+            $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
271 271
 
272
-			//show the fields names for user fields
273
-			foreach ($extra_user_fields as $field) {
274
-				$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
275
-				$column++;
276
-			}
277
-		}
272
+            //show the fields names for user fields
273
+            foreach ($extra_user_fields as $field) {
274
+                $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
275
+                $column++;
276
+            }
277
+        }
278 278
 
279
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
280
-		$column++;
281
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
279
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
280
+        $column++;
281
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
282 282
         $column++;
283 283
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate'));
284 284
         $column++;
285 285
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
286
-		$column++;
287
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
288
-		$column++;
289
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
290
-		$column++;
286
+        $column++;
287
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
288
+        $column++;
289
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
290
+        $column++;
291 291
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status'));
292
-		$line++;
292
+        $line++;
293 293
 
294
-		foreach ($this->results as $row) {
295
-			$column = 0;
294
+        foreach ($this->results as $row) {
295
+            $column = 0;
296 296
 
297 297
             if ($with_column_user) {
298 298
                 $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
@@ -309,38 +309,38 @@  discard block
 block discarded – undo
309 309
                     $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
310 310
                     $column++;
311 311
                 }
312
-			}
312
+            }
313 313
 
314
-			if ($export_user_fields) {
315
-				//show user fields data, if any, for this user
316
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
317
-				foreach($user_fields_values as $value) {
318
-					$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
319
-					$column++;
320
-				}
321
-			}
314
+            if ($export_user_fields) {
315
+                //show user fields data, if any, for this user
316
+                $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
317
+                foreach($user_fields_values as $value) {
318
+                    $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
319
+                    $column++;
320
+                }
321
+            }
322 322
 
323
-			$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
324
-			$column++;
325
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
323
+            $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
324
+            $column++;
325
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
326 326
             $column++;
327
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
327
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
328
+            $column++;
329
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
330
+            $column++;
331
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
332
+            $column++;
333
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
328 334
             $column++;
329
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
330
-			$column++;
331
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
332
-			$column++;
333
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
334
-			$column++;
335 335
             $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']);
336
-			$line++;
337
-		}
336
+            $line++;
337
+        }
338 338
 
339 339
         $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
340 340
         $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
341 341
         $writer->save($file);
342 342
         DocumentManager::file_send_for_download($file, true, $filename);
343 343
 
344
-		return true;
345
-	}
344
+        return true;
345
+    }
346 346
 }
Please login to merge, or discard this patch.
main/exercice/hotspot_actionscript_admin.as.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@
 block discarded – undo
98 98
         }*/
99 99
     }
100 100
 
101
-	// This is a good answer, count + 1 for nmbr of clicks
102
-	if ($answers['weighting'][$i] > 0) {
103
-		$nmbrTries++;
104
-	}
101
+    // This is a good answer, count + 1 for nmbr of clicks
102
+    if ($answers['weighting'][$i] > 0) {
103
+        $nmbrTries++;
104
+    }
105 105
 
106 106
     $hotSpot['coord'] = $answers['hotspot_coordinates'][$i];
107 107
     $data['hotspots'][] = $hotSpot;
Please login to merge, or discard this patch.
main/exercice/result.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 $show_headers = isset($_REQUEST['show_headers']) ? intval($_REQUEST['show_headers']) : null; //exe id
18 18
 
19 19
 if ($origin == 'learnpath') {
20
-	$show_headers = false;
20
+    $show_headers = false;
21 21
 }
22 22
 
23 23
 api_protect_course_script($show_headers);
24 24
 
25 25
 if (empty($id)) {
26
-	api_not_allowed($show_headers);
26
+    api_not_allowed($show_headers);
27 27
 }
28 28
 
29 29
 $is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 // Only users can see their own results
50 50
 if (!$is_allowedToEdit) {
51 51
     if ($student_id != $current_user_id) {
52
-    	api_not_allowed($show_headers);
52
+        api_not_allowed($show_headers);
53 53
     }
54 54
 }
55 55
 
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
         "name" => get_lang('Exercises'),
63 63
     );
64 64
     $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result'));
65
-	$this_section = SECTION_COURSES;
66
-	Display::display_header();
65
+    $this_section = SECTION_COURSES;
66
+    Display::display_header();
67 67
 } else {
68 68
     $htmlHeadXtra[] = "
69 69
     <style>
70 70
     body { background: none;}
71 71
     </style>
72 72
     ";
73
-	Display::display_reduced_header();
73
+    Display::display_reduced_header();
74 74
 }
75 75
 
76 76
 ExerciseLib::display_question_list_by_attempt($objExercise, $id, false);
77 77
 
78 78
 if ($show_headers) {
79
-	Display::display_footer();
79
+    Display::display_footer();
80 80
 }
Please login to merge, or discard this patch.
main/exercice/exercise_submit.php 1 patch
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     if (!$objExercise->read($exerciseId) ||
115 115
         (!$objExercise->selectStatus() && !$is_allowedToEdit && $origin != 'learnpath')
116 116
     ) {
117
-    	if ($debug) {error_log('1.1. Error while reading the exercise'); };
117
+        if ($debug) {error_log('1.1. Error while reading the exercise'); };
118 118
         unset ($objExercise);
119 119
         $error = get_lang('ExerciseNotFound');
120 120
     } else {
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 
129 129
 //2. Checking if $objExercise is set
130 130
 if (!isset($objExercise) && isset($_SESSION['objExercise'])) {
131
-	if ($debug) { error_log('2. Loading $objExercise from session'); };
131
+    if ($debug) { error_log('2. Loading $objExercise from session'); };
132 132
     $objExercise = $_SESSION['objExercise'];
133 133
 }
134 134
 
135 135
 //3. $objExercise is not set, then return to the exercise list
136 136
 if (!is_object($objExercise)) {
137
-	if ($debug) {error_log('3. $objExercise was not set, kill the script'); };
137
+    if ($debug) {error_log('3. $objExercise was not set, kill the script'); };
138 138
     header('Location: exercise.php');
139 139
     exit;
140 140
 }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 $time_control = false;
156 156
 if ($objExercise->expired_time != 0) {
157
-	$time_control = true;
157
+    $time_control = true;
158 158
 }
159 159
 
160 160
 // Generating the time control key for the user
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
164 164
 
165 165
 if ($time_control) {
166
-	// Get the expired time of the current exercise in track_e_exercises
167
-	$total_seconds = $objExercise->expired_time*60;
166
+    // Get the expired time of the current exercise in track_e_exercises
167
+    $total_seconds = $objExercise->expired_time*60;
168 168
 }
169 169
 
170 170
 $show_clock = true;
171 171
 $user_id = api_get_user_id();
172 172
 if ($objExercise->selectAttempts() > 0) {
173
-	$attempt_html = '';
173
+    $attempt_html = '';
174 174
     $attempt_count = Event::get_attempt_count(
175 175
         $user_id,
176 176
         $exerciseId,
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
         $learnpath_item_view_id
180 180
     );
181 181
 
182
-	if ($attempt_count >= $objExercise->selectAttempts()) {
183
-		$show_clock = false;
184
-		if (!api_is_allowed_to_edit(null,true)) {
182
+    if ($attempt_count >= $objExercise->selectAttempts()) {
183
+        $show_clock = false;
184
+        if (!api_is_allowed_to_edit(null,true)) {
185 185
             if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
186 186
 
187 187
                 // Showing latest attempt according with task BT#1628
@@ -220,29 +220,29 @@  discard block
 block discarded – undo
220 220
                             $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore'));
221 221
                         }
222 222
                     }
223
-					$score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
224
-					$attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
225
-				} else {
226
-					$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
227
-				}
228
-			} else {
229
-				$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
230
-			}
231
-		} else {
232
-			$attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
233
-		}
223
+                    $score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
224
+                    $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
225
+                } else {
226
+                    $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
227
+                }
228
+            } else {
229
+                $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
230
+            }
231
+        } else {
232
+            $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
233
+        }
234 234
 
235
-		if ($origin == 'learnpath') {
236
-			Display :: display_reduced_header();
237
-		} else {
238
-			Display :: display_header($nameTools,'Exercises');
239
-		}
235
+        if ($origin == 'learnpath') {
236
+            Display :: display_reduced_header();
237
+        } else {
238
+            Display :: display_header($nameTools,'Exercises');
239
+        }
240 240
 
241
-		echo $attempt_html;
242
-		if ($origin != 'learnpath')
243
-			Display :: display_footer();
244
-		exit;
245
-	}
241
+        echo $attempt_html;
242
+        if ($origin != 'learnpath')
243
+            Display :: display_footer();
244
+        exit;
245
+    }
246 246
 }
247 247
 
248 248
 if ($debug) {
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 
262 262
 if (empty($exercise_stat_info)) {
263 263
     if ($debug)  error_log('5  $exercise_stat_info is empty ');
264
-	$total_weight = 0;
265
-	$questionList = $objExercise->get_validated_question_list();
266
-	foreach ($questionList as $question_id) {
267
-		$objQuestionTmp = Question::read($question_id);
268
-		$total_weight += floatval($objQuestionTmp->weighting);
269
-	}
264
+    $total_weight = 0;
265
+    $questionList = $objExercise->get_validated_question_list();
266
+    foreach ($questionList as $question_id) {
267
+        $objQuestionTmp = Question::read($question_id);
268
+        $total_weight += floatval($objQuestionTmp->weighting);
269
+    }
270 270
 
271
-	if ($time_control) {
272
-		$expected_time = $current_timestamp + $total_seconds;
271
+    if ($time_control) {
272
+        $expected_time = $current_timestamp + $total_seconds;
273 273
 
274
-		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
275
-		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
274
+        if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
275
+        if ($debug)  error_log('5.2. $expected_time '.$expected_time);
276 276
 
277
-		$clock_expired_time 	= api_get_utc_datetime($expected_time);
278
-		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
277
+        $clock_expired_time 	= api_get_utc_datetime($expected_time);
278
+        if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
279 279
 
280
-		//Sessions  that contain the expired time
281
-		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
282
-		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
283
-	}
280
+        //Sessions  that contain the expired time
281
+        $_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
282
+        if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
283
+    }
284 284
 
285 285
     $exe_id = $objExercise->save_stat_track_exercise_info(
286 286
         $clock_expired_time,
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     );
298 298
     if ($debug)  error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
299 299
 } else {
300
-	$exe_id = $exercise_stat_info['exe_id'];
300
+    $exe_id = $exercise_stat_info['exe_id'];
301 301
     // Remember last question id position.
302 302
     $isFirstTime = Session::read('firstTime');
303 303
     if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) {
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called::  '.print_r($exercise_stat_info, 1)); };
328 328
 
329 329
 if (!empty($exercise_stat_info['questions_to_check'])) {
330
-	$my_remind_list = $exercise_stat_info['questions_to_check'];
331
-	$my_remind_list = explode(',', $my_remind_list);
332
-	$my_remind_list = array_filter($my_remind_list);
330
+    $my_remind_list = $exercise_stat_info['questions_to_check'];
331
+    $my_remind_list = explode(',', $my_remind_list);
332
+    $my_remind_list = array_filter($my_remind_list);
333 333
 }
334 334
 
335 335
 $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();
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 
338 338
 if ($reminder == 2 && empty($my_remind_list)) {
339 339
     if ($debug) { error_log("6.2 calling the exercise_reminder.php "); };
340
-	header('Location: exercise_reminder.php?'.$params);
341
-	exit;
340
+    header('Location: exercise_reminder.php?'.$params);
341
+    exit;
342 342
 }
343 343
 
344 344
 /*
@@ -346,56 +346,56 @@  discard block
 block discarded – undo
346 346
  * If the expired time is major that zero(0) then the expired time is compute on this time.
347 347
  */
348 348
 if ($time_control) {
349
-	if ($debug) error_log('7.1. Time control is enabled');
350
-	if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
351
-	if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
349
+    if ($debug) error_log('7.1. Time control is enabled');
350
+    if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
351
+    if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
352 352
 
353 353
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
354 354
         //Timer - Get expired_time for a student
355 355
         if (!empty($exercise_stat_info)) {
356
-        	if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); };
357
-	        $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
358
-			if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
359
-	        // Get the last attempt of an exercise
360
-	    	$last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
356
+            if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); };
357
+            $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
358
+            if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
359
+            // Get the last attempt of an exercise
360
+            $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
361 361
 
362
-	    	/* This means that the user enters the exam but do not answer the
362
+            /* This means that the user enters the exam but do not answer the
363 363
 	    	   first question we get the date from the track_e_exercises not from
364 364
 	    	   the track_et_attempt see #2069 */
365
-	    	if (empty($last_attempt_date)) {
366
-	    		$diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
367
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
368
-	    	} else {
369
-	    		//Recalculate the time control due #2069
370
-	    		$diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
371
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
372
-	    	}
373
-	        if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
374
-
375
-	        //New expired time - it is due to the possible closure of session
376
-	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
377
-	        if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
378
-
379
-	        $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
380
-	        if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
381
-
382
-	        $clock_expired_time  = api_get_utc_datetime($expected_time);
383
-	        if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
384
-
385
-			// First we update the attempt to today
386
-			/* How the expired time is changed into "track_e_exercises" table,
365
+            if (empty($last_attempt_date)) {
366
+                $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
367
+                $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
368
+            } else {
369
+                //Recalculate the time control due #2069
370
+                $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
371
+                $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
372
+            }
373
+            if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
374
+
375
+            //New expired time - it is due to the possible closure of session
376
+            $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
377
+            if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
378
+
379
+            $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
380
+            if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
381
+
382
+            $clock_expired_time  = api_get_utc_datetime($expected_time);
383
+            if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
384
+
385
+            // First we update the attempt to today
386
+            /* How the expired time is changed into "track_e_exercises" table,
387 387
                then the last attempt for this student should be changed too */
388
-	        $sql = "UPDATE $exercise_attempt_table SET
388
+            $sql = "UPDATE $exercise_attempt_table SET
389 389
 	                tms = '".api_get_utc_datetime()."'
390 390
 	                WHERE
391 391
 	                    exe_id = '".$exercise_stat_info['exe_id']."' AND
392 392
 	                    tms = '".$last_attempt_date."' ";
393
-	        if ($debug) {error_log('7.10. $sql: '.$sql); }
394
-	        Database::query($sql);
393
+            if ($debug) {error_log('7.10. $sql: '.$sql); }
394
+            Database::query($sql);
395 395
 
396
-	        //Sessions  that contain the expired time
397
-	        $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
398
-	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
396
+            //Sessions  that contain the expired time
397
+            $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
398
+            if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
399 399
         }
400 400
     } else {
401 401
         $clock_expired_time =  $_SESSION['expired_time'][$current_expired_time_key];
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
  * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock
413 413
  */
414 414
 if ($time_control) { //Sends the exercise form when the expired time is finished
415
-	$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
415
+    $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
416 416
 }
417 417
 
418 418
 // if the user has submitted the form
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
     // selects the list of question ID
427 427
     $questionList = $objExercise->get_validated_question_list();
428 428
     if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) {
429
-    	$questionList = explode(',', $exercise_stat_info['data_tracking']);
429
+        $questionList = explode(',', $exercise_stat_info['data_tracking']);
430 430
     }
431 431
     Session::write('questionList', $questionList);
432 432
     if ($debug > 0) { error_log('$_SESSION[questionList] was set'); }
433 433
 } else {
434
-	if (isset($objExercise) && isset($_SESSION['objExercise'])) {
435
-    	$questionList = $_SESSION['questionList'];
436
-	}
434
+    if (isset($objExercise) && isset($_SESSION['objExercise'])) {
435
+        $questionList = $_SESSION['questionList'];
436
+    }
437 437
 }
438 438
 
439 439
 if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1));
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 //Real question count
442 442
 $question_count = 0;
443 443
 if (!empty($questionList)) {
444
-	$question_count = count($questionList);
444
+    $question_count = count($questionList);
445 445
 }
446 446
 
447 447
 if ($formSent && isset($_POST)) {
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
                 //saving each question
484 484
                 if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) {
485 485
                     $nro_question = $current_question; // - 1;
486
-                 	$questionId   = $key;
486
+                        $questionId   = $key;
487 487
                     // gets the student choice for this question
488 488
                     $choice = $exerciseResult[$questionId];
489 489
                     if (isset($exe_id)) {
490
-                    	// Manage the question and answer attempts
490
+                        // Manage the question and answer attempts
491 491
                         if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); }
492 492
                         $objExercise->manage_answer(
493 493
                             $exe_id,
@@ -573,58 +573,58 @@  discard block
 block discarded – undo
573 573
 }
574 574
 
575 575
 if ($question_count != 0) {
576
-	if (($objExercise->type == ALL_ON_ONE_PAGE ||
576
+    if (($objExercise->type == ALL_ON_ONE_PAGE ||
577 577
         $current_question > $question_count)
578 578
     ) {
579
-	    if (api_is_allowed_to_session_edit()) {
580
-	        // goes to the script that will show the result of the exercise
581
-	        if ($objExercise->type == ALL_ON_ONE_PAGE) {
582
-	            if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); }
583
-
584
-	            //We check if the user attempts before sending to the exercise_result.php
585
-	            if ($objExercise->selectAttempts() > 0) {
586
-	                $attempt_count = Event::get_attempt_count(
579
+        if (api_is_allowed_to_session_edit()) {
580
+            // goes to the script that will show the result of the exercise
581
+            if ($objExercise->type == ALL_ON_ONE_PAGE) {
582
+                if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); }
583
+
584
+                //We check if the user attempts before sending to the exercise_result.php
585
+                if ($objExercise->selectAttempts() > 0) {
586
+                    $attempt_count = Event::get_attempt_count(
587 587
                         api_get_user_id(),
588 588
                         $exerciseId,
589 589
                         $learnpath_id,
590 590
                         $learnpath_item_id,
591 591
                         $learnpath_item_view_id
592 592
                     );
593
-	                if ($attempt_count >= $objExercise->selectAttempts()) {
594
-	                    Display :: display_warning_message(
593
+                    if ($attempt_count >= $objExercise->selectAttempts()) {
594
+                        Display :: display_warning_message(
595 595
                             sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()),
596 596
                             false
597 597
                         );
598
-	                    if ($origin != 'learnpath') {
599
-	                        //so we are not in learnpath tool
600
-	                        echo '</div>'; //End glossary div
601
-	                        Display :: display_footer();
602
-	                    } else {
603
-	                        echo '</body></html>';
604
-	                    }
605
-	                    exit;
606
-	                }
607
-	            }
608
-	        } else {
609
-	            if ($objExercise->review_answers) {
610
-	            	header('Location: exercise_reminder.php?'.$params);
611
-	            	exit;
612
-	            } else {
598
+                        if ($origin != 'learnpath') {
599
+                            //so we are not in learnpath tool
600
+                            echo '</div>'; //End glossary div
601
+                            Display :: display_footer();
602
+                        } else {
603
+                            echo '</body></html>';
604
+                        }
605
+                        exit;
606
+                    }
607
+                }
608
+            } else {
609
+                if ($objExercise->review_answers) {
610
+                    header('Location: exercise_reminder.php?'.$params);
611
+                    exit;
612
+                } else {
613 613
                     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");
614 614
                     exit;
615
-	            }
616
-	        }
617
-	    } else {
618
-	        if ($debug) { error_log('Redirecting to exercise_submit.php'); }
619
-	        exit;
620
-	    }
621
-	}
615
+                }
616
+            }
617
+        } else {
618
+            if ($debug) { error_log('Redirecting to exercise_submit.php'); }
619
+            exit;
620
+        }
621
+    }
622 622
 } else {
623
-	$error = get_lang('ThereAreNoQuestionsForThisExercise');
624
-	// if we are in the case where user select random by category, but didn't choose the number of random question
625
-	if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) {
626
-		$error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion');
627
-	}
623
+    $error = get_lang('ThereAreNoQuestionsForThisExercise');
624
+    // if we are in the case where user select random by category, but didn't choose the number of random question
625
+    if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) {
626
+        $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion');
627
+    }
628 628
 }
629 629
 
630 630
 if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 if (api_is_course_admin() && $origin != 'learnpath') {
659 659
     echo '<div class="actions">';
660 660
     if ($show_quiz_edition == false) {
661
-    	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>';
661
+        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>';
662 662
     } else {
663
-    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
663
+        echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
664 664
     }
665 665
     echo '</div>';
666 666
 }
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
             $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet');
704 704
             Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts()));
705 705
             if ($origin != 'learnpath') {
706
-            	Display :: display_footer();
706
+                Display :: display_footer();
707 707
             }
708 708
             exit;
709 709
         } else {
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 if (isset($_custom['exercises_hidden_when_no_start_date']) &&
719 719
     $_custom['exercises_hidden_when_no_start_date']
720 720
 ) {
721
-	if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') {
721
+    if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') {
722 722
         Display:: display_warning_message(
723 723
             sprintf(
724 724
                 get_lang('ExerciseNoStartedYet'),
@@ -726,20 +726,20 @@  discard block
 block discarded – undo
726 726
                 $objExercise->selectAttempts()
727 727
             )
728 728
         );
729
-		if ($origin != 'learnpath') {
730
-			Display :: display_footer();
731
-		}
732
-	}
729
+        if ($origin != 'learnpath') {
730
+            Display :: display_footer();
731
+        }
732
+    }
733 733
 }
734 734
 
735 735
 //Timer control
736 736
 if ($time_control) {
737 737
     echo $objExercise->return_time_left_div();
738
-	echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>';
738
+    echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>';
739 739
 }
740 740
 
741 741
 if ($origin != 'learnpath') {
742
-   echo '<div id="highlight-plugin" class="glossary-content">';
742
+    echo '<div id="highlight-plugin" class="glossary-content">';
743 743
 }
744 744
 
745 745
 if ($reminder == 2)  {
@@ -751,53 +751,53 @@  discard block
 block discarded – undo
751 751
     $current_question = 1; //set by default the 1st question
752 752
 
753 753
     if (!empty($my_remind_list)) {
754
-    	//Checking which questions we are going to call from the remind list
755
-		for ($i = 0; $i < count($data_tracking); $i++) {
756
-			for($j = 0; $j < count($my_remind_list); $j++) {
757
-
758
-				if (!empty($remind_question_id)) {
759
-					if ($remind_question_id == $my_remind_list[$j]) {
760
-
761
-			        	if ($remind_question_id == $data_tracking[$i]) {
762
-			        		if (isset($my_remind_list[$j+1])) {
763
-			        			$remind_question_id = $my_remind_list[$j+1];
764
-			        			$current_question = $i + 1;
765
-			        		} else {
754
+        //Checking which questions we are going to call from the remind list
755
+        for ($i = 0; $i < count($data_tracking); $i++) {
756
+            for($j = 0; $j < count($my_remind_list); $j++) {
757
+
758
+                if (!empty($remind_question_id)) {
759
+                    if ($remind_question_id == $my_remind_list[$j]) {
760
+
761
+                        if ($remind_question_id == $data_tracking[$i]) {
762
+                            if (isset($my_remind_list[$j+1])) {
763
+                                $remind_question_id = $my_remind_list[$j+1];
764
+                                $current_question = $i + 1;
765
+                            } else {
766 766
                                 // We end the remind list we go to the exercise_reminder.php please
767
-			        			$remind_question_id = -1;
768
-			        			$current_question = $i + 1; // last question
769
-			        		}
770
-			        		break 2;
771
-			            }
772
-					}
773
-				} else {
774
-					if ($my_remind_list[$j] == $data_tracking[$i]) {
775
-						if (isset($my_remind_list[$j+1])) {
776
-							$remind_question_id = $my_remind_list[$j+1];
777
-							$current_question = $i + 1; // last question
778
-						} else {
767
+                                $remind_question_id = -1;
768
+                                $current_question = $i + 1; // last question
769
+                            }
770
+                            break 2;
771
+                        }
772
+                    }
773
+                } else {
774
+                    if ($my_remind_list[$j] == $data_tracking[$i]) {
775
+                        if (isset($my_remind_list[$j+1])) {
776
+                            $remind_question_id = $my_remind_list[$j+1];
777
+                            $current_question = $i + 1; // last question
778
+                        } else {
779 779
                             // We end the remind list we go to the exercise_reminder.php please
780
-							$remind_question_id = -1;
781
-							$current_question = $i + 1; // last question
782
-						}
783
-						break 2;
784
-					}
785
-				}
786
-			}
780
+                            $remind_question_id = -1;
781
+                            $current_question = $i + 1; // last question
782
+                        }
783
+                        break 2;
784
+                    }
785
+                }
786
+            }
787 787
         }
788 788
     } else {
789
-    	if ($objExercise->review_answers) {
789
+        if ($objExercise->review_answers) {
790 790
             if ($debug) { error_log('. redirecting to exercise_reminder.php '); }
791
-	    	header("Location: exercise_reminder.php?$params");
792
-	    	exit;
793
-    	}
791
+            header("Location: exercise_reminder.php?$params");
792
+            exit;
793
+        }
794 794
     }
795 795
 }
796 796
 
797 797
 if ($objExercise->review_answers) {
798
-	$script_php = 'exercise_reminder.php';
798
+    $script_php = 'exercise_reminder.php';
799 799
 } else {
800
-	$script_php = 'exercise_result.php';
800
+    $script_php = 'exercise_result.php';
801 801
 }
802 802
 
803 803
 if (!empty($error)) {
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
          <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id . '" />
1038 1038
          <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />';
1039 1039
 
1040
-	// Show list of questions
1040
+    // Show list of questions
1041 1041
     $i = 1;
1042 1042
 
1043 1043
     $attempt_list = array();
@@ -1089,10 +1089,10 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
         $attributes = array('id' =>'remind_list['.$questionId.']');
1091 1091
         if (in_array($questionId, $remind_list)) {
1092
-        	$is_remind_on = true;
1093
-        	$attributes['checked'] = 1;
1094
-        	$remind_question = true;
1095
-        	$remind_highlight = ' remind_highlight ';
1092
+            $is_remind_on = true;
1093
+            $attributes['checked'] = 1;
1094
+            $remind_question = true;
1095
+            $remind_highlight = ' remind_highlight ';
1096 1096
         }
1097 1097
 
1098 1098
         // Showing the question
@@ -1152,8 +1152,8 @@  discard block
 block discarded – undo
1152 1152
     }
1153 1153
     // end foreach()
1154 1154
     if ($objExercise->type == ALL_ON_ONE_PAGE) {
1155
-    	$exercise_actions =  $objExercise->show_button($questionId, $current_question);
1156
-    	echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1155
+        $exercise_actions =  $objExercise->show_button($questionId, $current_question);
1156
+        echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1157 1157
         echo '<br>';
1158 1158
     }
1159 1159
     echo '</form>';
Please login to merge, or discard this patch.
main/exercice/multiple_answer.class.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
 
169
-	/**
170
-	 * abstract function which creates the form to create / edit the answers of the question
171
-	 * @param the formvalidator instance
172
-	 * @param the answers number to display
173
-	 */
174
-	function processAnswersCreation($form)
169
+    /**
170
+     * abstract function which creates the form to create / edit the answers of the question
171
+     * @param the formvalidator instance
172
+     * @param the answers number to display
173
+     */
174
+    function processAnswersCreation($form)
175 175
     {
176 176
         $questionWeighting = $nbrGoodAnswers = 0;
177 177
         $objAnswer  = new Answer($this->id);
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
         // sets the total weighting of the question
202 202
         $this->updateWeighting($questionWeighting);
203 203
         $this->save();
204
-	}
204
+    }
205 205
 
206
-	function return_header($feedback_type = null, $counter = null, $score = null)
206
+    function return_header($feedback_type = null, $counter = null, $score = null)
207 207
     {
208
-	    $header = parent::return_header($feedback_type, $counter, $score);
209
-	    $header .= '<table class="'.$this->question_table_class .'">
208
+        $header = parent::return_header($feedback_type, $counter, $score);
209
+        $header .= '<table class="'.$this->question_table_class .'">
210 210
 			<tr>
211 211
 				<th>'.get_lang("Choice").'</th>
212 212
 				<th>'. get_lang("ExpectedChoice").'</th>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $header .= '<th>'.get_lang("Comment").'</th>';
215 215
         $header .= '</tr>';
216 216
         return $header;
217
-	}
217
+    }
218 218
 
219 219
 
220 220
 }
Please login to merge, or discard this patch.
main/exercice/showinframes.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 $content = ReadFileCont($full_file_path.$user_id.'.t.html');
29 29
 
30 30
 if ($content == '') {
31
-	$content = ReadFileCont($full_file_path);
31
+    $content = ReadFileCont($full_file_path);
32 32
     // Do not move this like:
33
-	$mit = "function Finish(){";
34
-	$js_content = "
33
+    $mit = "function Finish(){";
34
+    $js_content = "
35 35
     // Code added - start
36 36
     var SaveScoreVariable = 0;
37 37
     function mySaveScore() {
Please login to merge, or discard this patch.
main/exercice/hotpotatoes.lib.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 block discarded – undo
344 344
                     if (is_dir($full_name)) {
345 345
                         $filelist[] = $file;
346 346
                     }
347
-               }
347
+                }
348 348
             }
349 349
         }
350 350
     }
Please login to merge, or discard this patch.
main/exercice/unique_answer_no_option.class.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class UniqueAnswerNoOption extends Question
14 14
 {
15
-	static $typePicture = 'mcuao.png';
16
-	static $explanationLangVar = 'UniqueAnswerNoOption';
15
+    static $typePicture = 'mcuao.png';
16
+    static $explanationLangVar = 'UniqueAnswerNoOption';
17 17
 
18
-	/**
19
-	 * Constructor
20
-	 */
21
-	public function __construct()
18
+    /**
19
+     * Constructor
20
+     */
21
+    public function __construct()
22 22
     {
23
-		//this is highly important
24
-		parent::__construct();
25
-		$this -> type = UNIQUE_ANSWER_NO_OPTION;
26
-		$this -> isContent = $this-> getIsContent();
27
-	}
23
+        //this is highly important
24
+        parent::__construct();
25
+        $this -> type = UNIQUE_ANSWER_NO_OPTION;
26
+        $this -> isContent = $this-> getIsContent();
27
+    }
28 28
 
29
-	/**
29
+    /**
30 30
      * function which redifines Question::createAnswersForm
31 31
      * @param the formvalidator instance
32 32
      * @param the answers number to display
@@ -283,37 +283,37 @@  discard block
 block discarded – undo
283 283
     }
284 284
 
285 285
     /**
286
-	 * Function which creates the form to create / edit the answers of the question
287
-	 * @param the formvalidator instance
288
-	 * @param the answers number to display
289
-	 */
290
-	function processAnswersCreation($form)
286
+     * Function which creates the form to create / edit the answers of the question
287
+     * @param the formvalidator instance
288
+     * @param the answers number to display
289
+     */
290
+    function processAnswersCreation($form)
291 291
     {
292
-		$questionWeighting = $nbrGoodAnswers = 0;
293
-		$correct = $form -> getSubmitValue('correct');
294
-		$objAnswer = new Answer($this->id);
295
-		$nb_answers = $form -> getSubmitValue('nb_answers');
296
-		$minus = 1;
297
-		if ($form -> getSubmitValue('new_question')) {
298
-		    $minus = 0;
299
-		}
300
-
301
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
292
+        $questionWeighting = $nbrGoodAnswers = 0;
293
+        $correct = $form -> getSubmitValue('correct');
294
+        $objAnswer = new Answer($this->id);
295
+        $nb_answers = $form -> getSubmitValue('nb_answers');
296
+        $minus = 1;
297
+        if ($form -> getSubmitValue('new_question')) {
298
+            $minus = 0;
299
+        }
300
+
301
+        for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
+            $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
+            $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
304 304
             $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
305 305
             $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
306 306
             $scenario   = $form -> getSubmitValue('scenario');
307 307
 
308
-           	//$list_destination = $form -> getSubmitValue('destination'.$i);
309
-           	//$destination_str = $form -> getSubmitValue('destination'.$i);
308
+                //$list_destination = $form -> getSubmitValue('destination'.$i);
309
+                //$destination_str = $form -> getSubmitValue('destination'.$i);
310 310
 
311
- 		    $try           = $scenario['try'.$i];
311
+                $try           = $scenario['try'.$i];
312 312
             $lp            = $scenario['lp'.$i];
313
- 			$destination   = $scenario['destination'.$i];
314
- 			$url           = trim($scenario['url'.$i]);
313
+                $destination   = $scenario['destination'.$i];
314
+                $url           = trim($scenario['url'.$i]);
315 315
 
316
- 			/*
316
+                /*
317 317
  			How we are going to parse the destination value
318 318
 
319 319
 			here we parse the destination value which is a string
@@ -326,41 +326,41 @@  discard block
 block discarded – undo
326 326
 			selected_questions= ids of questions
327 327
 			url= an url
328 328
 			*/
329
-			/*
329
+            /*
330 330
  			$destination_str='';
331 331
  			foreach ($list_destination as $destination_id)
332 332
  			{
333 333
  				$destination_str.=$destination_id.';';
334 334
  			}*/
335 335
 
336
-        	$goodAnswer= ($correct == $i) ? true : false;
336
+            $goodAnswer= ($correct == $i) ? true : false;
337 337
 
338
-        	if ($goodAnswer) {
339
-        		$nbrGoodAnswers++;
340
-        		$weighting = abs($weighting);
341
-        		if($weighting > 0) {
338
+            if ($goodAnswer) {
339
+                $nbrGoodAnswers++;
340
+                $weighting = abs($weighting);
341
+                if($weighting > 0) {
342 342
                     $questionWeighting += $weighting;
343 343
                 }
344
-        	}
344
+            }
345 345
 
346
- 			if (empty($try))
347
- 				$try=0;
346
+                if (empty($try))
347
+                    $try=0;
348 348
 
349
- 			if (empty($lp)) {
350
- 				$lp=0;
351
- 			}
349
+                if (empty($lp)) {
350
+                    $lp=0;
351
+                }
352 352
 
353
- 			if (empty($destination)) {
354
- 				$destination=0;
355
- 			}
353
+                if (empty($destination)) {
354
+                    $destination=0;
355
+                }
356 356
 
357
- 			if ($url=='') {
358
- 				$url=0;
359
- 			}
357
+                if ($url=='') {
358
+                    $url=0;
359
+                }
360 360
 
361
- 			//1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
-			$dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
-        	$objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
361
+                //1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
+            $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
+            $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
364 364
         }
365 365
 
366 366
         //Create 666 answer
@@ -373,18 +373,18 @@  discard block
 block discarded – undo
373 373
 
374 374
         $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
375 375
 
376
-    	// saves the answers into the data base
376
+        // saves the answers into the data base
377 377
         $objAnswer -> save();
378 378
 
379 379
         // sets the total weighting of the question
380 380
         $this -> updateWeighting($questionWeighting);
381 381
         $this -> save();
382
-	}
382
+    }
383 383
 
384
-	function return_header($feedback_type = null, $counter = null, $score = null)
384
+    function return_header($feedback_type = null, $counter = null, $score = null)
385 385
     {
386
-	    $header = parent::return_header($feedback_type, $counter, $score);
387
-	    $header .= '<table class="'.$this->question_table_class .'">
386
+        $header = parent::return_header($feedback_type, $counter, $score);
387
+        $header .= '<table class="'.$this->question_table_class .'">
388 388
 			<tr>
389 389
 				<th>'.get_lang("Choice").'</th>
390 390
 				<th>'. get_lang("ExpectedChoice").'</th>
@@ -392,5 +392,5 @@  discard block
 block discarded – undo
392 392
         $header .= '<th>'.get_lang("Comment").'</th>';
393 393
         $header .= '</tr>';
394 394
         return $header;
395
-	}
395
+    }
396 396
 }
Please login to merge, or discard this patch.