@@ -447,7 +447,7 @@ |
||
447 | 447 | $position = $row_max->max_position + 1; |
448 | 448 | |
449 | 449 | // Insert a new answer |
450 | - $params = [ |
|
450 | + $params = [ |
|
451 | 451 | 'c_id' => $course_id, |
452 | 452 | 'id' => $id, |
453 | 453 | 'question_id' => $question_id, |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | |
60 | 60 | if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { |
61 | 61 | //Scenario |
62 | - $comment_title = '<th width="20%">' . get_lang('Comment') . '</th>'; |
|
63 | - $feedback_title = '<th width="20%">' . get_lang('Scenario') . '</th>'; |
|
62 | + $comment_title = '<th width="20%">'.get_lang('Comment').'</th>'; |
|
63 | + $feedback_title = '<th width="20%">'.get_lang('Scenario').'</th>'; |
|
64 | 64 | } else { |
65 | - $comment_title = '<th width="40%">' . get_lang('Comment') . '</th>'; |
|
65 | + $comment_title = '<th width="40%">'.get_lang('Comment').'</th>'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $html = '<table class="table table-striped table-hover"> |
69 | 69 | <thead> |
70 | 70 | <tr style="text-align: center;"> |
71 | - <th width="5%">' . get_lang('Number') . '</th> |
|
72 | - <th width="5%"> ' . get_lang('True') . '</th> |
|
73 | - <th width="40%">' . get_lang('Answer') . '</th> |
|
74 | - ' . $comment_title . ' |
|
75 | - ' . $feedback_title . ' |
|
76 | - <th width="10%">' . get_lang('Weighting') . '</th> |
|
71 | + <th width="5%">' . get_lang('Number').'</th> |
|
72 | + <th width="5%"> ' . get_lang('True').'</th> |
|
73 | + <th width="40%">' . get_lang('Answer').'</th> |
|
74 | + ' . $comment_title.' |
|
75 | + ' . $feedback_title.' |
|
76 | + <th width="10%">' . get_lang('Weighting').'</th> |
|
77 | 77 | </tr> |
78 | 78 | </thead> |
79 | 79 | <tbody>'; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | $question = Question::read($questionid); |
106 | - $select_question[$questionid] = 'Q' . $key . ' :' . cut( |
|
106 | + $select_question[$questionid] = 'Q'.$key.' :'.cut( |
|
107 | 107 | $question->selectTitle(), 20 |
108 | 108 | ); |
109 | 109 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | if ($answer->correct[$i]) { |
135 | 135 | $correct = $i; |
136 | 136 | } |
137 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
138 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
139 | - $defaults['weighting[' . $i . ']'] = float_format( |
|
137 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
138 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
139 | + $defaults['weighting['.$i.']'] = float_format( |
|
140 | 140 | $answer->weighting[$i], |
141 | 141 | 1 |
142 | 142 | ); |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | $url_result = $url; |
160 | 160 | } |
161 | 161 | |
162 | - $temp_scenario['url' . $i] = $url_result; |
|
163 | - $temp_scenario['try' . $i] = $try_result; |
|
164 | - $temp_scenario['lp' . $i] = $lp; |
|
165 | - $temp_scenario['destination' . $i] = $list_dest; |
|
162 | + $temp_scenario['url'.$i] = $url_result; |
|
163 | + $temp_scenario['try'.$i] = $try_result; |
|
164 | + $temp_scenario['lp'.$i] = $lp; |
|
165 | + $temp_scenario['destination'.$i] = $list_dest; |
|
166 | 166 | } else { |
167 | 167 | $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1'); |
168 | 168 | $defaults['weighting[1]'] = 10; |
169 | 169 | $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2'); |
170 | 170 | $defaults['weighting[2]'] = 0; |
171 | 171 | |
172 | - $temp_scenario['destination' . $i] = array('0'); |
|
173 | - $temp_scenario['lp' . $i] = array('0'); |
|
172 | + $temp_scenario['destination'.$i] = array('0'); |
|
173 | + $temp_scenario['lp'.$i] = array('0'); |
|
174 | 174 | } |
175 | 175 | $defaults['scenario'] = $temp_scenario; |
176 | 176 | |
@@ -182,62 +182,62 @@ discard block |
||
182 | 182 | ); |
183 | 183 | $renderer->setElementTemplate( |
184 | 184 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
185 | - 'counter[' . $i . ']' |
|
185 | + 'counter['.$i.']' |
|
186 | 186 | ); |
187 | 187 | $renderer->setElementTemplate( |
188 | 188 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
189 | - 'answer[' . $i . ']' |
|
189 | + 'answer['.$i.']' |
|
190 | 190 | ); |
191 | 191 | $renderer->setElementTemplate( |
192 | 192 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
193 | - 'comment[' . $i . ']' |
|
193 | + 'comment['.$i.']' |
|
194 | 194 | ); |
195 | 195 | $renderer->setElementTemplate( |
196 | 196 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
197 | - 'weighting[' . $i . ']' |
|
197 | + 'weighting['.$i.']' |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | $answer_number = $form->addElement( |
201 | - 'text', 'counter[' . $i . ']', null, ' value = "' . $i . '"' |
|
201 | + 'text', 'counter['.$i.']', null, ' value = "'.$i.'"' |
|
202 | 202 | ); |
203 | 203 | $answer_number->freeze(); |
204 | 204 | $form->addElement( |
205 | 205 | 'radio', 'correct', null, null, $i, 'class="checkbox"' |
206 | 206 | ); |
207 | 207 | |
208 | - $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editor_config); |
|
208 | + $form->addHtmlEditor('answer['.$i.']', null, null, true, $editor_config); |
|
209 | 209 | |
210 | 210 | $form->addRule( |
211 | - 'answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required' |
|
211 | + 'answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required' |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { |
215 | - $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config); |
|
215 | + $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config); |
|
216 | 216 | // Direct feedback |
217 | 217 | //Adding extra feedback fields |
218 | 218 | $group = array(); |
219 | - $group['try' . $i] = $form->createElement( |
|
219 | + $group['try'.$i] = $form->createElement( |
|
220 | 220 | 'checkbox', |
221 | - 'try' . $i, |
|
221 | + 'try'.$i, |
|
222 | 222 | null, |
223 | 223 | get_lang('TryAgain') |
224 | 224 | ); |
225 | - $group['lp' . $i] = $form->createElement( |
|
225 | + $group['lp'.$i] = $form->createElement( |
|
226 | 226 | 'select', |
227 | - 'lp' . $i, |
|
228 | - get_lang('SeeTheory') . ': ', |
|
227 | + 'lp'.$i, |
|
228 | + get_lang('SeeTheory').': ', |
|
229 | 229 | $select_lp_id |
230 | 230 | ); |
231 | - $group['destination' . $i] = $form->createElement( |
|
231 | + $group['destination'.$i] = $form->createElement( |
|
232 | 232 | 'select', |
233 | - 'destination' . $i, |
|
234 | - get_lang('GoToQuestion') . ': ', |
|
233 | + 'destination'.$i, |
|
234 | + get_lang('GoToQuestion').': ', |
|
235 | 235 | $select_question |
236 | 236 | ); |
237 | - $group['url' . $i] = $form->createElement( |
|
237 | + $group['url'.$i] = $form->createElement( |
|
238 | 238 | 'text', |
239 | - 'url' . $i, |
|
240 | - get_lang('Other') . ': ', |
|
239 | + 'url'.$i, |
|
240 | + get_lang('Other').': ', |
|
241 | 241 | array( |
242 | 242 | 'class' => 'col-md-2', |
243 | 243 | 'placeholder' => get_lang('Other') |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | 'scenario' |
251 | 251 | ); |
252 | 252 | } else { |
253 | - $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config); |
|
253 | + $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config); |
|
254 | 254 | } |
255 | - $form->addText('weighting[' . $i . ']', null, null, array('value' => '0')); |
|
255 | + $form->addText('weighting['.$i.']', null, null, array('value' => '0')); |
|
256 | 256 | $form->addHtml('</tr>'); |
257 | 257 | } |
258 | 258 | |
@@ -306,19 +306,19 @@ discard block |
||
306 | 306 | $nb_answers = $form->getSubmitValue('nb_answers'); |
307 | 307 | |
308 | 308 | for ($i = 1; $i <= $nb_answers; $i++) { |
309 | - $answer = trim($form->getSubmitValue('answer[' . $i . ']')); |
|
310 | - $comment = trim($form->getSubmitValue('comment[' . $i . ']')); |
|
311 | - $weighting = trim($form->getSubmitValue('weighting[' . $i . ']')); |
|
309 | + $answer = trim($form->getSubmitValue('answer['.$i.']')); |
|
310 | + $comment = trim($form->getSubmitValue('comment['.$i.']')); |
|
311 | + $weighting = trim($form->getSubmitValue('weighting['.$i.']')); |
|
312 | 312 | |
313 | 313 | $scenario = $form->getSubmitValue('scenario'); |
314 | 314 | |
315 | 315 | //$list_destination = $form -> getSubmitValue('destination'.$i); |
316 | 316 | //$destination_str = $form -> getSubmitValue('destination'.$i); |
317 | 317 | |
318 | - $try = $scenario['try' . $i]; |
|
319 | - $lp = $scenario['lp' . $i]; |
|
320 | - $destination = $scenario['destination' . $i]; |
|
321 | - $url = trim($scenario['url' . $i]); |
|
318 | + $try = $scenario['try'.$i]; |
|
319 | + $lp = $scenario['lp'.$i]; |
|
320 | + $destination = $scenario['destination'.$i]; |
|
321 | + $url = trim($scenario['url'.$i]); |
|
322 | 322 | |
323 | 323 | /* |
324 | 324 | How we are going to parse the destination value |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
369 | - $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url; |
|
369 | + $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
370 | 370 | $objAnswer->createAnswer( |
371 | 371 | $answer, |
372 | 372 | $goodAnswer, |
@@ -400,12 +400,12 @@ discard block |
||
400 | 400 | $score = null |
401 | 401 | ) { |
402 | 402 | $header = parent::return_header($feedback_type, $counter, $score); |
403 | - $header .= '<table class="' . $this->question_table_class . '"> |
|
403 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
404 | 404 | <tr> |
405 | - <th>' . get_lang("Choice") . '</th> |
|
406 | - <th>' . get_lang("ExpectedChoice") . '</th> |
|
407 | - <th>' . get_lang("Answer") . '</th>'; |
|
408 | - $header .= '<th>' . get_lang("Comment") . '</th>'; |
|
405 | + <th>' . get_lang("Choice").'</th> |
|
406 | + <th>' . get_lang("ExpectedChoice").'</th> |
|
407 | + <th>' . get_lang("Answer").'</th>'; |
|
408 | + $header .= '<th>'.get_lang("Comment").'</th>'; |
|
409 | 409 | $header .= '</tr>'; |
410 | 410 | |
411 | 411 | return $header; |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | if ($correct) { |
470 | 470 | $sql = "UPDATE $tbl_quiz_question |
471 | 471 | SET ponderation = (ponderation + $score) |
472 | - WHERE c_id = $course_id AND id = " . $question_id; |
|
472 | + WHERE c_id = $course_id AND id = ".$question_id; |
|
473 | 473 | Database::query($sql); |
474 | 474 | } |
475 | 475 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | |
31 | 31 | // Query db for answers |
32 | 32 | if ($answer_type==HOT_SPOT_DELINEATION) { |
33 | - $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
33 | + $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
34 | 34 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id"; |
35 | 35 | } else { |
36 | - $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
36 | + $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
37 | 37 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id"; |
38 | 38 | } |
39 | 39 | $result = Database::query($sql); |
@@ -74,37 +74,37 @@ discard block |
||
74 | 74 | $hotSpot['id'] = $hotspot['id']; |
75 | 75 | $hotSpot['answer'] = $hotspot['answer']; |
76 | 76 | |
77 | - // Square or rectancle |
|
78 | - if ($hotspot['hotspot_type'] == 'square' ) |
|
79 | - { |
|
77 | + // Square or rectancle |
|
78 | + if ($hotspot['hotspot_type'] == 'square' ) |
|
79 | + { |
|
80 | 80 | $hotSpot['type'] = 'square'; |
81 | - } |
|
82 | - // Circle or ovale |
|
83 | - if ($hotspot['hotspot_type'] == 'circle') |
|
84 | - { |
|
81 | + } |
|
82 | + // Circle or ovale |
|
83 | + if ($hotspot['hotspot_type'] == 'circle') |
|
84 | + { |
|
85 | 85 | $hotSpot['type'] = 'circle'; |
86 | - } |
|
87 | - // Polygon |
|
88 | - if ($hotspot['hotspot_type'] == 'poly') |
|
89 | - { |
|
86 | + } |
|
87 | + // Polygon |
|
88 | + if ($hotspot['hotspot_type'] == 'poly') |
|
89 | + { |
|
90 | 90 | $hotSpot['type'] = 'poly'; |
91 | - } |
|
92 | - // Delineation |
|
93 | - if ($hotspot['hotspot_type'] == 'delineation') |
|
94 | - { |
|
91 | + } |
|
92 | + // Delineation |
|
93 | + if ($hotspot['hotspot_type'] == 'delineation') |
|
94 | + { |
|
95 | 95 | $hotSpot['type'] = 'delineation'; |
96 | - } |
|
97 | - // No error |
|
98 | - if ($hotspot['hotspot_type'] == 'noerror') |
|
99 | - { |
|
96 | + } |
|
97 | + // No error |
|
98 | + if ($hotspot['hotspot_type'] == 'noerror') |
|
99 | + { |
|
100 | 100 | $hotSpot['type'] = 'noerror'; |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - // This is a good answer, count + 1 for nmbr of clicks |
|
104 | - if ($hotspot['hotspot_type'] > 0) |
|
105 | - { |
|
106 | - $nmbrTries++; |
|
107 | - } |
|
103 | + // This is a good answer, count + 1 for nmbr of clicks |
|
104 | + if ($hotspot['hotspot_type'] > 0) |
|
105 | + { |
|
106 | + $nmbrTries++; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | $hotSpot['coord'] = $hotspot['hotspot_coordinates']; |
110 | 110 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | session_cache_limiter("none"); |
12 | 12 | |
13 | 13 | require '../inc/global.inc.php'; |
14 | -require api_get_path(LIBRARY_PATH) . 'geometry.lib.php'; |
|
14 | +require api_get_path(LIBRARY_PATH).'geometry.lib.php'; |
|
15 | 15 | |
16 | 16 | // set vars |
17 | 17 | $questionId = intval($_GET['modifyAnswers']); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $course_id = api_get_course_int_id(); |
30 | 30 | |
31 | 31 | // Query db for answers |
32 | -if ($answer_type==HOT_SPOT_DELINEATION) { |
|
32 | +if ($answer_type == HOT_SPOT_DELINEATION) { |
|
33 | 33 | $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
34 | 34 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id"; |
35 | 35 | } else { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $hotSpot['answer'] = $hotspot['answer']; |
76 | 76 | |
77 | 77 | // Square or rectancle |
78 | - if ($hotspot['hotspot_type'] == 'square' ) |
|
78 | + if ($hotspot['hotspot_type'] == 'square') |
|
79 | 79 | { |
80 | 80 | $hotSpot['type'] = 'square'; |
81 | 81 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | //Event::event_download($doc_url); |
24 | 24 | if (isset($_course['path'])) { |
25 | 25 | $course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
26 | - $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
26 | + $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
27 | 27 | } else { |
28 | 28 | $course_path = api_get_path(SYS_COURSE_PATH).$cid.'/document'; |
29 | - $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
29 | + $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if(!is_file($full_file_name)) { |
33 | - exit; |
|
33 | + exit; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | if (!Security::check_abs_path($full_file_name, $course_path.'/')) { |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | $extension=strtolower($extension[sizeof($extension)-1]); |
42 | 42 | |
43 | 43 | switch($extension) { |
44 | - case 'gz': $content_type='application/x-gzip'; break; |
|
45 | - case 'zip': $content_type='application/zip'; break; |
|
46 | - case 'pdf': $content_type='application/pdf'; break; |
|
47 | - case 'png': $content_type='image/png'; break; |
|
48 | - case 'gif': $content_type='image/gif'; break; |
|
49 | - case 'jpg': $content_type='image/jpeg'; break; |
|
50 | - case 'txt': $content_type='text/plain'; break; |
|
51 | - case 'htm': $content_type='text/html'; break; |
|
52 | - case 'html': $content_type='text/html'; break; |
|
53 | - default: $content_type='application/octet-stream'; break; |
|
44 | + case 'gz': $content_type='application/x-gzip'; break; |
|
45 | + case 'zip': $content_type='application/zip'; break; |
|
46 | + case 'pdf': $content_type='application/pdf'; break; |
|
47 | + case 'png': $content_type='image/png'; break; |
|
48 | + case 'gif': $content_type='image/gif'; break; |
|
49 | + case 'jpg': $content_type='image/jpeg'; break; |
|
50 | + case 'txt': $content_type='text/plain'; break; |
|
51 | + case 'htm': $content_type='text/html'; break; |
|
52 | + case 'html': $content_type='text/html'; break; |
|
53 | + default: $content_type='application/octet-stream'; break; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | header('Content-disposition: filename='.$filename); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | */ |
69 | 69 | |
70 | 70 | if ($content_type == 'text/html') { |
71 | - $directory_name = dirname($full_file_name); |
|
71 | + $directory_name = dirname($full_file_name); |
|
72 | 72 | |
73 | - $dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name); |
|
73 | + $dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name); |
|
74 | 74 | |
75 | - if($dir[strlen($dir)-1] != '/') { |
|
76 | - $dir.='/'; |
|
77 | - } |
|
75 | + if($dir[strlen($dir)-1] != '/') { |
|
76 | + $dir.='/'; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | - //Parse whole file at one |
|
81 | - $fp = fopen($full_file_name, "r"); |
|
82 | - $file_content = fread ($fp, filesize ($full_file_name)); |
|
83 | - fclose($fp); |
|
84 | - //$file_content = api_replace_parameter($dir, $file_content, "src"); |
|
85 | - //$file_content = api_replace_parameter($dir, $file_content, "href"); |
|
80 | + //Parse whole file at one |
|
81 | + $fp = fopen($full_file_name, "r"); |
|
82 | + $file_content = fread ($fp, filesize ($full_file_name)); |
|
83 | + fclose($fp); |
|
84 | + //$file_content = api_replace_parameter($dir, $file_content, "src"); |
|
85 | + //$file_content = api_replace_parameter($dir, $file_content, "href"); |
|
86 | 86 | |
87 | - /* |
|
87 | + /* |
|
88 | 88 | //parse line per line |
89 | 89 | $file_content_array = file($full_file_name); |
90 | 90 | |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | |
99 | 99 | |
100 | 100 | $exercisePath = api_get_self(); |
101 | - $exfile = explode('/',$exercisePath); |
|
102 | - $exfile = $exfile[sizeof($exfile)-1]; |
|
103 | - $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile)); |
|
104 | - $exercisePath = $exercisePath; |
|
101 | + $exfile = explode('/',$exercisePath); |
|
102 | + $exfile = $exfile[sizeof($exfile)-1]; |
|
103 | + $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile)); |
|
104 | + $exercisePath = $exercisePath; |
|
105 | 105 | |
106 | - $content = $file_content; |
|
107 | - $mit = "function Finish(){"; |
|
106 | + $content = $file_content; |
|
107 | + $mit = "function Finish(){"; |
|
108 | 108 | |
109 | - $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n". |
|
110 | - "function mySaveScore() // This function included by Dokeos System\n". |
|
109 | + $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n". |
|
110 | + "function mySaveScore() // This function included by Dokeos System\n". |
|
111 | 111 | "{\n". |
112 | 112 | " if (SaveScoreVariable==0)\n". |
113 | 113 | " {\n". |
@@ -125,23 +125,23 @@ discard block |
||
125 | 125 | "// Must be included \n". |
126 | 126 | "function Finish(){\n". |
127 | 127 | " mySaveScore();"; |
128 | - $newcontent = str_replace($mit,$js_content,$content); |
|
128 | + $newcontent = str_replace($mit,$js_content,$content); |
|
129 | 129 | |
130 | - $prehref="javascript:void(0);"; |
|
131 | - $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; |
|
132 | - $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
130 | + $prehref="javascript:void(0);"; |
|
131 | + $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; |
|
132 | + $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
133 | 133 | |
134 | 134 | |
135 | - $prehref="class=\"GridNum\" onclick="; |
|
136 | - $posthref="class=\"GridNum\" onMouseover="; |
|
137 | - $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
135 | + $prehref="class=\"GridNum\" onclick="; |
|
136 | + $posthref="class=\"GridNum\" onMouseover="; |
|
137 | + $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
138 | 138 | |
139 | 139 | |
140 | - header('Content-length: '.strlen($newcontent)); |
|
141 | - // Dipsp. |
|
142 | - echo $newcontent; |
|
140 | + header('Content-length: '.strlen($newcontent)); |
|
141 | + // Dipsp. |
|
142 | + echo $newcontent; |
|
143 | 143 | |
144 | - exit(); |
|
144 | + exit(); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | //normal case, all non-html files |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | session_cache_limiter('public'); |
13 | 13 | |
14 | 14 | require_once '../inc/global.inc.php'; |
15 | -$this_section=SECTION_COURSES; |
|
15 | +$this_section = SECTION_COURSES; |
|
16 | 16 | |
17 | 17 | $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
18 | 18 | |
19 | -$doc_url=str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldecode($_GET['doc_url'])); |
|
20 | -$filename=basename($doc_url); |
|
19 | +$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($_GET['doc_url'])); |
|
20 | +$filename = basename($doc_url); |
|
21 | 21 | |
22 | 22 | // launch event |
23 | 23 | //Event::event_download($doc_url); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $full_file_name = $course_path.Security::remove_XSS($doc_url); |
30 | 30 | } |
31 | 31 | |
32 | -if(!is_file($full_file_name)) { |
|
32 | +if (!is_file($full_file_name)) { |
|
33 | 33 | exit; |
34 | 34 | } |
35 | 35 | |
@@ -37,26 +37,26 @@ discard block |
||
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | -$extension=explode('.',$filename); |
|
41 | -$extension=strtolower($extension[sizeof($extension)-1]); |
|
42 | - |
|
43 | -switch($extension) { |
|
44 | - case 'gz': $content_type='application/x-gzip'; break; |
|
45 | - case 'zip': $content_type='application/zip'; break; |
|
46 | - case 'pdf': $content_type='application/pdf'; break; |
|
47 | - case 'png': $content_type='image/png'; break; |
|
48 | - case 'gif': $content_type='image/gif'; break; |
|
49 | - case 'jpg': $content_type='image/jpeg'; break; |
|
50 | - case 'txt': $content_type='text/plain'; break; |
|
51 | - case 'htm': $content_type='text/html'; break; |
|
52 | - case 'html': $content_type='text/html'; break; |
|
53 | - default: $content_type='application/octet-stream'; break; |
|
40 | +$extension = explode('.', $filename); |
|
41 | +$extension = strtolower($extension[sizeof($extension) - 1]); |
|
42 | + |
|
43 | +switch ($extension) { |
|
44 | + case 'gz': $content_type = 'application/x-gzip'; break; |
|
45 | + case 'zip': $content_type = 'application/zip'; break; |
|
46 | + case 'pdf': $content_type = 'application/pdf'; break; |
|
47 | + case 'png': $content_type = 'image/png'; break; |
|
48 | + case 'gif': $content_type = 'image/gif'; break; |
|
49 | + case 'jpg': $content_type = 'image/jpeg'; break; |
|
50 | + case 'txt': $content_type = 'text/plain'; break; |
|
51 | + case 'htm': $content_type = 'text/html'; break; |
|
52 | + case 'html': $content_type = 'text/html'; break; |
|
53 | + default: $content_type = 'application/octet-stream'; break; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | header('Content-disposition: filename='.$filename); |
57 | 57 | header('Content-Type: '.$content_type); |
58 | -header('Expires: '.gmdate('D, d M Y H:i:s',time()+10).' GMT'); |
|
59 | -header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()+10).' GMT'); |
|
58 | +header('Expires: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT'); |
|
59 | +header('Last-Modified: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT'); |
|
60 | 60 | |
61 | 61 | /* |
62 | 62 | Dynamic parsing section |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | if ($content_type == 'text/html') { |
71 | 71 | $directory_name = dirname($full_file_name); |
72 | 72 | |
73 | - $dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name); |
|
73 | + $dir = str_replace(array('\\', $_configuration['root_sys']."courses/".$_course['path'].'/document'), array('/', ''), $directory_name); |
|
74 | 74 | |
75 | - if($dir[strlen($dir)-1] != '/') { |
|
76 | - $dir.='/'; |
|
75 | + if ($dir[strlen($dir) - 1] != '/') { |
|
76 | + $dir .= '/'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | //Parse whole file at one |
81 | 81 | $fp = fopen($full_file_name, "r"); |
82 | - $file_content = fread ($fp, filesize ($full_file_name)); |
|
82 | + $file_content = fread($fp, filesize($full_file_name)); |
|
83 | 83 | fclose($fp); |
84 | 84 | //$file_content = api_replace_parameter($dir, $file_content, "src"); |
85 | 85 | //$file_content = api_replace_parameter($dir, $file_content, "href"); |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | |
99 | 99 | |
100 | 100 | $exercisePath = api_get_self(); |
101 | - $exfile = explode('/',$exercisePath); |
|
102 | - $exfile = $exfile[sizeof($exfile)-1]; |
|
103 | - $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile)); |
|
101 | + $exfile = explode('/', $exercisePath); |
|
102 | + $exfile = $exfile[sizeof($exfile) - 1]; |
|
103 | + $exercisePath = substr($exercisePath, 0, strpos($exercisePath, $exfile)); |
|
104 | 104 | $exercisePath = $exercisePath; |
105 | 105 | |
106 | 106 | $content = $file_content; |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | "// Must be included \n". |
126 | 126 | "function Finish(){\n". |
127 | 127 | " mySaveScore();"; |
128 | - $newcontent = str_replace($mit,$js_content,$content); |
|
128 | + $newcontent = str_replace($mit, $js_content, $content); |
|
129 | 129 | |
130 | - $prehref="javascript:void(0);"; |
|
131 | - $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; |
|
132 | - $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
130 | + $prehref = "javascript:void(0);"; |
|
131 | + $posthref = $_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; |
|
132 | + $newcontent = str_replace($prehref, $posthref, $newcontent); |
|
133 | 133 | |
134 | 134 | |
135 | - $prehref="class=\"GridNum\" onclick="; |
|
136 | - $posthref="class=\"GridNum\" onMouseover="; |
|
137 | - $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
135 | + $prehref = "class=\"GridNum\" onclick="; |
|
136 | + $posthref = "class=\"GridNum\" onMouseover="; |
|
137 | + $newcontent = str_replace($prehref, $posthref, $newcontent); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | header('Content-length: '.strlen($newcontent)); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | //normal case, all non-html files |
148 | 148 | //header('Content-length: '.filesize($full_file_name)); |
149 | -$fp=fopen($full_file_name,'rb'); |
|
149 | +$fp = fopen($full_file_name, 'rb'); |
|
150 | 150 | fpassthru($fp); |
151 | 151 | fclose($fp); |
152 | 152 | ?> |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | { |
24 | 24 | $return = array(); |
25 | 25 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
26 | - $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
26 | + $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
27 | 27 | |
28 | 28 | $cid = api_get_course_id(); |
29 | 29 | $course_id = api_get_course_int_id(); |
30 | 30 | //$user_id = intval($user_id); |
31 | 31 | $user_id = null; |
32 | - $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' '; |
|
32 | + $session_id_and = ' AND te.session_id = '.api_get_session_id().' '; |
|
33 | 33 | $hotpotato_name = Database::escape_string($hotpotato_name); |
34 | 34 | |
35 | 35 | if (!empty($exercise_id)) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($user_id)) { |
40 | - $sql="SELECT firstname as userpart1, lastname as userpart2 , |
|
40 | + $sql = "SELECT firstname as userpart1, lastname as userpart2 , |
|
41 | 41 | email, |
42 | 42 | tth.exe_name, |
43 | 43 | tth.exe_result, |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | tth.exe_name = '$hotpotato_name' |
50 | 50 | ORDER BY tth.c_id ASC, tth.exe_date ASC"; |
51 | 51 | } else { |
52 | - $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' '; |
|
52 | + $user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' '; |
|
53 | 53 | // get only this user's results |
54 | 54 | |
55 | 55 | $sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date |
56 | 56 | FROM $TBL_TRACK_HOTPOTATOES |
57 | 57 | WHERE |
58 | - exe_user_id = '" . $user_id . "' AND |
|
58 | + exe_user_id = '".$user_id."' AND |
|
59 | 59 | c_id = $course_id AND |
60 | 60 | tth.exe_name = '$hotpotato_name' |
61 | 61 | ORDER BY c_id ASC, exe_date ASC"; |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | $results = array(); |
65 | 65 | |
66 | 66 | $resx = Database::query($sql); |
67 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
67 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
68 | 68 | $results[] = $rowx; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $hpresults = array(); |
72 | 72 | $resx = Database::query($sql); |
73 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
73 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
74 | 74 | $hpresults[] = $rowx; |
75 | 75 | } |
76 | 76 | |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | |
90 | 90 | // Print the Result of Hotpotatoes Tests |
91 | 91 | if (is_array($hpresults)) { |
92 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
92 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
93 | 93 | $return[$i] = array(); |
94 | 94 | $title = GetQuizName($hpresults[$i]['exe_name'], $document_path); |
95 | - if ($title =='') { |
|
95 | + if ($title == '') { |
|
96 | 96 | $title = basename($hpresults[$i]['exe_name']); |
97 | 97 | } |
98 | - if(empty($user_id)) { |
|
98 | + if (empty($user_id)) { |
|
99 | 99 | $return[$i]['email'] = $hpresults[$i]['email']; |
100 | 100 | $return[$i]['first_name'] = $hpresults[$i]['userpart1']; |
101 | 101 | $return[$i]['last_name'] = $hpresults[$i]['userpart2']; |
102 | 102 | } |
103 | 103 | $return[$i]['title'] = $title; |
104 | - $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
104 | + $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
105 | 105 | |
106 | 106 | $return[$i]['result'] = $hpresults[$i]['exe_result']; |
107 | 107 | $return[$i]['max'] = $hpresults[$i]['exe_weighting']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param boolean Whether to include user fields or not |
121 | 121 | * @return boolean False on error |
122 | 122 | */ |
123 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
123 | + public function exportCompleteReportCSV($document_path = '', $hotpotato_name) |
|
124 | 124 | { |
125 | 125 | global $charset; |
126 | 126 | $this->getExercisesReporting($document_path, $hotpotato_name); |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | $data = ''; |
132 | 132 | |
133 | 133 | if (api_is_western_name_order()) { |
134 | - if(!empty($this->results[0]['first_name'])) { |
|
134 | + if (!empty($this->results[0]['first_name'])) { |
|
135 | 135 | $data .= get_lang('FirstName').';'; |
136 | 136 | } |
137 | - if(!empty($this->results[0]['last_name'])) { |
|
137 | + if (!empty($this->results[0]['last_name'])) { |
|
138 | 138 | $data .= get_lang('LastName').';'; |
139 | 139 | } |
140 | 140 | } else { |
141 | - if(!empty($this->results[0]['last_name'])) { |
|
141 | + if (!empty($this->results[0]['last_name'])) { |
|
142 | 142 | $data .= get_lang('LastName').';'; |
143 | 143 | } |
144 | - if(!empty($this->results[0]['first_name'])) { |
|
144 | + if (!empty($this->results[0]['first_name'])) { |
|
145 | 145 | $data .= get_lang('FirstName').';'; |
146 | 146 | } |
147 | 147 | } |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | $data .= "\n"; |
164 | 164 | |
165 | 165 | //results |
166 | - foreach($this->results as $row) { |
|
166 | + foreach ($this->results as $row) { |
|
167 | 167 | if (api_is_western_name_order()) { |
168 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
168 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
170 | 170 | } else { |
171 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
171 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
173 | 173 | } |
174 | 174 | |
175 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
175 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
176 | 176 | |
177 | 177 | /*if ($export_user_fields) { |
178 | 178 | //show user fields data, if any, for this user |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | } |
183 | 183 | }*/ |
184 | 184 | |
185 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
185 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | + $data .= str_replace("\r\n", ' ', $row['exe_date']).';'; |
|
187 | + $data .= str_replace("\r\n", ' ', $row['result']).';'; |
|
188 | + $data .= str_replace("\r\n", ' ', $row['max']).';'; |
|
189 | 189 | $data .= "\n"; |
190 | 190 | } |
191 | 191 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | header('Content-Description: '.$filename); |
208 | 208 | header('Content-transfer-encoding: binary'); |
209 | 209 | // @todo add this utf-8 header for all csv files |
210 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
210 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | 211 | echo $data; |
212 | 212 | return true; |
213 | 213 | } |
@@ -249,25 +249,25 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | if ($with_column_user) { |
252 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
252 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email')); |
|
253 | 253 | $column++; |
254 | 254 | |
255 | 255 | if (api_is_western_name_order()) { |
256 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
256 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
257 | 257 | $column++; |
258 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
258 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
259 | 259 | $column++; |
260 | 260 | } else { |
261 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
261 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
262 | 262 | $column++; |
263 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
263 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
264 | 264 | $column++; |
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | 268 | if ($export_user_fields) { |
269 | 269 | //show user fields section with a big th colspan that spans over all fields |
270 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
270 | + $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1); |
|
271 | 271 | |
272 | 272 | //show the fields names for user fields |
273 | 273 | foreach ($extra_user_fields as $field) { |
@@ -276,63 +276,63 @@ discard block |
||
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
279 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title')); |
|
280 | 280 | $column++; |
281 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
281 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate')); |
|
282 | 282 | $column++; |
283 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
|
283 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate')); |
|
284 | 284 | $column++; |
285 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
285 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
286 | 286 | $column++; |
287 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
287 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score')); |
|
288 | 288 | $column++; |
289 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
289 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total')); |
|
290 | 290 | $column++; |
291 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
|
291 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status')); |
|
292 | 292 | $line++; |
293 | 293 | |
294 | 294 | foreach ($this->results as $row) { |
295 | 295 | $column = 0; |
296 | 296 | |
297 | 297 | if ($with_column_user) { |
298 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
298 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
299 | 299 | $column++; |
300 | 300 | |
301 | 301 | if (api_is_western_name_order()) { |
302 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
302 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
303 | 303 | $column++; |
304 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
304 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
305 | 305 | $column++; |
306 | 306 | } else { |
307 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
307 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
308 | 308 | $column++; |
309 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
309 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
310 | 310 | $column++; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | 314 | if ($export_user_fields) { |
315 | 315 | //show user fields data, if any, for this user |
316 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | - foreach($user_fields_values as $value) { |
|
318 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
316 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true); |
|
317 | + foreach ($user_fields_values as $value) { |
|
318 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | 319 | $column++; |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
323 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | 324 | $column++; |
325 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
325 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']); |
|
326 | 326 | $column++; |
327 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
327 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']); |
|
328 | 328 | $column++; |
329 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
329 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['duration']); |
|
330 | 330 | $column++; |
331 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
331 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['result']); |
|
332 | 332 | $column++; |
333 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
333 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['max']); |
|
334 | 334 | $column++; |
335 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
|
335 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['status']); |
|
336 | 336 | $line++; |
337 | 337 | } |
338 | 338 |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | //stores the results |
15 | 15 | private $results = array(); |
16 | 16 | |
17 | - /** |
|
18 | - * Gets the results of all students (or just one student if access is limited) |
|
19 | - * @param string The document path (for HotPotatoes retrieval) |
|
20 | - * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | - * @param string $document_path |
|
22 | - */ |
|
23 | - public function getExercisesReporting($document_path, $hotpotato_name) |
|
17 | + /** |
|
18 | + * Gets the results of all students (or just one student if access is limited) |
|
19 | + * @param string The document path (for HotPotatoes retrieval) |
|
20 | + * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | + * @param string $document_path |
|
22 | + */ |
|
23 | + public function getExercisesReporting($document_path, $hotpotato_name) |
|
24 | 24 | { |
25 | - $return = array(); |
|
25 | + $return = array(); |
|
26 | 26 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
27 | 27 | $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
28 | 28 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $hotpotato_name = Database::escape_string($hotpotato_name); |
35 | 35 | |
36 | 36 | if (!empty($exercise_id)) { |
37 | - $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
37 | + $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if (empty($user_id)) { |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | $this->results = $return; |
112 | 112 | |
113 | 113 | return true; |
114 | - } |
|
114 | + } |
|
115 | 115 | |
116 | 116 | |
117 | - /** |
|
118 | - * Exports the complete report as a CSV file |
|
119 | - * @param string Document path inside the document tool |
|
120 | - * @param integer Optional user ID |
|
121 | - * @param boolean Whether to include user fields or not |
|
122 | - * @return boolean False on error |
|
123 | - */ |
|
124 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
117 | + /** |
|
118 | + * Exports the complete report as a CSV file |
|
119 | + * @param string Document path inside the document tool |
|
120 | + * @param integer Optional user ID |
|
121 | + * @param boolean Whether to include user fields or not |
|
122 | + * @return boolean False on error |
|
123 | + */ |
|
124 | + public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
125 | 125 | { |
126 | - global $charset; |
|
127 | - $this->getExercisesReporting($document_path, $hotpotato_name); |
|
128 | - $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
129 | - if (!empty($user_id)) { |
|
130 | - $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
131 | - } |
|
132 | - $data = ''; |
|
126 | + global $charset; |
|
127 | + $this->getExercisesReporting($document_path, $hotpotato_name); |
|
128 | + $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
129 | + if (!empty($user_id)) { |
|
130 | + $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
131 | + } |
|
132 | + $data = ''; |
|
133 | 133 | |
134 | 134 | if (api_is_western_name_order()) { |
135 | 135 | if(!empty($this->results[0]['first_name'])) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | $data .= get_lang('Email').';'; |
150 | 150 | |
151 | - /*if ($export_user_fields) { |
|
151 | + /*if ($export_user_fields) { |
|
152 | 152 | //show user fields section with a big th colspan that spans over all fields |
153 | 153 | $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
154 | 154 | $num = count($extra_user_fields); |
@@ -157,25 +157,25 @@ discard block |
||
157 | 157 | } |
158 | 158 | }*/ |
159 | 159 | |
160 | - $data .= get_lang('Title').';'; |
|
161 | - $data .= get_lang('StartDate').';'; |
|
162 | - $data .= get_lang('Score').';'; |
|
163 | - $data .= get_lang('Total').';'; |
|
164 | - $data .= "\n"; |
|
160 | + $data .= get_lang('Title').';'; |
|
161 | + $data .= get_lang('StartDate').';'; |
|
162 | + $data .= get_lang('Score').';'; |
|
163 | + $data .= get_lang('Total').';'; |
|
164 | + $data .= "\n"; |
|
165 | 165 | |
166 | - //results |
|
167 | - foreach($this->results as $row) { |
|
166 | + //results |
|
167 | + foreach($this->results as $row) { |
|
168 | 168 | if (api_is_western_name_order()) { |
169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
170 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
169 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
170 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
171 | 171 | } else { |
172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
173 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
172 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
173 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
177 | 177 | |
178 | - /*if ($export_user_fields) { |
|
178 | + /*if ($export_user_fields) { |
|
179 | 179 | //show user fields data, if any, for this user |
180 | 180 | $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
181 | 181 | foreach($user_fields_values as $value) { |
@@ -183,40 +183,40 @@ discard block |
||
183 | 183 | } |
184 | 184 | }*/ |
185 | 185 | |
186 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
187 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
188 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
189 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
190 | - $data .= "\n"; |
|
191 | - } |
|
192 | - |
|
193 | - //output the results |
|
194 | - $len = strlen($data); |
|
195 | - header('Content-type: application/octet-stream'); |
|
196 | - header('Content-Type: application/force-download'); |
|
197 | - header('Content-length: '.$len); |
|
198 | - if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
199 | - header('Content-Disposition: filename= '.$filename); |
|
200 | - } else { |
|
201 | - header('Content-Disposition: attachment; filename= '.$filename); |
|
202 | - } |
|
203 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
204 | - header('Pragma: '); |
|
205 | - header('Cache-Control: '); |
|
206 | - header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
207 | - } |
|
208 | - header('Content-Description: '.$filename); |
|
209 | - header('Content-transfer-encoding: binary'); |
|
210 | - // @todo add this utf-8 header for all csv files |
|
211 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
212 | - echo $data; |
|
213 | - return true; |
|
214 | - } |
|
215 | - |
|
216 | - /** |
|
217 | - * Exports the complete report as an XLS file |
|
218 | - * @return boolean False on error |
|
219 | - */ |
|
186 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
187 | + $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
188 | + $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
189 | + $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
190 | + $data .= "\n"; |
|
191 | + } |
|
192 | + |
|
193 | + //output the results |
|
194 | + $len = strlen($data); |
|
195 | + header('Content-type: application/octet-stream'); |
|
196 | + header('Content-Type: application/force-download'); |
|
197 | + header('Content-length: '.$len); |
|
198 | + if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
199 | + header('Content-Disposition: filename= '.$filename); |
|
200 | + } else { |
|
201 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
202 | + } |
|
203 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
204 | + header('Pragma: '); |
|
205 | + header('Cache-Control: '); |
|
206 | + header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
207 | + } |
|
208 | + header('Content-Description: '.$filename); |
|
209 | + header('Content-transfer-encoding: binary'); |
|
210 | + // @todo add this utf-8 header for all csv files |
|
211 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
212 | + echo $data; |
|
213 | + return true; |
|
214 | + } |
|
215 | + |
|
216 | + /** |
|
217 | + * Exports the complete report as an XLS file |
|
218 | + * @return boolean False on error |
|
219 | + */ |
|
220 | 220 | public function exportCompleteReportXLS( |
221 | 221 | $document_path = '', |
222 | 222 | $user_id = null, |
@@ -225,37 +225,37 @@ discard block |
||
225 | 225 | $exercise_id = 0, |
226 | 226 | $hotpotato_name = null |
227 | 227 | ) { |
228 | - global $charset; |
|
229 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
230 | - $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
231 | - if (!empty($user_id)) { |
|
232 | - $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
233 | - } |
|
228 | + global $charset; |
|
229 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
230 | + $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
231 | + if (!empty($user_id)) { |
|
232 | + $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
233 | + } |
|
234 | 234 | |
235 | 235 | $spreadsheet = new PHPExcel(); |
236 | 236 | $spreadsheet->setActiveSheetIndex(0); |
237 | 237 | $worksheet = $spreadsheet->getActiveSheet(); |
238 | 238 | |
239 | 239 | |
240 | - $line = 0; |
|
241 | - $column = 0; //skip the first column (row titles) |
|
240 | + $line = 0; |
|
241 | + $column = 0; //skip the first column (row titles) |
|
242 | 242 | |
243 | - // check if exists column 'user' |
|
244 | - $with_column_user = false; |
|
245 | - foreach ($this->results as $result) { |
|
246 | - if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
247 | - $with_column_user = true; |
|
248 | - break; |
|
249 | - } |
|
250 | - } |
|
243 | + // check if exists column 'user' |
|
244 | + $with_column_user = false; |
|
245 | + foreach ($this->results as $result) { |
|
246 | + if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
247 | + $with_column_user = true; |
|
248 | + break; |
|
249 | + } |
|
250 | + } |
|
251 | 251 | |
252 | - if ($with_column_user) { |
|
253 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
254 | - $column++; |
|
252 | + if ($with_column_user) { |
|
253 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
254 | + $column++; |
|
255 | 255 | |
256 | 256 | if (api_is_western_name_order()) { |
257 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
258 | - $column++; |
|
257 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
258 | + $column++; |
|
259 | 259 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
260 | 260 | $column++; |
261 | 261 | } else { |
@@ -264,36 +264,36 @@ discard block |
||
264 | 264 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
265 | 265 | $column++; |
266 | 266 | } |
267 | - } |
|
267 | + } |
|
268 | 268 | |
269 | - if ($export_user_fields) { |
|
270 | - //show user fields section with a big th colspan that spans over all fields |
|
271 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
269 | + if ($export_user_fields) { |
|
270 | + //show user fields section with a big th colspan that spans over all fields |
|
271 | + $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
272 | 272 | |
273 | - //show the fields names for user fields |
|
274 | - foreach ($extra_user_fields as $field) { |
|
275 | - $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
276 | - $column++; |
|
277 | - } |
|
278 | - } |
|
273 | + //show the fields names for user fields |
|
274 | + foreach ($extra_user_fields as $field) { |
|
275 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
276 | + $column++; |
|
277 | + } |
|
278 | + } |
|
279 | 279 | |
280 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
281 | - $column++; |
|
282 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
280 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
281 | + $column++; |
|
282 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
283 | 283 | $column++; |
284 | 284 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
285 | 285 | $column++; |
286 | 286 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
287 | - $column++; |
|
288 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
289 | - $column++; |
|
290 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
291 | - $column++; |
|
287 | + $column++; |
|
288 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
289 | + $column++; |
|
290 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
291 | + $column++; |
|
292 | 292 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
293 | - $line++; |
|
293 | + $line++; |
|
294 | 294 | |
295 | - foreach ($this->results as $row) { |
|
296 | - $column = 0; |
|
295 | + foreach ($this->results as $row) { |
|
296 | + $column = 0; |
|
297 | 297 | |
298 | 298 | if ($with_column_user) { |
299 | 299 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
@@ -310,38 +310,38 @@ discard block |
||
310 | 310 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
311 | 311 | $column++; |
312 | 312 | } |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - if ($export_user_fields) { |
|
316 | - //show user fields data, if any, for this user |
|
317 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
318 | - foreach($user_fields_values as $value) { |
|
319 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
320 | - $column++; |
|
321 | - } |
|
322 | - } |
|
315 | + if ($export_user_fields) { |
|
316 | + //show user fields data, if any, for this user |
|
317 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
318 | + foreach($user_fields_values as $value) { |
|
319 | + $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
320 | + $column++; |
|
321 | + } |
|
322 | + } |
|
323 | 323 | |
324 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
325 | - $column++; |
|
326 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
324 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
325 | + $column++; |
|
326 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
327 | 327 | $column++; |
328 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
328 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
329 | + $column++; |
|
330 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
331 | + $column++; |
|
332 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
333 | + $column++; |
|
334 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
329 | 335 | $column++; |
330 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
331 | - $column++; |
|
332 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
333 | - $column++; |
|
334 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
335 | - $column++; |
|
336 | 336 | $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
337 | - $line++; |
|
338 | - } |
|
337 | + $line++; |
|
338 | + } |
|
339 | 339 | |
340 | 340 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
341 | 341 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
342 | 342 | $writer->save($file); |
343 | 343 | DocumentManager::file_send_for_download($file, true, $filename); |
344 | 344 | |
345 | - return true; |
|
346 | - } |
|
345 | + return true; |
|
346 | + } |
|
347 | 347 | } |
@@ -607,10 +607,11 @@ |
||
607 | 607 | $current_width = $current_image_size['width']; |
608 | 608 | $current_height = $current_image_size['height']; |
609 | 609 | |
610 | - if ($current_width < $Max && $current_height < $Max) |
|
611 | - return true; |
|
612 | - elseif ($current_height == "") |
|
613 | - return false; |
|
610 | + if ($current_width < $Max && $current_height < $Max) { |
|
611 | + return true; |
|
612 | + } elseif ($current_height == "") { |
|
613 | + return false; |
|
614 | + } |
|
614 | 615 | |
615 | 616 | // Resize according to height. |
616 | 617 | if ($Dimension == "height") { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public $type; |
23 | 23 | public $level; |
24 | 24 | public $picture; |
25 | - public $exerciseList; // array with the list of exercises which this question is in |
|
25 | + public $exerciseList; // array with the list of exercises which this question is in |
|
26 | 26 | public $category_list; |
27 | 27 | public $parent_id; |
28 | 28 | public $category; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | 'multiple_answer_combination_true_false.class.php', |
48 | 48 | 'MultipleAnswerCombinationTrueFalse' |
49 | 49 | ), |
50 | - GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'), |
|
51 | - CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'), |
|
50 | + GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'), |
|
51 | + CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'), |
|
52 | 52 | UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'], |
53 | 53 | DRAGGABLE => ['Draggable.php', 'Draggable'], |
54 | 54 | MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'] |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | $id = intval($id); |
108 | 108 | |
109 | 109 | if (!empty($course_id)) { |
110 | - $course_info = api_get_course_info_by_id($course_id); |
|
110 | + $course_info = api_get_course_info_by_id($course_id); |
|
111 | 111 | } else { |
112 | 112 | $course_info = api_get_course_info(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | $course_id = $course_info['real_id']; |
116 | 116 | |
117 | - if (empty($course_id) || $course_id == -1 ) { |
|
117 | + if (empty($course_id) || $course_id == -1) { |
|
118 | 118 | |
119 | 119 | return false; |
120 | 120 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | public function selectPicturePath() |
270 | 270 | { |
271 | 271 | if (!empty($this->picture)) { |
272 | - return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture; |
|
272 | + return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | return false; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function updateTitle($title) |
308 | 308 | { |
309 | - $this->question=$title; |
|
309 | + $this->question = $title; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | // DO nothing |
406 | 406 | } else { |
407 | 407 | $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id) |
408 | - VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)"; |
|
408 | + VALUES (".api_get_course_int_id().", $question_id, $category_id)"; |
|
409 | 409 | Database::query($sql); |
410 | 410 | } |
411 | 411 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $sql = "SELECT count(*) AS nb FROM $table |
433 | 433 | WHERE |
434 | 434 | question_id = $question_id AND |
435 | - c_id=" . api_get_course_int_id(); |
|
435 | + c_id=".api_get_course_int_id(); |
|
436 | 436 | $res = Database::query($sql); |
437 | 437 | $row = Database::fetch_array($res); |
438 | 438 | if ($row['nb'] > 0) { |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | SET category_id = $category_id |
441 | 441 | WHERE |
442 | 442 | question_id = $question_id AND |
443 | - c_id = " . api_get_course_int_id(); |
|
443 | + c_id = ".api_get_course_int_id(); |
|
444 | 444 | Database::query($sql); |
445 | 445 | } else { |
446 | 446 | $sql = "INSERT INTO $table (c_id, question_id, category_id) |
447 | - VALUES (" . api_get_course_int_id().", $question_id, $category_id)"; |
|
447 | + VALUES (".api_get_course_int_id().", $question_id, $category_id)"; |
|
448 | 448 | Database::query($sql); |
449 | 449 | } |
450 | 450 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $sql = "DELETE FROM $table |
463 | 463 | WHERE |
464 | 464 | question_id = $question_id AND |
465 | - c_id = " . api_get_course_int_id(); |
|
465 | + c_id = ".api_get_course_int_id(); |
|
466 | 466 | Database::query($sql); |
467 | 467 | } |
468 | 468 | |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | ) { |
516 | 516 | // removes old answers |
517 | 517 | $sql = "DELETE FROM $TBL_REPONSES |
518 | - WHERE c_id = $course_id AND question_id = " . intval($this->id); |
|
518 | + WHERE c_id = $course_id AND question_id = ".intval($this->id); |
|
519 | 519 | Database::query($sql); |
520 | 520 | } |
521 | 521 | |
522 | - $this->type=$type; |
|
522 | + $this->type = $type; |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if (!file_exists($picturePath)) { |
544 | 544 | if (mkdir($picturePath, api_get_permissions_for_new_directories())) { |
545 | 545 | // document path |
546 | - $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document"; |
|
546 | + $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path']."/document"; |
|
547 | 547 | $path = str_replace($documentPath, '', $picturePath); |
548 | 548 | $title_path = basename($picturePath); |
549 | 549 | $doc_id = add_document($this->course, $path, 'folder', 0, $title_path); |
@@ -559,14 +559,14 @@ discard block |
||
559 | 559 | |
560 | 560 | // if the question has got an ID |
561 | 561 | if ($this->id) { |
562 | - $this->picture = 'quiz-' . $this->id . '.jpg'; |
|
562 | + $this->picture = 'quiz-'.$this->id.'.jpg'; |
|
563 | 563 | $o_img = new Image($Picture); |
564 | - $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg'); |
|
564 | + $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg'); |
|
565 | 565 | $document_id = add_document( |
566 | 566 | $this->course, |
567 | - '/images/' . $this->picture, |
|
567 | + '/images/'.$this->picture, |
|
568 | 568 | 'file', |
569 | - filesize($picturePath . '/' . $this->picture), |
|
569 | + filesize($picturePath.'/'.$this->picture), |
|
570 | 570 | $this->picture |
571 | 571 | ); |
572 | 572 | if ($document_id) { |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | // if the question has an ID |
601 | 601 | if ($this->id) { |
602 | 602 | // Get dimensions from current image. |
603 | - $my_image = new Image($picturePath . '/' . $this->picture); |
|
603 | + $my_image = new Image($picturePath.'/'.$this->picture); |
|
604 | 604 | |
605 | 605 | $current_image_size = $my_image->get_image_size(); |
606 | 606 | $current_width = $current_image_size['width']; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } |
641 | 641 | |
642 | 642 | $my_image->resize($new_width, $new_height); |
643 | - $result = $my_image->send_image($picturePath . '/' . $this->picture); |
|
643 | + $result = $my_image->send_image($picturePath.'/'.$this->picture); |
|
644 | 644 | |
645 | 645 | if ($result) { |
646 | 646 | return true; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $picture = $this->picture; |
666 | 666 | $this->picture = ''; |
667 | 667 | |
668 | - return @unlink($picturePath . '/' . $picture) ? true : false; |
|
668 | + return @unlink($picturePath.'/'.$picture) ? true : false; |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | return false; |
@@ -682,27 +682,27 @@ discard block |
||
682 | 682 | { |
683 | 683 | $course_id = $course_info['real_id']; |
684 | 684 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
685 | - $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images'; |
|
686 | - $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images'; |
|
685 | + $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images'; |
|
686 | + $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images'; |
|
687 | 687 | |
688 | 688 | // if the question has got an ID and if the picture exists |
689 | 689 | if ($this->id && !empty($this->picture)) { |
690 | 690 | $picture = explode('.', $this->picture); |
691 | 691 | $extension = $picture[sizeof($picture) - 1]; |
692 | - $picture = 'quiz-' . $questionId . '.' . $extension; |
|
693 | - $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false; |
|
692 | + $picture = 'quiz-'.$questionId.'.'.$extension; |
|
693 | + $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false; |
|
694 | 694 | // If copy was correct then add to the database |
695 | 695 | if ($result) { |
696 | 696 | $sql = "UPDATE $TBL_QUESTIONS SET |
697 | - picture = '" . Database::escape_string($picture) . "' |
|
698 | - WHERE c_id = $course_id AND id='" . intval($questionId) . "'"; |
|
697 | + picture = '".Database::escape_string($picture)."' |
|
698 | + WHERE c_id = $course_id AND id='".intval($questionId)."'"; |
|
699 | 699 | Database::query($sql); |
700 | 700 | |
701 | 701 | $document_id = add_document( |
702 | 702 | $course_info, |
703 | - '/images/' . $picture, |
|
703 | + '/images/'.$picture, |
|
704 | 704 | 'file', |
705 | - filesize($destination_path . '/' . $picture), |
|
705 | + filesize($destination_path.'/'.$picture), |
|
706 | 706 | $picture |
707 | 707 | ); |
708 | 708 | if ($document_id) { |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $Extension = $PictureName[sizeof($PictureName) - 1]; |
738 | 738 | |
739 | 739 | // saves the picture into a temporary file |
740 | - @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension); |
|
740 | + @move_uploaded_file($Picture, $picturePath.'/tmp.'.$Extension); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
@@ -770,15 +770,15 @@ discard block |
||
770 | 770 | |
771 | 771 | // if the question has got an ID and if the picture exists |
772 | 772 | if ($this->id) { |
773 | - if (file_exists($picturePath . '/tmp.jpg')) { |
|
773 | + if (file_exists($picturePath.'/tmp.jpg')) { |
|
774 | 774 | $Extension = 'jpg'; |
775 | - } elseif (file_exists($picturePath . '/tmp.gif')) { |
|
775 | + } elseif (file_exists($picturePath.'/tmp.gif')) { |
|
776 | 776 | $Extension = 'gif'; |
777 | - } elseif (file_exists($picturePath . '/tmp.png')) { |
|
777 | + } elseif (file_exists($picturePath.'/tmp.png')) { |
|
778 | 778 | $Extension = 'png'; |
779 | 779 | } |
780 | - $this->picture = 'quiz-' . $this->id . '.' . $Extension; |
|
781 | - return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false; |
|
780 | + $this->picture = 'quiz-'.$this->id.'.'.$Extension; |
|
781 | + return @rename($picturePath.'/tmp.'.$Extension, $picturePath.'/'.$this->picture) ? true : false; |
|
782 | 782 | } |
783 | 783 | return false; |
784 | 784 | } |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | $category = $this->category; |
809 | 809 | |
810 | 810 | // question already exists |
811 | - if(!empty($id)) { |
|
811 | + if (!empty($id)) { |
|
812 | 812 | |
813 | 813 | $params = [ |
814 | 814 | 'question' => $question, |
@@ -854,12 +854,12 @@ discard block |
||
854 | 854 | $TBL_EXERCISE_QUESTION as test_question |
855 | 855 | WHERE |
856 | 856 | question.id = test_question.question_id AND |
857 | - test_question.exercice_id = " . intval($exerciseId) . " AND |
|
857 | + test_question.exercice_id = ".intval($exerciseId)." AND |
|
858 | 858 | question.c_id = $c_id AND |
859 | 859 | test_question.c_id = $c_id "; |
860 | - $result = Database::query($sql); |
|
861 | - $current_position = Database::result($result,0,0); |
|
862 | - $this->updatePosition($current_position+1); |
|
860 | + $result = Database::query($sql); |
|
861 | + $current_position = Database::result($result, 0, 0); |
|
862 | + $this->updatePosition($current_position + 1); |
|
863 | 863 | $position = $this->position; |
864 | 864 | |
865 | 865 | $params = [ |
@@ -955,10 +955,10 @@ discard block |
||
955 | 955 | } |
956 | 956 | } |
957 | 957 | |
958 | - public function search_engine_edit($exerciseId, $addQs=false, $rmQs=false) |
|
958 | + public function search_engine_edit($exerciseId, $addQs = false, $rmQs = false) |
|
959 | 959 | { |
960 | 960 | // update search engine and its values table if enabled |
961 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
961 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
962 | 962 | $course_id = api_get_course_id(); |
963 | 963 | // get search_did |
964 | 964 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
@@ -976,8 +976,8 @@ discard block |
||
976 | 976 | $res = Database::query($sql); |
977 | 977 | |
978 | 978 | if (Database::num_rows($res) > 0 || $addQs) { |
979 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
980 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
979 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
980 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
981 | 981 | |
982 | 982 | $di = new ChamiloIndexer(); |
983 | 983 | if ($addQs) { |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | |
991 | 991 | // retrieve others exercise ids |
992 | 992 | $se_ref = Database::fetch_array($res); |
993 | - $se_doc = $di->get_document((int)$se_ref['search_did']); |
|
993 | + $se_doc = $di->get_document((int) $se_ref['search_did']); |
|
994 | 994 | if ($se_doc !== FALSE) { |
995 | 995 | if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) { |
996 | 996 | $se_doc_data = unserialize($se_doc_data); |
@@ -1028,16 +1028,16 @@ discard block |
||
1028 | 1028 | SE_DATA => array( |
1029 | 1029 | 'type' => SE_DOCTYPE_EXERCISE_QUESTION, |
1030 | 1030 | 'exercise_ids' => $question_exercises, |
1031 | - 'question_id' => (int)$this->id |
|
1031 | + 'question_id' => (int) $this->id |
|
1032 | 1032 | ), |
1033 | - SE_USER => (int)api_get_user_id(), |
|
1033 | + SE_USER => (int) api_get_user_id(), |
|
1034 | 1034 | ); |
1035 | 1035 | $ic_slide->xapian_data = serialize($xapian_data); |
1036 | 1036 | $ic_slide->addValue("content", $this->description); |
1037 | 1037 | |
1038 | 1038 | //TODO: index answers, see also form validation on question_admin.inc.php |
1039 | 1039 | |
1040 | - $di->remove_document((int)$se_ref['search_did']); |
|
1040 | + $di->remove_document((int) $se_ref['search_did']); |
|
1041 | 1041 | $di->addChunk($ic_slide); |
1042 | 1042 | |
1043 | 1043 | //index and return search engine document id |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | $count = $new_exercise->selectNbrQuestions(); |
1117 | 1117 | $count++; |
1118 | 1118 | $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order) |
1119 | - VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')"; |
|
1119 | + VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')"; |
|
1120 | 1120 | Database::query($sql); |
1121 | 1121 | |
1122 | 1122 | // we do not want to reindex if we had just saved adnd indexed the question |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | $course_id = api_get_course_int_id(); |
1146 | 1146 | |
1147 | 1147 | // exercise not found |
1148 | - if($pos === false) { |
|
1148 | + if ($pos === false) { |
|
1149 | 1149 | return false; |
1150 | 1150 | } else { |
1151 | 1151 | // deletes the position in the array containing the wanted exercise ID |
@@ -1155,17 +1155,17 @@ discard block |
||
1155 | 1155 | FROM $TBL_EXERCISE_QUESTION |
1156 | 1156 | WHERE |
1157 | 1157 | c_id = $course_id |
1158 | - AND question_id = " . intval($id) . " |
|
1158 | + AND question_id = ".intval($id)." |
|
1159 | 1159 | AND exercice_id = " . intval($exerciseId); |
1160 | 1160 | $res = Database::query($sql); |
1161 | - if (Database::num_rows($res)>0) { |
|
1161 | + if (Database::num_rows($res) > 0) { |
|
1162 | 1162 | $row = Database::fetch_array($res); |
1163 | 1163 | if (!empty($row['question_order'])) { |
1164 | 1164 | $sql = "UPDATE $TBL_EXERCISE_QUESTION |
1165 | 1165 | SET question_order = question_order-1 |
1166 | 1166 | WHERE |
1167 | 1167 | c_id = $course_id |
1168 | - AND exercice_id = " . intval($exerciseId) . " |
|
1168 | + AND exercice_id = ".intval($exerciseId)." |
|
1169 | 1169 | AND question_order > " . $row['question_order']; |
1170 | 1170 | Database::query($sql); |
1171 | 1171 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | $sql = "DELETE FROM $TBL_EXERCISE_QUESTION |
1175 | 1175 | WHERE |
1176 | 1176 | c_id = $course_id |
1177 | - AND question_id = " . intval($id) . " |
|
1177 | + AND question_id = ".intval($id)." |
|
1178 | 1178 | AND exercice_id = " . intval($exerciseId); |
1179 | 1179 | Database::query($sql); |
1180 | 1180 | |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | SET question_order = question_order-1 |
1216 | 1216 | WHERE |
1217 | 1217 | c_id= $course_id |
1218 | - AND exercice_id = " . intval($row['exercice_id']) . " |
|
1218 | + AND exercice_id = ".intval($row['exercice_id'])." |
|
1219 | 1219 | AND question_order > " . $row['question_order']; |
1220 | 1220 | Database::query($sql); |
1221 | 1221 | } |
@@ -1223,22 +1223,22 @@ discard block |
||
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | $sql = "DELETE FROM $TBL_EXERCISE_QUESTION |
1226 | - WHERE c_id = $course_id AND question_id = " . $id; |
|
1226 | + WHERE c_id = $course_id AND question_id = ".$id; |
|
1227 | 1227 | Database::query($sql); |
1228 | 1228 | |
1229 | 1229 | $sql = "DELETE FROM $TBL_QUESTIONS |
1230 | - WHERE c_id = $course_id AND id = " . $id; |
|
1230 | + WHERE c_id = $course_id AND id = ".$id; |
|
1231 | 1231 | Database::query($sql); |
1232 | 1232 | |
1233 | 1233 | $sql = "DELETE FROM $TBL_REPONSES |
1234 | - WHERE c_id = $course_id AND question_id = " . $id; |
|
1234 | + WHERE c_id = $course_id AND question_id = ".$id; |
|
1235 | 1235 | Database::query($sql); |
1236 | 1236 | |
1237 | 1237 | // remove the category of this question in the question_rel_category table |
1238 | 1238 | $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY |
1239 | 1239 | WHERE |
1240 | 1240 | c_id = $course_id AND |
1241 | - question_id = " . $id; |
|
1241 | + question_id = ".$id; |
|
1242 | 1242 | Database::query($sql); |
1243 | 1243 | |
1244 | 1244 | api_item_property_update( |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | if (class_exists($class_name)) { |
1408 | 1408 | return new $class_name(); |
1409 | 1409 | } else { |
1410 | - echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type; |
|
1410 | + echo 'Can\'t instanciate class '.$class_name.' of type '.$type; |
|
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 | } |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | |
1450 | 1450 | // Question type |
1451 | 1451 | $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null; |
1452 | - $form->addElement('hidden','answerType', $answerType); |
|
1452 | + $form->addElement('hidden', 'answerType', $answerType); |
|
1453 | 1453 | |
1454 | 1454 | // html editor |
1455 | 1455 | $editorConfig = array( |
@@ -1457,7 +1457,7 @@ discard block |
||
1457 | 1457 | 'Height' => '150' |
1458 | 1458 | ); |
1459 | 1459 | |
1460 | - if (!api_is_allowed_to_edit(null,true)) { |
|
1460 | + if (!api_is_allowed_to_edit(null, true)) { |
|
1461 | 1461 | $editorConfig['UserStatus'] = 'student'; |
1462 | 1462 | } |
1463 | 1463 | |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | |
1595 | 1595 | if ($feedback_type == 1) { |
1596 | 1596 | //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available |
1597 | - $question_type_custom_list = array ( |
|
1597 | + $question_type_custom_list = array( |
|
1598 | 1598 | UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER], |
1599 | 1599 | HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION] |
1600 | 1600 | ); |
@@ -1610,17 +1610,17 @@ discard block |
||
1610 | 1610 | require_once $a_type[0]; |
1611 | 1611 | // get the picture of the type and the langvar which describes it |
1612 | 1612 | $img = $explanation = ''; |
1613 | - eval('$img = ' . $a_type[1] . '::$typePicture;'); |
|
1614 | - eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);'); |
|
1613 | + eval('$img = '.$a_type[1].'::$typePicture;'); |
|
1614 | + eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);'); |
|
1615 | 1615 | echo '<li>'; |
1616 | 1616 | echo '<div class="icon-image">'; |
1617 | 1617 | if ($objExercise->exercise_was_added_in_lp == true) { |
1618 | 1618 | $img = pathinfo($img); |
1619 | - $img = $img['filename'] . '_na.' . $img['extension']; |
|
1619 | + $img = $img['filename'].'_na.'.$img['extension']; |
|
1620 | 1620 | echo Display::return_icon($img, $explanation, null, ICON_SIZE_BIG); |
1621 | 1621 | } else { |
1622 | - echo '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' . |
|
1623 | - Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>'; |
|
1622 | + echo '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'. |
|
1623 | + Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>'; |
|
1624 | 1624 | } |
1625 | 1625 | echo '</div>'; |
1626 | 1626 | echo '</li>'; |
@@ -1632,9 +1632,9 @@ discard block |
||
1632 | 1632 | echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); |
1633 | 1633 | } else { |
1634 | 1634 | if ($feedback_type == 1) { |
1635 | - echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">"; |
|
1635 | + echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">"; |
|
1636 | 1636 | } else { |
1637 | - echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">'; |
|
1637 | + echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">'; |
|
1638 | 1638 | } |
1639 | 1639 | echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); |
1640 | 1640 | } |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | $header .= $this->show_media_content(); |
1772 | 1772 | } |
1773 | 1773 | |
1774 | - $header .= Display::page_subheader2($counter_label . ". " . $question_title); |
|
1774 | + $header .= Display::page_subheader2($counter_label.". ".$question_title); |
|
1775 | 1775 | $header .= Display::div( |
1776 | 1776 | "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>", |
1777 | 1777 | array('class' => 'ribbon') |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | public function create_question( |
1793 | 1793 | $quiz_id, |
1794 | 1794 | $question_name, |
1795 | - $question_description = "" , |
|
1795 | + $question_description = "", |
|
1796 | 1796 | $max_score = 0, |
1797 | 1797 | $type = 1, |
1798 | 1798 | $level = 1 |
@@ -1862,8 +1862,8 @@ discard block |
||
1862 | 1862 | require_once $tabQuestionList[$type][0]; |
1863 | 1863 | |
1864 | 1864 | $img = $explanation = null; |
1865 | - eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;'); |
|
1866 | - eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);'); |
|
1865 | + eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;'); |
|
1866 | + eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);'); |
|
1867 | 1867 | return array($img, $explanation); |
1868 | 1868 | } |
1869 | 1869 | |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | $media_list[0] = get_lang('NoMedia'); |
1928 | 1928 | |
1929 | 1929 | if (!empty($medias)) { |
1930 | - foreach($medias as $media) { |
|
1930 | + foreach ($medias as $media) { |
|
1931 | 1931 | $media_list[$media['id']] = empty($media['question']) ? get_lang('Untitled') : $media['question']; |
1932 | 1932 | } |
1933 | 1933 | } |
@@ -98,10 +98,10 @@ |
||
98 | 98 | }*/ |
99 | 99 | } |
100 | 100 | |
101 | - // This is a good answer, count + 1 for nmbr of clicks |
|
102 | - if ($answers['weighting'][$i] > 0) { |
|
103 | - $nmbrTries++; |
|
104 | - } |
|
101 | + // This is a good answer, count + 1 for nmbr of clicks |
|
102 | + if ($answers['weighting'][$i] > 0) { |
|
103 | + $nmbrTries++; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | $hotSpot['coord'] = $answers['hotspot_coordinates'][$i]; |
107 | 107 | $data['hotspots'][] = $hotSpot; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | api_protect_course_script(false); |
12 | 12 | |
13 | -$isAllowedToEdit = api_is_allowed_to_edit(null,true); |
|
13 | +$isAllowedToEdit = api_is_allowed_to_edit(null, true); |
|
14 | 14 | |
15 | 15 | if (!$isAllowedToEdit) { |
16 | 16 | api_not_allowed(true); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $objQuestion = Question::read($questionId); |
23 | 23 | $_course = api_get_course_info(); |
24 | 24 | |
25 | -$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
25 | +$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
26 | 26 | |
27 | 27 | $picturePath = $documentPath.'/images'; |
28 | 28 | $pictureName = $objQuestion->selectPicture(); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $answers = $_SESSION['tmp_answers']; |
66 | 66 | $nbrAnswers = count($answers['answer']); |
67 | 67 | |
68 | -for ($i=1;$i <= $nbrAnswers; $i++) { |
|
68 | +for ($i = 1; $i <= $nbrAnswers; $i++) { |
|
69 | 69 | $hotSpot = []; |
70 | 70 | $hotSpot['id'] = null; |
71 | - $hotSpot['answer']= $answers['answer'][$i]; |
|
71 | + $hotSpot['answer'] = $answers['answer'][$i]; |
|
72 | 72 | |
73 | 73 | if ($answer_type == HOT_SPOT_DELINEATION) { |
74 | - if ($i==1) { |
|
74 | + if ($i == 1) { |
|
75 | 75 | $hotSpot['type'] = 'delineation'; |
76 | 76 | } else { |
77 | 77 | $hotSpot['type'] = 'oar'; |
@@ -7,4 +7,4 @@ |
||
7 | 7 | // directly to exercise.php. This redirection is enabled for 1.10.x (2015-04-21) |
8 | 8 | // The final goal of this file is to be removed in a few years time, if |
9 | 9 | // considered realistically not harmful |
10 | -require __DIR__ . '/exercise.php'; |
|
10 | +require __DIR__.'/exercise.php'; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $show_headers = isset($_REQUEST['show_headers']) ? intval($_REQUEST['show_headers']) : null; //exe id |
18 | 18 | |
19 | 19 | if ($origin == 'learnpath') { |
20 | - $show_headers = false; |
|
20 | + $show_headers = false; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | api_protect_course_script($show_headers); |
24 | 24 | |
25 | 25 | if (empty($id)) { |
26 | - api_not_allowed($show_headers); |
|
26 | + api_not_allowed($show_headers); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // Only users can see their own results |
50 | 50 | if (!$is_allowedToEdit) { |
51 | 51 | if ($student_id != $current_user_id) { |
52 | - api_not_allowed($show_headers); |
|
52 | + api_not_allowed($show_headers); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | "name" => get_lang('Exercises'), |
63 | 63 | ); |
64 | 64 | $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
65 | - $this_section = SECTION_COURSES; |
|
66 | - Display::display_header(); |
|
65 | + $this_section = SECTION_COURSES; |
|
66 | + Display::display_header(); |
|
67 | 67 | } else { |
68 | 68 | $htmlHeadXtra[] = " |
69 | 69 | <style> |
70 | 70 | body { background: none;} |
71 | 71 | </style> |
72 | 72 | "; |
73 | - Display::display_reduced_header(); |
|
73 | + Display::display_reduced_header(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | ExerciseLib::display_question_list_by_attempt($objExercise, $id, false); |
77 | 77 | |
78 | 78 | if ($show_headers) { |
79 | - Display::display_footer(); |
|
79 | + Display::display_footer(); |
|
80 | 80 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | api_not_allowed($show_headers); |
27 | 27 | } |
28 | 28 | |
29 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
|
29 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor; |
|
30 | 30 | |
31 | 31 | //Getting results from the exe_id. This variable also contain all the information about the exercise |
32 | 32 | $track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id); |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
57 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
56 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
57 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
58 | 58 | |
59 | 59 | if ($show_headers) { |
60 | 60 | $interbreadcrumb[] = array( |
@@ -7,7 +7,7 @@ |
||
7 | 7 | get_lang('MultiplicationStar')."\n". |
8 | 8 | get_lang('DivisionSlash')."\n". |
9 | 9 | get_lang('ExponentiationCircumflex')."\n". |
10 | -get_lang('ModuloPercentage') . "\n" . |
|
10 | +get_lang('ModuloPercentage')."\n". |
|
11 | 11 | "\n". |
12 | 12 | get_lang('SquareRootSqrt')."\n". |
13 | 13 | get_lang('AbsoluteValueAbs')."\n". |