Completed
Push — 1.10.x ( 5afc49...70def3 )
by Julito
48:57
created
main/exercice/hotspot_updatescore.inc.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@
 block discarded – undo
17 17
 $hotspotId	  = $_GET['hotspotId'];
18 18
 $exerciseId   = $objExcercise->selectId();
19 19
 if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
20
-	$hit = 0;
21
-	$answerId = $hotspotId;
20
+    $hit = 0;
21
+    $answerId = $hotspotId;
22 22
 
23
-	// remove from session
24
-	unset($_SESSION['exerciseResult'][$questionId][$answerId]);
23
+    // remove from session
24
+    unset($_SESSION['exerciseResult'][$questionId][$answerId]);
25 25
 
26
-	// Save clicking order
27
-	//$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
28
-	//$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
26
+    // Save clicking order
27
+    //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
28
+    //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
29 29
 } else { // user clicked ON a hotspot
30
-	$hit = 1;
31
-	$answerId = $hotspotId;
30
+    $hit = 1;
31
+    $answerId = $hotspotId;
32 32
 
33
-	// Save into session
34
-	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
33
+    // Save into session
34
+    $_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
35 35
 
36
-	// Save clicking order
37
-	//$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
38
-	//$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
36
+    // Save clicking order
37
+    //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
38
+    //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
39 39
 }
40 40
 
41 41
 //round-up the coordinates
Please login to merge, or discard this patch.
main/exercice/hotspot_admin.inc.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -907,10 +907,10 @@
 block discarded – undo
907 907
                                         <?php } else { ?>
908 908
                                             <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
909 909
                                                    <?php
910
-                                               }
911
-                                           }
912
-                                           if ($answerType == HOT_SPOT) {
913
-                                               ?>
910
+                                                }
911
+                                            }
912
+                                            if ($answerType == HOT_SPOT) {
913
+                                                ?>
914 914
                                         <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" />
915 915
                                         <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
916 916
                                         <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" />
Please login to merge, or discard this patch.
main/exercice/hotspot_savescore.inc.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@
 block discarded – undo
17 17
 $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
18 18
 if ($_GET['answerId'] == "0") // click is NOT on a hotspot
19 19
 {
20
-	$hit = 0;
21
-	$answerId = NULL;
20
+    $hit = 0;
21
+    $answerId = NULL;
22 22
 }
23 23
 else // user clicked ON a hotspot
24 24
 {
25
-	$hit = 1;
26
-	$answerId = api_substr($_GET['answerId'],22,2);
27
-	// Save into session
28
-	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
25
+    $hit = 1;
26
+    $answerId = api_substr($_GET['answerId'],22,2);
27
+    // Save into session
28
+    $_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
29 29
 }
30 30
 //round-up the coordinates
31 31
 $coords = explode('/',$coordinates);
Please login to merge, or discard this patch.
main/exercice/exercise_reminder.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -223,10 +223,10 @@
 block discarded – undo
223 223
 
224 224
     $counter++;
225 225
     if ($objExercise->type == ONE_PER_PAGE) {
226
-       $question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url);
227
-       $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40);
226
+        $question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url);
227
+        $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40);
228 228
     } else {
229
-       $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40);
229
+        $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40);
230 230
     }
231 231
     //Check if the question doesn't have an answer
232 232
     if (!in_array($questionId, $exercise_result)) {
Please login to merge, or discard this patch.
main/exercice/exercise_result.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 $gradebook = '';
61 61
 if (isset($_SESSION['gradebook'])) {
62
-	$gradebook=	$_SESSION['gradebook'];
62
+    $gradebook=	$_SESSION['gradebook'];
63 63
 }
64 64
 if (!empty($gradebook) && $gradebook=='view') {
65 65
     $interbreadcrumb[] = array(
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 $htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
80 80
 
81 81
 if ($origin != 'learnpath') {
82
-	// So we are not in learnpath tool
83
-	Display::display_header($nameTools, get_lang('Exercise'));
82
+    // So we are not in learnpath tool
83
+    Display::display_header($nameTools, get_lang('Exercise'));
84 84
 } else {
85 85
     $htmlHeadXtra[] = "
86 86
     <style>
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
 
95 95
 // I'm in a preview mode as course admin. Display the action menu.
96 96
 if (api_is_course_admin() && $origin != 'learnpath') {
97
-	echo '<div class="actions">';
98
-	echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.
97
+    echo '<div class="actions">';
98
+    echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.
99 99
         Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>';
100
-	echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
100
+    echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
101 101
         Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>';
102
-	echo '</div>';
102
+    echo '</div>';
103 103
 }
104 104
 
105 105
 $feedback_type = $objExercise->feedback_type;
106 106
 $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
107 107
 
108 108
 if (!empty($exercise_stat_info['data_tracking'])) {
109
-	$question_list = explode(',', $exercise_stat_info['data_tracking']);
109
+    $question_list = explode(',', $exercise_stat_info['data_tracking']);
110 110
 }
111 111
 
112 112
 $learnpath_id = $exercise_stat_info['orig_lp_id'];
@@ -180,19 +180,19 @@  discard block
 block discarded – undo
180 180
         Session::erase('exe_id');
181 181
     }
182 182
 
183
-	Display::display_footer();
183
+    Display::display_footer();
184 184
 } else {
185
-	$lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null;
186
-	$url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
187
-	$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
185
+    $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null;
186
+    $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
187
+    $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
188 188
 
189 189
     if (api_is_allowed_to_session_edit()) {
190 190
         Session::erase('objExercise');
191 191
         Session::erase('exe_id');
192 192
     }
193 193
 
194
-	// Record the results in the learning path, using the SCORM interface (API)
195
-	echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>";
194
+    // Record the results in the learning path, using the SCORM interface (API)
195
+    echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>";
196 196
     echo '<script type="text/javascript">'.$href.'</script>';
197
-	echo '</body></html>';
197
+    echo '</body></html>';
198 198
 }
Please login to merge, or discard this patch.
main/exercice/exercise_result.class.php 1 patch
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 */
10 10
 class ExerciseResult
11 11
 {
12
-	private $results = array();
12
+    private $results = array();
13 13
     public $includeAllUsers = false;
14 14
     public $onlyBestAttempts = false;
15 15
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $exercise_id = 0,
47 47
         $hotpotato_name = null
48 48
     ) {
49
-		$return = array();
49
+        $return = array();
50 50
 
51 51
         $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
52 52
         $TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN);
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
             $session_id_and .= " AND exe_exo_id = $exercise_id ";
67 67
         }
68 68
 
69
-		if (empty($user_id)) {
69
+        if (empty($user_id)) {
70 70
             $user_id_and = null;
71
-			$sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
71
+            $sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
72 72
 			            official_code,
73 73
                         ce.title as extitle,
74 74
                         te.exe_result as exresult ,
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
                     te.status != 'incomplete' AND
92 92
                     te.c_id = ce.c_id $user_id_and  $session_id_and AND
93 93
                     ce.active <>-1";
94
-		} else {
94
+        } else {
95 95
             $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
96
-			// get only this user's results
96
+            // get only this user's results
97 97
             $sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
98 98
                     official_code,
99 99
                     ce.title as extitle,
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
                         te.c_id = ce.c_id $user_id_and $session_id_and AND
120 120
                         ce.active <>-1 AND
121 121
                     ORDER BY userpart2, te.c_id ASC, ce.title ASC, te.exe_date DESC";
122
-		}
122
+        }
123 123
 
124
-		$results = array();
125
-		$resx = Database::query($sql);
124
+        $results = array();
125
+        $resx = Database::query($sql);
126 126
         $bestAttemptPerUser = array();
127
-		while ($rowx = Database::fetch_array($resx,'ASSOC')) {
127
+        while ($rowx = Database::fetch_array($resx,'ASSOC')) {
128 128
             if ($this->onlyBestAttempts) {
129 129
                 if (!isset($bestAttemptPerUser[$rowx['excruid']])) {
130 130
                     $bestAttemptPerUser[$rowx['excruid']] = $rowx;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             } else {
137 137
                 $results[] = $rowx;
138 138
             }
139
-		}
139
+        }
140 140
 
141 141
         if ($this->onlyBestAttempts) {
142 142
             $results = $bestAttemptPerUser;
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
                     continue;
191 191
                 }
192 192
 
193
-				$return[$i] = array();
194
-				if (empty($user_id)) {
193
+                $return[$i] = array();
194
+                if (empty($user_id)) {
195 195
                     $return[$i]['official_code']   = $result['official_code'];
196 196
                     if (api_is_western_name_order()) {
197 197
                         $return[$i]['first_name']   = $results[$i]['userpart1'];
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
                         $return[$i]['first_name']   = $results[$i]['userpart2'];
201 201
                         $return[$i]['last_name']    = $results[$i]['userpart1'];
202 202
                     }
203
-					$return[$i]['user_id']      = $results[$i]['excruid'];
204
-					$return[$i]['email']        = $results[$i]['exemail'];
205
-				}
206
-				$return[$i]['title'] = $result['extitle'];
207
-				$return[$i]['start_date'] = api_get_local_time($result['exstart']);
203
+                    $return[$i]['user_id']      = $results[$i]['excruid'];
204
+                    $return[$i]['email']        = $results[$i]['exemail'];
205
+                }
206
+                $return[$i]['title'] = $result['extitle'];
207
+                $return[$i]['start_date'] = api_get_local_time($result['exstart']);
208 208
                 $return[$i]['end_date'] = api_get_local_time($result['exdate']);
209 209
                 $return[$i]['duration'] = $result['duration'];
210
-				$return[$i]['result'] = $result['exresult'];
211
-				$return[$i]['max'] = $result['exweight'];
210
+                $return[$i]['result'] = $result['exresult'];
211
+                $return[$i]['max'] = $result['exweight'];
212 212
                 $return[$i]['status'] = $revised ? get_lang('Validated') : get_lang('NotValidated');
213 213
                 $return[$i]['lp_id'] = $result['orig_lp_id'];
214 214
                 $return[$i]['lp_name'] = $result['lp_name'];
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 
222 222
                 $userWithResults[$result['excruid']] = 1;
223 223
                 $i++;
224
-			}
225
-		}
224
+            }
225
+        }
226 226
 
227 227
         if ($this->includeAllUsers) {
228 228
             $latestId = count($return);
@@ -265,18 +265,18 @@  discard block
 block discarded – undo
265 265
             }
266 266
         }
267 267
 
268
-		$this->results = $return;
268
+        $this->results = $return;
269 269
 
270
-		return true;
271
-	}
270
+        return true;
271
+    }
272 272
 
273
-	/**
274
-	 * Exports the complete report as a CSV file
275
-	 * @param	string		Document path inside the document tool
276
-	 * @param	integer		Optional user ID
277
-	 * @param	boolean		Whether to include user fields or not
278
-	 * @return	boolean		False on error
279
-	 */
273
+    /**
274
+     * Exports the complete report as a CSV file
275
+     * @param	string		Document path inside the document tool
276
+     * @param	integer		Optional user ID
277
+     * @param	boolean		Whether to include user fields or not
278
+     * @return	boolean		False on error
279
+     */
280 280
     public function exportCompleteReportCSV(
281 281
         $document_path = '',
282 282
         $user_id = null,
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
         $exercise_id = 0,
286 286
         $hotpotato_name = null
287 287
     ) {
288
-		global $charset;
289
-		$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
290
-
291
-		$filename = 'exercise_results_'.date('YmdGis').'.csv';
292
-		if(!empty($user_id)) {
293
-			$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
294
-		}
295
-		$data = '';
288
+        global $charset;
289
+        $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
290
+
291
+        $filename = 'exercise_results_'.date('YmdGis').'.csv';
292
+        if(!empty($user_id)) {
293
+            $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
294
+        }
295
+        $data = '';
296 296
         if (api_is_western_name_order()) {
297 297
             if(!empty($this->results[0]['first_name'])) {
298 298
                 $data .= get_lang('FirstName').';';
@@ -316,28 +316,28 @@  discard block
 block discarded – undo
316 316
         $data .= get_lang('Email').';';
317 317
         $data .= get_lang('Groups').';';
318 318
 
319
-		if ($export_user_fields) {
320
-			//show user fields section with a big th colspan that spans over all fields
321
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
322
-			$num = count($extra_user_fields);
323
-			foreach($extra_user_fields as $field) {
324
-				$data .= '"'.str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";';
325
-			}
326
-		}
327
-
328
-		$data .= get_lang('Title').';';
329
-		$data .= get_lang('StartDate').';';
319
+        if ($export_user_fields) {
320
+            //show user fields section with a big th colspan that spans over all fields
321
+            $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
322
+            $num = count($extra_user_fields);
323
+            foreach($extra_user_fields as $field) {
324
+                $data .= '"'.str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";';
325
+            }
326
+        }
327
+
328
+        $data .= get_lang('Title').';';
329
+        $data .= get_lang('StartDate').';';
330 330
         $data .= get_lang('EndDate').';';
331 331
         $data .= get_lang('Duration'). ' ('.get_lang('MinMinutes').') ;';
332
-		$data .= get_lang('Score').';';
333
-		$data .= get_lang('Total').';';
332
+        $data .= get_lang('Score').';';
333
+        $data .= get_lang('Total').';';
334 334
         $data .= get_lang('Status').';';
335 335
         $data .= get_lang('ToolLearnpath').';';
336 336
         $data .= get_lang('UserIsCurrentlySubscribed').';';
337
-		$data .= "\n";
337
+        $data .= "\n";
338 338
 
339
-		//results
340
-		foreach ($this->results as $row) {
339
+        //results
340
+        foreach ($this->results as $row) {
341 341
 
342 342
             if (api_is_western_name_order()) {
343 343
                 $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
@@ -354,51 +354,51 @@  discard block
 block discarded – undo
354 354
             $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
355 355
             $data .= str_replace("\r\n",'  ',implode(", ", GroupManager :: get_user_group_name($row['user_id']))).';';
356 356
 
357
-			if ($export_user_fields) {
358
-				//show user fields data, if any, for this user
359
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
360
-				foreach($user_fields_values as $value) {
361
-					$data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
362
-				}
363
-			}
357
+            if ($export_user_fields) {
358
+                //show user fields data, if any, for this user
359
+                $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
360
+                foreach($user_fields_values as $value) {
361
+                    $data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
362
+                }
363
+            }
364 364
 
365
-			$data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
366
-			$data .= str_replace("\r\n",'  ',$row['start_date']).';';
365
+            $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
366
+            $data .= str_replace("\r\n",'  ',$row['start_date']).';';
367 367
             $data .= str_replace("\r\n",'  ',$row['end_date']).';';
368 368
             $data .= str_replace("\r\n",'  ',$row['duration']).';';
369
-			$data .= str_replace("\r\n",'  ',$row['result']).';';
370
-			$data .= str_replace("\r\n",'  ',$row['max']).';';
369
+            $data .= str_replace("\r\n",'  ',$row['result']).';';
370
+            $data .= str_replace("\r\n",'  ',$row['max']).';';
371 371
             $data .= str_replace("\r\n",'  ',$row['status']).';';
372 372
             $data .= str_replace("\r\n",'  ',$row['lp_name']).';';
373 373
             $data .= str_replace("\r\n",'  ',$row['is_user_subscribed']).';';
374
-			$data .= "\n";
375
-		}
376
-
377
-		//output the results
378
-		$len = strlen($data);
379
-		header('Content-type: application/octet-stream');
380
-		header('Content-Type: application/force-download');
381
-		header('Content-length: '.$len);
382
-		if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
383
-			header('Content-Disposition: filename= '.$filename);
384
-		} else {
385
-			header('Content-Disposition: attachment; filename= '.$filename);
386
-		}
387
-		if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
388
-			header('Pragma: ');
389
-			header('Cache-Control: ');
390
-			header('Cache-Control: public'); // IE cannot download from sessions without a cache
391
-		}
392
-		header('Content-Description: '.$filename);
393
-		header('Content-transfer-encoding: binary');
394
-		echo $data;
395
-		return true;
396
-	}
397
-
398
-	/**
399
-	 * Exports the complete report as an XLS file
400
-	 * @return	boolean		False on error
401
-	 */
374
+            $data .= "\n";
375
+        }
376
+
377
+        //output the results
378
+        $len = strlen($data);
379
+        header('Content-type: application/octet-stream');
380
+        header('Content-Type: application/force-download');
381
+        header('Content-length: '.$len);
382
+        if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
383
+            header('Content-Disposition: filename= '.$filename);
384
+        } else {
385
+            header('Content-Disposition: attachment; filename= '.$filename);
386
+        }
387
+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
388
+            header('Pragma: ');
389
+            header('Cache-Control: ');
390
+            header('Cache-Control: public'); // IE cannot download from sessions without a cache
391
+        }
392
+        header('Content-Description: '.$filename);
393
+        header('Content-transfer-encoding: binary');
394
+        echo $data;
395
+        return true;
396
+    }
397
+
398
+    /**
399
+     * Exports the complete report as an XLS file
400
+     * @return	boolean		False on error
401
+     */
402 402
     public function exportCompleteReportXLS(
403 403
         $document_path = '',
404 404
         $user_id = null,
@@ -407,35 +407,35 @@  discard block
 block discarded – undo
407 407
         $exercise_id = 0,
408 408
         $hotpotato_name = null
409 409
     ) {
410
-		global $charset;
411
-		$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
412
-		$filename = 'exercise_results_'.api_get_local_time().'.xls';
413
-		if (!empty($user_id)) {
414
-			$filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
415
-		}
410
+        global $charset;
411
+        $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
412
+        $filename = 'exercise_results_'.api_get_local_time().'.xls';
413
+        if (!empty($user_id)) {
414
+            $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
415
+        }
416 416
 
417 417
         $spreadsheet = new PHPExcel();
418 418
         $spreadsheet->setActiveSheetIndex(0);
419 419
         $worksheet = $spreadsheet->getActiveSheet();
420 420
 
421
-		$line = 0;
422
-		$column = 0; //skip the first column (row titles)
421
+        $line = 0;
422
+        $column = 0; //skip the first column (row titles)
423 423
 
424
-		// check if exists column 'user'
425
-		$with_column_user = false;
426
-		foreach ($this->results as $result) {
427
-			if (!empty($result['last_name']) && !empty($result['first_name'])) {
428
-				$with_column_user = true;
429
-				break;
430
-			}
431
-		}
424
+        // check if exists column 'user'
425
+        $with_column_user = false;
426
+        foreach ($this->results as $result) {
427
+            if (!empty($result['last_name']) && !empty($result['first_name'])) {
428
+                $with_column_user = true;
429
+                break;
430
+            }
431
+        }
432 432
 
433 433
         $officialCodeInList = api_get_setting('show_official_code_exercise_result_list');
434 434
 
435
-		if ($with_column_user) {
435
+        if ($with_column_user) {
436 436
             if (api_is_western_name_order()) {
437
-    			$worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName'));
438
-    			$column++;
437
+                $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName'));
438
+                $column++;
439 439
                 $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('LastName'));
440 440
                 $column++;
441 441
             } else {
@@ -451,43 +451,43 @@  discard block
 block discarded – undo
451 451
             }
452 452
 
453 453
             $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email'));
454
-		    $column++;
455
-		}
454
+            $column++;
455
+        }
456 456
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Groups'));
457
-	    $column++;
458
-
459
-		if ($export_user_fields) {
460
-			//show user fields section with a big th colspan that spans over all fields
461
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
462
-
463
-			//show the fields names for user fields
464
-			foreach ($extra_user_fields as $field) {
465
-				$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
466
-				$column++;
467
-			}
468
-		}
469
-
470
-		$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title'));
471
-		$column++;
472
-		$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate'));
457
+        $column++;
458
+
459
+        if ($export_user_fields) {
460
+            //show user fields section with a big th colspan that spans over all fields
461
+            $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
462
+
463
+            //show the fields names for user fields
464
+            foreach ($extra_user_fields as $field) {
465
+                $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
466
+                $column++;
467
+            }
468
+        }
469
+
470
+        $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title'));
471
+        $column++;
472
+        $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate'));
473 473
         $column++;
474 474
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate'));
475 475
         $column++;
476 476
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
477
-		$column++;
478
-		$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score'));
479
-		$column++;
480
-		$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total'));
481
-		$column++;
477
+        $column++;
478
+        $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score'));
479
+        $column++;
480
+        $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total'));
481
+        $column++;
482 482
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status'));
483
-		$column++;
483
+        $column++;
484 484
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ToolLearnpath'));
485 485
         $column++;
486 486
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('UserIsCurrentlySubscribed'));
487
-		$line++;
487
+        $line++;
488 488
 
489
-		foreach ($this->results as $row) {
490
-			$column = 0;
489
+        foreach ($this->results as $row) {
490
+            $column = 0;
491 491
 
492 492
             if ($with_column_user) {
493 493
                 if (api_is_western_name_order()) {
@@ -509,22 +509,22 @@  discard block
 block discarded – undo
509 509
 
510 510
                 $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
511 511
                 $column++;
512
-			}
512
+            }
513 513
 
514 514
             $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset));
515 515
             $column++;
516 516
 
517
-			if ($export_user_fields) {
518
-				//show user fields data, if any, for this user
519
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
520
-				foreach($user_fields_values as $value) {
521
-					$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
522
-					$column++;
523
-				}
524
-			}
525
-
526
-			$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
527
-			$column++;
517
+            if ($export_user_fields) {
518
+                //show user fields data, if any, for this user
519
+                $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
520
+                foreach($user_fields_values as $value) {
521
+                    $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
522
+                    $column++;
523
+                }
524
+            }
525
+
526
+            $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
527
+            $column++;
528 528
             $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']);
529 529
             $column++;
530 530
             $worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']);
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
             $worksheet->SetCellValueByColumnAndRow($line, $column, $row['lp_name']);
541 541
             $column++;
542 542
             $worksheet->SetCellValueByColumnAndRow($line, $column, $row['is_user_subscribed']);
543
-			$line++;
544
-		}
543
+            $line++;
544
+        }
545 545
 
546 546
         $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
547 547
         $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
548 548
         $writer->save($file);
549 549
         DocumentManager::file_send_for_download($file, true, $filename);
550 550
 
551
-		return true;
552
-	}
551
+        return true;
552
+    }
553 553
 }
Please login to merge, or discard this patch.
main/exercice/unique_answer.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -447,7 +447,7 @@
 block discarded – undo
447 447
         $position = $row_max->max_position + 1;
448 448
 
449 449
         // Insert a new answer
450
-       $params = [
450
+        $params = [
451 451
             'c_id' => $course_id,
452 452
             'id' => $id,
453 453
             'question_id' => $question_id,
Please login to merge, or discard this patch.
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/Hpdownload.php 1 patch
Indentation   +44 added lines, -44 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,23 +68,23 @@  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);
84
-	//$file_content = api_replace_parameter($dir, $file_content, "src");
85
-	//$file_content = api_replace_parameter($dir, $file_content, "href");
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
+    //$file_content = api_replace_parameter($dir, $file_content, "src");
85
+    //$file_content = api_replace_parameter($dir, $file_content, "href");
86 86
 
87
-	/*
87
+    /*
88 88
 	//parse line per line
89 89
 	$file_content_array = file($full_file_name);
90 90
 
@@ -98,16 +98,16 @@  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));
104
-  	$exercisePath = $exercisePath;
101
+        $exfile = explode('/',$exercisePath);
102
+        $exfile = $exfile[sizeof($exfile)-1];
103
+        $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile));
104
+        $exercisePath = $exercisePath;
105 105
 
106
-		$content = $file_content;
107
-		$mit = "function Finish(){";
106
+        $content = $file_content;
107
+        $mit = "function Finish(){";
108 108
 
109
-		$js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n".
110
-		"function mySaveScore() // This function included by Dokeos System\n".
109
+        $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n".
110
+        "function mySaveScore() // This function included by Dokeos System\n".
111 111
 "{\n".
112 112
 "   if (SaveScoreVariable==0)\n".
113 113
 "		{\n".
@@ -125,23 +125,23 @@  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=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
132
-		$newcontent = str_replace($prehref,$posthref,$newcontent);
130
+        $prehref="javascript:void(0);";
131
+        $posthref=$_configuration['root_web']."main/exercice/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
-		header('Content-length: '.strlen($newcontent));
141
-		// Dipsp.
142
-		echo $newcontent;
140
+        header('Content-length: '.strlen($newcontent));
141
+        // Dipsp.
142
+        echo $newcontent;
143 143
 
144
-	exit();
144
+    exit();
145 145
 }
146 146
 
147 147
 //normal case, all non-html files
Please login to merge, or discard this patch.