Completed
Push — 1.10.x ( fe0e5a...3a6f9c )
by Yannick
134:15 queued 86:39
created
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/fill_blanks.class.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -729,43 +729,43 @@  discard block
 block discarded – undo
729 729
     }
730 730
     
731 731
     /**
732
-    * Return an array of student state answers for fill the blank questions
733
-    * for each students that answered the question
734
-    * -2  : didn't answer
735
-    * -1  : student answer is wrong
736
-    *  0  : student answer is correct
737
-    * >0  : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0)
738
-    *
739
-    * @param $testId
740
-    * @param $questionId
741
-    * @param $studentsIdList
742
-    * @param $startDate
743
-    * @param $endDate
744
-    * @param bool $useLastAnswerredAttempt
745
-    * @return array
746
-    * (
747
-    *     [student_id] => Array
748
-    *         (
749
-    *             [first fill the blank for question] => -1
750
-    *             [second fill the blank for question] => 2
751
-    *             [third fill the blank for question] => -1
752
-    *         )
753
-    * )
754
-    */
732
+     * Return an array of student state answers for fill the blank questions
733
+     * for each students that answered the question
734
+     * -2  : didn't answer
735
+     * -1  : student answer is wrong
736
+     *  0  : student answer is correct
737
+     * >0  : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0)
738
+     *
739
+     * @param $testId
740
+     * @param $questionId
741
+     * @param $studentsIdList
742
+     * @param $startDate
743
+     * @param $endDate
744
+     * @param bool $useLastAnswerredAttempt
745
+     * @return array
746
+     * (
747
+     *     [student_id] => Array
748
+     *         (
749
+     *             [first fill the blank for question] => -1
750
+     *             [second fill the blank for question] => 2
751
+     *             [third fill the blank for question] => -1
752
+     *         )
753
+     * )
754
+     */
755 755
     public static function getFillTheBlankTabResult($testId, $questionId, $studentsIdList, $startDate, $endDate, $useLastAnswerredAttempt = true) {
756 756
 
757
-       $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
758
-       $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
759
-       $courseId = api_get_course_int_id();
757
+        $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
758
+        $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
759
+        $courseId = api_get_course_int_id();
760 760
 
761
-       require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php';
761
+        require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php';
762 762
 
763
-       // request to have all the answers of student for this question
764
-       // student may have doing it several time
765
-       // student may have not answered the bracket id, in this case, is result of the answer is empty
763
+        // request to have all the answers of student for this question
764
+        // student may have doing it several time
765
+        // student may have not answered the bracket id, in this case, is result of the answer is empty
766 766
 
767
-       // we got the less recent attempt first
768
-       $sql = '
767
+        // we got the less recent attempt first
768
+        $sql = '
769 769
            SELECT * FROM '.$tblTrackEAttempt.' tea
770 770
 
771 771
            LEFT JOIN '.$tblTrackEExercise.' tee
@@ -781,49 +781,49 @@  discard block
 block discarded – undo
781 781
            ORDER BY user_id, tea.exe_id;
782 782
        ';
783 783
 
784
-       $res = Database::query($sql);
785
-       $tabUserResult = array();
786
-       $bracketNumber = 0;
787
-       // foreach attempts for all students starting with his older attempt
788
-       while ($data = Database::fetch_array($res)) {
789
-           $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true);
784
+        $res = Database::query($sql);
785
+        $tabUserResult = array();
786
+        $bracketNumber = 0;
787
+        // foreach attempts for all students starting with his older attempt
788
+        while ($data = Database::fetch_array($res)) {
789
+            $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true);
790 790
 
791
-           // for each bracket to find in this question
792
-           foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) {
791
+            // for each bracket to find in this question
792
+            foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) {
793 793
 
794
-               if ($tabAnswer['studentanswer'][$bracketNumber] != '') {
795
-                   // student has answered this bracket, cool
796
-                   switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) {
797
-                       case self::FILL_THE_BLANK_MENU :
794
+                if ($tabAnswer['studentanswer'][$bracketNumber] != '') {
795
+                    // student has answered this bracket, cool
796
+                    switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) {
797
+                        case self::FILL_THE_BLANK_MENU :
798 798
                            // get the indice of the choosen answer in the menu
799 799
                            // we know that the right answer is the first entry of the menu, ie 0
800 800
                            // (remember, menu entries are shuffled when taking the test)
801 801
                            $tabUserResult[$data['user_id']][$bracketNumber] = FillBlanks::getFillTheBlankMenuAnswerNum($tabAnswer['tabwords'][$bracketNumber], $tabAnswer['studentanswer'][$bracketNumber]);
802
-                           break;
803
-                       default :
802
+                            break;
803
+                        default :
804 804
                            if (FillBlanks::isGoodStudentAnswer($tabAnswer['studentanswer'][$bracketNumber], $tabAnswer['tabwords'][$bracketNumber])) {
805
-                               $tabUserResult[$data['user_id']][$bracketNumber] = 0;   //  right answer
806
-                           } else {
807
-                               $tabUserResult[$data['user_id']][$bracketNumber] = -1;  // wrong answer
808
-                           }
809
-                   }
810
-               } else {
811
-                   // student didn't answer this bracket
812
-                   if ($useLastAnswerredAttempt) {
813
-                       // if we take into account the last answered attempt
814
-                       if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) {
815
-                           $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
816
-                       }
817
-                   } else {
818
-                       // we take the last attempt, even if the student answer the question before
819
-                       $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
820
-                   }
821
-               }
822
-           }
823
-
824
-
825
-       }
826
-       return $tabUserResult;
805
+                                $tabUserResult[$data['user_id']][$bracketNumber] = 0;   //  right answer
806
+                            } else {
807
+                                $tabUserResult[$data['user_id']][$bracketNumber] = -1;  // wrong answer
808
+                            }
809
+                    }
810
+                } else {
811
+                    // student didn't answer this bracket
812
+                    if ($useLastAnswerredAttempt) {
813
+                        // if we take into account the last answered attempt
814
+                        if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) {
815
+                            $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
816
+                        }
817
+                    } else {
818
+                        // we take the last attempt, even if the student answer the question before
819
+                        $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
820
+                    }
821
+                }
822
+            }
823
+
824
+
825
+        }
826
+        return $tabUserResult;
827 827
     }
828 828
 
829 829
 
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/export/qti2/qti2_export.php 1 patch
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @param $question Ims2Question object we want to export.
36 36
      */
37
-     function ImsAssessmentItem($question)
38
-     {
37
+        function ImsAssessmentItem($question)
38
+        {
39 39
         $this->question = $question;
40 40
         $this->answer = $this->question->setAnswer();
41 41
         $this->questionIdent = "QST_" . $question->id ;
42
-     }
43
-
44
-     /**
45
-      * Start the XML flow.
46
-      *
47
-      * This opens the <item> block, with correct attributes.
48
-      *
49
-      */
50
-      function start_item()
51
-      {
42
+        }
43
+
44
+        /**
45
+         * Start the XML flow.
46
+         *
47
+         * This opens the <item> block, with correct attributes.
48
+         *
49
+         */
50
+        function start_item()
51
+        {
52 52
         $string = '<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
53 53
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
54 54
                     xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 imsqti_v2p1.xsd"
@@ -56,55 +56,55 @@  discard block
 block discarded – undo
56 56
                     title="'.htmlspecialchars(formatExerciseQtiTitle($this->question->selectTitle())).'">'."\n";
57 57
 
58 58
         return $string;
59
-      }
60
-
61
-      /**
62
-       * End the XML flow, closing the </item> tag.
63
-       *
64
-       */
65
-      function end_item()
66
-      {
59
+        }
60
+
61
+        /**
62
+         * End the XML flow, closing the </item> tag.
63
+         *
64
+         */
65
+        function end_item()
66
+        {
67 67
         return "</assessmentItem>\n";
68
-      }
69
-
70
-     /**
71
-      * Start the itemBody
72
-      *
73
-      */
74
-     function start_item_body()
75
-     {
68
+        }
69
+
70
+        /**
71
+         * Start the itemBody
72
+         *
73
+         */
74
+        function start_item_body()
75
+        {
76 76
         return '  <itemBody>' . "\n";
77
-     }
78
-
79
-     /**
80
-      * End the itemBody part.
81
-      *
82
-      */
83
-     function end_item_body()
84
-     {
77
+        }
78
+
79
+        /**
80
+         * End the itemBody part.
81
+         *
82
+         */
83
+        function end_item_body()
84
+        {
85 85
         return "  </itemBody>\n";
86
-     }
87
-
88
-     /**
89
-      * add the response processing template used.
90
-      *
91
-      */
92
-
93
-      function add_response_processing()
94
-      {
95
-          return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
96
-      }
97
-
98
-     /**
99
-      * Export the question as an IMS/QTI Item.
100
-      *
101
-      * This is a default behaviour, some classes may want to override this.
102
-      *
103
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
104
-      * @return A string, the XML flow for an Item.
105
-      */
106
-     function export($standalone = false)
107
-     {
86
+        }
87
+
88
+        /**
89
+         * add the response processing template used.
90
+         *
91
+         */
92
+
93
+        function add_response_processing()
94
+        {
95
+            return '  <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n";
96
+        }
97
+
98
+        /**
99
+         * Export the question as an IMS/QTI Item.
100
+         *
101
+         * This is a default behaviour, some classes may want to override this.
102
+         *
103
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
104
+         * @return A string, the XML flow for an Item.
105
+         */
106
+        function export($standalone = false)
107
+        {
108 108
         $head = $foot = "";
109 109
 
110 110
         if ($standalone) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             .$foot;
132 132
 
133 133
         return $res;
134
-     }
134
+        }
135 135
 }
136 136
 
137 137
 /**
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
     function export_presentation()
194 194
     {
195 195
         $out = "<presentation_material><flow_mat><material>\n"
196
-             . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
197
-             . "</material></flow_mat></presentation_material>\n";
196
+                . "  <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n"
197
+                . "</material></flow_mat></presentation_material>\n";
198 198
         return $out;
199 199
     }
200 200
 
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
         $out = '';
209 209
         if ($n = $this->exercise->getShuffle()) {
210 210
             $out.= "<selection_ordering>"
211
-                 . "  <selection>\n"
212
-                 . "    <selection_number>" . $n . "</selection_number>\n"
213
-                 . "  </selection>\n"
214
-                 . '  <order order_type="Random" />'
215
-                 . "\n</selection_ordering>\n";
211
+                    . "  <selection>\n"
212
+                    . "    <selection_number>" . $n . "</selection_number>\n"
213
+                    . "  </selection>\n"
214
+                    . '  <order order_type="Random" />'
215
+                    . "\n</selection_ordering>\n";
216 216
         } else {
217 217
             $out.= '<selection_ordering sequence_type="Normal">' . "\n"
218
-                 . "  <selection />\n"
219
-                 . "</selection_ordering>\n";
218
+                    . "  <selection />\n"
219
+                    . "</selection_ordering>\n";
220 220
         }
221 221
 
222 222
         return $out;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     {
231 231
         $out = "";
232 232
         foreach ($this->exercise->selectQuestionList() as $q) {
233
-        	$out .= export_question_qti($q, false);
233
+            $out .= export_question_qti($q, false);
234 234
         }
235 235
         return $out;
236 236
     }
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
         $head = $foot = "";
248 248
         if ($standalone) {
249 249
             $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n"
250
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
251
-                  . "<questestinterop>\n";
250
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
251
+                    . "<questestinterop>\n";
252 252
             $foot = "</questestinterop>\n";
253 253
         }
254 254
         $out = $head
255
-             . $this->start_section()
256
-             . $this->export_duration()
257
-             . $this->export_presentation()
258
-             . $this->export_ordering()
259
-             . $this->export_questions()
260
-             . $this->end_section()
261
-             . $foot;
255
+                . $this->start_section()
256
+                . $this->export_duration()
257
+                . $this->export_presentation()
258
+                . $this->export_ordering()
259
+                . $this->export_questions()
260
+                . $this->end_section()
261
+                . $foot;
262 262
 
263 263
         return $out;
264 264
     }
@@ -304,97 +304,97 @@  discard block
 block discarded – undo
304 304
      * @param $question The Question object we want to export.
305 305
      * @author Anamd Tihon
306 306
      */
307
-     function ImsItem($question)
308
-     {
307
+        function ImsItem($question)
308
+        {
309 309
         $this->question = $question;
310 310
         $this->answer = $question->answer;
311 311
         $this->questionIdent = "QST_" . $question->selectId() ;
312
-     }
313
-
314
-     /**
315
-      * Start the XML flow.
316
-      *
317
-      * This opens the <item> block, with correct attributes.
318
-      *
319
-      * @author Amand Tihon <[email protected]>
320
-      */
321
-      function start_item()
322
-      {
312
+        }
313
+
314
+        /**
315
+         * Start the XML flow.
316
+         *
317
+         * This opens the <item> block, with correct attributes.
318
+         *
319
+         * @author Amand Tihon <[email protected]>
320
+         */
321
+        function start_item()
322
+        {
323 323
         return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n";
324
-      }
325
-
326
-      /**
327
-       * End the XML flow, closing the </item> tag.
328
-       *
329
-       * @author Amand Tihon <[email protected]>
330
-       */
331
-      function end_item()
332
-      {
324
+        }
325
+
326
+        /**
327
+         * End the XML flow, closing the </item> tag.
328
+         *
329
+         * @author Amand Tihon <[email protected]>
330
+         */
331
+        function end_item()
332
+        {
333 333
         return "</item>\n";
334
-      }
335
-
336
-     /**
337
-      * Create the opening, with the question itself.
338
-      *
339
-      * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
340
-      * In between, the export_responses from the subclass should have been called.
341
-      *
342
-      * @author Amand Tihon <[email protected]>
343
-      */
344
-     function start_presentation()
345
-     {
334
+        }
335
+
336
+        /**
337
+         * Create the opening, with the question itself.
338
+         *
339
+         * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation().
340
+         * In between, the export_responses from the subclass should have been called.
341
+         *
342
+         * @author Amand Tihon <[email protected]>
343
+         */
344
+        function start_presentation()
345
+        {
346 346
         return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n"
347
-             . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
348
-     }
349
-
350
-     /**
351
-      * End the </presentation> part, opened by export_header.
352
-      *
353
-      * @author Amand Tihon <[email protected]>
354
-      */
355
-     function end_presentation()
356
-     {
347
+                . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n";
348
+        }
349
+
350
+        /**
351
+         * End the </presentation> part, opened by export_header.
352
+         *
353
+         * @author Amand Tihon <[email protected]>
354
+         */
355
+        function end_presentation()
356
+        {
357 357
         return "</flow></presentation>\n";
358
-     }
359
-
360
-     /**
361
-      * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
362
-      *
363
-      * @author Amand Tihon <[email protected]>
364
-      */
365
-     function start_processing()
366
-     {
358
+        }
359
+
360
+        /**
361
+         * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
362
+         *
363
+         * @author Amand Tihon <[email protected]>
364
+         */
365
+        function start_processing()
366
+        {
367 367
         return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n";
368
-     }
369
-
370
-     /**
371
-      * End the response processing part.
372
-      *
373
-      * @author Amand Tihon <[email protected]>
374
-      */
375
-     function end_processing()
376
-     {
368
+        }
369
+
370
+        /**
371
+         * End the response processing part.
372
+         *
373
+         * @author Amand Tihon <[email protected]>
374
+         */
375
+        function end_processing()
376
+        {
377 377
         return "</resprocessing>\n";
378
-     }
379
-
380
-     /**
381
-      * Export the question as an IMS/QTI Item.
382
-      *
383
-      * This is a default behaviour, some classes may want to override this.
384
-      *
385
-      * @param $standalone: Boolean stating if it should be exported as a stand-alone question
386
-      * @return A string, the XML flow for an Item.
387
-      * @author Amand Tihon <[email protected]>
388
-      */
389
-     function export($standalone = False)
390
-     {
378
+        }
379
+
380
+        /**
381
+         * Export the question as an IMS/QTI Item.
382
+         *
383
+         * This is a default behaviour, some classes may want to override this.
384
+         *
385
+         * @param $standalone: Boolean stating if it should be exported as a stand-alone question
386
+         * @return A string, the XML flow for an Item.
387
+         * @author Amand Tihon <[email protected]>
388
+         */
389
+        function export($standalone = False)
390
+        {
391 391
         global $charset;
392 392
         $head = $foot = "";
393 393
 
394 394
         if ($standalone) {
395 395
             $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n"
396
-                  . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
397
-                  . "<questestinterop>\n";
396
+                    . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"
397
+                    . "<questestinterop>\n";
398 398
             $foot = "</questestinterop>\n";
399 399
         }
400 400
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             . $this->answer->imsExportFeedback($this->questionIdent)
410 410
             . $this->end_item()
411 411
             . $foot;
412
-     }
412
+        }
413 413
 }
414 414
 
415 415
 /**
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
     $question->type = $qst->type;
448 448
     $question->question = $qst->question;
449 449
     $question->description = $qst->description;
450
-	$question->weighting=$qst->weighting;
451
-	$question->position=$qst->position;
452
-	$question->picture=$qst->picture;
450
+    $question->weighting=$qst->weighting;
451
+    $question->position=$qst->position;
452
+    $question->picture=$qst->picture;
453 453
     $ims = new ImsAssessmentItem($question);
454 454
 
455 455
     return $ims->export($standalone);
Please login to merge, or discard this patch.
main/exercice/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.