@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | $form->addElement('checkbox', 'activate_start_date_check', null,get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
161 | 161 | $display_date = 'none'; |
162 | 162 | if ($publicated_on!='0000-00-00 00:00:00' && !empty($publicated_on)) { |
163 | - $display_date = 'block'; |
|
164 | - $defaults['activate_start_date_check'] = 1; |
|
163 | + $display_date = 'block'; |
|
164 | + $defaults['activate_start_date_check'] = 1; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $form->addElement('html','<div id="start_date_div" style="display:'.$display_date.';">'); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
173 | 173 | $display_date = 'none'; |
174 | 174 | if ($expired_on!='0000-00-00 00:00:00' && !empty($expired_on)) { |
175 | - $display_date = 'block'; |
|
176 | - $defaults['activate_end_date_check'] = 1; |
|
175 | + $display_date = 'block'; |
|
176 | + $defaults['activate_end_date_check'] = 1; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | $form->addElement('html','<div id="end_date_div" style="display:'.$display_date.';">'); |
@@ -308,11 +308,11 @@ |
||
308 | 308 | //$_SESSION['addedresourceid']=null; |
309 | 309 | // cleaning up the session once again |
310 | 310 | $_SESSION['addedresource'] = null; |
311 | - $_SESSION['addedresourceid'] = null; |
|
312 | - $_SESSION['addedresourceassigned'] = null; |
|
313 | - unset ($_SESSION['addedresource']); |
|
314 | - unset ($_SESSION['addedresourceid']); |
|
315 | - unset ($_SESSION['addedresourceassigned']); |
|
311 | + $_SESSION['addedresourceid'] = null; |
|
312 | + $_SESSION['addedresourceassigned'] = null; |
|
313 | + unset ($_SESSION['addedresource']); |
|
314 | + unset ($_SESSION['addedresourceid']); |
|
315 | + unset ($_SESSION['addedresourceassigned']); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | api_get_group_id() |
37 | 37 | ); |
38 | 38 | if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) { |
39 | - api_not_allowed(); |
|
39 | + api_not_allowed(); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if (empty($_SESSION['oLP'])) { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | // Using the resource linker as a tool for adding resources to the learning path. |
26 | 26 | if ($action == 'add' && $type == 'learnpathitem') { |
27 | - $htmlHeadXtra[] = "<script> |
|
27 | + $htmlHeadXtra[] = "<script> |
|
28 | 28 | window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; |
29 | 29 | </script>"; |
30 | 30 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | // Create the directory |
50 | 50 | $result = $this->generate_lp_folder($_course, $this->file_name); |
51 | 51 | |
52 | - // Create the directory |
|
52 | + // Create the directory |
|
53 | 53 | $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
54 | 54 | ///learning_path/ppt_dirname directory |
55 | 55 | $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1); |
@@ -9,261 +9,261 @@ |
||
9 | 9 | */ |
10 | 10 | class LearnpathLink extends AbstractLink |
11 | 11 | { |
12 | - private $course_info = null; |
|
13 | - private $learnpath_table = null; |
|
14 | - private $learnpath_data = null; |
|
15 | - |
|
16 | - /** |
|
17 | - * Constructor |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - parent::__construct(); |
|
22 | - $this->set_type(LINK_LEARNPATH); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | - */ |
|
29 | - public function get_not_created_links() |
|
30 | - { |
|
31 | - return false; |
|
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
34 | - |
|
35 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | - |
|
37 | - $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
12 | + private $course_info = null; |
|
13 | + private $learnpath_table = null; |
|
14 | + private $learnpath_data = null; |
|
15 | + |
|
16 | + /** |
|
17 | + * Constructor |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + parent::__construct(); |
|
22 | + $this->set_type(LINK_LEARNPATH); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | + */ |
|
29 | + public function get_not_created_links() |
|
30 | + { |
|
31 | + return false; |
|
32 | + if (empty($this->course_code)) |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + |
|
35 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | + |
|
37 | + $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
39 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | - .' WHERE type = '.LINK_LEARNPATH |
|
41 | - ." AND course_code = '".$this->get_course_code()."'" |
|
42 | - .') AND lp.session_id='.api_get_session_id().''; |
|
43 | - |
|
44 | - $result = Database::query($sql); |
|
45 | - |
|
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
49 | - } |
|
50 | - |
|
51 | - return $cats; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Generate an array of all learnpaths available. |
|
56 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | - */ |
|
58 | - public function get_all_links() |
|
59 | - { |
|
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
62 | - |
|
63 | - $session_id = api_get_session_id(); |
|
64 | - if (empty($session_id)) { |
|
65 | - $session_condition = api_get_session_condition(0, true); |
|
66 | - } else { |
|
67 | - $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | - } |
|
69 | - |
|
70 | - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
39 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | + .' WHERE type = '.LINK_LEARNPATH |
|
41 | + ." AND course_code = '".$this->get_course_code()."'" |
|
42 | + .') AND lp.session_id='.api_get_session_id().''; |
|
43 | + |
|
44 | + $result = Database::query($sql); |
|
45 | + |
|
46 | + $cats=array(); |
|
47 | + while ($data=Database::fetch_array($result)) { |
|
48 | + $cats[] = array ($data['id'], $data['name']); |
|
49 | + } |
|
50 | + |
|
51 | + return $cats; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Generate an array of all learnpaths available. |
|
56 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | + */ |
|
58 | + public function get_all_links() |
|
59 | + { |
|
60 | + if (empty($this->course_code)) |
|
61 | + die('Error in get_not_created_links() : course code not set'); |
|
62 | + |
|
63 | + $session_id = api_get_session_id(); |
|
64 | + if (empty($session_id)) { |
|
65 | + $session_condition = api_get_session_condition(0, true); |
|
66 | + } else { |
|
67 | + $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | + } |
|
69 | + |
|
70 | + $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
71 | 71 | WHERE c_id = '.$this->course_id.' '.$session_condition.' '; |
72 | - $result = Database::query($sql); |
|
72 | + $result = Database::query($sql); |
|
73 | 73 | |
74 | - $cats = array(); |
|
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
77 | - } |
|
74 | + $cats = array(); |
|
75 | + while ($data=Database::fetch_array($result)) { |
|
76 | + $cats[] = array ($data['id'], $data['name']); |
|
77 | + } |
|
78 | 78 | |
79 | - return $cats; |
|
80 | - } |
|
79 | + return $cats; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Has anyone used this learnpath yet ? |
|
85 | - */ |
|
86 | - public function has_results() |
|
87 | - { |
|
88 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | - $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
83 | + /** |
|
84 | + * Has anyone used this learnpath yet ? |
|
85 | + */ |
|
86 | + public function has_results() |
|
87 | + { |
|
88 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | + $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
91 | - $result = Database::query($sql); |
|
92 | - $number = Database::fetch_array($result,'NUM'); |
|
93 | - return ($number[0] != 0); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | - * @return array (score, max) if student is given |
|
100 | - * array (sum of scores, number of scores) otherwise |
|
101 | - * or null if no scores available |
|
102 | - */ |
|
103 | - public function calc_score($stud_id = null, $type = null) |
|
104 | - { |
|
105 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | - $session_id = api_get_session_id(); |
|
107 | - |
|
108 | - $sql = "SELECT * FROM $tbl_stats |
|
91 | + $result = Database::query($sql); |
|
92 | + $number = Database::fetch_array($result,'NUM'); |
|
93 | + return ($number[0] != 0); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | + * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | + * @return array (score, max) if student is given |
|
100 | + * array (sum of scores, number of scores) otherwise |
|
101 | + * or null if no scores available |
|
102 | + */ |
|
103 | + public function calc_score($stud_id = null, $type = null) |
|
104 | + { |
|
105 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | + $session_id = api_get_session_id(); |
|
107 | + |
|
108 | + $sql = "SELECT * FROM $tbl_stats |
|
109 | 109 | WHERE |
110 | 110 | c_id = ".$this->course_id." AND |
111 | 111 | lp_id = ".$this->get_ref_id()." AND |
112 | 112 | session_id = $session_id "; |
113 | 113 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | - |
|
117 | - // order by id, that way the student's first attempt is accessed first |
|
118 | - $sql .= ' ORDER BY view_count DESC'; |
|
119 | - |
|
120 | - $scores = Database::query($sql); |
|
121 | - // for 1 student |
|
122 | - if (isset($stud_id)) { |
|
123 | - if ($data = Database::fetch_assoc($scores)) { |
|
124 | - return array ($data['progress'], 100); |
|
125 | - } else |
|
126 | - return null; |
|
127 | - } else { |
|
128 | - // all students -> get average |
|
129 | - $students = array(); // user list, needed to make sure we only |
|
130 | - // take first attempts into account |
|
131 | - $rescount = 0; |
|
132 | - $sum = 0; |
|
133 | - $bestResult = 0; |
|
134 | - $sumResult = 0; |
|
135 | - while ($data = Database::fetch_array($scores)) { |
|
136 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | - $students[$data['user_id']] = $data['progress']; |
|
138 | - $rescount++; |
|
139 | - $sum += $data['progress'] / 100; |
|
140 | - $sumResult += $data['progress']; |
|
141 | - |
|
142 | - if ($data['progress'] > $bestResult) { |
|
143 | - $bestResult = $data['progress']; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ($rescount == 0) { |
|
149 | - return null; |
|
150 | - } else { |
|
151 | - |
|
152 | - switch ($type) { |
|
153 | - case 'best': |
|
154 | - return array($bestResult, 100); |
|
155 | - break; |
|
156 | - case 'average': |
|
157 | - return array($sumResult/$rescount, 100); |
|
158 | - break; |
|
159 | - case 'ranking': |
|
160 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | - break; |
|
162 | - default: |
|
163 | - return array($sum, $rescount); |
|
164 | - break; |
|
165 | - } |
|
166 | - } |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Get URL where to go to if the user clicks on the link. |
|
172 | - */ |
|
173 | - public function get_link() |
|
174 | - { |
|
175 | - $session_id = api_get_session_id(); |
|
176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | - |
|
178 | - if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
179 | - $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
180 | - } else { |
|
181 | - $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
182 | - } |
|
183 | - return $url; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * Get name to display: same as learnpath title |
|
188 | - */ |
|
189 | - public function get_name() |
|
190 | - { |
|
191 | - $data = $this->get_learnpath_data(); |
|
192 | - return $data['name']; |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Get description to display: same as learnpath description |
|
197 | - */ |
|
198 | - public function get_description() |
|
199 | - { |
|
200 | - $data = $this->get_learnpath_data(); |
|
201 | - return $data['description']; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * Check if this still links to a learnpath |
|
206 | - */ |
|
207 | - public function is_valid_link() { |
|
208 | - $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
114 | + if (isset($stud_id)) |
|
115 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + |
|
117 | + // order by id, that way the student's first attempt is accessed first |
|
118 | + $sql .= ' ORDER BY view_count DESC'; |
|
119 | + |
|
120 | + $scores = Database::query($sql); |
|
121 | + // for 1 student |
|
122 | + if (isset($stud_id)) { |
|
123 | + if ($data = Database::fetch_assoc($scores)) { |
|
124 | + return array ($data['progress'], 100); |
|
125 | + } else |
|
126 | + return null; |
|
127 | + } else { |
|
128 | + // all students -> get average |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | + // take first attempts into account |
|
131 | + $rescount = 0; |
|
132 | + $sum = 0; |
|
133 | + $bestResult = 0; |
|
134 | + $sumResult = 0; |
|
135 | + while ($data = Database::fetch_array($scores)) { |
|
136 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | + $students[$data['user_id']] = $data['progress']; |
|
138 | + $rescount++; |
|
139 | + $sum += $data['progress'] / 100; |
|
140 | + $sumResult += $data['progress']; |
|
141 | + |
|
142 | + if ($data['progress'] > $bestResult) { |
|
143 | + $bestResult = $data['progress']; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ($rescount == 0) { |
|
149 | + return null; |
|
150 | + } else { |
|
151 | + |
|
152 | + switch ($type) { |
|
153 | + case 'best': |
|
154 | + return array($bestResult, 100); |
|
155 | + break; |
|
156 | + case 'average': |
|
157 | + return array($sumResult/$rescount, 100); |
|
158 | + break; |
|
159 | + case 'ranking': |
|
160 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | + break; |
|
162 | + default: |
|
163 | + return array($sum, $rescount); |
|
164 | + break; |
|
165 | + } |
|
166 | + } |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Get URL where to go to if the user clicks on the link. |
|
172 | + */ |
|
173 | + public function get_link() |
|
174 | + { |
|
175 | + $session_id = api_get_session_id(); |
|
176 | + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | + |
|
178 | + if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
179 | + $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
180 | + } else { |
|
181 | + $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
182 | + } |
|
183 | + return $url; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * Get name to display: same as learnpath title |
|
188 | + */ |
|
189 | + public function get_name() |
|
190 | + { |
|
191 | + $data = $this->get_learnpath_data(); |
|
192 | + return $data['name']; |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Get description to display: same as learnpath description |
|
197 | + */ |
|
198 | + public function get_description() |
|
199 | + { |
|
200 | + $data = $this->get_learnpath_data(); |
|
201 | + return $data['description']; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * Check if this still links to a learnpath |
|
206 | + */ |
|
207 | + public function is_valid_link() { |
|
208 | + $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
210 | - $result = Database::query($sql); |
|
211 | - $number = Database::fetch_row($result,'NUM'); |
|
212 | - return ($number[0] != 0); |
|
213 | - } |
|
214 | - |
|
215 | - public function get_type_name() |
|
216 | - { |
|
217 | - return get_lang('LearningPaths'); |
|
218 | - } |
|
219 | - |
|
220 | - public function needs_name_and_description() |
|
221 | - { |
|
222 | - return false; |
|
223 | - } |
|
224 | - |
|
225 | - public function needs_max() |
|
226 | - { |
|
227 | - return false; |
|
228 | - } |
|
229 | - |
|
230 | - public function needs_results() |
|
231 | - { |
|
232 | - return false; |
|
233 | - } |
|
234 | - |
|
235 | - public function is_allowed_to_change_name() |
|
236 | - { |
|
237 | - return false; |
|
238 | - } |
|
239 | - |
|
240 | - // INTERNAL FUNCTIONS |
|
241 | - |
|
242 | - /** |
|
243 | - * Lazy load function to get the database table of the learnpath |
|
244 | - */ |
|
245 | - private function get_learnpath_table() |
|
246 | - { |
|
247 | - $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
248 | - return $this->learnpath_table; |
|
249 | - } |
|
250 | - |
|
251 | - /** |
|
252 | - * Lazy load function to get the database contents of this learnpath |
|
253 | - */ |
|
254 | - private function get_learnpath_data() |
|
255 | - { |
|
256 | - if (!isset($this->learnpath_data)) { |
|
257 | - $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
210 | + $result = Database::query($sql); |
|
211 | + $number = Database::fetch_row($result,'NUM'); |
|
212 | + return ($number[0] != 0); |
|
213 | + } |
|
214 | + |
|
215 | + public function get_type_name() |
|
216 | + { |
|
217 | + return get_lang('LearningPaths'); |
|
218 | + } |
|
219 | + |
|
220 | + public function needs_name_and_description() |
|
221 | + { |
|
222 | + return false; |
|
223 | + } |
|
224 | + |
|
225 | + public function needs_max() |
|
226 | + { |
|
227 | + return false; |
|
228 | + } |
|
229 | + |
|
230 | + public function needs_results() |
|
231 | + { |
|
232 | + return false; |
|
233 | + } |
|
234 | + |
|
235 | + public function is_allowed_to_change_name() |
|
236 | + { |
|
237 | + return false; |
|
238 | + } |
|
239 | + |
|
240 | + // INTERNAL FUNCTIONS |
|
241 | + |
|
242 | + /** |
|
243 | + * Lazy load function to get the database table of the learnpath |
|
244 | + */ |
|
245 | + private function get_learnpath_table() |
|
246 | + { |
|
247 | + $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
248 | + return $this->learnpath_table; |
|
249 | + } |
|
250 | + |
|
251 | + /** |
|
252 | + * Lazy load function to get the database contents of this learnpath |
|
253 | + */ |
|
254 | + private function get_learnpath_data() |
|
255 | + { |
|
256 | + if (!isset($this->learnpath_data)) { |
|
257 | + $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
258 | 258 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
259 | - $result = Database::query($sql); |
|
260 | - $this->learnpath_data = Database::fetch_array($result); |
|
261 | - } |
|
262 | - return $this->learnpath_data; |
|
263 | - } |
|
264 | - |
|
265 | - public function get_icon_name() |
|
266 | - { |
|
267 | - return 'learnpath'; |
|
268 | - } |
|
259 | + $result = Database::query($sql); |
|
260 | + $this->learnpath_data = Database::fetch_array($result); |
|
261 | + } |
|
262 | + return $this->learnpath_data; |
|
263 | + } |
|
264 | + |
|
265 | + public function get_icon_name() |
|
266 | + { |
|
267 | + return 'learnpath'; |
|
268 | + } |
|
269 | 269 | } |
@@ -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']; |
@@ -201,19 +201,19 @@ discard block |
||
201 | 201 | Session::erase('objExercise'); |
202 | 202 | Session::erase('exe_id'); |
203 | 203 | } |
204 | - Display::display_footer(); |
|
204 | + Display::display_footer(); |
|
205 | 205 | } else { |
206 | - $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
207 | - $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
|
208 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
206 | + $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
207 | + $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
|
208 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
209 | 209 | |
210 | 210 | if (api_is_allowed_to_session_edit()) { |
211 | 211 | Session::erase('objExercise'); |
212 | 212 | Session::erase('exe_id'); |
213 | 213 | } |
214 | 214 | |
215 | - // Record the results in the learning path, using the SCORM interface (API) |
|
216 | - echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
215 | + // Record the results in the learning path, using the SCORM interface (API) |
|
216 | + echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
217 | 217 | echo '<script type="text/javascript">'.$href.'</script>'; |
218 | - echo '</body></html>'; |
|
218 | + echo '</body></html>'; |
|
219 | 219 | } |
@@ -18,156 +18,156 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class ScormQuestion extends Question |
20 | 20 | { |
21 | - /** |
|
22 | - * Returns the HTML + JS flow corresponding to one question |
|
23 | - * |
|
24 | - * @param int The question ID |
|
25 | - * @param bool standalone (ie including XML tag, DTD declaration, etc) |
|
26 | - * @param int The JavaScript ID for this question. |
|
27 | - * Due to the nature of interactions, we must have a natural sequence for |
|
28 | - * questions in the generated JavaScript. |
|
29 | - * @param integer $js_id |
|
30 | - */ |
|
31 | - public static function export_question($questionId, $standalone = true, $js_id) |
|
32 | - { |
|
33 | - $question = new ScormQuestion(); |
|
34 | - $qst = $question->read($questionId); |
|
35 | - if (!$qst) { |
|
36 | - return ''; |
|
37 | - } |
|
38 | - $question->id = $qst->id; |
|
39 | - $question->js_id = $js_id; |
|
40 | - $question->type = $qst->type; |
|
41 | - $question->question = $qst->question; |
|
42 | - $question->description = $qst->description; |
|
43 | - $question->weighting=$qst->weighting; |
|
44 | - $question->position=$qst->position; |
|
45 | - $question->picture=$qst->picture; |
|
46 | - $assessmentItem = new ScormAssessmentItem($question, $standalone); |
|
47 | - //echo "<pre>".print_r($scorm,1)."</pre>";exit; |
|
48 | - return $assessmentItem->export(); |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Include the correct answer class and create answer |
|
53 | - */ |
|
54 | - public function setAnswer() |
|
55 | - { |
|
56 | - switch ($this->type) { |
|
57 | - case MCUA: |
|
58 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
59 | - $this->answer->questionJSId = $this->js_id; |
|
60 | - break; |
|
61 | - case MCMA: |
|
62 | - case GLOBAL_MULTIPLE_ANSWER: |
|
63 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
64 | - $this->answer->questionJSId = $this->js_id; |
|
65 | - break; |
|
66 | - case TF: |
|
67 | - $this->answer = new ScormAnswerTrueFalse($this->id); |
|
68 | - $this->answer->questionJSId = $this->js_id; |
|
69 | - break; |
|
70 | - case FIB: |
|
71 | - $this->answer = new ScormAnswerFillInBlanks($this->id); |
|
72 | - $this->answer->questionJSId = $this->js_id; |
|
73 | - break; |
|
74 | - case MATCHING: |
|
75 | - case MATCHING_DRAGGABLE: |
|
76 | - case DRAGGABLE: |
|
77 | - $this->answer = new ScormAnswerMatching($this->id); |
|
78 | - $this->answer->questionJSId = $this->js_id; |
|
79 | - break; |
|
80 | - case ORAL_EXPRESSION: |
|
81 | - case FREE_ANSWER: |
|
82 | - $this->answer = new ScormAnswerFree($this->id); |
|
83 | - $this->answer->questionJSId = $this->js_id; |
|
84 | - break; |
|
85 | - case HOT_SPOT: |
|
86 | - $this->answer = new ScormAnswerHotspot($this->id); |
|
87 | - $this->answer->questionJSId = $this->js_id; |
|
88 | - break; |
|
89 | - case MULTIPLE_ANSWER_COMBINATION: |
|
90 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
91 | - $this->answer->questionJSId = $this->js_id; |
|
92 | - break; |
|
93 | - case HOT_SPOT_ORDER: |
|
94 | - $this->answer = new ScormAnswerHotspot($this->id); |
|
95 | - $this->answer->questionJSId = $this->js_id; |
|
96 | - break; |
|
97 | - case HOT_SPOT_DELINEATION: |
|
98 | - $this->answer = new ScormAnswerHotspot($this->id); |
|
99 | - $this->answer->questionJSId = $this->js_id; |
|
100 | - break; |
|
101 | - default: |
|
102 | - $this->answer = new stdClass(); |
|
103 | - $this->answer->questionJSId = $this->js_id; |
|
104 | - break; |
|
105 | - } |
|
106 | - |
|
107 | - return true; |
|
108 | - } |
|
109 | - |
|
110 | - function export() |
|
111 | - { |
|
112 | - $html = $this->getQuestionHTML(); |
|
113 | - $js = $this->getQuestionJS(); |
|
114 | - |
|
115 | - if (is_object($this->answer)) { |
|
116 | - list($js2, $html2) = $this->answer->export(); |
|
117 | - $js .= $js2; |
|
118 | - $html .= $html2; |
|
119 | - } |
|
120 | - |
|
121 | - return array($js,$html); |
|
122 | - } |
|
123 | - |
|
124 | - function createAnswersForm($form) |
|
125 | - { |
|
126 | - return true; |
|
127 | - } |
|
128 | - |
|
129 | - function processAnswersCreation($form) |
|
130 | - { |
|
131 | - return true; |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * Returns an HTML-formatted question |
|
136 | - */ |
|
137 | - function getQuestionHTML() |
|
138 | - { |
|
139 | - $title = $this->selectTitle(); |
|
140 | - $description = $this->selectDescription(); |
|
141 | - $cols = 2; |
|
142 | - $s='<tr>' . |
|
143 | - '<td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;">' . "\n" . |
|
144 | - $title. |
|
145 | - '</td>' . "\n" . |
|
146 | - '</tr>' . "\n" . |
|
147 | - '<tr>' . "\n" . |
|
148 | - '<td valign="top" colspan="'.$cols.'">' . "\n" . |
|
149 | - '<i>'.$description.'</i>' . "\n" . |
|
150 | - '</td>' . "\n" . |
|
151 | - '</tr>' . "\n"; |
|
152 | - return $s; |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Return the JavaScript code bound to the question |
|
157 | - */ |
|
158 | - function getQuestionJS() |
|
159 | - { |
|
160 | - //$id = $this->id; |
|
161 | - $w = $this->selectWeighting(); |
|
162 | - $s = 'questions.push('.$this->js_id.');'."\n"; |
|
163 | - if($this->type == FREE_ANSWER or $this->type == HOT_SPOT) |
|
164 | - { //put the max score to 0 to avoid discounting the points of |
|
165 | - //non-exported quiz types in the SCORM |
|
166 | - $w=0; |
|
167 | - } |
|
168 | - $s .= 'questions_score_max['.$this->js_id.'] = '.$w.";\n"; |
|
169 | - return $s; |
|
170 | - } |
|
21 | + /** |
|
22 | + * Returns the HTML + JS flow corresponding to one question |
|
23 | + * |
|
24 | + * @param int The question ID |
|
25 | + * @param bool standalone (ie including XML tag, DTD declaration, etc) |
|
26 | + * @param int The JavaScript ID for this question. |
|
27 | + * Due to the nature of interactions, we must have a natural sequence for |
|
28 | + * questions in the generated JavaScript. |
|
29 | + * @param integer $js_id |
|
30 | + */ |
|
31 | + public static function export_question($questionId, $standalone = true, $js_id) |
|
32 | + { |
|
33 | + $question = new ScormQuestion(); |
|
34 | + $qst = $question->read($questionId); |
|
35 | + if (!$qst) { |
|
36 | + return ''; |
|
37 | + } |
|
38 | + $question->id = $qst->id; |
|
39 | + $question->js_id = $js_id; |
|
40 | + $question->type = $qst->type; |
|
41 | + $question->question = $qst->question; |
|
42 | + $question->description = $qst->description; |
|
43 | + $question->weighting=$qst->weighting; |
|
44 | + $question->position=$qst->position; |
|
45 | + $question->picture=$qst->picture; |
|
46 | + $assessmentItem = new ScormAssessmentItem($question, $standalone); |
|
47 | + //echo "<pre>".print_r($scorm,1)."</pre>";exit; |
|
48 | + return $assessmentItem->export(); |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Include the correct answer class and create answer |
|
53 | + */ |
|
54 | + public function setAnswer() |
|
55 | + { |
|
56 | + switch ($this->type) { |
|
57 | + case MCUA: |
|
58 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
59 | + $this->answer->questionJSId = $this->js_id; |
|
60 | + break; |
|
61 | + case MCMA: |
|
62 | + case GLOBAL_MULTIPLE_ANSWER: |
|
63 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
64 | + $this->answer->questionJSId = $this->js_id; |
|
65 | + break; |
|
66 | + case TF: |
|
67 | + $this->answer = new ScormAnswerTrueFalse($this->id); |
|
68 | + $this->answer->questionJSId = $this->js_id; |
|
69 | + break; |
|
70 | + case FIB: |
|
71 | + $this->answer = new ScormAnswerFillInBlanks($this->id); |
|
72 | + $this->answer->questionJSId = $this->js_id; |
|
73 | + break; |
|
74 | + case MATCHING: |
|
75 | + case MATCHING_DRAGGABLE: |
|
76 | + case DRAGGABLE: |
|
77 | + $this->answer = new ScormAnswerMatching($this->id); |
|
78 | + $this->answer->questionJSId = $this->js_id; |
|
79 | + break; |
|
80 | + case ORAL_EXPRESSION: |
|
81 | + case FREE_ANSWER: |
|
82 | + $this->answer = new ScormAnswerFree($this->id); |
|
83 | + $this->answer->questionJSId = $this->js_id; |
|
84 | + break; |
|
85 | + case HOT_SPOT: |
|
86 | + $this->answer = new ScormAnswerHotspot($this->id); |
|
87 | + $this->answer->questionJSId = $this->js_id; |
|
88 | + break; |
|
89 | + case MULTIPLE_ANSWER_COMBINATION: |
|
90 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
91 | + $this->answer->questionJSId = $this->js_id; |
|
92 | + break; |
|
93 | + case HOT_SPOT_ORDER: |
|
94 | + $this->answer = new ScormAnswerHotspot($this->id); |
|
95 | + $this->answer->questionJSId = $this->js_id; |
|
96 | + break; |
|
97 | + case HOT_SPOT_DELINEATION: |
|
98 | + $this->answer = new ScormAnswerHotspot($this->id); |
|
99 | + $this->answer->questionJSId = $this->js_id; |
|
100 | + break; |
|
101 | + default: |
|
102 | + $this->answer = new stdClass(); |
|
103 | + $this->answer->questionJSId = $this->js_id; |
|
104 | + break; |
|
105 | + } |
|
106 | + |
|
107 | + return true; |
|
108 | + } |
|
109 | + |
|
110 | + function export() |
|
111 | + { |
|
112 | + $html = $this->getQuestionHTML(); |
|
113 | + $js = $this->getQuestionJS(); |
|
114 | + |
|
115 | + if (is_object($this->answer)) { |
|
116 | + list($js2, $html2) = $this->answer->export(); |
|
117 | + $js .= $js2; |
|
118 | + $html .= $html2; |
|
119 | + } |
|
120 | + |
|
121 | + return array($js,$html); |
|
122 | + } |
|
123 | + |
|
124 | + function createAnswersForm($form) |
|
125 | + { |
|
126 | + return true; |
|
127 | + } |
|
128 | + |
|
129 | + function processAnswersCreation($form) |
|
130 | + { |
|
131 | + return true; |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * Returns an HTML-formatted question |
|
136 | + */ |
|
137 | + function getQuestionHTML() |
|
138 | + { |
|
139 | + $title = $this->selectTitle(); |
|
140 | + $description = $this->selectDescription(); |
|
141 | + $cols = 2; |
|
142 | + $s='<tr>' . |
|
143 | + '<td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;">' . "\n" . |
|
144 | + $title. |
|
145 | + '</td>' . "\n" . |
|
146 | + '</tr>' . "\n" . |
|
147 | + '<tr>' . "\n" . |
|
148 | + '<td valign="top" colspan="'.$cols.'">' . "\n" . |
|
149 | + '<i>'.$description.'</i>' . "\n" . |
|
150 | + '</td>' . "\n" . |
|
151 | + '</tr>' . "\n"; |
|
152 | + return $s; |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Return the JavaScript code bound to the question |
|
157 | + */ |
|
158 | + function getQuestionJS() |
|
159 | + { |
|
160 | + //$id = $this->id; |
|
161 | + $w = $this->selectWeighting(); |
|
162 | + $s = 'questions.push('.$this->js_id.');'."\n"; |
|
163 | + if($this->type == FREE_ANSWER or $this->type == HOT_SPOT) |
|
164 | + { //put the max score to 0 to avoid discounting the points of |
|
165 | + //non-exported quiz types in the SCORM |
|
166 | + $w=0; |
|
167 | + } |
|
168 | + $s .= 'questions_score_max['.$this->js_id.'] = '.$w.";\n"; |
|
169 | + return $s; |
|
170 | + } |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -177,110 +177,110 @@ discard block |
||
177 | 177 | */ |
178 | 178 | class ScormAnswerMultipleChoice extends Answer |
179 | 179 | { |
180 | - /** |
|
181 | - * Return HTML code for possible answers |
|
182 | - */ |
|
183 | - function export() |
|
184 | - { |
|
185 | - $html = ''; |
|
186 | - $js = ''; |
|
187 | - $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
188 | - $type = $this->getQuestionType(); |
|
189 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
190 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
191 | - |
|
192 | - //not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM |
|
193 | - //if ($type == MCMA || $type == MULTIPLE_ANSWER_COMBINATION ) { |
|
194 | - if ($type == MCMA ) { |
|
195 | - //$questionTypeLang = get_lang('MultipleChoiceMultipleAnswers'); |
|
196 | - $id = 1; |
|
197 | - $jstmp = ''; |
|
198 | - $jstmpc = ''; |
|
199 | - foreach( $this->answer as $i => $answer ) |
|
200 | - { |
|
201 | - $identifier = 'question_'.$this->questionJSId.'_multiple_'.$i; |
|
202 | - $html .= |
|
203 | - '<tr>' . "\n" |
|
204 | - . '<td align="center" width="5%">' . "\n" |
|
205 | - . '<input name="'.$identifier.'" id="'.$identifier.'" value="'.$i.'" type="checkbox" />' . "\n" |
|
206 | - . '</td>' . "\n" |
|
207 | - . '<td width="95%">' . "\n" |
|
208 | - . '<label for="'.$identifier.'">' . $this->answer[$i] . '</label>' . "\n" |
|
209 | - . '</td>' . "\n" |
|
210 | - . '</tr>' . "\n\n"; |
|
211 | - $jstmp .= $i.','; |
|
212 | - if($this->correct[$i]) |
|
213 | - { |
|
214 | - $jstmpc .= $i.','; |
|
215 | - } |
|
216 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";\n"; |
|
217 | - $id++; |
|
218 | - } |
|
219 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
220 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n"; |
|
221 | - if ($type == MCMA) { |
|
222 | - $js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n"; |
|
223 | - } else { |
|
224 | - $js .= 'questions_types['.$this->questionJSId.'] = \'exact\';'."\n"; |
|
225 | - } |
|
226 | - $js .= $jstmpw; |
|
227 | - } elseif ($type == MULTIPLE_ANSWER_COMBINATION) { |
|
228 | - //To this items we show the ThisItemIsNotExportable |
|
229 | - $qId = $this->questionJSId; |
|
230 | - $js = ''; |
|
231 | - $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
232 | - // some javascript must be added for that kind of questions |
|
233 | - $html .= '<tr>' . "\n" |
|
234 | - . '<td>' . "\n" |
|
235 | - . '<textarea name="question_'.$qId.'_free" id="question_'.$qId.'_exact" rows="20" cols="100"></textarea>' . "\n" |
|
236 | - . '</td>' . "\n" |
|
237 | - . '</tr>' . "\n"; |
|
238 | - $html .= '</table></td></tr>' . "\n"; |
|
239 | - // currently the exact answers cannot be displayed, so ignore the textarea |
|
240 | - $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
241 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
242 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
243 | - $js .= 'questions_types['.$this->questionJSId.'] = \'exact\';'."\n"; |
|
244 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
245 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
246 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
247 | - $js .= $jstmpw; |
|
248 | - return array($js,$html); |
|
249 | - } else { |
|
250 | - //$questionTypeLang = get_lang('MultipleChoiceUniqueAnswer'); |
|
251 | - $id = 1; |
|
252 | - $jstmp = ''; |
|
253 | - $jstmpc = ''; |
|
254 | - foreach( $this->answer as $i => $answer ) |
|
255 | - { |
|
256 | - $identifier = 'question_'.$this->questionJSId.'_unique_'.$i; |
|
257 | - $identifier_name = 'question_'.$this->questionJSId.'_unique_answer'; |
|
258 | - $html .= |
|
259 | - '<tr>' . "\n" |
|
260 | - . '<td align="center" width="5%">' . "\n" |
|
261 | - . '<input name="'.$identifier_name.'" id="'.$identifier.'" value="'.$i.'" type="radio"/>' . "\n" |
|
262 | - . '</td>' . "\n" |
|
263 | - . '<td width="95%">' . "\n" |
|
264 | - . '<label for="'.$identifier.'">' . $this->answer[$i] . '</label>' . "\n" |
|
265 | - . '</td>' . "\n" |
|
266 | - . '</tr>' . "\n\n"; |
|
267 | - $jstmp .= $i.','; |
|
268 | - if($this->correct[$i]) |
|
269 | - { |
|
270 | - $jstmpc .= $i; |
|
271 | - } |
|
272 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";\n"; |
|
273 | - $id++; |
|
274 | - } |
|
275 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
276 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = '.$jstmpc.';'."\n"; |
|
277 | - $js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';'."\n"; |
|
278 | - $js .= $jstmpw; |
|
279 | - } |
|
280 | - $html .= '</table></td></tr>' . "\n"; |
|
281 | - |
|
282 | - return array($js,$html); |
|
283 | - } |
|
180 | + /** |
|
181 | + * Return HTML code for possible answers |
|
182 | + */ |
|
183 | + function export() |
|
184 | + { |
|
185 | + $html = ''; |
|
186 | + $js = ''; |
|
187 | + $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
188 | + $type = $this->getQuestionType(); |
|
189 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
190 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
191 | + |
|
192 | + //not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM |
|
193 | + //if ($type == MCMA || $type == MULTIPLE_ANSWER_COMBINATION ) { |
|
194 | + if ($type == MCMA ) { |
|
195 | + //$questionTypeLang = get_lang('MultipleChoiceMultipleAnswers'); |
|
196 | + $id = 1; |
|
197 | + $jstmp = ''; |
|
198 | + $jstmpc = ''; |
|
199 | + foreach( $this->answer as $i => $answer ) |
|
200 | + { |
|
201 | + $identifier = 'question_'.$this->questionJSId.'_multiple_'.$i; |
|
202 | + $html .= |
|
203 | + '<tr>' . "\n" |
|
204 | + . '<td align="center" width="5%">' . "\n" |
|
205 | + . '<input name="'.$identifier.'" id="'.$identifier.'" value="'.$i.'" type="checkbox" />' . "\n" |
|
206 | + . '</td>' . "\n" |
|
207 | + . '<td width="95%">' . "\n" |
|
208 | + . '<label for="'.$identifier.'">' . $this->answer[$i] . '</label>' . "\n" |
|
209 | + . '</td>' . "\n" |
|
210 | + . '</tr>' . "\n\n"; |
|
211 | + $jstmp .= $i.','; |
|
212 | + if($this->correct[$i]) |
|
213 | + { |
|
214 | + $jstmpc .= $i.','; |
|
215 | + } |
|
216 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";\n"; |
|
217 | + $id++; |
|
218 | + } |
|
219 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
220 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n"; |
|
221 | + if ($type == MCMA) { |
|
222 | + $js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n"; |
|
223 | + } else { |
|
224 | + $js .= 'questions_types['.$this->questionJSId.'] = \'exact\';'."\n"; |
|
225 | + } |
|
226 | + $js .= $jstmpw; |
|
227 | + } elseif ($type == MULTIPLE_ANSWER_COMBINATION) { |
|
228 | + //To this items we show the ThisItemIsNotExportable |
|
229 | + $qId = $this->questionJSId; |
|
230 | + $js = ''; |
|
231 | + $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
232 | + // some javascript must be added for that kind of questions |
|
233 | + $html .= '<tr>' . "\n" |
|
234 | + . '<td>' . "\n" |
|
235 | + . '<textarea name="question_'.$qId.'_free" id="question_'.$qId.'_exact" rows="20" cols="100"></textarea>' . "\n" |
|
236 | + . '</td>' . "\n" |
|
237 | + . '</tr>' . "\n"; |
|
238 | + $html .= '</table></td></tr>' . "\n"; |
|
239 | + // currently the exact answers cannot be displayed, so ignore the textarea |
|
240 | + $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
241 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
242 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
243 | + $js .= 'questions_types['.$this->questionJSId.'] = \'exact\';'."\n"; |
|
244 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
245 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
246 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
247 | + $js .= $jstmpw; |
|
248 | + return array($js,$html); |
|
249 | + } else { |
|
250 | + //$questionTypeLang = get_lang('MultipleChoiceUniqueAnswer'); |
|
251 | + $id = 1; |
|
252 | + $jstmp = ''; |
|
253 | + $jstmpc = ''; |
|
254 | + foreach( $this->answer as $i => $answer ) |
|
255 | + { |
|
256 | + $identifier = 'question_'.$this->questionJSId.'_unique_'.$i; |
|
257 | + $identifier_name = 'question_'.$this->questionJSId.'_unique_answer'; |
|
258 | + $html .= |
|
259 | + '<tr>' . "\n" |
|
260 | + . '<td align="center" width="5%">' . "\n" |
|
261 | + . '<input name="'.$identifier_name.'" id="'.$identifier.'" value="'.$i.'" type="radio"/>' . "\n" |
|
262 | + . '</td>' . "\n" |
|
263 | + . '<td width="95%">' . "\n" |
|
264 | + . '<label for="'.$identifier.'">' . $this->answer[$i] . '</label>' . "\n" |
|
265 | + . '</td>' . "\n" |
|
266 | + . '</tr>' . "\n\n"; |
|
267 | + $jstmp .= $i.','; |
|
268 | + if($this->correct[$i]) |
|
269 | + { |
|
270 | + $jstmpc .= $i; |
|
271 | + } |
|
272 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";\n"; |
|
273 | + $id++; |
|
274 | + } |
|
275 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
276 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = '.$jstmpc.';'."\n"; |
|
277 | + $js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';'."\n"; |
|
278 | + $js .= $jstmpw; |
|
279 | + } |
|
280 | + $html .= '</table></td></tr>' . "\n"; |
|
281 | + |
|
282 | + return array($js,$html); |
|
283 | + } |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,54 +289,54 @@ discard block |
||
289 | 289 | */ |
290 | 290 | class ScormAnswerTrueFalse extends Answer |
291 | 291 | { |
292 | - /** |
|
293 | - * Return the XML flow for the possible answers. |
|
294 | - * That's one <response_lid>, containing several <flow_label> |
|
295 | - * |
|
296 | - * @author Amand Tihon <[email protected]> |
|
297 | - */ |
|
298 | - function export() |
|
299 | - { |
|
300 | - $js = ''; |
|
301 | - $html = '<tr><td colspan="2"><table width="100%">'; |
|
302 | - $identifier = 'question_'.$this->questionJSId.'_tf'; |
|
303 | - $identifier_true = $identifier.'_true'; |
|
304 | - $identifier_false = $identifier.'_false'; |
|
305 | - $html .= |
|
306 | - '<tr>' . "\n" |
|
307 | - . '<td align="center" width="5%">' . "\n" |
|
308 | - . '<input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" ' |
|
309 | - . '/>' . "\n" |
|
310 | - . '</td>' . "\n" |
|
311 | - . '<td width="95%">' . "\n" |
|
312 | - . '<label for="'.$identifier_true.'">' . get_lang('True') . '</label>' . "\n" |
|
313 | - . '</td>' . "\n" |
|
314 | - . '</tr>' . "\n\n"; |
|
315 | - $html .= |
|
316 | - '<tr>' . "\n" |
|
317 | - . '<td align="center" width="5%">' . "\n" |
|
318 | - . '<input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" ' |
|
319 | - . '/>' . "\n" |
|
320 | - . '</td>' . "\n" |
|
321 | - . '<td width="95%">' . "\n" |
|
322 | - . '<label for="'.$identifier_false.'">' . get_lang('False') . '</label>' . "\n" |
|
323 | - . '</td>' . "\n" |
|
324 | - . '</tr>' . "\n\n"; |
|
325 | - $html .= '</table></td></tr>' . "\n"; |
|
326 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n"; |
|
327 | - $js .= 'questions_types['.$this->questionJSId.'] = \'tf\';'."\n"; |
|
328 | - if ($this->response == 'TRUE') { |
|
329 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n"; |
|
330 | - } else { |
|
331 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n"; |
|
332 | - } |
|
333 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
334 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
335 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = '.$this->weighting[1].";\n"; |
|
336 | - $js .= $jstmpw; |
|
337 | - |
|
338 | - return array($js,$html); |
|
339 | - } |
|
292 | + /** |
|
293 | + * Return the XML flow for the possible answers. |
|
294 | + * That's one <response_lid>, containing several <flow_label> |
|
295 | + * |
|
296 | + * @author Amand Tihon <[email protected]> |
|
297 | + */ |
|
298 | + function export() |
|
299 | + { |
|
300 | + $js = ''; |
|
301 | + $html = '<tr><td colspan="2"><table width="100%">'; |
|
302 | + $identifier = 'question_'.$this->questionJSId.'_tf'; |
|
303 | + $identifier_true = $identifier.'_true'; |
|
304 | + $identifier_false = $identifier.'_false'; |
|
305 | + $html .= |
|
306 | + '<tr>' . "\n" |
|
307 | + . '<td align="center" width="5%">' . "\n" |
|
308 | + . '<input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" ' |
|
309 | + . '/>' . "\n" |
|
310 | + . '</td>' . "\n" |
|
311 | + . '<td width="95%">' . "\n" |
|
312 | + . '<label for="'.$identifier_true.'">' . get_lang('True') . '</label>' . "\n" |
|
313 | + . '</td>' . "\n" |
|
314 | + . '</tr>' . "\n\n"; |
|
315 | + $html .= |
|
316 | + '<tr>' . "\n" |
|
317 | + . '<td align="center" width="5%">' . "\n" |
|
318 | + . '<input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" ' |
|
319 | + . '/>' . "\n" |
|
320 | + . '</td>' . "\n" |
|
321 | + . '<td width="95%">' . "\n" |
|
322 | + . '<label for="'.$identifier_false.'">' . get_lang('False') . '</label>' . "\n" |
|
323 | + . '</td>' . "\n" |
|
324 | + . '</tr>' . "\n\n"; |
|
325 | + $html .= '</table></td></tr>' . "\n"; |
|
326 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n"; |
|
327 | + $js .= 'questions_types['.$this->questionJSId.'] = \'tf\';'."\n"; |
|
328 | + if ($this->response == 'TRUE') { |
|
329 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n"; |
|
330 | + } else { |
|
331 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n"; |
|
332 | + } |
|
333 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
334 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
335 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = '.$this->weighting[1].";\n"; |
|
336 | + $js .= $jstmpw; |
|
337 | + |
|
338 | + return array($js,$html); |
|
339 | + } |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | /** |
@@ -345,68 +345,68 @@ discard block |
||
345 | 345 | */ |
346 | 346 | class ScormAnswerFillInBlanks extends Answer |
347 | 347 | { |
348 | - /** |
|
349 | - * Export the text with missing words. |
|
350 | - * |
|
351 | - * As a side effect, it stores two lists in the class : |
|
352 | - * the missing words and their respective weightings. |
|
353 | - */ |
|
354 | - function export() |
|
355 | - { |
|
356 | - global $charset; |
|
357 | - $js = ''; |
|
358 | - $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
359 | - // get all enclosed answers |
|
360 | - $blankList = array(); |
|
361 | - // build replacement |
|
362 | - $replacementList = array(); |
|
363 | - foreach ($this->answer as $i => $answer) { |
|
364 | - $blankList[] = '['.$answer.']'; |
|
365 | - } |
|
366 | - $answerCount = count($blankList); |
|
367 | - |
|
368 | - // splits text and weightings that are joined with the character '::' |
|
369 | - list($answer,$weight)=explode('::',$answer); |
|
370 | - $weights = explode(',',$weight); |
|
371 | - // because [] is parsed here we follow this procedure: |
|
372 | - // 1. find everything between the [ and ] tags |
|
373 | - $i=1; |
|
374 | - $jstmp = ''; |
|
375 | - $jstmpc = ''; |
|
376 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
377 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
378 | - $startlocations=api_strpos($answer,'['); |
|
379 | - $endlocations=api_strpos($answer,']'); |
|
380 | - while($startlocations !== false && $endlocations !== false) { |
|
381 | - $texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1); |
|
382 | - $answer = api_substr_replace($answer,'<input type="text" name="question_'.$this->questionJSId.'_fib_'.$i.'" id="question_'.$this->questionJSId.'_fib_'.$i.'" size="10" value="" />',$startlocations,($endlocations-$startlocations)+1); |
|
383 | - $jstmp .= $i.','; |
|
384 | - $jstmpc .= "'".api_htmlentities(api_substr($texstring,1,-1),ENT_QUOTES,$charset)."',"; |
|
385 | - $my_weight=explode('@',$weights[$i-1]); |
|
386 | - if (count($my_weight)==2) { |
|
387 | - $weight_db=$my_weight[0]; |
|
388 | - } else { |
|
389 | - $weight_db=$my_weight[0]; |
|
390 | - } |
|
391 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$weight_db.";\n"; |
|
392 | - $i++; |
|
393 | - $startlocations = api_strpos($answer, '['); |
|
394 | - $endlocations = api_strpos($answer, ']'); |
|
395 | - } |
|
396 | - |
|
397 | - $html .= '<tr>' . "\n" |
|
398 | - . '<td>' . "\n" |
|
399 | - . $answer . "\n" |
|
400 | - . '</td>' . "\n" |
|
401 | - . '</tr>' . "\n"; |
|
402 | - $html .= '</table></td></tr>' . "\n"; |
|
403 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n"; |
|
404 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n"; |
|
405 | - $js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n"; |
|
406 | - $js .= $jstmpw; |
|
407 | - |
|
408 | - return array($js,$html); |
|
409 | - } |
|
348 | + /** |
|
349 | + * Export the text with missing words. |
|
350 | + * |
|
351 | + * As a side effect, it stores two lists in the class : |
|
352 | + * the missing words and their respective weightings. |
|
353 | + */ |
|
354 | + function export() |
|
355 | + { |
|
356 | + global $charset; |
|
357 | + $js = ''; |
|
358 | + $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
359 | + // get all enclosed answers |
|
360 | + $blankList = array(); |
|
361 | + // build replacement |
|
362 | + $replacementList = array(); |
|
363 | + foreach ($this->answer as $i => $answer) { |
|
364 | + $blankList[] = '['.$answer.']'; |
|
365 | + } |
|
366 | + $answerCount = count($blankList); |
|
367 | + |
|
368 | + // splits text and weightings that are joined with the character '::' |
|
369 | + list($answer,$weight)=explode('::',$answer); |
|
370 | + $weights = explode(',',$weight); |
|
371 | + // because [] is parsed here we follow this procedure: |
|
372 | + // 1. find everything between the [ and ] tags |
|
373 | + $i=1; |
|
374 | + $jstmp = ''; |
|
375 | + $jstmpc = ''; |
|
376 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
377 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
378 | + $startlocations=api_strpos($answer,'['); |
|
379 | + $endlocations=api_strpos($answer,']'); |
|
380 | + while($startlocations !== false && $endlocations !== false) { |
|
381 | + $texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1); |
|
382 | + $answer = api_substr_replace($answer,'<input type="text" name="question_'.$this->questionJSId.'_fib_'.$i.'" id="question_'.$this->questionJSId.'_fib_'.$i.'" size="10" value="" />',$startlocations,($endlocations-$startlocations)+1); |
|
383 | + $jstmp .= $i.','; |
|
384 | + $jstmpc .= "'".api_htmlentities(api_substr($texstring,1,-1),ENT_QUOTES,$charset)."',"; |
|
385 | + $my_weight=explode('@',$weights[$i-1]); |
|
386 | + if (count($my_weight)==2) { |
|
387 | + $weight_db=$my_weight[0]; |
|
388 | + } else { |
|
389 | + $weight_db=$my_weight[0]; |
|
390 | + } |
|
391 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$weight_db.";\n"; |
|
392 | + $i++; |
|
393 | + $startlocations = api_strpos($answer, '['); |
|
394 | + $endlocations = api_strpos($answer, ']'); |
|
395 | + } |
|
396 | + |
|
397 | + $html .= '<tr>' . "\n" |
|
398 | + . '<td>' . "\n" |
|
399 | + . $answer . "\n" |
|
400 | + . '</td>' . "\n" |
|
401 | + . '</tr>' . "\n"; |
|
402 | + $html .= '</table></td></tr>' . "\n"; |
|
403 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n"; |
|
404 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n"; |
|
405 | + $js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n"; |
|
406 | + $js .= $jstmpw; |
|
407 | + |
|
408 | + return array($js,$html); |
|
409 | + } |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -415,99 +415,99 @@ discard block |
||
415 | 415 | */ |
416 | 416 | class ScormAnswerMatching extends Answer |
417 | 417 | { |
418 | - /** |
|
419 | - * Export the question part as a matrix-choice, with only one possible answer per line. |
|
420 | - * @author Amand Tihon <[email protected]> |
|
421 | - */ |
|
422 | - function export() |
|
423 | - { |
|
424 | - $js = ''; |
|
425 | - $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
426 | - // prepare list of right proposition to allow |
|
427 | - // - easiest display |
|
428 | - // - easiest randomisation if needed one day |
|
429 | - // (here I use array_values to change array keys from $code1 $code2 ... to 0 1 ...) |
|
430 | - |
|
431 | - // get max length of displayed array |
|
432 | - |
|
433 | - $nbrAnswers = $this->selectNbrAnswers(); |
|
434 | - $cpt1='A'; |
|
435 | - $cpt2=1; |
|
436 | - $Select = array(); |
|
437 | - $qId = $this->questionJSId; |
|
438 | - $s = ''; |
|
439 | - $jstmp = ''; |
|
440 | - $jstmpc = ''; |
|
441 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
442 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
443 | - |
|
444 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
445 | - $identifier = 'question_'.$qId.'_matching_'; |
|
446 | - $answer=$this->selectAnswer($answerId); |
|
447 | - $answerCorrect=$this->isCorrect($answerId); |
|
448 | - $weight=$this->selectWeighting($answerId); |
|
449 | - $jstmp .= $answerId.','; |
|
450 | - |
|
451 | - if (!$answerCorrect) { |
|
452 | - // options (A, B, C, ...) that will be put into the list-box |
|
453 | - $Select[$answerId]['Lettre']=$cpt1; |
|
454 | - // answers that will be shown at the right side |
|
455 | - $Select[$answerId]['Reponse'] = $answer; |
|
456 | - $cpt1++; |
|
457 | - } else { |
|
458 | - $s.='<tr>'."\n"; |
|
459 | - $s.='<td width="40%" valign="top">'."\n".'<b>'.$cpt2.'</b>. '.$answer."\n</td>\n"; |
|
460 | - $s.='<td width="20%" align="center"> <select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">'; |
|
461 | - $s.=' <option value="0">--</option>'; |
|
462 | - // fills the list-box |
|
463 | - foreach($Select as $key=>$val) |
|
464 | - { |
|
465 | - $s.='<option value="'.$key.'">'.$val['Lettre'].'</option>'; |
|
466 | - } // end foreach() |
|
467 | - |
|
468 | - $s.='</select> </td>'."\n"; |
|
469 | - $s.='<td width="40%" valign="top">'; |
|
470 | - if(isset($Select[$cpt2])) $s.='<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
471 | - else $s.=' '; |
|
472 | - $s.="</td>\n</tr>\n"; |
|
473 | - |
|
474 | - $jstmpc .= '['.$answerCorrect.','.$cpt2.'],'; |
|
475 | - |
|
476 | - $my_weight=explode('@',$weight); |
|
477 | - if (count($my_weight)==2) { |
|
478 | - $weight=$my_weight[0]; |
|
479 | - } else { |
|
480 | - $weight=$my_weight[0]; |
|
481 | - } |
|
482 | - $jstmpw .= 'questions_answers_ponderation['.$qId.']['.$cpt2.'] = '.$weight.";\n"; |
|
483 | - $cpt2++; |
|
484 | - |
|
485 | - // if the left side of the "matching" has been completely shown |
|
486 | - if ($answerId == $nbrAnswers) { |
|
487 | - // if there remain answers to be shown on the right side |
|
488 | - while (isset($Select[$cpt2])) { |
|
489 | - //$s.='<tr>'."\n"; |
|
490 | - //$s.='<td colspan="2">'."\n"; |
|
491 | - //$s.='<table border="0" cellpadding="0" cellspacing="0" width="100%">'."\n"; |
|
492 | - $s.='<tr>'."\n"; |
|
493 | - $s.='<td width="60%" colspan="2"> </td>'."\n"; |
|
494 | - $s.='<td width="40%" valign="top">'; |
|
495 | - $s.='<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
496 | - $s.="</td>\n</tr>\n"; |
|
497 | - $cpt2++; |
|
498 | - } // end while() |
|
499 | - } // end if() |
|
500 | - } |
|
501 | - } |
|
502 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
503 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n"; |
|
504 | - $js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n"; |
|
505 | - $js .= $jstmpw; |
|
506 | - $html .= $s; |
|
507 | - $html .= '</table></td></tr>' . "\n"; |
|
508 | - |
|
509 | - return array($js,$html); |
|
510 | - } |
|
418 | + /** |
|
419 | + * Export the question part as a matrix-choice, with only one possible answer per line. |
|
420 | + * @author Amand Tihon <[email protected]> |
|
421 | + */ |
|
422 | + function export() |
|
423 | + { |
|
424 | + $js = ''; |
|
425 | + $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
426 | + // prepare list of right proposition to allow |
|
427 | + // - easiest display |
|
428 | + // - easiest randomisation if needed one day |
|
429 | + // (here I use array_values to change array keys from $code1 $code2 ... to 0 1 ...) |
|
430 | + |
|
431 | + // get max length of displayed array |
|
432 | + |
|
433 | + $nbrAnswers = $this->selectNbrAnswers(); |
|
434 | + $cpt1='A'; |
|
435 | + $cpt2=1; |
|
436 | + $Select = array(); |
|
437 | + $qId = $this->questionJSId; |
|
438 | + $s = ''; |
|
439 | + $jstmp = ''; |
|
440 | + $jstmpc = ''; |
|
441 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
442 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
443 | + |
|
444 | + for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
445 | + $identifier = 'question_'.$qId.'_matching_'; |
|
446 | + $answer=$this->selectAnswer($answerId); |
|
447 | + $answerCorrect=$this->isCorrect($answerId); |
|
448 | + $weight=$this->selectWeighting($answerId); |
|
449 | + $jstmp .= $answerId.','; |
|
450 | + |
|
451 | + if (!$answerCorrect) { |
|
452 | + // options (A, B, C, ...) that will be put into the list-box |
|
453 | + $Select[$answerId]['Lettre']=$cpt1; |
|
454 | + // answers that will be shown at the right side |
|
455 | + $Select[$answerId]['Reponse'] = $answer; |
|
456 | + $cpt1++; |
|
457 | + } else { |
|
458 | + $s.='<tr>'."\n"; |
|
459 | + $s.='<td width="40%" valign="top">'."\n".'<b>'.$cpt2.'</b>. '.$answer."\n</td>\n"; |
|
460 | + $s.='<td width="20%" align="center"> <select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">'; |
|
461 | + $s.=' <option value="0">--</option>'; |
|
462 | + // fills the list-box |
|
463 | + foreach($Select as $key=>$val) |
|
464 | + { |
|
465 | + $s.='<option value="'.$key.'">'.$val['Lettre'].'</option>'; |
|
466 | + } // end foreach() |
|
467 | + |
|
468 | + $s.='</select> </td>'."\n"; |
|
469 | + $s.='<td width="40%" valign="top">'; |
|
470 | + if(isset($Select[$cpt2])) $s.='<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
471 | + else $s.=' '; |
|
472 | + $s.="</td>\n</tr>\n"; |
|
473 | + |
|
474 | + $jstmpc .= '['.$answerCorrect.','.$cpt2.'],'; |
|
475 | + |
|
476 | + $my_weight=explode('@',$weight); |
|
477 | + if (count($my_weight)==2) { |
|
478 | + $weight=$my_weight[0]; |
|
479 | + } else { |
|
480 | + $weight=$my_weight[0]; |
|
481 | + } |
|
482 | + $jstmpw .= 'questions_answers_ponderation['.$qId.']['.$cpt2.'] = '.$weight.";\n"; |
|
483 | + $cpt2++; |
|
484 | + |
|
485 | + // if the left side of the "matching" has been completely shown |
|
486 | + if ($answerId == $nbrAnswers) { |
|
487 | + // if there remain answers to be shown on the right side |
|
488 | + while (isset($Select[$cpt2])) { |
|
489 | + //$s.='<tr>'."\n"; |
|
490 | + //$s.='<td colspan="2">'."\n"; |
|
491 | + //$s.='<table border="0" cellpadding="0" cellspacing="0" width="100%">'."\n"; |
|
492 | + $s.='<tr>'."\n"; |
|
493 | + $s.='<td width="60%" colspan="2"> </td>'."\n"; |
|
494 | + $s.='<td width="40%" valign="top">'; |
|
495 | + $s.='<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
496 | + $s.="</td>\n</tr>\n"; |
|
497 | + $cpt2++; |
|
498 | + } // end while() |
|
499 | + } // end if() |
|
500 | + } |
|
501 | + } |
|
502 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
503 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n"; |
|
504 | + $js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n"; |
|
505 | + $js .= $jstmpw; |
|
506 | + $html .= $s; |
|
507 | + $html .= '</table></td></tr>' . "\n"; |
|
508 | + |
|
509 | + return array($js,$html); |
|
510 | + } |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -516,36 +516,36 @@ discard block |
||
516 | 516 | */ |
517 | 517 | class ScormAnswerFree extends Answer |
518 | 518 | { |
519 | - /** |
|
520 | - * Export the text with missing words. |
|
521 | - * |
|
522 | - * As a side effect, it stores two lists in the class : |
|
523 | - * the missing words and their respective weightings. |
|
524 | - * |
|
525 | - */ |
|
526 | - function export() |
|
527 | - { |
|
528 | - //$qId = $this->questionJSId; |
|
529 | - $js = ''; |
|
530 | - /*$html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
519 | + /** |
|
520 | + * Export the text with missing words. |
|
521 | + * |
|
522 | + * As a side effect, it stores two lists in the class : |
|
523 | + * the missing words and their respective weightings. |
|
524 | + * |
|
525 | + */ |
|
526 | + function export() |
|
527 | + { |
|
528 | + //$qId = $this->questionJSId; |
|
529 | + $js = ''; |
|
530 | + /*$html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
531 | 531 | // some javascript must be added for that kind of questions |
532 | 532 | $html .= '<tr><td> |
533 | 533 | <textarea name="question_'.$qId.'_free" id="question_'.$qId.'_free" rows="20" cols="100"></textarea> |
534 | 534 | </td> |
535 | 535 | </tr>'; |
536 | 536 | $html .= '</table></td></tr>';*/ |
537 | - // currently the free answers cannot be displayed, so ignore the textarea |
|
538 | - $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
539 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
540 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
541 | - $js .= 'questions_types['.$this->questionJSId.'] = \'free\';'."\n"; |
|
542 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
543 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
544 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
545 | - $js .= $jstmpw; |
|
546 | - |
|
547 | - return array($js,$html); |
|
548 | - } |
|
537 | + // currently the free answers cannot be displayed, so ignore the textarea |
|
538 | + $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
539 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
540 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
541 | + $js .= 'questions_types['.$this->questionJSId.'] = \'free\';'."\n"; |
|
542 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
543 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
544 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
545 | + $js .= $jstmpw; |
|
546 | + |
|
547 | + return array($js,$html); |
|
548 | + } |
|
549 | 549 | } |
550 | 550 | /** |
551 | 551 | * This class handles the SCORM export of hotpot questions |
@@ -553,64 +553,64 @@ discard block |
||
553 | 553 | */ |
554 | 554 | class ScormAnswerHotspot extends Answer |
555 | 555 | { |
556 | - /** |
|
557 | - * Returns the javascript code that goes with HotSpot exercises |
|
558 | - * @return string The JavaScript code |
|
559 | - */ |
|
560 | - function get_js_header() |
|
561 | - { |
|
562 | - if ($this->standalone) { |
|
563 | - $header = '<script type="text/javascript" language="javascript">'; |
|
564 | - $header .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
565 | - $header .= '</script>'; |
|
566 | - //because this header closes so many times the <script> tag, we have to reopen our own |
|
567 | - $header .= '<script type="text/javascript" language="javascript">'."\n"; |
|
568 | - $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
569 | - $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
570 | - $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
571 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
572 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
573 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
574 | - $header .= $jstmpw; |
|
575 | - } else { |
|
576 | - $header = ''; |
|
577 | - $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
578 | - $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
579 | - $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
580 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
581 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
582 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'."\n"; |
|
583 | - $header .= $jstmpw; |
|
584 | - } |
|
585 | - |
|
586 | - return $header; |
|
587 | - } |
|
588 | - /** |
|
589 | - * Export the text with missing words. |
|
590 | - * |
|
591 | - * As a side effect, it stores two lists in the class : |
|
592 | - * the missing words and their respective weightings. |
|
593 | - * |
|
594 | - */ |
|
595 | - function export() |
|
596 | - { |
|
597 | - $js = $this->get_js_header(); |
|
598 | - $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
599 | - // some javascript must be added for that kind of questions |
|
600 | - $html .= ''; |
|
601 | - |
|
602 | - // Get the answers, make a list |
|
603 | - $nbrAnswers=$this->selectNbrAnswers(); |
|
604 | - |
|
605 | - $answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>'; |
|
606 | - for($answerId=1;$answerId <= $nbrAnswers;$answerId++) |
|
607 | - { |
|
608 | - $answer_list .= '<li>'.$this->selectAnswer($answerId).'</li>'; |
|
609 | - } |
|
610 | - $answer_list .= '</ol></div>'; |
|
611 | - $canClick = true; |
|
612 | - $relPath = api_get_path(REL_PATH); |
|
613 | - $html .= <<<HTML |
|
556 | + /** |
|
557 | + * Returns the javascript code that goes with HotSpot exercises |
|
558 | + * @return string The JavaScript code |
|
559 | + */ |
|
560 | + function get_js_header() |
|
561 | + { |
|
562 | + if ($this->standalone) { |
|
563 | + $header = '<script type="text/javascript" language="javascript">'; |
|
564 | + $header .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
565 | + $header .= '</script>'; |
|
566 | + //because this header closes so many times the <script> tag, we have to reopen our own |
|
567 | + $header .= '<script type="text/javascript" language="javascript">'."\n"; |
|
568 | + $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
569 | + $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
570 | + $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
571 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
572 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
573 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
574 | + $header .= $jstmpw; |
|
575 | + } else { |
|
576 | + $header = ''; |
|
577 | + $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
578 | + $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
579 | + $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
580 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
581 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
582 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'."\n"; |
|
583 | + $header .= $jstmpw; |
|
584 | + } |
|
585 | + |
|
586 | + return $header; |
|
587 | + } |
|
588 | + /** |
|
589 | + * Export the text with missing words. |
|
590 | + * |
|
591 | + * As a side effect, it stores two lists in the class : |
|
592 | + * the missing words and their respective weightings. |
|
593 | + * |
|
594 | + */ |
|
595 | + function export() |
|
596 | + { |
|
597 | + $js = $this->get_js_header(); |
|
598 | + $html = '<tr><td colspan="2"><table width="100%">' . "\n"; |
|
599 | + // some javascript must be added for that kind of questions |
|
600 | + $html .= ''; |
|
601 | + |
|
602 | + // Get the answers, make a list |
|
603 | + $nbrAnswers=$this->selectNbrAnswers(); |
|
604 | + |
|
605 | + $answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>'; |
|
606 | + for($answerId=1;$answerId <= $nbrAnswers;$answerId++) |
|
607 | + { |
|
608 | + $answer_list .= '<li>'.$this->selectAnswer($answerId).'</li>'; |
|
609 | + } |
|
610 | + $answer_list .= '</ol></div>'; |
|
611 | + $canClick = true; |
|
612 | + $relPath = api_get_path(REL_PATH); |
|
613 | + $html .= <<<HTML |
|
614 | 614 | <tr> |
615 | 615 | <td> |
616 | 616 | <div id="hotspot-{$this->questionJSId}"></div> |
@@ -630,12 +630,12 @@ discard block |
||
630 | 630 | </td> |
631 | 631 | <tr> |
632 | 632 | HTML; |
633 | - $html .= '</table></td></tr>' . "\n"; |
|
633 | + $html .= '</table></td></tr>' . "\n"; |
|
634 | 634 | |
635 | - // currently the free answers cannot be displayed, so ignore the textarea |
|
636 | - $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
637 | - return array($js,$html); |
|
638 | - } |
|
635 | + // currently the free answers cannot be displayed, so ignore the textarea |
|
636 | + $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
637 | + return array($js,$html); |
|
638 | + } |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | |
@@ -651,119 +651,119 @@ discard block |
||
651 | 651 | */ |
652 | 652 | class ScormAssessmentItem |
653 | 653 | { |
654 | - public $question; |
|
655 | - public $question_ident; |
|
656 | - public $answer; |
|
657 | - public $standalone; |
|
658 | - |
|
659 | - /** |
|
660 | - * Constructor. |
|
661 | - * |
|
662 | - * @param ScormQuestion $question The Question object we want to export. |
|
663 | - */ |
|
664 | - public function __construct($question, $standalone = false) |
|
665 | - { |
|
666 | - $this->question = $question; |
|
667 | - $this->question->setAnswer(); |
|
668 | - $this->questionIdent = "QST_" . $question->id ; |
|
669 | - $this->standalone = $standalone; |
|
670 | - } |
|
671 | - |
|
672 | - /** |
|
673 | - * Start the XML flow. |
|
674 | - * |
|
675 | - * This opens the <item> block, with correct attributes. |
|
676 | - * |
|
677 | - */ |
|
678 | - function start_page() |
|
679 | - { |
|
680 | - global $charset; |
|
681 | - $head = ""; |
|
682 | - if( $this->standalone) |
|
683 | - { |
|
684 | - $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?>' . "\n"; |
|
685 | - $head .= '<html>'."\n"; |
|
686 | - } |
|
687 | - return $head; |
|
688 | - } |
|
689 | - |
|
690 | - /** |
|
691 | - * End the XML flow, closing the </item> tag. |
|
692 | - * |
|
693 | - */ |
|
694 | - function end_page() { |
|
695 | - if ($this->standalone) { |
|
696 | - return '</html>'; |
|
697 | - } |
|
698 | - |
|
699 | - return ''; |
|
700 | - } |
|
701 | - |
|
702 | - /** |
|
703 | - * Start document header |
|
704 | - */ |
|
705 | - function start_header() |
|
706 | - { |
|
707 | - if ($this->standalone) { |
|
708 | - return '<head>'."\n"; |
|
709 | - } |
|
710 | - |
|
711 | - return ''; |
|
712 | - } |
|
713 | - |
|
714 | - /** |
|
715 | - * Print CSS inclusion |
|
716 | - */ |
|
717 | - function css() |
|
718 | - { |
|
719 | - $css = ''; |
|
720 | - if ($this->standalone) { |
|
721 | - $css = '<style type="text/css" media="screen, projection">'."\n"; |
|
722 | - $css .= '/*<![CDATA[*/'."\n"; |
|
723 | - $css .= '/*]]>*/'."\n"; |
|
724 | - $css .= '</style>'."\n"; |
|
725 | - $css .= '<style type="text/css" media="print">'."\n"; |
|
726 | - $css .= '/*<![CDATA[*/'."\n"; |
|
727 | - $css .= '/*]]>*/'."\n"; |
|
728 | - $css .= '</style>'."\n"; |
|
729 | - } |
|
730 | - return $css; |
|
731 | - } |
|
732 | - |
|
733 | - /** |
|
734 | - * End document header |
|
735 | - */ |
|
736 | - function end_header() |
|
737 | - { |
|
738 | - if ($this->standalone) { |
|
739 | - return '</head>'."\n"; |
|
740 | - } |
|
741 | - |
|
742 | - return ''; |
|
743 | - } |
|
744 | - /** |
|
745 | - * Start the itemBody |
|
746 | - * |
|
747 | - */ |
|
748 | - function start_js() |
|
749 | - { |
|
750 | - if ($this->standalone) { |
|
751 | - return '<script type="text/javascript" language="javascript">'."\n"; |
|
752 | - } |
|
753 | - return ''; |
|
754 | - } |
|
755 | - /** |
|
756 | - * Common JS functions |
|
757 | - */ |
|
758 | - function common_js() |
|
759 | - { |
|
760 | - $js = file_get_contents('../lp/js/api_wrapper.js'); |
|
761 | - $js .= 'var questions = new Array();' . "\n"; |
|
762 | - $js .= 'var questions_answers = new Array();' . "\n"; |
|
763 | - $js .= 'var questions_answers_correct = new Array();' . "\n"; |
|
764 | - $js .= 'var questions_types = new Array();' . "\n"; |
|
765 | - $js .= "\n" . |
|
766 | - '/** |
|
654 | + public $question; |
|
655 | + public $question_ident; |
|
656 | + public $answer; |
|
657 | + public $standalone; |
|
658 | + |
|
659 | + /** |
|
660 | + * Constructor. |
|
661 | + * |
|
662 | + * @param ScormQuestion $question The Question object we want to export. |
|
663 | + */ |
|
664 | + public function __construct($question, $standalone = false) |
|
665 | + { |
|
666 | + $this->question = $question; |
|
667 | + $this->question->setAnswer(); |
|
668 | + $this->questionIdent = "QST_" . $question->id ; |
|
669 | + $this->standalone = $standalone; |
|
670 | + } |
|
671 | + |
|
672 | + /** |
|
673 | + * Start the XML flow. |
|
674 | + * |
|
675 | + * This opens the <item> block, with correct attributes. |
|
676 | + * |
|
677 | + */ |
|
678 | + function start_page() |
|
679 | + { |
|
680 | + global $charset; |
|
681 | + $head = ""; |
|
682 | + if( $this->standalone) |
|
683 | + { |
|
684 | + $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?>' . "\n"; |
|
685 | + $head .= '<html>'."\n"; |
|
686 | + } |
|
687 | + return $head; |
|
688 | + } |
|
689 | + |
|
690 | + /** |
|
691 | + * End the XML flow, closing the </item> tag. |
|
692 | + * |
|
693 | + */ |
|
694 | + function end_page() { |
|
695 | + if ($this->standalone) { |
|
696 | + return '</html>'; |
|
697 | + } |
|
698 | + |
|
699 | + return ''; |
|
700 | + } |
|
701 | + |
|
702 | + /** |
|
703 | + * Start document header |
|
704 | + */ |
|
705 | + function start_header() |
|
706 | + { |
|
707 | + if ($this->standalone) { |
|
708 | + return '<head>'."\n"; |
|
709 | + } |
|
710 | + |
|
711 | + return ''; |
|
712 | + } |
|
713 | + |
|
714 | + /** |
|
715 | + * Print CSS inclusion |
|
716 | + */ |
|
717 | + function css() |
|
718 | + { |
|
719 | + $css = ''; |
|
720 | + if ($this->standalone) { |
|
721 | + $css = '<style type="text/css" media="screen, projection">'."\n"; |
|
722 | + $css .= '/*<![CDATA[*/'."\n"; |
|
723 | + $css .= '/*]]>*/'."\n"; |
|
724 | + $css .= '</style>'."\n"; |
|
725 | + $css .= '<style type="text/css" media="print">'."\n"; |
|
726 | + $css .= '/*<![CDATA[*/'."\n"; |
|
727 | + $css .= '/*]]>*/'."\n"; |
|
728 | + $css .= '</style>'."\n"; |
|
729 | + } |
|
730 | + return $css; |
|
731 | + } |
|
732 | + |
|
733 | + /** |
|
734 | + * End document header |
|
735 | + */ |
|
736 | + function end_header() |
|
737 | + { |
|
738 | + if ($this->standalone) { |
|
739 | + return '</head>'."\n"; |
|
740 | + } |
|
741 | + |
|
742 | + return ''; |
|
743 | + } |
|
744 | + /** |
|
745 | + * Start the itemBody |
|
746 | + * |
|
747 | + */ |
|
748 | + function start_js() |
|
749 | + { |
|
750 | + if ($this->standalone) { |
|
751 | + return '<script type="text/javascript" language="javascript">'."\n"; |
|
752 | + } |
|
753 | + return ''; |
|
754 | + } |
|
755 | + /** |
|
756 | + * Common JS functions |
|
757 | + */ |
|
758 | + function common_js() |
|
759 | + { |
|
760 | + $js = file_get_contents('../lp/js/api_wrapper.js'); |
|
761 | + $js .= 'var questions = new Array();' . "\n"; |
|
762 | + $js .= 'var questions_answers = new Array();' . "\n"; |
|
763 | + $js .= 'var questions_answers_correct = new Array();' . "\n"; |
|
764 | + $js .= 'var questions_types = new Array();' . "\n"; |
|
765 | + $js .= "\n" . |
|
766 | + '/** |
|
767 | 767 | * Assigns any event handler to any element |
768 | 768 | * @param object Element on which the event is added |
769 | 769 | * @param string Name of event |
@@ -798,85 +798,85 @@ discard block |
||
798 | 798 | addEvent(window,\'unload\',unloadPage,false); |
799 | 799 | }'."\n\n"; |
800 | 800 | |
801 | - $js .= ''; |
|
802 | - //$js .= 'addEvent(window,\'load\',loadPage,false);'."\n"; |
|
803 | - //$js .= 'addEvent(window,\'unload\',unloadPage,false);'."\n"; |
|
804 | - $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
805 | - if($this->standalone){return $js. "\n";} |
|
806 | - return ''; |
|
807 | - } |
|
808 | - |
|
809 | - /** |
|
810 | - * End the itemBody part. |
|
811 | - * |
|
812 | - */ |
|
813 | - function end_js() |
|
814 | - { |
|
815 | - if($this->standalone){return '</script>'. "\n";} |
|
816 | - return ''; |
|
817 | - } |
|
818 | - |
|
819 | - /** |
|
820 | - * Start the itemBody |
|
821 | - * |
|
822 | - */ |
|
823 | - function start_body() |
|
824 | - { |
|
825 | - if ($this->standalone) { |
|
826 | - return '<body>'."\n".'<form id="dokeos_scorm_form" method="post" action="">'."\n"; |
|
827 | - } |
|
828 | - |
|
829 | - return ''; |
|
830 | - } |
|
831 | - |
|
832 | - /** |
|
833 | - * End the itemBody part. |
|
834 | - * |
|
835 | - */ |
|
836 | - function end_body() |
|
837 | - { |
|
838 | - if ($this->standalone) { |
|
839 | - return '<br /><input type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form>'."\n".'</body>'."\n"; |
|
840 | - } |
|
841 | - |
|
842 | - return ''; |
|
843 | - } |
|
844 | - |
|
845 | - /** |
|
846 | - * Export the question as a SCORM Item. |
|
847 | - * |
|
848 | - * This is a default behaviour, some classes may want to override this. |
|
849 | - * |
|
850 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
851 | - * @return A string, the XML flow for an Item. |
|
852 | - */ |
|
853 | - function export() |
|
854 | - { |
|
855 | - $js = $html = ''; |
|
856 | - list($js,$html) = $this->question->export(); |
|
857 | - //list($js,$html) = $this->question->answer->export(); |
|
858 | - if ($this->standalone) { |
|
859 | - $res = $this->start_page() |
|
860 | - . $this->start_header() |
|
861 | - . $this->css() |
|
862 | - . $this->start_js() |
|
863 | - . $this->common_js() |
|
864 | - . $js |
|
865 | - . $this->end_js() |
|
866 | - . $this->end_header() |
|
867 | - . $this->start_body() |
|
868 | - // .$this->answer->imsExportResponsesDeclaration($this->questionIdent) |
|
869 | - // . $this->start_item_body() |
|
870 | - // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture) |
|
871 | - // .$question |
|
872 | - . $html |
|
873 | - . $this->end_body() |
|
874 | - . $this->end_page(); |
|
875 | - return $res; |
|
876 | - } else { |
|
877 | - return array($js,$html); |
|
878 | - } |
|
879 | - } |
|
801 | + $js .= ''; |
|
802 | + //$js .= 'addEvent(window,\'load\',loadPage,false);'."\n"; |
|
803 | + //$js .= 'addEvent(window,\'unload\',unloadPage,false);'."\n"; |
|
804 | + $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
805 | + if($this->standalone){return $js. "\n";} |
|
806 | + return ''; |
|
807 | + } |
|
808 | + |
|
809 | + /** |
|
810 | + * End the itemBody part. |
|
811 | + * |
|
812 | + */ |
|
813 | + function end_js() |
|
814 | + { |
|
815 | + if($this->standalone){return '</script>'. "\n";} |
|
816 | + return ''; |
|
817 | + } |
|
818 | + |
|
819 | + /** |
|
820 | + * Start the itemBody |
|
821 | + * |
|
822 | + */ |
|
823 | + function start_body() |
|
824 | + { |
|
825 | + if ($this->standalone) { |
|
826 | + return '<body>'."\n".'<form id="dokeos_scorm_form" method="post" action="">'."\n"; |
|
827 | + } |
|
828 | + |
|
829 | + return ''; |
|
830 | + } |
|
831 | + |
|
832 | + /** |
|
833 | + * End the itemBody part. |
|
834 | + * |
|
835 | + */ |
|
836 | + function end_body() |
|
837 | + { |
|
838 | + if ($this->standalone) { |
|
839 | + return '<br /><input type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form>'."\n".'</body>'."\n"; |
|
840 | + } |
|
841 | + |
|
842 | + return ''; |
|
843 | + } |
|
844 | + |
|
845 | + /** |
|
846 | + * Export the question as a SCORM Item. |
|
847 | + * |
|
848 | + * This is a default behaviour, some classes may want to override this. |
|
849 | + * |
|
850 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
851 | + * @return A string, the XML flow for an Item. |
|
852 | + */ |
|
853 | + function export() |
|
854 | + { |
|
855 | + $js = $html = ''; |
|
856 | + list($js,$html) = $this->question->export(); |
|
857 | + //list($js,$html) = $this->question->answer->export(); |
|
858 | + if ($this->standalone) { |
|
859 | + $res = $this->start_page() |
|
860 | + . $this->start_header() |
|
861 | + . $this->css() |
|
862 | + . $this->start_js() |
|
863 | + . $this->common_js() |
|
864 | + . $js |
|
865 | + . $this->end_js() |
|
866 | + . $this->end_header() |
|
867 | + . $this->start_body() |
|
868 | + // .$this->answer->imsExportResponsesDeclaration($this->questionIdent) |
|
869 | + // . $this->start_item_body() |
|
870 | + // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture) |
|
871 | + // .$question |
|
872 | + . $html |
|
873 | + . $this->end_body() |
|
874 | + . $this->end_page(); |
|
875 | + return $res; |
|
876 | + } else { |
|
877 | + return array($js,$html); |
|
878 | + } |
|
879 | + } |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | /** |
@@ -893,118 +893,118 @@ discard block |
||
893 | 893 | */ |
894 | 894 | class ScormSection |
895 | 895 | { |
896 | - public $exercise; |
|
897 | - public $standalone; |
|
898 | - |
|
899 | - /** |
|
900 | - * Send a complete exercise in SCORM format, from its ID |
|
901 | - * |
|
902 | - * @param int $exerciseId The exercise to exporte |
|
903 | - * @param boolean $standalone Wether it should include XML tag and DTD line. |
|
904 | - * @return string XML as a string, or an empty string if there's no exercise with given ID. |
|
905 | - */ |
|
906 | - public static function export_exercise_to_scorm($exerciseId, $standalone = true) |
|
907 | - { |
|
908 | - $exercise = new Exercise(); |
|
909 | - if (!$exercise->read($exerciseId)) { |
|
910 | - return ''; |
|
911 | - } |
|
912 | - $ims = new ScormSection($exercise); |
|
913 | - $xml = $ims->export($standalone); |
|
914 | - |
|
915 | - return $xml; |
|
916 | - } |
|
917 | - |
|
918 | - |
|
919 | - /** |
|
920 | - * Constructor. |
|
921 | - * @param Exercise $exe The Exercise instance to export |
|
922 | - * @author Amand Tihon <[email protected]> |
|
923 | - */ |
|
924 | - function ScormSection($exe) |
|
925 | - { |
|
926 | - $this->exercise = $exe; |
|
927 | - } |
|
928 | - |
|
929 | - /** |
|
930 | - * Start the XML flow. |
|
931 | - * |
|
932 | - * This opens the <item> block, with correct attributes. |
|
933 | - * |
|
934 | - */ |
|
935 | - function start_page() |
|
936 | - { |
|
937 | - global $charset; |
|
938 | - $head = $foot = ""; |
|
939 | - $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?>' . "\n".'<html>'."\n"; |
|
940 | - return $head; |
|
941 | - } |
|
942 | - |
|
943 | - /** |
|
944 | - * End the XML flow, closing the </item> tag. |
|
945 | - * |
|
946 | - */ |
|
947 | - function end_page() |
|
948 | - { |
|
949 | - return '</html>'; |
|
950 | - } |
|
951 | - |
|
952 | - /** |
|
953 | - * Start document header |
|
954 | - */ |
|
955 | - function start_header() |
|
956 | - { |
|
957 | - return '<head>'. "\n"; |
|
958 | - } |
|
959 | - |
|
960 | - /** |
|
961 | - * Print CSS inclusion |
|
962 | - */ |
|
963 | - function css() |
|
964 | - { |
|
965 | - $css = '<style type="text/css" media="screen, projection">'."\n"; |
|
966 | - $css .= '/*<![CDATA[*/'."\n"; |
|
967 | - $css .= '/*]]>*/'."\n"; |
|
968 | - $css .= '</style>'."\n"; |
|
969 | - $css .= '<style type="text/css" media="print">'."\n"; |
|
970 | - $css .= '/*<![CDATA[*/'."\n"; |
|
971 | - $css .= '/*]]>*/'."\n"; |
|
972 | - $css .= '</style>'."\n"; |
|
973 | - |
|
974 | - return $css; |
|
975 | - } |
|
976 | - |
|
977 | - /** |
|
978 | - * End document header |
|
979 | - */ |
|
980 | - function end_header() |
|
981 | - { |
|
982 | - return '</head>'. "\n"; |
|
983 | - } |
|
984 | - |
|
985 | - /** |
|
986 | - * Start the itemBody |
|
987 | - * |
|
988 | - */ |
|
989 | - function start_js() |
|
990 | - { |
|
991 | - return '<script type="text/javascript" language="javascript">'. "\n"; |
|
992 | - } |
|
993 | - |
|
994 | - /** |
|
995 | - * Common JS functions |
|
996 | - */ |
|
997 | - function common_js() |
|
998 | - { |
|
999 | - $js = "\n"; |
|
1000 | - $js .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
1001 | - $js .= file_get_contents('../lp/js/api_wrapper.js'); |
|
1002 | - $js .= 'var questions = new Array();' . "\n"; |
|
1003 | - $js .= 'var questions_answers = new Array();' . "\n"; |
|
1004 | - $js .= 'var questions_answers_correct = new Array();' . "\n"; |
|
1005 | - $js .= 'var questions_types = new Array();' . "\n"; |
|
1006 | - $js .= "\n" . |
|
1007 | - '/** |
|
896 | + public $exercise; |
|
897 | + public $standalone; |
|
898 | + |
|
899 | + /** |
|
900 | + * Send a complete exercise in SCORM format, from its ID |
|
901 | + * |
|
902 | + * @param int $exerciseId The exercise to exporte |
|
903 | + * @param boolean $standalone Wether it should include XML tag and DTD line. |
|
904 | + * @return string XML as a string, or an empty string if there's no exercise with given ID. |
|
905 | + */ |
|
906 | + public static function export_exercise_to_scorm($exerciseId, $standalone = true) |
|
907 | + { |
|
908 | + $exercise = new Exercise(); |
|
909 | + if (!$exercise->read($exerciseId)) { |
|
910 | + return ''; |
|
911 | + } |
|
912 | + $ims = new ScormSection($exercise); |
|
913 | + $xml = $ims->export($standalone); |
|
914 | + |
|
915 | + return $xml; |
|
916 | + } |
|
917 | + |
|
918 | + |
|
919 | + /** |
|
920 | + * Constructor. |
|
921 | + * @param Exercise $exe The Exercise instance to export |
|
922 | + * @author Amand Tihon <[email protected]> |
|
923 | + */ |
|
924 | + function ScormSection($exe) |
|
925 | + { |
|
926 | + $this->exercise = $exe; |
|
927 | + } |
|
928 | + |
|
929 | + /** |
|
930 | + * Start the XML flow. |
|
931 | + * |
|
932 | + * This opens the <item> block, with correct attributes. |
|
933 | + * |
|
934 | + */ |
|
935 | + function start_page() |
|
936 | + { |
|
937 | + global $charset; |
|
938 | + $head = $foot = ""; |
|
939 | + $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?>' . "\n".'<html>'."\n"; |
|
940 | + return $head; |
|
941 | + } |
|
942 | + |
|
943 | + /** |
|
944 | + * End the XML flow, closing the </item> tag. |
|
945 | + * |
|
946 | + */ |
|
947 | + function end_page() |
|
948 | + { |
|
949 | + return '</html>'; |
|
950 | + } |
|
951 | + |
|
952 | + /** |
|
953 | + * Start document header |
|
954 | + */ |
|
955 | + function start_header() |
|
956 | + { |
|
957 | + return '<head>'. "\n"; |
|
958 | + } |
|
959 | + |
|
960 | + /** |
|
961 | + * Print CSS inclusion |
|
962 | + */ |
|
963 | + function css() |
|
964 | + { |
|
965 | + $css = '<style type="text/css" media="screen, projection">'."\n"; |
|
966 | + $css .= '/*<![CDATA[*/'."\n"; |
|
967 | + $css .= '/*]]>*/'."\n"; |
|
968 | + $css .= '</style>'."\n"; |
|
969 | + $css .= '<style type="text/css" media="print">'."\n"; |
|
970 | + $css .= '/*<![CDATA[*/'."\n"; |
|
971 | + $css .= '/*]]>*/'."\n"; |
|
972 | + $css .= '</style>'."\n"; |
|
973 | + |
|
974 | + return $css; |
|
975 | + } |
|
976 | + |
|
977 | + /** |
|
978 | + * End document header |
|
979 | + */ |
|
980 | + function end_header() |
|
981 | + { |
|
982 | + return '</head>'. "\n"; |
|
983 | + } |
|
984 | + |
|
985 | + /** |
|
986 | + * Start the itemBody |
|
987 | + * |
|
988 | + */ |
|
989 | + function start_js() |
|
990 | + { |
|
991 | + return '<script type="text/javascript" language="javascript">'. "\n"; |
|
992 | + } |
|
993 | + |
|
994 | + /** |
|
995 | + * Common JS functions |
|
996 | + */ |
|
997 | + function common_js() |
|
998 | + { |
|
999 | + $js = "\n"; |
|
1000 | + $js .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
1001 | + $js .= file_get_contents('../lp/js/api_wrapper.js'); |
|
1002 | + $js .= 'var questions = new Array();' . "\n"; |
|
1003 | + $js .= 'var questions_answers = new Array();' . "\n"; |
|
1004 | + $js .= 'var questions_answers_correct = new Array();' . "\n"; |
|
1005 | + $js .= 'var questions_types = new Array();' . "\n"; |
|
1006 | + $js .= "\n" . |
|
1007 | + '/** |
|
1008 | 1008 | * Assigns any event handler to any element |
1009 | 1009 | * @param object Element on which the event is added |
1010 | 1010 | * @param string Name of event |
@@ -1046,96 +1046,96 @@ discard block |
||
1046 | 1046 | } |
1047 | 1047 | '."\n"; |
1048 | 1048 | |
1049 | - $js .= ''; |
|
1050 | - //$js .= 'addEvent(window,\'load\',loadPage,false);'."\n"; |
|
1051 | - //$js .= 'addEvent(window,\'unload\',unloadPage,false);'."\n"; |
|
1052 | - $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
1053 | - return $js. "\n"; |
|
1054 | - } |
|
1055 | - |
|
1056 | - /** |
|
1057 | - * End the itemBody part. |
|
1058 | - * |
|
1059 | - */ |
|
1060 | - function end_js() { |
|
1061 | - return '</script>'. "\n"; |
|
1062 | - } |
|
1063 | - |
|
1064 | - /** |
|
1065 | - * Start the itemBody |
|
1066 | - * |
|
1067 | - */ |
|
1068 | - function start_body() |
|
1069 | - { |
|
1070 | - return '<body>'. "\n". |
|
1071 | - '<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>\n". |
|
1072 | - '<form id="dokeos_scorm_form" method="post" action="">'."\n". |
|
1073 | - '<table width="100%">'."\n"; |
|
1074 | - } |
|
1075 | - |
|
1076 | - /** |
|
1077 | - * End the itemBody part. |
|
1078 | - * |
|
1079 | - */ |
|
1080 | - function end_body() |
|
1081 | - { |
|
1082 | - return '</table><br /><input type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form>'."\n".'</body>'. "\n"; |
|
1083 | - } |
|
1084 | - |
|
1085 | - /** |
|
1086 | - * Export the question as a SCORM Item. |
|
1087 | - * |
|
1088 | - * This is a default behaviour, some classes may want to override this. |
|
1089 | - * |
|
1090 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
1091 | - * @return string string, the XML flow for an Item. |
|
1092 | - */ |
|
1093 | - function export() |
|
1094 | - { |
|
1095 | - global $charset; |
|
1096 | - |
|
1097 | - $head = ''; |
|
1098 | - if ($this->standalone) { |
|
1099 | - $head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n" |
|
1100 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"; |
|
1101 | - } |
|
1102 | - |
|
1103 | - list($js,$html) = $this->export_questions(); |
|
1104 | - //list($js,$html) = $this->question->answer->export(); |
|
1105 | - $res = $this->start_page() |
|
1106 | - . $this->start_header() |
|
1107 | - . $this->css() |
|
1108 | - . $this->start_js() |
|
1109 | - . $this->common_js() |
|
1110 | - . $js |
|
1111 | - . $this->end_js() |
|
1112 | - . $this->end_header() |
|
1113 | - . $this->start_body() |
|
1114 | - // .$this->answer->imsExportResponsesDeclaration($this->questionIdent) |
|
1115 | - // . $this->start_item_body() |
|
1116 | - // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture) |
|
1117 | - // .$question |
|
1118 | - .$html |
|
1119 | - . $this->end_body() |
|
1120 | - . $this->end_page(); |
|
1121 | - |
|
1122 | - return $res; |
|
1123 | - } |
|
1124 | - |
|
1125 | - /** |
|
1126 | - * Export the questions, as a succession of <items> |
|
1127 | - * @author Amand Tihon <[email protected]> |
|
1128 | - */ |
|
1129 | - function export_questions() |
|
1130 | - { |
|
1131 | - $js = $html = ""; |
|
1132 | - $js_id = 0; |
|
1133 | - foreach ($this->exercise->selectQuestionList() as $q) { |
|
1134 | - list($jstmp,$htmltmp)= ScormQuestion::export_question($q, false, $js_id); |
|
1135 | - $js .= $jstmp."\n"; |
|
1136 | - $html .= $htmltmp."\n"; |
|
1137 | - ++$js_id; |
|
1138 | - } |
|
1139 | - return array($js,$html); |
|
1140 | - } |
|
1049 | + $js .= ''; |
|
1050 | + //$js .= 'addEvent(window,\'load\',loadPage,false);'."\n"; |
|
1051 | + //$js .= 'addEvent(window,\'unload\',unloadPage,false);'."\n"; |
|
1052 | + $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
1053 | + return $js. "\n"; |
|
1054 | + } |
|
1055 | + |
|
1056 | + /** |
|
1057 | + * End the itemBody part. |
|
1058 | + * |
|
1059 | + */ |
|
1060 | + function end_js() { |
|
1061 | + return '</script>'. "\n"; |
|
1062 | + } |
|
1063 | + |
|
1064 | + /** |
|
1065 | + * Start the itemBody |
|
1066 | + * |
|
1067 | + */ |
|
1068 | + function start_body() |
|
1069 | + { |
|
1070 | + return '<body>'. "\n". |
|
1071 | + '<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>\n". |
|
1072 | + '<form id="dokeos_scorm_form" method="post" action="">'."\n". |
|
1073 | + '<table width="100%">'."\n"; |
|
1074 | + } |
|
1075 | + |
|
1076 | + /** |
|
1077 | + * End the itemBody part. |
|
1078 | + * |
|
1079 | + */ |
|
1080 | + function end_body() |
|
1081 | + { |
|
1082 | + return '</table><br /><input type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form>'."\n".'</body>'. "\n"; |
|
1083 | + } |
|
1084 | + |
|
1085 | + /** |
|
1086 | + * Export the question as a SCORM Item. |
|
1087 | + * |
|
1088 | + * This is a default behaviour, some classes may want to override this. |
|
1089 | + * |
|
1090 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
1091 | + * @return string string, the XML flow for an Item. |
|
1092 | + */ |
|
1093 | + function export() |
|
1094 | + { |
|
1095 | + global $charset; |
|
1096 | + |
|
1097 | + $head = ''; |
|
1098 | + if ($this->standalone) { |
|
1099 | + $head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n" |
|
1100 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"; |
|
1101 | + } |
|
1102 | + |
|
1103 | + list($js,$html) = $this->export_questions(); |
|
1104 | + //list($js,$html) = $this->question->answer->export(); |
|
1105 | + $res = $this->start_page() |
|
1106 | + . $this->start_header() |
|
1107 | + . $this->css() |
|
1108 | + . $this->start_js() |
|
1109 | + . $this->common_js() |
|
1110 | + . $js |
|
1111 | + . $this->end_js() |
|
1112 | + . $this->end_header() |
|
1113 | + . $this->start_body() |
|
1114 | + // .$this->answer->imsExportResponsesDeclaration($this->questionIdent) |
|
1115 | + // . $this->start_item_body() |
|
1116 | + // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture) |
|
1117 | + // .$question |
|
1118 | + .$html |
|
1119 | + . $this->end_body() |
|
1120 | + . $this->end_page(); |
|
1121 | + |
|
1122 | + return $res; |
|
1123 | + } |
|
1124 | + |
|
1125 | + /** |
|
1126 | + * Export the questions, as a succession of <items> |
|
1127 | + * @author Amand Tihon <[email protected]> |
|
1128 | + */ |
|
1129 | + function export_questions() |
|
1130 | + { |
|
1131 | + $js = $html = ""; |
|
1132 | + $js_id = 0; |
|
1133 | + foreach ($this->exercise->selectQuestionList() as $q) { |
|
1134 | + list($jstmp,$htmltmp)= ScormQuestion::export_question($q, false, $js_id); |
|
1135 | + $js .= $jstmp."\n"; |
|
1136 | + $html .= $htmltmp."\n"; |
|
1137 | + ++$js_id; |
|
1138 | + } |
|
1139 | + return array($js,$html); |
|
1140 | + } |
|
1141 | 1141 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $learnpath_id = 0; |
44 | 44 | |
45 | 45 | if (isset($_REQUEST['learnpath_id'])) { |
46 | - $learnpath_id = intval($_REQUEST['learnpath_id']); |
|
46 | + $learnpath_id = intval($_REQUEST['learnpath_id']); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $learnpath_item_id = 0; |
50 | 50 | |
51 | 51 | if (isset($_REQUEST['learnpath_item_id'])) { |
52 | - $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
52 | + $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $_SESSION['hotspot_coord']=array(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // Getting the options by js |
94 | 94 | if (empty($choice_value)) { |
95 | 95 | |
96 | - echo "<script> |
|
96 | + echo "<script> |
|
97 | 97 | // this works for only radio buttons |
98 | 98 | var f = self.parent.window.document.frm_exercise; |
99 | 99 | var choice_js=''; |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | "; |
125 | - // IMPORTANT |
|
126 | - //this is the real redirect function |
|
127 | - //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
125 | + // IMPORTANT |
|
126 | + //this is the real redirect function |
|
127 | + //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
128 | 128 | echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
129 | 129 | echo "$('#global-modal .modal-body').load(url);"; |
130 | - echo '</script>'; |
|
130 | + echo '</script>'; |
|
131 | 131 | |
132 | 132 | exit; |
133 | 133 | } |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | |
181 | 181 | // creates a temporary Question object |
182 | 182 | if (in_array($questionid, $questionList)) { |
183 | - $objQuestionTmp = Question :: read($questionid); |
|
184 | - $questionName =$objQuestionTmp->selectTitle(); |
|
185 | - $questionDescription=$objQuestionTmp->selectDescription(); |
|
186 | - $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
187 | - $answerType =$objQuestionTmp->selectType(); |
|
188 | - $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
183 | + $objQuestionTmp = Question :: read($questionid); |
|
184 | + $questionName =$objQuestionTmp->selectTitle(); |
|
185 | + $questionDescription=$objQuestionTmp->selectDescription(); |
|
186 | + $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
187 | + $answerType =$objQuestionTmp->selectType(); |
|
188 | + $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $objAnswerTmp=new Answer($questionid); |
@@ -208,43 +208,43 @@ discard block |
||
208 | 208 | $totalScore = 0; |
209 | 209 | |
210 | 210 | if (!empty($choice_value)) { |
211 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
212 | - $answer = $objAnswerTmp->selectAnswer($answerId); |
|
213 | - $answerComment = $objAnswerTmp->selectComment($answerId); |
|
214 | - $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
215 | - |
|
216 | - $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
217 | - $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
218 | - $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
219 | - |
|
220 | - //delineation |
|
221 | - $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
222 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
211 | + for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
212 | + $answer = $objAnswerTmp->selectAnswer($answerId); |
|
213 | + $answerComment = $objAnswerTmp->selectComment($answerId); |
|
214 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
215 | + |
|
216 | + $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
217 | + $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
218 | + $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
219 | + |
|
220 | + //delineation |
|
221 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
222 | + $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
223 | 223 | if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);} |
224 | 224 | |
225 | - switch($answerType) { |
|
226 | - // for unique answer |
|
227 | - case UNIQUE_ANSWER : |
|
228 | - $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
229 | - if ($studentChoice) { |
|
230 | - $questionScore +=$answerWeighting; |
|
231 | - $totalScore +=$answerWeighting; |
|
232 | - $newquestionList[]=$questionid; |
|
233 | - } |
|
234 | - break; |
|
235 | - case HOT_SPOT_DELINEATION : |
|
236 | - $studentChoice=$choice[$answerId]; |
|
237 | - if ($studentChoice) { |
|
238 | - $newquestionList[]=$questionid; |
|
239 | - } |
|
240 | - if ($answerId===1) { |
|
241 | - $questionScore +=$answerWeighting; |
|
242 | - $totalScore +=$answerWeighting; |
|
243 | - $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
244 | - $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
245 | - } |
|
246 | - break; |
|
247 | - } |
|
225 | + switch($answerType) { |
|
226 | + // for unique answer |
|
227 | + case UNIQUE_ANSWER : |
|
228 | + $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
229 | + if ($studentChoice) { |
|
230 | + $questionScore +=$answerWeighting; |
|
231 | + $totalScore +=$answerWeighting; |
|
232 | + $newquestionList[]=$questionid; |
|
233 | + } |
|
234 | + break; |
|
235 | + case HOT_SPOT_DELINEATION : |
|
236 | + $studentChoice=$choice[$answerId]; |
|
237 | + if ($studentChoice) { |
|
238 | + $newquestionList[]=$questionid; |
|
239 | + } |
|
240 | + if ($answerId===1) { |
|
241 | + $questionScore +=$answerWeighting; |
|
242 | + $totalScore +=$answerWeighting; |
|
243 | + $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
244 | + $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
245 | + } |
|
246 | + break; |
|
247 | + } |
|
248 | 248 | |
249 | 249 | |
250 | 250 | if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $lp_hotspot=$destination_items[2]; |
342 | 342 | $select_question_hotspot=$destination_items[3]; |
343 | 343 | $url_hotspot=$destination_items[4]; |
344 | - //echo 'show the feedback'; |
|
344 | + //echo 'show the feedback'; |
|
345 | 345 | } |
346 | 346 | } elseif($answerId>1) { |
347 | 347 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
@@ -398,41 +398,41 @@ discard block |
||
398 | 398 | //we send the error |
399 | 399 | } |
400 | 400 | } |
401 | - } |
|
401 | + } |
|
402 | 402 | |
403 | - if ($overlap_color) { |
|
404 | - $overlap_color='green'; |
|
403 | + if ($overlap_color) { |
|
404 | + $overlap_color='green'; |
|
405 | 405 | } else { |
406 | - $overlap_color='red'; |
|
406 | + $overlap_color='red'; |
|
407 | 407 | } |
408 | - if ($missing_color) { |
|
409 | - $missing_color='green'; |
|
408 | + if ($missing_color) { |
|
409 | + $missing_color='green'; |
|
410 | 410 | } else { |
411 | - $missing_color='red'; |
|
411 | + $missing_color='red'; |
|
412 | 412 | } |
413 | - if ($excess_color) { |
|
414 | - $excess_color='green'; |
|
413 | + if ($excess_color) { |
|
414 | + $excess_color='green'; |
|
415 | 415 | } else { |
416 | - $excess_color='red'; |
|
416 | + $excess_color='red'; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | if (!is_numeric($final_overlap)) { |
420 | - $final_overlap = 0; |
|
420 | + $final_overlap = 0; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | if (!is_numeric($final_missing)) { |
424 | - $final_missing = 0; |
|
424 | + $final_missing = 0; |
|
425 | 425 | } |
426 | 426 | if (!is_numeric($final_excess)) { |
427 | - $final_excess = 0; |
|
427 | + $final_excess = 0; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | if ($final_excess>100) { |
431 | - $final_excess = 100; |
|
431 | + $final_excess = 100; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
435 | - $table_resume = '<table class="data_table" > |
|
435 | + $table_resume = '<table class="data_table" > |
|
436 | 436 | <tr class="row_odd" > |
437 | 437 | <td></td> |
438 | 438 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
458 | 458 | </tr> |
459 | 459 | </table>'; |
460 | - //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
460 | + //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
461 | 461 | } |
462 | 462 | $_SESSION['newquestionList'] = $newquestionList; |
463 | 463 | |
@@ -474,68 +474,68 @@ discard block |
||
474 | 474 | if ($answerType != HOT_SPOT_DELINEATION) { |
475 | 475 | if (!empty($destination)) { |
476 | 476 | $item_list = explode('@@',$destination); |
477 | - //print_R($item_list); |
|
478 | - $try = $item_list[0]; |
|
479 | - $lp = $item_list[1]; |
|
480 | - $destinationid= $item_list[2]; |
|
481 | - $url=$item_list[3]; |
|
477 | + //print_R($item_list); |
|
478 | + $try = $item_list[0]; |
|
479 | + $lp = $item_list[1]; |
|
480 | + $destinationid= $item_list[2]; |
|
481 | + $url=$item_list[3]; |
|
482 | 482 | } |
483 | - $table_resume=''; |
|
483 | + $table_resume=''; |
|
484 | 484 | } else { |
485 | - $try = $try_hotspot; |
|
486 | - $lp = $lp_hotspot; |
|
487 | - $destinationid= $select_question_hotspot; |
|
488 | - $url=$url_hotspot; |
|
489 | - if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
490 | - // no error = no oar and no wrong result for delineation |
|
491 | - //show if no error |
|
492 | - //echo 'no error'; |
|
493 | - $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
494 | - $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
495 | - |
|
496 | - //we send the error |
|
497 | - $destination_items= explode('@@', $answerDestination); |
|
498 | - $try=$destination_items[1]; |
|
499 | - $lp=$destination_items[2]; |
|
500 | - $destinationid=$destination_items[3]; |
|
501 | - $url=$destination_items[4]; |
|
502 | - $exerciseResult[$questionid] = 1; |
|
503 | - } else { |
|
504 | - $exerciseResult[$questionid] = 0; |
|
505 | - } |
|
485 | + $try = $try_hotspot; |
|
486 | + $lp = $lp_hotspot; |
|
487 | + $destinationid= $select_question_hotspot; |
|
488 | + $url=$url_hotspot; |
|
489 | + if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
490 | + // no error = no oar and no wrong result for delineation |
|
491 | + //show if no error |
|
492 | + //echo 'no error'; |
|
493 | + $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
494 | + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
495 | + |
|
496 | + //we send the error |
|
497 | + $destination_items= explode('@@', $answerDestination); |
|
498 | + $try=$destination_items[1]; |
|
499 | + $lp=$destination_items[2]; |
|
500 | + $destinationid=$destination_items[3]; |
|
501 | + $url=$destination_items[4]; |
|
502 | + $exerciseResult[$questionid] = 1; |
|
503 | + } else { |
|
504 | + $exerciseResult[$questionid] = 0; |
|
505 | + } |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | // the link to retry the question |
509 | 509 | if (isset($try) && $try==1) { |
510 | - $num_value_array= (array_keys($questionList, $questionid)); |
|
511 | - $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
510 | + $num_value_array= (array_keys($questionList, $questionid)); |
|
511 | + $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | // the link to theory (a learning path) |
515 | 515 | if (!empty($lp)) { |
516 | - $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
517 | - $list = new LearnpathList(api_get_user_id()); |
|
518 | - $flat_list = $list->get_flat_list(); |
|
519 | - $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
516 | + $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
517 | + $list = new LearnpathList(api_get_user_id()); |
|
518 | + $flat_list = $list->get_flat_list(); |
|
519 | + $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
520 | 520 | } |
521 | 521 | $links.='<br />'; |
522 | 522 | |
523 | 523 | // the link to an external website or link |
524 | 524 | if (!empty($url)) { |
525 | - $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
525 | + $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | // the link to finish the test |
529 | 529 | if ($destinationid==-1) { |
530 | - $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
530 | + $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
531 | 531 | } else { |
532 | - // the link to other question |
|
533 | - if (in_array($destinationid,$questionList)) { |
|
534 | - $objQuestionTmp = Question :: read($destinationid); |
|
535 | - $questionName=$objQuestionTmp->selectTitle(); |
|
536 | - $num_value_array= (array_keys($questionList, $destinationid)); |
|
537 | - $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
538 | - } |
|
532 | + // the link to other question |
|
533 | + if (in_array($destinationid,$questionList)) { |
|
534 | + $objQuestionTmp = Question :: read($destinationid); |
|
535 | + $questionName=$objQuestionTmp->selectTitle(); |
|
536 | + $num_value_array= (array_keys($questionList, $destinationid)); |
|
537 | + $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
538 | + } |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | echo '<script> |
@@ -552,43 +552,43 @@ discard block |
||
552 | 552 | </script>'; |
553 | 553 | |
554 | 554 | if ($links!='') { |
555 | - /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
555 | + /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
556 | 556 | <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/ |
557 | - echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
558 | - |
|
559 | - if ($answerType == HOT_SPOT_DELINEATION) { |
|
560 | - if ($organs_at_risk_hit > 0) { |
|
561 | - //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
562 | - //$message.=$table_resume; |
|
563 | - $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
564 | - //if ($wrong_results) { } |
|
565 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
566 | - $message.='<p>'.$comment.'</p>'; |
|
567 | - } else { |
|
568 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
569 | - $message.=$table_resume; |
|
570 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
571 | - $message.='<p>'.$comment.'</p>'; |
|
572 | - } |
|
573 | - echo $message; |
|
574 | - } else { |
|
575 | - echo '<p>'.$comment.'</p>'; |
|
576 | - } |
|
577 | - echo '<h3>'.$links.'</h3>'; |
|
578 | - echo '</div>'; |
|
579 | - |
|
580 | - $_SESSION['hot_spot_result']=$message; |
|
581 | - $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
582 | - //reseting the exerciseResult variable |
|
583 | - Session::write('exerciseResult',$exerciseResult); |
|
584 | - |
|
585 | - //save this variables just in case the exercise loads an LP with other exercise |
|
586 | - $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
587 | - $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
588 | - $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
557 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
558 | + |
|
559 | + if ($answerType == HOT_SPOT_DELINEATION) { |
|
560 | + if ($organs_at_risk_hit > 0) { |
|
561 | + //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
562 | + //$message.=$table_resume; |
|
563 | + $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
564 | + //if ($wrong_results) { } |
|
565 | + $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
566 | + $message.='<p>'.$comment.'</p>'; |
|
567 | + } else { |
|
568 | + $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
569 | + $message.=$table_resume; |
|
570 | + $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
571 | + $message.='<p>'.$comment.'</p>'; |
|
572 | + } |
|
573 | + echo $message; |
|
574 | + } else { |
|
575 | + echo '<p>'.$comment.'</p>'; |
|
576 | + } |
|
577 | + echo '<h3>'.$links.'</h3>'; |
|
578 | + echo '</div>'; |
|
579 | + |
|
580 | + $_SESSION['hot_spot_result']=$message; |
|
581 | + $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
582 | + //reseting the exerciseResult variable |
|
583 | + Session::write('exerciseResult',$exerciseResult); |
|
584 | + |
|
585 | + //save this variables just in case the exercise loads an LP with other exercise |
|
586 | + $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
587 | + $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
588 | + $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
589 | 589 | } else { |
590 | - $questionNum++; |
|
591 | - echo '<script> |
|
590 | + $questionNum++; |
|
591 | + echo '<script> |
|
592 | 592 | self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'"; |
593 | 593 | //self.parent.tb_remove(); |
594 | 594 | </script>'; |