@@ -171,10 +171,11 @@ |
||
171 | 171 | } |
172 | 172 | echo '</div>'; |
173 | 173 | |
174 | - if ($objExercise->feedback_type == 1) |
|
175 | - Display::display_normal_message( |
|
174 | + if ($objExercise->feedback_type == 1) { |
|
175 | + Display::display_normal_message( |
|
176 | 176 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
177 | 177 | ); |
178 | + } |
|
178 | 179 | |
179 | 180 | if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
180 | 181 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | require_once '../inc/global.inc.php'; |
14 | 14 | $this_section = SECTION_COURSES; |
15 | 15 | |
16 | -if (!api_is_allowed_to_edit(null,true)) { |
|
16 | +if (!api_is_allowed_to_edit(null, true)) { |
|
17 | 17 | api_not_allowed(true); |
18 | 18 | } |
19 | 19 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $gradebook = $_SESSION['gradebook']; |
167 | 167 | } |
168 | 168 | |
169 | - if (!empty($gradebook) && $gradebook=='view') { |
|
170 | - $interbreadcrumb[]= array ( |
|
169 | + if (!empty($gradebook) && $gradebook == 'view') { |
|
170 | + $interbreadcrumb[] = array( |
|
171 | 171 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
172 | 172 | 'name' => get_lang('ToolGradebook') |
173 | 173 | ); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | echo '<div class="actions">'; |
188 | 188 | |
189 | 189 | if ($objExercise->id != 0) { |
190 | - echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">' . |
|
190 | + echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
191 | 191 | Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
192 | 192 | } else { |
193 | - if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){ |
|
194 | - if (!empty($_POST['lp_id'])){ |
|
193 | + if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) { |
|
194 | + if (!empty($_POST['lp_id'])) { |
|
195 | 195 | $lp_id = intval($_POST['lp_id']); |
196 | 196 | //TODO:this remains to be implemented after press the first post |
197 | 197 | } else { |
198 | 198 | $lp_id = intval($_GET['lp_id']); |
199 | 199 | } |
200 | - echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)."</a>"; |
|
200 | + echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"), '', ICON_SIZE_MEDIUM)."</a>"; |
|
201 | 201 | } else { |
202 | - echo '<a href="exercise.php?'.api_get_cidreq().'">' . |
|
202 | + echo '<a href="exercise.php?'.api_get_cidreq().'">'. |
|
203 | 203 | Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM). |
204 | 204 | '</a>'; |
205 | 205 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
212 | 212 | ); |
213 | 213 | |
214 | - if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
|
214 | + if (api_get_setting('search_enabled') == 'true' && !extension_loaded('xapian')) { |
|
215 | 215 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
216 | 216 | } |
217 | 217 |
@@ -223,10 +223,10 @@ |
||
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)) { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | // notice for unauthorized people. |
15 | 15 | api_protect_course_script(true); |
16 | 16 | |
17 | -if ($debug>0) { |
|
17 | +if ($debug > 0) { |
|
18 | 18 | error_log('Entered exercise_result.php: '.print_r($_POST, 1)); |
19 | 19 | } |
20 | 20 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if (isset($_SESSION['exe_id'])) { |
94 | 94 | $exe_id = intval($_SESSION['exe_id']); |
95 | 95 | } |
96 | -$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
|
96 | +$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
|
97 | 97 | if (!empty($exercise_stat_info['data_tracking'])) { |
98 | 98 | $question_list = explode(',', $exercise_stat_info['data_tracking']); |
99 | 99 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $remind_list = $exercise_stat_info['questions_to_check']; |
174 | 174 | $remind_list = explode(',', $remind_list); |
175 | 175 | |
176 | -$exercise_result = array(); |
|
176 | +$exercise_result = array(); |
|
177 | 177 | |
178 | 178 | foreach ($attempt_list as $question_id => $options) { |
179 | 179 | foreach ($options as $item) { |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | unset($objQuestionTmp); |
205 | 205 | |
206 | 206 | // creates a temporary Question object |
207 | - $objQuestionTmp = Question :: read($questionId); |
|
207 | + $objQuestionTmp = Question :: read($questionId); |
|
208 | 208 | |
209 | 209 | $quesId = $objQuestionTmp->selectId(); |
210 | - $check_id = 'remind_list['.$questionId.']'; |
|
210 | + $check_id = 'remind_list['.$questionId.']'; |
|
211 | 211 | $attributes = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');"); |
212 | 212 | |
213 | 213 | if (in_array($questionId, $remind_list)) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | echo Display::div($table, array('class'=>'span10')); |
240 | 240 | |
241 | 241 | $exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-warning')); |
242 | -$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn btn-success')); |
|
242 | +$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();', 'class'=>'btn btn-success')); |
|
243 | 243 | |
244 | 244 | echo Display::div('', array('class'=>'clear')); |
245 | 245 | echo Display::div($exercise_actions, array('class'=>'form-actions')); |
@@ -59,7 +59,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | $gradebook = ''; |
61 | 61 | if (isset($_SESSION['gradebook'])) { |
62 | - $gradebook= $_SESSION['gradebook']; |
|
62 | + $gradebook = $_SESSION['gradebook']; |
|
63 | 63 | } |
64 | -if (!empty($gradebook) && $gradebook=='view') { |
|
64 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
65 | 65 | $interbreadcrumb[] = array( |
66 | 66 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
67 | 67 | 'name' => get_lang('ToolGradebook'), |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | "name" => get_lang('Exercises'), |
76 | 76 | ); |
77 | 77 | |
78 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
79 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
78 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
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 | 82 | // So we are not in learnpath tool |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $max_score = $objExercise->get_max_score(); |
156 | 156 | |
157 | -Display::display_normal_message(get_lang('Saved').'<br />',false); |
|
157 | +Display::display_normal_message(get_lang('Saved').'<br />', false); |
|
158 | 158 | |
159 | 159 | // Display and save questions |
160 | 160 | ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } else { |
187 | 187 | $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
188 | 188 | $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; |
189 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
189 | + $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'"'; |
|
190 | 190 | |
191 | 191 | if (api_is_allowed_to_session_edit()) { |
192 | 192 | Session::erase('objExercise'); |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | $objExercise = $_SESSION['objExercise']; |
52 | 52 | } |
53 | 53 | $exercise_id = intval($_GET['exercise_id']); |
54 | -$is_allowedToEdit=$is_courseAdmin; |
|
54 | +$is_allowedToEdit = $is_courseAdmin; |
|
55 | 55 | |
56 | -if (isset($_SESSION['gradebook'])){ |
|
57 | - $gradebook= $_SESSION['gradebook']; |
|
56 | +if (isset($_SESSION['gradebook'])) { |
|
57 | + $gradebook = $_SESSION['gradebook']; |
|
58 | 58 | } |
59 | 59 | |
60 | -if (!empty($gradebook) && $gradebook=='view') { |
|
61 | - $interbreadcrumb[]= array ( |
|
60 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
61 | + $interbreadcrumb[] = array( |
|
62 | 62 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
63 | 63 | 'name' => get_lang('ToolGradebook') |
64 | 64 | ); |
65 | 65 | } |
66 | -$nameTools=get_lang('Exercises'); |
|
66 | +$nameTools = get_lang('Exercises'); |
|
67 | 67 | $interbreadcrumb[] = array( |
68 | 68 | "url" => "exercise.php", |
69 | 69 | "name" => get_lang('Exercises'), |
70 | 70 | ); |
71 | -Display::display_header($nameTools,"Exercises"); |
|
71 | +Display::display_header($nameTools, "Exercises"); |
|
72 | 72 | |
73 | 73 | if (isset($_POST['ok'])) { |
74 | 74 | $message = get_lang('TestLimitsAdded'); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | if (isset($_POST['ok'])) { |
142 | 142 | $exercise_id = intval($_POST['exe_id']); |
143 | - if ($_POST['limit']==1) { |
|
143 | + if ($_POST['limit'] == 1) { |
|
144 | 144 | $minutes = intval($_POST['minutes']); |
145 | 145 | $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
146 | 146 | Database::query($query); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | Database::query($query); |
150 | 150 | } |
151 | 151 | |
152 | - if ($_POST['attempt']==1) { |
|
152 | + if ($_POST['attempt'] == 1) { |
|
153 | 153 | $attempts = intval($_POST['attempts']); |
154 | 154 | $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
155 | 155 | Database::query($query); |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $is_allowedToEdit=$is_courseAdmin; |
55 | 55 | |
56 | 56 | if (isset($_SESSION['gradebook'])){ |
57 | - $gradebook= $_SESSION['gradebook']; |
|
57 | + $gradebook= $_SESSION['gradebook']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!empty($gradebook) && $gradebook=='view') { |
61 | - $interbreadcrumb[]= array ( |
|
61 | + $interbreadcrumb[]= array ( |
|
62 | 62 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
63 | 63 | 'name' => get_lang('ToolGradebook') |
64 | 64 | ); |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | Display::display_header($nameTools,"Exercises"); |
72 | 72 | |
73 | 73 | if (isset($_POST['ok'])) { |
74 | - $message = get_lang('TestLimitsAdded'); |
|
75 | - Display::display_normal_message($message); |
|
74 | + $message = get_lang('TestLimitsAdded'); |
|
75 | + Display::display_normal_message($message); |
|
76 | 76 | } |
77 | 77 | ?> |
78 | 78 | <script type="text/javascript"> |
@@ -139,22 +139,22 @@ discard block |
||
139 | 139 | * @todo shouldn't this be moved to the part above (around line 111: action handling) |
140 | 140 | */ |
141 | 141 | if (isset($_POST['ok'])) { |
142 | - $exercise_id = intval($_POST['exe_id']); |
|
143 | - if ($_POST['limit']==1) { |
|
144 | - $minutes = intval($_POST['minutes']); |
|
145 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
146 | - Database::query($query); |
|
147 | - } else { |
|
148 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
149 | - Database::query($query); |
|
150 | - } |
|
142 | + $exercise_id = intval($_POST['exe_id']); |
|
143 | + if ($_POST['limit']==1) { |
|
144 | + $minutes = intval($_POST['minutes']); |
|
145 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
146 | + Database::query($query); |
|
147 | + } else { |
|
148 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
149 | + Database::query($query); |
|
150 | + } |
|
151 | 151 | |
152 | - if ($_POST['attempt']==1) { |
|
153 | - $attempts = intval($_POST['attempts']); |
|
154 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
155 | - Database::query($query); |
|
156 | - } else { |
|
157 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
158 | - Database::query($query); |
|
159 | - } |
|
152 | + if ($_POST['attempt']==1) { |
|
153 | + $attempts = intval($_POST['attempts']); |
|
154 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
155 | + Database::query($query); |
|
156 | + } else { |
|
157 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
158 | + Database::query($query); |
|
159 | + } |
|
160 | 160 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | require_once '../inc/global.inc.php'; |
16 | 16 | |
17 | -require_once api_get_path(LIBRARY_PATH) . 'pear/excelreader/reader.php'; |
|
17 | +require_once api_get_path(LIBRARY_PATH).'pear/excelreader/reader.php'; |
|
18 | 18 | |
19 | 19 | // Security check |
20 | 20 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | function lp_upload_quiz_actions() |
60 | 60 | { |
61 | 61 | $return = '<a href="exercise.php?'.api_get_cidReq().'">'. |
62 | - Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
62 | + Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
63 | 63 | return $return; |
64 | 64 | } |
65 | 65 | |
66 | 66 | function lp_upload_quiz_secondary_actions() |
67 | 67 | { |
68 | - $return = '<a href="exercise_report.php?' . api_get_cidreq() . '">' . |
|
69 | - Display :: return_icon('reporting32.png', get_lang('Tracking')) . get_lang('Tracking') . '</a>'; |
|
68 | + $return = '<a href="exercise_report.php?'.api_get_cidreq().'">'. |
|
69 | + Display :: return_icon('reporting32.png', get_lang('Tracking')).get_lang('Tracking').'</a>'; |
|
70 | 70 | return $return; |
71 | 71 | } |
72 | 72 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $table->setHeaderContents(0, 1, '#'); |
105 | 105 | |
106 | 106 | $row = 1; |
107 | - foreach ($tableList as $key => $label ) { |
|
107 | + foreach ($tableList as $key => $label) { |
|
108 | 108 | $table->setCellContents($row, 0, $label); |
109 | 109 | $table->setCellContents($row, 1, $key); |
110 | 110 | $row++; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $comment = $feedback_true_list[$i][2]; |
444 | 444 | } else { |
445 | 445 | $comment = $feedback_false_list[$i][2]; |
446 | - $floatVal = (float)$answer_data[3]; |
|
446 | + $floatVal = (float) $answer_data[3]; |
|
447 | 447 | if (is_numeric($floatVal)) { |
448 | 448 | $score = $answer_data[3]; |
449 | 449 | } |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | // EXECUTE COMMAND |
40 | 40 | //---------------------------------- |
41 | 41 | |
42 | -$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import'); |
|
42 | +$cmd = (isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'show_import'); |
|
43 | 43 | |
44 | 44 | switch ($cmd) { |
45 | 45 | case 'show_import' : |
46 | 46 | { |
47 | 47 | $display = '<p>' |
48 | - . get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . '<br>' |
|
48 | + . get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.').'<br>' |
|
49 | 49 | . '</p>' |
50 | 50 | . '<form enctype="multipart/form-data" action="" method="post">' |
51 | 51 | . '<input name="cmd" type="hidden" value="import" />' |
52 | 52 | . '<input name="uploadedExercise" type="file" /><br><br>' |
53 | - . get_lang('Import exercise') . ' : ' |
|
54 | - . '<input value="' . get_lang('Ok') . '" type="submit" /> ' |
|
55 | - . claro_html_button( $_SERVER['PHP_SELF'], get_lang('Cancel')) |
|
53 | + . get_lang('Import exercise').' : ' |
|
54 | + . '<input value="'.get_lang('Ok').'" type="submit" /> ' |
|
55 | + . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) |
|
56 | 56 | . '<br><br>' |
57 | - . '<small>' . get_lang('Max file size') . ' : 2 MB</small>' |
|
57 | + . '<small>'.get_lang('Max file size').' : 2 MB</small>' |
|
58 | 58 | . '</form>'; |
59 | 59 | } |
60 | 60 | break; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | // DISPLAY |
86 | 86 | //---------------------------------- |
87 | 87 | |
88 | -include api_get_path(INCLUDE_PATH) . '/header.inc.php'; |
|
88 | +include api_get_path(INCLUDE_PATH).'/header.inc.php'; |
|
89 | 89 | |
90 | 90 | //display title |
91 | 91 | |
@@ -114,5 +114,5 @@ discard block |
||
114 | 114 | |
115 | 115 | //footer display |
116 | 116 | |
117 | -include api_get_path(INCLUDE_PATH) . '/footer.inc.php'; |
|
117 | +include api_get_path(INCLUDE_PATH).'/footer.inc.php'; |
|
118 | 118 | ?> |
@@ -93,10 +93,10 @@ |
||
93 | 93 | // Tool introduction |
94 | 94 | // TODO: These settings to be checked when it is possible. |
95 | 95 | Display::display_introduction_section(TOOL_QUIZ, array( |
96 | - 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', |
|
97 | - 'CreateDocumentDir' => '../../../courses/'.api_get_course_path().'/document/', |
|
98 | - 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/' |
|
99 | - ) |
|
96 | + 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', |
|
97 | + 'CreateDocumentDir' => '../../../courses/'.api_get_course_path().'/document/', |
|
98 | + 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/' |
|
99 | + ) |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | /** |
9 | 9 | * Code |
10 | 10 | */ |
11 | -require dirname(__FILE__) . '/qti2_classes.php'; |
|
11 | +require dirname(__FILE__).'/qti2_classes.php'; |
|
12 | 12 | /** |
13 | 13 | * Classes |
14 | 14 | */ |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $this->question = $question; |
40 | 40 | $this->answer = $this->question->setAnswer(); |
41 | - $this->questionIdent = "QST_" . $question->id ; |
|
41 | + $this->questionIdent = "QST_".$question->id; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | function start_item_body() |
75 | 75 | { |
76 | - return ' <itemBody>' . "\n"; |
|
76 | + return ' <itemBody>'."\n"; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | function add_response_processing() |
94 | 94 | { |
95 | - return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
95 | + return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>'."\n"; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $head = $foot = ""; |
109 | 109 | |
110 | 110 | if ($standalone) { |
111 | - $head = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . "\n"; |
|
111 | + $head = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'."\n"; |
|
112 | 112 | } |
113 | 113 | //TODO understand why answer might be a non-object sometimes |
114 | 114 | if (!is_object($this->answer)) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | function start_section() |
166 | 166 | { |
167 | - $out = '<section ident="EXO_' . $this->exercise->selectId() . '" title="' .cleanAttribute(formatExerciseQtiDescription($this->exercise->selectTitle())) . '">' . "\n"; |
|
167 | + $out = '<section ident="EXO_'.$this->exercise->selectId().'" title="'.cleanAttribute(formatExerciseQtiDescription($this->exercise->selectTitle())).'">'."\n"; |
|
168 | 168 | return $out; |
169 | 169 | } |
170 | 170 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // return exercise duration in ISO8601 format. |
181 | 181 | $minutes = floor($max_time / 60); |
182 | 182 | $seconds = $max_time % 60; |
183 | - return '<duration>PT' . $minutes . 'M' . $seconds . "S</duration>\n"; |
|
183 | + return '<duration>PT'.$minutes.'M'.$seconds."S</duration>\n"; |
|
184 | 184 | } else { |
185 | 185 | return ''; |
186 | 186 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | function export_presentation() |
194 | 194 | { |
195 | 195 | $out = "<presentation_material><flow_mat><material>\n" |
196 | - . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
196 | + . " <mattext><![CDATA[".formatExerciseQtiDescription($this->exercise->selectDescription())."]]></mattext>\n" |
|
197 | 197 | . "</material></flow_mat></presentation_material>\n"; |
198 | 198 | return $out; |
199 | 199 | } |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | { |
208 | 208 | $out = ''; |
209 | 209 | if ($n = $this->exercise->getShuffle()) { |
210 | - $out.= "<selection_ordering>" |
|
210 | + $out .= "<selection_ordering>" |
|
211 | 211 | . " <selection>\n" |
212 | - . " <selection_number>" . $n . "</selection_number>\n" |
|
212 | + . " <selection_number>".$n."</selection_number>\n" |
|
213 | 213 | . " </selection>\n" |
214 | 214 | . ' <order order_type="Random" />' |
215 | 215 | . "\n</selection_ordering>\n"; |
216 | 216 | } else { |
217 | - $out.= '<selection_ordering sequence_type="Normal">' . "\n" |
|
217 | + $out .= '<selection_ordering sequence_type="Normal">'."\n" |
|
218 | 218 | . " <selection />\n" |
219 | 219 | . "</selection_ordering>\n"; |
220 | 220 | } |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | { |
247 | 247 | $head = $foot = ""; |
248 | 248 | if ($standalone) { |
249 | - $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n" |
|
250 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
249 | + $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>'."\n" |
|
250 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">'."\n" |
|
251 | 251 | . "<questestinterop>\n"; |
252 | 252 | $foot = "</questestinterop>\n"; |
253 | 253 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | $this->question = $question; |
310 | 310 | $this->answer = $question->answer; |
311 | - $this->questionIdent = "QST_" . $question->selectId() ; |
|
311 | + $this->questionIdent = "QST_".$question->selectId(); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function start_item() |
322 | 322 | { |
323 | - return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n"; |
|
323 | + return '<item title="'.cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())).'" ident="'.$this->questionIdent.'">'."\n"; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | */ |
344 | 344 | function start_presentation() |
345 | 345 | { |
346 | - return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n" |
|
347 | - . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
346 | + return '<presentation label="'.$this->questionIdent.'"><flow>'."\n" |
|
347 | + . '<material><mattext>'.formatExerciseQtiDescription($this->question->selectDescription())."</mattext></material>\n"; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function start_processing() |
366 | 366 | { |
367 | - return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n"; |
|
367 | + return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>'."\n"; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | $head = $foot = ""; |
393 | 393 | |
394 | 394 | if ($standalone) { |
395 | - $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n" |
|
396 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
395 | + $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>'."\n" |
|
396 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">'."\n" |
|
397 | 397 | . "<questestinterop>\n"; |
398 | 398 | $foot = "</questestinterop>\n"; |
399 | 399 | } |
@@ -447,9 +447,9 @@ discard block |
||
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); |
@@ -34,21 +34,21 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param Ims2Question $question Ims2Question object we want to export. |
36 | 36 | */ |
37 | - function __construct($question) |
|
38 | - { |
|
37 | + function __construct($question) |
|
38 | + { |
|
39 | 39 | $this->question = $question; |
40 | 40 | $this->answer = $this->question->setAnswer(); |
41 | 41 | $this->questionIdent = "QST_" . $question->id ; |
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Start the XML flow. |
|
46 | - * |
|
47 | - * This opens the <item> block, with correct attributes. |
|
48 | - * |
|
49 | - */ |
|
50 | - function start_item() |
|
51 | - { |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Start the XML flow. |
|
46 | + * |
|
47 | + * This opens the <item> block, with correct attributes. |
|
48 | + * |
|
49 | + */ |
|
50 | + function start_item() |
|
51 | + { |
|
52 | 52 | $string = '<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" |
53 | 53 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
54 | 54 | xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 imsqti_v2p1.xsd" |
@@ -56,55 +56,55 @@ discard block |
||
56 | 56 | title="'.htmlspecialchars(formatExerciseQtiTitle($this->question->selectTitle())).'">'."\n"; |
57 | 57 | |
58 | 58 | return $string; |
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * End the XML flow, closing the </item> tag. |
|
63 | - * |
|
64 | - */ |
|
65 | - function end_item() |
|
66 | - { |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * End the XML flow, closing the </item> tag. |
|
63 | + * |
|
64 | + */ |
|
65 | + function end_item() |
|
66 | + { |
|
67 | 67 | return "</assessmentItem>\n"; |
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Start the itemBody |
|
72 | - * |
|
73 | - */ |
|
74 | - function start_item_body() |
|
75 | - { |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Start the itemBody |
|
72 | + * |
|
73 | + */ |
|
74 | + function start_item_body() |
|
75 | + { |
|
76 | 76 | return ' <itemBody>' . "\n"; |
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * End the itemBody part. |
|
81 | - * |
|
82 | - */ |
|
83 | - function end_item_body() |
|
84 | - { |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * End the itemBody part. |
|
81 | + * |
|
82 | + */ |
|
83 | + function end_item_body() |
|
84 | + { |
|
85 | 85 | return " </itemBody>\n"; |
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * add the response processing template used. |
|
90 | - * |
|
91 | - */ |
|
92 | - |
|
93 | - function add_response_processing() |
|
94 | - { |
|
95 | - return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Export the question as an IMS/QTI Item. |
|
100 | - * |
|
101 | - * This is a default behaviour, some classes may want to override this. |
|
102 | - * |
|
103 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
104 | - * @return string string, the XML flow for an Item. |
|
105 | - */ |
|
106 | - function export($standalone = false) |
|
107 | - { |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * add the response processing template used. |
|
90 | + * |
|
91 | + */ |
|
92 | + |
|
93 | + function add_response_processing() |
|
94 | + { |
|
95 | + return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Export the question as an IMS/QTI Item. |
|
100 | + * |
|
101 | + * This is a default behaviour, some classes may want to override this. |
|
102 | + * |
|
103 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
104 | + * @return string string, the XML flow for an Item. |
|
105 | + */ |
|
106 | + function export($standalone = false) |
|
107 | + { |
|
108 | 108 | $head = $foot = ""; |
109 | 109 | |
110 | 110 | if ($standalone) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | .$foot; |
132 | 132 | |
133 | 133 | return $res; |
134 | - } |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | function export_presentation() |
195 | 195 | { |
196 | 196 | $out = "<presentation_material><flow_mat><material>\n" |
197 | - . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
198 | - . "</material></flow_mat></presentation_material>\n"; |
|
197 | + . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
198 | + . "</material></flow_mat></presentation_material>\n"; |
|
199 | 199 | return $out; |
200 | 200 | } |
201 | 201 | |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | $out = ''; |
210 | 210 | if ($n = $this->exercise->getShuffle()) { |
211 | 211 | $out.= "<selection_ordering>" |
212 | - . " <selection>\n" |
|
213 | - . " <selection_number>" . $n . "</selection_number>\n" |
|
214 | - . " </selection>\n" |
|
215 | - . ' <order order_type="Random" />' |
|
216 | - . "\n</selection_ordering>\n"; |
|
212 | + . " <selection>\n" |
|
213 | + . " <selection_number>" . $n . "</selection_number>\n" |
|
214 | + . " </selection>\n" |
|
215 | + . ' <order order_type="Random" />' |
|
216 | + . "\n</selection_ordering>\n"; |
|
217 | 217 | } else { |
218 | 218 | $out.= '<selection_ordering sequence_type="Normal">' . "\n" |
219 | - . " <selection />\n" |
|
220 | - . "</selection_ordering>\n"; |
|
219 | + . " <selection />\n" |
|
220 | + . "</selection_ordering>\n"; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $out; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | $out = ""; |
233 | 233 | foreach ($this->exercise->selectQuestionList() as $q) { |
234 | - $out .= export_question_qti($q, false); |
|
234 | + $out .= export_question_qti($q, false); |
|
235 | 235 | } |
236 | 236 | return $out; |
237 | 237 | } |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | $head = $foot = ""; |
249 | 249 | if ($standalone) { |
250 | 250 | $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n" |
251 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
252 | - . "<questestinterop>\n"; |
|
251 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
252 | + . "<questestinterop>\n"; |
|
253 | 253 | $foot = "</questestinterop>\n"; |
254 | 254 | } |
255 | 255 | $out = $head |
256 | - . $this->start_section() |
|
257 | - . $this->export_duration() |
|
258 | - . $this->export_presentation() |
|
259 | - . $this->export_ordering() |
|
260 | - . $this->export_questions() |
|
261 | - . $this->end_section() |
|
262 | - . $foot; |
|
256 | + . $this->start_section() |
|
257 | + . $this->export_duration() |
|
258 | + . $this->export_presentation() |
|
259 | + . $this->export_ordering() |
|
260 | + . $this->export_questions() |
|
261 | + . $this->end_section() |
|
262 | + . $foot; |
|
263 | 263 | |
264 | 264 | return $out; |
265 | 265 | } |
@@ -306,97 +306,97 @@ discard block |
||
306 | 306 | * @return ImsItem |
307 | 307 | * @author Anamd Tihon |
308 | 308 | */ |
309 | - function __construct($question) |
|
310 | - { |
|
309 | + function __construct($question) |
|
310 | + { |
|
311 | 311 | $this->question = $question; |
312 | 312 | $this->answer = $question->answer; |
313 | 313 | $this->questionIdent = "QST_" . $question->selectId() ; |
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * Start the XML flow. |
|
318 | - * |
|
319 | - * This opens the <item> block, with correct attributes. |
|
320 | - * |
|
321 | - * @author Amand Tihon <[email protected]> |
|
322 | - */ |
|
323 | - function start_item() |
|
324 | - { |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * Start the XML flow. |
|
318 | + * |
|
319 | + * This opens the <item> block, with correct attributes. |
|
320 | + * |
|
321 | + * @author Amand Tihon <[email protected]> |
|
322 | + */ |
|
323 | + function start_item() |
|
324 | + { |
|
325 | 325 | return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n"; |
326 | - } |
|
327 | - |
|
328 | - /** |
|
329 | - * End the XML flow, closing the </item> tag. |
|
330 | - * |
|
331 | - * @author Amand Tihon <[email protected]> |
|
332 | - */ |
|
333 | - function end_item() |
|
334 | - { |
|
326 | + } |
|
327 | + |
|
328 | + /** |
|
329 | + * End the XML flow, closing the </item> tag. |
|
330 | + * |
|
331 | + * @author Amand Tihon <[email protected]> |
|
332 | + */ |
|
333 | + function end_item() |
|
334 | + { |
|
335 | 335 | return "</item>\n"; |
336 | - } |
|
337 | - |
|
338 | - /** |
|
339 | - * Create the opening, with the question itself. |
|
340 | - * |
|
341 | - * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation(). |
|
342 | - * In between, the export_responses from the subclass should have been called. |
|
343 | - * |
|
344 | - * @author Amand Tihon <[email protected]> |
|
345 | - */ |
|
346 | - function start_presentation() |
|
347 | - { |
|
336 | + } |
|
337 | + |
|
338 | + /** |
|
339 | + * Create the opening, with the question itself. |
|
340 | + * |
|
341 | + * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation(). |
|
342 | + * In between, the export_responses from the subclass should have been called. |
|
343 | + * |
|
344 | + * @author Amand Tihon <[email protected]> |
|
345 | + */ |
|
346 | + function start_presentation() |
|
347 | + { |
|
348 | 348 | return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n" |
349 | - . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
350 | - } |
|
351 | - |
|
352 | - /** |
|
353 | - * End the </presentation> part, opened by export_header. |
|
354 | - * |
|
355 | - * @author Amand Tihon <[email protected]> |
|
356 | - */ |
|
357 | - function end_presentation() |
|
358 | - { |
|
349 | + . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
350 | + } |
|
351 | + |
|
352 | + /** |
|
353 | + * End the </presentation> part, opened by export_header. |
|
354 | + * |
|
355 | + * @author Amand Tihon <[email protected]> |
|
356 | + */ |
|
357 | + function end_presentation() |
|
358 | + { |
|
359 | 359 | return "</flow></presentation>\n"; |
360 | - } |
|
361 | - |
|
362 | - /** |
|
363 | - * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes. |
|
364 | - * |
|
365 | - * @author Amand Tihon <[email protected]> |
|
366 | - */ |
|
367 | - function start_processing() |
|
368 | - { |
|
360 | + } |
|
361 | + |
|
362 | + /** |
|
363 | + * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes. |
|
364 | + * |
|
365 | + * @author Amand Tihon <[email protected]> |
|
366 | + */ |
|
367 | + function start_processing() |
|
368 | + { |
|
369 | 369 | return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n"; |
370 | - } |
|
371 | - |
|
372 | - /** |
|
373 | - * End the response processing part. |
|
374 | - * |
|
375 | - * @author Amand Tihon <[email protected]> |
|
376 | - */ |
|
377 | - function end_processing() |
|
378 | - { |
|
370 | + } |
|
371 | + |
|
372 | + /** |
|
373 | + * End the response processing part. |
|
374 | + * |
|
375 | + * @author Amand Tihon <[email protected]> |
|
376 | + */ |
|
377 | + function end_processing() |
|
378 | + { |
|
379 | 379 | return "</resprocessing>\n"; |
380 | - } |
|
381 | - |
|
382 | - /** |
|
383 | - * Export the question as an IMS/QTI Item. |
|
384 | - * |
|
385 | - * This is a default behaviour, some classes may want to override this. |
|
386 | - * |
|
387 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
388 | - * @return string string, the XML flow for an Item. |
|
389 | - * @author Amand Tihon <[email protected]> |
|
390 | - */ |
|
391 | - function export($standalone = False) |
|
392 | - { |
|
380 | + } |
|
381 | + |
|
382 | + /** |
|
383 | + * Export the question as an IMS/QTI Item. |
|
384 | + * |
|
385 | + * This is a default behaviour, some classes may want to override this. |
|
386 | + * |
|
387 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
388 | + * @return string string, the XML flow for an Item. |
|
389 | + * @author Amand Tihon <[email protected]> |
|
390 | + */ |
|
391 | + function export($standalone = False) |
|
392 | + { |
|
393 | 393 | global $charset; |
394 | 394 | $head = $foot = ""; |
395 | 395 | |
396 | 396 | if ($standalone) { |
397 | 397 | $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n" |
398 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
399 | - . "<questestinterop>\n"; |
|
398 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
399 | + . "<questestinterop>\n"; |
|
400 | 400 | $foot = "</questestinterop>\n"; |
401 | 401 | } |
402 | 402 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | . $this->answer->imsExportFeedback($this->questionIdent) |
412 | 412 | . $this->end_item() |
413 | 413 | . $foot; |
414 | - } |
|
414 | + } |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | $question->type = $qst->type; |
451 | 451 | $question->question = $qst->question; |
452 | 452 | $question->description = $qst->description; |
453 | - $question->weighting=$qst->weighting; |
|
454 | - $question->position=$qst->position; |
|
455 | - $question->picture=$qst->picture; |
|
453 | + $question->weighting=$qst->weighting; |
|
454 | + $question->position=$qst->position; |
|
455 | + $question->picture=$qst->picture; |
|
456 | 456 | $ims = new ImsAssessmentItem($question); |
457 | 457 | |
458 | 458 | return $ims->export($standalone); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function setAnswer() |
16 | 16 | { |
17 | - switch($this->type) { |
|
17 | + switch ($this->type) { |
|
18 | 18 | case MCUA: |
19 | 19 | $answer = new ImsAnswerMultipleChoice($this->id); |
20 | 20 | |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | { |
78 | 78 | // @todo getAnswersList() converts the answers using api_html_entity_decode() |
79 | 79 | $this->answerList = $this->getAnswersList(true); |
80 | - $out = ' <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n"; |
|
81 | - $out .= ' <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n"; |
|
80 | + $out = ' <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n"; |
|
81 | + $out .= ' <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment).']]></prompt>'."\n"; |
|
82 | 82 | if (is_array($this->answerList)) { |
83 | 83 | foreach ($this->answerList as $current_answer) { |
84 | - $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false"> |
|
84 | + $out .= '<simpleChoice identifier="answer_'.$current_answer['id'].'" fixed="false"> |
|
85 | 85 | <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>'; |
86 | 86 | if (isset($current_answer['comment']) && $current_answer['comment'] != '') { |
87 | - $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '"> |
|
87 | + $out .= '<feedbackInline identifier="answer_'.$current_answer['id'].'"> |
|
88 | 88 | <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]> |
89 | 89 | </feedbackInline>'; |
90 | 90 | } |
91 | - $out .= '</simpleChoice>'. "\n"; |
|
91 | + $out .= '</simpleChoice>'."\n"; |
|
92 | 92 | } |
93 | 93 | } |
94 | - $out .= ' </choiceInteraction>'. "\n"; |
|
94 | + $out .= ' </choiceInteraction>'."\n"; |
|
95 | 95 | |
96 | 96 | return $out; |
97 | 97 | } |
@@ -106,32 +106,32 @@ discard block |
||
106 | 106 | $type = $this->getQuestionType(); |
107 | 107 | if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
108 | 108 | |
109 | - $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; |
|
109 | + $out = ' <responseDeclaration identifier="'.$questionIdent.'" cardinality="'.$cardinality.'" baseType="identifier">'."\n"; |
|
110 | 110 | |
111 | 111 | // Match the correct answers. |
112 | 112 | |
113 | - $out .= ' <correctResponse>'. "\n"; |
|
113 | + $out .= ' <correctResponse>'."\n"; |
|
114 | 114 | if (is_array($this->answerList)) { |
115 | - foreach($this->answerList as $current_answer) { |
|
115 | + foreach ($this->answerList as $current_answer) { |
|
116 | 116 | if ($current_answer['correct']) { |
117 | - $out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n"; |
|
117 | + $out .= ' <value>answer_'.$current_answer['id'].'</value>'."\n"; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
121 | - $out .= ' </correctResponse>'. "\n"; |
|
121 | + $out .= ' </correctResponse>'."\n"; |
|
122 | 122 | |
123 | 123 | //Add the grading |
124 | 124 | |
125 | - $out .= ' <mapping>'. "\n"; |
|
125 | + $out .= ' <mapping>'."\n"; |
|
126 | 126 | if (is_array($this->answerList)) { |
127 | - foreach($this->answerList as $current_answer) { |
|
127 | + foreach ($this->answerList as $current_answer) { |
|
128 | 128 | if (isset($current_answer['grade'])) { |
129 | - $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n"; |
|
129 | + $out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n"; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
133 | - $out .= ' </mapping>'. "\n"; |
|
134 | - $out .= ' </responseDeclaration>'. "\n"; |
|
133 | + $out .= ' </mapping>'."\n"; |
|
134 | + $out .= ' </responseDeclaration>'."\n"; |
|
135 | 135 | |
136 | 136 | return $out; |
137 | 137 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $key = $answer['id']; |
159 | 159 | $answer = $answer['answer']; |
160 | 160 | $len = api_strlen($answer); |
161 | - $text = str_replace('['.$answer.']','<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text); |
|
161 | + $text = str_replace('['.$answer.']', '<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | $out = $text; |
@@ -178,17 +178,17 @@ discard block |
||
178 | 178 | foreach ($this->answerList as $answer) { |
179 | 179 | $answerKey = $answer['id']; |
180 | 180 | $answer = $answer['answer']; |
181 | - $out .= ' <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n"; |
|
182 | - $out .= ' <correctResponse>'. "\n"; |
|
183 | - $out .= ' <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n"; |
|
184 | - $out .= ' </correctResponse>'. "\n"; |
|
181 | + $out .= ' <responseDeclaration identifier="fill_'.$answerKey.'" cardinality="single" baseType="identifier">'."\n"; |
|
182 | + $out .= ' <correctResponse>'."\n"; |
|
183 | + $out .= ' <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'."\n"; |
|
184 | + $out .= ' </correctResponse>'."\n"; |
|
185 | 185 | if (isset($this->gradeList[$answerKey])) { |
186 | - $out .= ' <mapping>'. "\n"; |
|
187 | - $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n"; |
|
188 | - $out .= ' </mapping>'. "\n"; |
|
186 | + $out .= ' <mapping>'."\n"; |
|
187 | + $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'."\n"; |
|
188 | + $out .= ' </mapping>'."\n"; |
|
189 | 189 | } |
190 | 190 | |
191 | - $out .= ' </responseDeclaration>'. "\n"; |
|
191 | + $out .= ' </responseDeclaration>'."\n"; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | |
213 | 213 | $out = ""; |
214 | 214 | |
215 | - $out .= '<matchInteraction responseIdentifier="' . $questionIdent . '" maxAssociations="'. $maxAssociation .'">'. "\n"; |
|
215 | + $out .= '<matchInteraction responseIdentifier="'.$questionIdent.'" maxAssociations="'.$maxAssociation.'">'."\n"; |
|
216 | 216 | $out .= $questionStatment; |
217 | 217 | |
218 | 218 | //add left column |
219 | 219 | |
220 | - $out .= ' <simpleMatchSet>'. "\n"; |
|
220 | + $out .= ' <simpleMatchSet>'."\n"; |
|
221 | 221 | if (is_array($this->leftList)) { |
222 | 222 | foreach ($this->leftList as $leftKey=>$leftElement) { |
223 | 223 | $out .= ' |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - $out .= ' </simpleMatchSet>'. "\n"; |
|
230 | + $out .= ' </simpleMatchSet>'."\n"; |
|
231 | 231 | |
232 | 232 | //add right column |
233 | 233 | |
234 | - $out .= ' <simpleMatchSet>'. "\n"; |
|
234 | + $out .= ' <simpleMatchSet>'."\n"; |
|
235 | 235 | |
236 | 236 | $i = 0; |
237 | 237 | |
238 | 238 | if (is_array($this->rightList)) { |
239 | - foreach($this->rightList as $rightKey=>$rightElement) { |
|
239 | + foreach ($this->rightList as $rightKey=>$rightElement) { |
|
240 | 240 | $out .= '<simpleAssociableChoice identifier="right_'.$i.'" > |
241 | 241 | <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]> |
242 | 242 | </simpleAssociableChoice>'. "\n"; |
243 | 243 | $i++; |
244 | 244 | } |
245 | 245 | } |
246 | - $out .= ' </simpleMatchSet>'. "\n"; |
|
247 | - $out .= '</matchInteraction>'. "\n"; |
|
246 | + $out .= ' </simpleMatchSet>'."\n"; |
|
247 | + $out .= '</matchInteraction>'."\n"; |
|
248 | 248 | |
249 | 249 | return $out; |
250 | 250 | } |
@@ -255,32 +255,32 @@ discard block |
||
255 | 255 | public function imsExportResponsesDeclaration($questionIdent) |
256 | 256 | { |
257 | 257 | $this->answerList = $this->getAnswersList(true); |
258 | - $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n"; |
|
259 | - $out .= ' <correctResponse>' . "\n"; |
|
258 | + $out = ' <responseDeclaration identifier="'.$questionIdent.'" cardinality="single" baseType="identifier">'."\n"; |
|
259 | + $out .= ' <correctResponse>'."\n"; |
|
260 | 260 | |
261 | 261 | $gradeArray = array(); |
262 | 262 | if (is_array($this->leftList)) { |
263 | 263 | foreach ($this->leftList as $leftKey=>$leftElement) { |
264 | - $i=0; |
|
264 | + $i = 0; |
|
265 | 265 | foreach ($this->rightList as $rightKey=>$rightElement) { |
266 | 266 | if (($leftElement['match'] == $rightElement['code'])) { |
267 | - $out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; |
|
267 | + $out .= ' <value>left_'.$leftKey.' right_'.$i.'</value>'."\n"; |
|
268 | 268 | |
269 | - $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; |
|
269 | + $gradeArray['left_'.$leftKey.' right_'.$i] = $leftElement['grade']; |
|
270 | 270 | } |
271 | 271 | $i++; |
272 | 272 | } |
273 | 273 | } |
274 | 274 | } |
275 | - $out .= ' </correctResponse>'. "\n"; |
|
276 | - $out .= ' <mapping>' . "\n"; |
|
275 | + $out .= ' </correctResponse>'."\n"; |
|
276 | + $out .= ' <mapping>'."\n"; |
|
277 | 277 | if (is_array($gradeArray)) { |
278 | 278 | foreach ($gradeArray as $gradeKey=>$grade) { |
279 | - $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n"; |
|
279 | + $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>'."\n"; |
|
280 | 280 | } |
281 | 281 | } |
282 | - $out .= ' </mapping>' . "\n"; |
|
283 | - $out .= ' </responseDeclaration>'. "\n"; |
|
282 | + $out .= ' </mapping>'."\n"; |
|
283 | + $out .= ' </responseDeclaration>'."\n"; |
|
284 | 284 | |
285 | 285 | return $out; |
286 | 286 | } |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | * TODO update this to match hot spots instead of copying matching |
297 | 297 | * Export the question part as a matrix-choice, with only one possible answer per line. |
298 | 298 | */ |
299 | - public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
|
299 | + public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '') |
|
300 | 300 | { |
301 | 301 | $this->answerList = $this->getAnswersList(true); |
302 | 302 | $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia; |
303 | 303 | $mimetype = mime_content_type($questionMedia); |
304 | - if(empty($mimetype)){ |
|
304 | + if (empty($mimetype)) { |
|
305 | 305 | $mimetype = 'image/jpeg'; |
306 | 306 | } |
307 | 307 | |
@@ -317,26 +317,26 @@ discard block |
||
317 | 317 | //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663 |
318 | 318 | $coords = ''; |
319 | 319 | $type = 'default'; |
320 | - switch($answer['hotspot_type']){ |
|
320 | + switch ($answer['hotspot_type']) { |
|
321 | 321 | case 'square': |
322 | 322 | $type = 'rect'; |
323 | 323 | $res = array(); |
324 | - $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); |
|
325 | - $coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]); |
|
324 | + $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res); |
|
325 | + $coords = $res[1].','.$res[2].','.((int) $res[1] + (int) $res[3]).",".((int) $res[2] + (int) $res[4]); |
|
326 | 326 | break; |
327 | 327 | case 'circle': |
328 | 328 | $type = 'circle'; |
329 | 329 | $res = array(); |
330 | - $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); |
|
331 | - $coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4]))); |
|
330 | + $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res); |
|
331 | + $coords = $res[1].','.$res[2].','.sqrt(pow(($res[1] - $res[3]), 2) + pow(($res[2] - $res[4]))); |
|
332 | 332 | break; |
333 | 333 | case 'poly': |
334 | 334 | $type = 'poly'; |
335 | - $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
335 | + $coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']); |
|
336 | 336 | break; |
337 | 337 | case 'delineation' : |
338 | 338 | $type = 'delineation'; |
339 | - $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
339 | + $coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']); |
|
340 | 340 | break; |
341 | 341 | } |
342 | 342 | $text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n"; |
@@ -356,18 +356,18 @@ discard block |
||
356 | 356 | $this->answerList = $this->getAnswersList(true); |
357 | 357 | $this->gradeList = $this->getGradesList(); |
358 | 358 | $out = ''; |
359 | - $out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n"; |
|
360 | - $out .= ' <correctResponse>'. "\n"; |
|
359 | + $out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">'."\n"; |
|
360 | + $out .= ' <correctResponse>'."\n"; |
|
361 | 361 | |
362 | 362 | if (is_array($this->answerList)) { |
363 | - foreach ($this->answerList as $answerKey=>$answer) { |
|
363 | + foreach ($this->answerList as $answerKey=>$answer) { |
|
364 | 364 | $answerKey = $answer['id']; |
365 | 365 | $answer = $answer['answer']; |
366 | 366 | $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; |
367 | 367 | } |
368 | 368 | } |
369 | - $out .= ' </correctResponse>'. "\n"; |
|
370 | - $out .= ' </responseDeclaration>'. "\n"; |
|
369 | + $out .= ' </correctResponse>'."\n"; |
|
370 | + $out .= ' </responseDeclaration>'."\n"; |
|
371 | 371 | |
372 | 372 | return $out; |
373 | 373 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * TODO implement |
384 | 384 | * Export the question part as a matrix-choice, with only one possible answer per line. |
385 | 385 | */ |
386 | - public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
|
386 | + public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '') |
|
387 | 387 | { |
388 | 388 | return ''; |
389 | 389 | } |
@@ -104,7 +104,11 @@ |
||
104 | 104 | { |
105 | 105 | $this->answerList = $this->getAnswersList(true); |
106 | 106 | $type = $this->getQuestionType(); |
107 | - if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
|
107 | + if ($type == MCMA) { |
|
108 | + $cardinality = 'multiple'; |
|
109 | + } else { |
|
110 | + $cardinality = 'single'; |
|
111 | + } |
|
108 | 112 | |
109 | 113 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; |
110 | 114 |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | |
56 | 56 | function createAnswersForm($form) |
57 | 57 | { |
58 | - return true; |
|
58 | + return true; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | function processAnswersCreation($form) |
62 | 62 | { |
63 | - return true; |
|
63 | + return true; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | /** |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | public function imsExportResponses($questionIdent, $questionStatment) |
77 | 77 | { |
78 | 78 | // @todo getAnswersList() converts the answers using api_html_entity_decode() |
79 | - $this->answerList = $this->getAnswersList(true); |
|
79 | + $this->answerList = $this->getAnswersList(true); |
|
80 | 80 | $out = ' <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n"; |
81 | 81 | $out .= ' <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n"; |
82 | - if (is_array($this->answerList)) { |
|
83 | - foreach ($this->answerList as $current_answer) { |
|
84 | - $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false"> |
|
82 | + if (is_array($this->answerList)) { |
|
83 | + foreach ($this->answerList as $current_answer) { |
|
84 | + $out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false"> |
|
85 | 85 | <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>'; |
86 | - if (isset($current_answer['comment']) && $current_answer['comment'] != '') { |
|
87 | - $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '"> |
|
86 | + if (isset($current_answer['comment']) && $current_answer['comment'] != '') { |
|
87 | + $out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '"> |
|
88 | 88 | <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]> |
89 | 89 | </feedbackInline>'; |
90 | - } |
|
91 | - $out .= '</simpleChoice>'. "\n"; |
|
92 | - } |
|
93 | - } |
|
90 | + } |
|
91 | + $out .= '</simpleChoice>'. "\n"; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | $out .= ' </choiceInteraction>'. "\n"; |
95 | 95 | |
96 | 96 | return $out; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function imsExportResponsesDeclaration($questionIdent) |
104 | 104 | { |
105 | - $this->answerList = $this->getAnswersList(true); |
|
106 | - $type = $this->getQuestionType(); |
|
105 | + $this->answerList = $this->getAnswersList(true); |
|
106 | + $type = $this->getQuestionType(); |
|
107 | 107 | if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
108 | 108 | |
109 | 109 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | // Match the correct answers. |
112 | 112 | |
113 | 113 | $out .= ' <correctResponse>'. "\n"; |
114 | - if (is_array($this->answerList)) { |
|
115 | - foreach($this->answerList as $current_answer) { |
|
116 | - if ($current_answer['correct']) { |
|
117 | - $out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n"; |
|
118 | - } |
|
119 | - } |
|
120 | - } |
|
114 | + if (is_array($this->answerList)) { |
|
115 | + foreach($this->answerList as $current_answer) { |
|
116 | + if ($current_answer['correct']) { |
|
117 | + $out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n"; |
|
118 | + } |
|
119 | + } |
|
120 | + } |
|
121 | 121 | $out .= ' </correctResponse>'. "\n"; |
122 | 122 | |
123 | 123 | //Add the grading |
124 | 124 | |
125 | 125 | $out .= ' <mapping>'. "\n"; |
126 | - if (is_array($this->answerList)) { |
|
127 | - foreach($this->answerList as $current_answer) { |
|
128 | - if (isset($current_answer['grade'])) { |
|
129 | - $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n"; |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
126 | + if (is_array($this->answerList)) { |
|
127 | + foreach($this->answerList as $current_answer) { |
|
128 | + if (isset($current_answer['grade'])) { |
|
129 | + $out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n"; |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | 133 | $out .= ' </mapping>'. "\n"; |
134 | 134 | $out .= ' </responseDeclaration>'. "\n"; |
135 | 135 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function imsExportResponses($questionIdent, $questionStatment) |
152 | 152 | { |
153 | - $this->answerList = $this->getAnswersList(true); |
|
153 | + $this->answerList = $this->getAnswersList(true); |
|
154 | 154 | $text = ''; |
155 | 155 | $text .= $this->answerText; |
156 | 156 | if (is_array($this->answerList)) { |
@@ -171,28 +171,28 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function imsExportResponsesDeclaration($questionIdent) |
173 | 173 | { |
174 | - $this->answerList = $this->getAnswersList(true); |
|
175 | - $this->gradeList = $this->getGradesList(); |
|
174 | + $this->answerList = $this->getAnswersList(true); |
|
175 | + $this->gradeList = $this->getGradesList(); |
|
176 | 176 | $out = ''; |
177 | - if (is_array($this->answerList)) { |
|
178 | - foreach ($this->answerList as $answer) { |
|
179 | - $answerKey = $answer['id']; |
|
180 | - $answer = $answer['answer']; |
|
181 | - $out .= ' <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n"; |
|
182 | - $out .= ' <correctResponse>'. "\n"; |
|
177 | + if (is_array($this->answerList)) { |
|
178 | + foreach ($this->answerList as $answer) { |
|
179 | + $answerKey = $answer['id']; |
|
180 | + $answer = $answer['answer']; |
|
181 | + $out .= ' <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n"; |
|
182 | + $out .= ' <correctResponse>'. "\n"; |
|
183 | 183 | $out .= ' <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n"; |
184 | - $out .= ' </correctResponse>'. "\n"; |
|
185 | - if (isset($this->gradeList[$answerKey])) { |
|
186 | - $out .= ' <mapping>'. "\n"; |
|
187 | - $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n"; |
|
188 | - $out .= ' </mapping>'. "\n"; |
|
189 | - } |
|
190 | - |
|
191 | - $out .= ' </responseDeclaration>'. "\n"; |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - return $out; |
|
184 | + $out .= ' </correctResponse>'. "\n"; |
|
185 | + if (isset($this->gradeList[$answerKey])) { |
|
186 | + $out .= ' <mapping>'. "\n"; |
|
187 | + $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n"; |
|
188 | + $out .= ' </mapping>'. "\n"; |
|
189 | + } |
|
190 | + |
|
191 | + $out .= ' </responseDeclaration>'. "\n"; |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + return $out; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function imsExportResponses($questionIdent, $questionStatment) |
209 | 209 | { |
210 | - $this->answerList = $this->getAnswersList(true); |
|
211 | - $maxAssociation = max(count($this->leftList), count($this->rightList)); |
|
210 | + $this->answerList = $this->getAnswersList(true); |
|
211 | + $maxAssociation = max(count($this->leftList), count($this->rightList)); |
|
212 | 212 | |
213 | 213 | $out = ""; |
214 | 214 | |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | //add left column |
219 | 219 | |
220 | 220 | $out .= ' <simpleMatchSet>'. "\n"; |
221 | - if (is_array($this->leftList)) { |
|
222 | - foreach ($this->leftList as $leftKey=>$leftElement) { |
|
223 | - $out .= ' |
|
221 | + if (is_array($this->leftList)) { |
|
222 | + foreach ($this->leftList as $leftKey=>$leftElement) { |
|
223 | + $out .= ' |
|
224 | 224 | <simpleAssociableChoice identifier="left_'.$leftKey.'" > |
225 | 225 | <![CDATA['.formatExerciseQtiTitle($leftElement['answer']).']]> |
226 | 226 | </simpleAssociableChoice>'. "\n"; |
227 | - } |
|
228 | - } |
|
227 | + } |
|
228 | + } |
|
229 | 229 | |
230 | 230 | $out .= ' </simpleMatchSet>'. "\n"; |
231 | 231 | |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | |
236 | 236 | $i = 0; |
237 | 237 | |
238 | - if (is_array($this->rightList)) { |
|
239 | - foreach($this->rightList as $rightKey=>$rightElement) { |
|
240 | - $out .= '<simpleAssociableChoice identifier="right_'.$i.'" > |
|
238 | + if (is_array($this->rightList)) { |
|
239 | + foreach($this->rightList as $rightKey=>$rightElement) { |
|
240 | + $out .= '<simpleAssociableChoice identifier="right_'.$i.'" > |
|
241 | 241 | <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]> |
242 | 242 | </simpleAssociableChoice>'. "\n"; |
243 | - $i++; |
|
244 | - } |
|
245 | - } |
|
243 | + $i++; |
|
244 | + } |
|
245 | + } |
|
246 | 246 | $out .= ' </simpleMatchSet>'. "\n"; |
247 | 247 | $out .= '</matchInteraction>'. "\n"; |
248 | 248 | |
@@ -254,30 +254,30 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function imsExportResponsesDeclaration($questionIdent) |
256 | 256 | { |
257 | - $this->answerList = $this->getAnswersList(true); |
|
257 | + $this->answerList = $this->getAnswersList(true); |
|
258 | 258 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n"; |
259 | 259 | $out .= ' <correctResponse>' . "\n"; |
260 | 260 | |
261 | 261 | $gradeArray = array(); |
262 | - if (is_array($this->leftList)) { |
|
263 | - foreach ($this->leftList as $leftKey=>$leftElement) { |
|
264 | - $i=0; |
|
265 | - foreach ($this->rightList as $rightKey=>$rightElement) { |
|
266 | - if (($leftElement['match'] == $rightElement['code'])) { |
|
267 | - $out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; |
|
268 | - |
|
269 | - $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; |
|
270 | - } |
|
271 | - $i++; |
|
272 | - } |
|
273 | - } |
|
274 | - } |
|
262 | + if (is_array($this->leftList)) { |
|
263 | + foreach ($this->leftList as $leftKey=>$leftElement) { |
|
264 | + $i=0; |
|
265 | + foreach ($this->rightList as $rightKey=>$rightElement) { |
|
266 | + if (($leftElement['match'] == $rightElement['code'])) { |
|
267 | + $out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; |
|
268 | + |
|
269 | + $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; |
|
270 | + } |
|
271 | + $i++; |
|
272 | + } |
|
273 | + } |
|
274 | + } |
|
275 | 275 | $out .= ' </correctResponse>'. "\n"; |
276 | 276 | $out .= ' <mapping>' . "\n"; |
277 | 277 | if (is_array($gradeArray)) { |
278 | - foreach ($gradeArray as $gradeKey=>$grade) { |
|
279 | - $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n"; |
|
280 | - } |
|
278 | + foreach ($gradeArray as $gradeKey=>$grade) { |
|
279 | + $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n"; |
|
280 | + } |
|
281 | 281 | } |
282 | 282 | $out .= ' </mapping>' . "\n"; |
283 | 283 | $out .= ' </responseDeclaration>'. "\n"; |
@@ -298,49 +298,49 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
300 | 300 | { |
301 | - $this->answerList = $this->getAnswersList(true); |
|
302 | - $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia; |
|
303 | - $mimetype = mime_content_type($questionMedia); |
|
304 | - if(empty($mimetype)){ |
|
305 | - $mimetype = 'image/jpeg'; |
|
306 | - } |
|
307 | - |
|
308 | - $text = ' <p>'.$questionStatment.'</p>'."\n"; |
|
309 | - $text .= ' <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n"; |
|
310 | - $text .= ' <prompt>'.$questionDesc.'</prompt>'."\n"; |
|
311 | - $text .= ' <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n"; |
|
301 | + $this->answerList = $this->getAnswersList(true); |
|
302 | + $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia; |
|
303 | + $mimetype = mime_content_type($questionMedia); |
|
304 | + if(empty($mimetype)){ |
|
305 | + $mimetype = 'image/jpeg'; |
|
306 | + } |
|
307 | + |
|
308 | + $text = ' <p>'.$questionStatment.'</p>'."\n"; |
|
309 | + $text .= ' <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n"; |
|
310 | + $text .= ' <prompt>'.$questionDesc.'</prompt>'."\n"; |
|
311 | + $text .= ' <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n"; |
|
312 | 312 | if (is_array($this->answerList)) { |
313 | - foreach ($this->answerList as $key=>$answer) { |
|
314 | - $key = $answer['id']; |
|
315 | - $answerTxt = $answer['answer']; |
|
316 | - $len = api_strlen($answerTxt); |
|
317 | - //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663 |
|
318 | - $coords = ''; |
|
319 | - $type = 'default'; |
|
320 | - switch($answer['hotspot_type']){ |
|
321 | - case 'square': |
|
322 | - $type = 'rect'; |
|
323 | - $res = array(); |
|
324 | - $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); |
|
325 | - $coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]); |
|
326 | - break; |
|
327 | - case 'circle': |
|
328 | - $type = 'circle'; |
|
329 | - $res = array(); |
|
330 | - $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); |
|
331 | - $coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4]))); |
|
332 | - break; |
|
333 | - case 'poly': |
|
334 | - $type = 'poly'; |
|
335 | - $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
336 | - break; |
|
337 | - case 'delineation' : |
|
338 | - $type = 'delineation'; |
|
339 | - $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
340 | - break; |
|
341 | - } |
|
342 | - $text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n"; |
|
343 | - } |
|
313 | + foreach ($this->answerList as $key=>$answer) { |
|
314 | + $key = $answer['id']; |
|
315 | + $answerTxt = $answer['answer']; |
|
316 | + $len = api_strlen($answerTxt); |
|
317 | + //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663 |
|
318 | + $coords = ''; |
|
319 | + $type = 'default'; |
|
320 | + switch($answer['hotspot_type']){ |
|
321 | + case 'square': |
|
322 | + $type = 'rect'; |
|
323 | + $res = array(); |
|
324 | + $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); |
|
325 | + $coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]); |
|
326 | + break; |
|
327 | + case 'circle': |
|
328 | + $type = 'circle'; |
|
329 | + $res = array(); |
|
330 | + $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); |
|
331 | + $coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4]))); |
|
332 | + break; |
|
333 | + case 'poly': |
|
334 | + $type = 'poly'; |
|
335 | + $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
336 | + break; |
|
337 | + case 'delineation' : |
|
338 | + $type = 'delineation'; |
|
339 | + $coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); |
|
340 | + break; |
|
341 | + } |
|
342 | + $text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n"; |
|
343 | + } |
|
344 | 344 | } |
345 | 345 | $text .= ' </graphicOrderInteraction>'."\n"; |
346 | 346 | $out = $text; |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function imsExportResponsesDeclaration($questionIdent) |
355 | 355 | { |
356 | - $this->answerList = $this->getAnswersList(true); |
|
357 | - $this->gradeList = $this->getGradesList(); |
|
356 | + $this->answerList = $this->getAnswersList(true); |
|
357 | + $this->gradeList = $this->getGradesList(); |
|
358 | 358 | $out = ''; |
359 | 359 | $out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n"; |
360 | 360 | $out .= ' <correctResponse>'. "\n"; |
361 | 361 | |
362 | - if (is_array($this->answerList)) { |
|
363 | - foreach ($this->answerList as $answerKey=>$answer) { |
|
364 | - $answerKey = $answer['id']; |
|
365 | - $answer = $answer['answer']; |
|
366 | - $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; |
|
367 | - } |
|
368 | - } |
|
362 | + if (is_array($this->answerList)) { |
|
363 | + foreach ($this->answerList as $answerKey=>$answer) { |
|
364 | + $answerKey = $answer['id']; |
|
365 | + $answer = $answer['answer']; |
|
366 | + $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; |
|
367 | + } |
|
368 | + } |
|
369 | 369 | $out .= ' </correctResponse>'. "\n"; |
370 | 370 | $out .= ' </responseDeclaration>'. "\n"; |
371 | 371 | |
372 | - return $out; |
|
372 | + return $out; |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | * Export the question part as a matrix-choice, with only one possible answer per line. |
385 | 385 | */ |
386 | 386 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
387 | - { |
|
388 | - return ''; |
|
389 | - } |
|
387 | + { |
|
388 | + return ''; |
|
389 | + } |
|
390 | 390 | /** |
391 | 391 | * |
392 | 392 | */ |
393 | 393 | public function imsExportResponsesDeclaration($questionIdent) |
394 | 394 | { |
395 | - return ''; |
|
395 | + return ''; |
|
396 | 396 | } |
397 | 397 | } |
@@ -72,6 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Return the XML flow for the possible answers. |
74 | 74 | * |
75 | + * @param string $questionStatment |
|
75 | 76 | */ |
76 | 77 | public function imsExportResponses($questionIdent, $questionStatment) |
77 | 78 | { |
@@ -147,6 +148,7 @@ discard block |
||
147 | 148 | * Export the text with missing words. |
148 | 149 | * |
149 | 150 | * |
151 | + * @param string $questionStatment |
|
150 | 152 | */ |
151 | 153 | public function imsExportResponses($questionIdent, $questionStatment) |
152 | 154 | { |
@@ -204,6 +206,7 @@ discard block |
||
204 | 206 | { |
205 | 207 | /** |
206 | 208 | * Export the question part as a matrix-choice, with only one possible answer per line. |
209 | + * @param string $questionStatment |
|
207 | 210 | */ |
208 | 211 | public function imsExportResponses($questionIdent, $questionStatment) |
209 | 212 | { |
@@ -295,6 +298,7 @@ discard block |
||
295 | 298 | /** |
296 | 299 | * TODO update this to match hot spots instead of copying matching |
297 | 300 | * Export the question part as a matrix-choice, with only one possible answer per line. |
301 | + * @param string $questionStatment |
|
298 | 302 | */ |
299 | 303 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
300 | 304 | { |
@@ -382,6 +386,7 @@ discard block |
||
382 | 386 | /** |
383 | 387 | * TODO implement |
384 | 388 | * Export the question part as a matrix-choice, with only one possible answer per line. |
389 | + * @param string $questionStatment |
|
385 | 390 | */ |
386 | 391 | public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') |
387 | 392 | { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dir .= '/'; |
26 | 26 | |
27 | 27 | do { |
28 | - $path = $dir . $prefix . mt_rand(0, 9999999); |
|
28 | + $path = $dir.$prefix.mt_rand(0, 9999999); |
|
29 | 29 | } while (!mkdir($path, $mode)); |
30 | 30 | |
31 | 31 | return $path; |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | function aiken_display_form($msg = '') { |
39 | 39 | $name_tools = get_lang('ImportAikenQuiz'); |
40 | 40 | $form = '<div class="actions">'; |
41 | - $form .= '<a href="exercise.php?show=test">' . Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
41 | + $form .= '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
42 | 42 | $form .= '</div>'; |
43 | 43 | $form .= $msg; |
44 | - $form_validator = new FormValidator('aiken_upload', 'post',api_get_self()."?".api_get_cidreq(), null, array('enctype' => 'multipart/form-data') ); |
|
44 | + $form_validator = new FormValidator('aiken_upload', 'post', api_get_self()."?".api_get_cidreq(), null, array('enctype' => 'multipart/form-data')); |
|
45 | 45 | $form_validator->addElement('header', $name_tools); |
46 | 46 | $form_validator->addElement('text', 'total_weight', get_lang('TotalWeight')); |
47 | 47 | $form_validator->addElement('file', 'userFile', get_lang('DownloadFile')); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | global $record_item_body; |
90 | 90 | // used to specify the question directory where files could be found in relation in any question |
91 | 91 | global $questionTempDir; |
92 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'aiken'; |
|
92 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH).'aiken'; |
|
93 | 93 | $baseWorkDir = $archive_path; |
94 | 94 | |
95 | 95 | if (!is_dir($baseWorkDir)) { |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | |
131 | 131 | // Parse every subdirectory to search txt question files |
132 | 132 | while (false !== ($file = readdir($exerciseHandle))) { |
133 | - if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") { |
|
133 | + if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") { |
|
134 | 134 | //find each manifest for each question repository found |
135 | - $questionHandle = opendir($baseWorkDir . '/' . $file); |
|
135 | + $questionHandle = opendir($baseWorkDir.'/'.$file); |
|
136 | 136 | while (false !== ($questionFile = readdir($questionHandle))) { |
137 | 137 | if (preg_match('/.txt$/i', $questionFile)) { |
138 | 138 | $result = aiken_parse_file( |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $result = 'NoTxtFileFoundInTheZip'; |
155 | 155 | } |
156 | 156 | |
157 | - if ($result !== true ) { |
|
157 | + if ($result !== true) { |
|
158 | 158 | return $result; |
159 | 159 | } |
160 | 160 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | // Delete the temp dir where the exercise was unzipped |
218 | - my_delete($baseWorkDir . $uploadPath); |
|
218 | + my_delete($baseWorkDir.$uploadPath); |
|
219 | 219 | $operation = $last_exercise_id; |
220 | 220 | } |
221 | 221 | |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile) { |
236 | 236 | global $questionTempDir; |
237 | 237 | |
238 | - $questionTempDir = $exercisePath . '/' . $file . '/'; |
|
239 | - $questionFilePath = $questionTempDir . $questionFile; |
|
238 | + $questionTempDir = $exercisePath.'/'.$file.'/'; |
|
239 | + $questionFilePath = $questionTempDir.$questionFile; |
|
240 | 240 | |
241 | 241 | if (!is_file($questionFilePath)) { |
242 | 242 | return 'FileNotFound'; |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | $answers_array = array(); |
249 | 249 | $new_question = true; |
250 | 250 | foreach ($data as $line => $info) { |
251 | - if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/',$info)) { |
|
251 | + if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/', $info)) { |
|
252 | 252 | // double empty line |
253 | 253 | continue; |
254 | 254 | } |
255 | 255 | $new_question = false; |
256 | 256 | //make sure it is transformed from iso-8859-1 to utf-8 if in that form |
257 | - if (!mb_check_encoding($info,'utf-8') && mb_check_encoding($info,'iso-8859-1')) { |
|
257 | + if (!mb_check_encoding($info, 'utf-8') && mb_check_encoding($info, 'iso-8859-1')) { |
|
258 | 258 | $info = utf8_encode($info); |
259 | 259 | } |
260 | 260 | $exercise_info['question'][$question_index]['type'] = 'MCUA'; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) { |
287 | 287 | //TAGS for chamilo >= 1.10 (Spanish e-ducativa format) |
288 | 288 | $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]); |
289 | - } elseif (preg_match('/^(\r)?\n/',$info)) { |
|
289 | + } elseif (preg_match('/^(\r)?\n/', $info)) { |
|
290 | 290 | //moving to next question (tolerate \r\n or just \n) |
291 | 291 | if (empty($exercise_info['question'][$question_index]['correct_answers'])) { |
292 | 292 | error_log('Aiken: Error in question index '.$question_index.': no correct answer defined'); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $exercise_info['question'][$question_index]['title'] = $info; |
307 | 307 | } else { |
308 | 308 | //Question itself (use a 100-chars long title and a larger description) |
309 | - $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)) . '...'; |
|
309 | + $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)).'...'; |
|
310 | 310 | $exercise_info['question'][$question_index]['description'] = $info; |
311 | 311 | } |
312 | 312 | } else { |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | $total_questions = count($exercise_info['question']); |
318 | 318 | $total_weight = (!empty($_POST['total_weight'])) ? intval($_POST['total_weight']) : 20; |
319 | - foreach ($exercise_info['question'] as $key => $question) { |
|
319 | + foreach ($exercise_info['question'] as $key => $question) { |
|
320 | 320 | $exercise_info['question'][$key]['weighting'][current(array_keys($exercise_info['question'][$key]['weighting']))] = $total_weight / $total_questions; |
321 | 321 | } |
322 | 322 | return true; |
@@ -10,8 +10,9 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * Security check |
12 | 12 | */ |
13 | -if (count(get_included_files()) == 1) |
|
13 | +if (count(get_included_files()) == 1) { |
|
14 | 14 | die('---'); |
15 | +} |
|
15 | 16 | |
16 | 17 | /** |
17 | 18 | * Creates a temporary directory |
@@ -21,8 +22,9 @@ discard block |
||
21 | 22 | * @return string |
22 | 23 | */ |
23 | 24 | function tempdir($dir, $prefix = 'tmp', $mode = 0777) { |
24 | - if (substr($dir, -1) != '/') |
|
25 | - $dir .= '/'; |
|
25 | + if (substr($dir, -1) != '/') { |
|
26 | + $dir .= '/'; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | do { |
28 | 30 | $path = $dir . $prefix . mt_rand(0, 9999999); |
@@ -281,7 +281,7 @@ |
||
281 | 281 | $correct_answer_index = array_search($matches[1], $answers_array); |
282 | 282 | $exercise_info['question'][$question_index]['title'] = $matches[1]; |
283 | 283 | } elseif (preg_match('/^TAGS:\s?([A-Z])\s?/', $info, $matches)) { |
284 | - //TAGS for chamilo >= 1.10 |
|
284 | + //TAGS for chamilo >= 1.10 |
|
285 | 285 | $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]); |
286 | 286 | } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) { |
287 | 287 | //TAGS for chamilo >= 1.10 (Spanish e-ducativa format) |