@@ -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'; |
@@ -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". |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'Height' => '125' |
39 | 39 | ); |
40 | 40 | |
41 | - $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
41 | + $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
42 | 42 | $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); |
43 | 43 | |
44 | 44 | $obj_ex = $_SESSION['objExercise']; |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $html = '<table class="table table-striped table-hover"> |
49 | 49 | <thead> |
50 | 50 | <tr> |
51 | - <th width="10">' . get_lang('Number') . '</th> |
|
52 | - <th width="10">' . get_lang('True') . '</th> |
|
53 | - <th width="50%">' . get_lang('Answer') . '</th> |
|
54 | - <th width="50%">' . get_lang('Comment') . '</th> |
|
55 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
51 | + <th width="10">' . get_lang('Number').'</th> |
|
52 | + <th width="10">' . get_lang('True').'</th> |
|
53 | + <th width="50%">' . get_lang('Answer').'</th> |
|
54 | + <th width="50%">' . get_lang('Comment').'</th> |
|
55 | + <th width="10">' . get_lang('Weighting').'</th> |
|
56 | 56 | </tr> |
57 | 57 | </thead> |
58 | 58 | <tbody>'; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | $form->addHtml('<tr>'); |
83 | 83 | |
84 | 84 | if (is_object($answer)) { |
85 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
86 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
87 | - $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); |
|
88 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
85 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
86 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
87 | + $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1); |
|
88 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
89 | 89 | } else { |
90 | 90 | $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); |
91 | 91 | $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); |
@@ -101,38 +101,38 @@ discard block |
||
101 | 101 | |
102 | 102 | $renderer->setElementTemplate( |
103 | 103 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
104 | - 'correct[' . $i . ']' |
|
104 | + 'correct['.$i.']' |
|
105 | 105 | ); |
106 | 106 | $renderer->setElementTemplate( |
107 | 107 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
108 | - 'counter[' . $i . ']' |
|
108 | + 'counter['.$i.']' |
|
109 | 109 | ); |
110 | 110 | $renderer->setElementTemplate( |
111 | 111 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
112 | - 'answer[' . $i . ']' |
|
112 | + 'answer['.$i.']' |
|
113 | 113 | ); |
114 | 114 | $renderer->setElementTemplate( |
115 | 115 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
116 | - 'comment[' . $i . ']' |
|
116 | + 'comment['.$i.']' |
|
117 | 117 | ); |
118 | 118 | $renderer->setElementTemplate( |
119 | 119 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
120 | - 'weighting[' . $i . ']' |
|
120 | + 'weighting['.$i.']' |
|
121 | 121 | ); |
122 | 122 | |
123 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
123 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
124 | 124 | $answer_number->freeze(); |
125 | 125 | |
126 | - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, |
|
126 | + $form->addElement('checkbox', 'correct['.$i.']', null, null, |
|
127 | 127 | 'class="checkbox" style="margin-left: 0em;"'); |
128 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
128 | + $boxes_names[] = 'correct['.$i.']'; |
|
129 | 129 | |
130 | 130 | $form->addHtmlEditor("answer[$i]", null, null, true, $editorConfig); |
131 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
131 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
132 | 132 | |
133 | 133 | $form->addHtmlEditor("comment[$i]", null, null, true, $editorConfig); |
134 | 134 | |
135 | - $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
135 | + $form->addElement('text', 'weighting['.$i.']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
136 | 136 | $form->addHtml('</tr>'); |
137 | 137 | } |
138 | 138 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $objAnswer = new Answer($this->id); |
178 | 178 | $nb_answers = $form->getSubmitValue('nb_answers'); |
179 | 179 | |
180 | - for($i=1 ; $i <= $nb_answers ; $i++) { |
|
180 | + for ($i = 1; $i <= $nb_answers; $i++) { |
|
181 | 181 | $answer = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('answer['.$i.']'))); |
182 | 182 | $comment = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('comment['.$i.']'))); |
183 | 183 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | $weighting = abs($weighting); |
190 | 190 | $weighting = -$weighting; |
191 | 191 | } |
192 | - if($weighting > 0) { |
|
192 | + if ($weighting > 0) { |
|
193 | 193 | $questionWeighting += $weighting; |
194 | 194 | } |
195 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i); |
|
195 | + $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // saves the answers into the data base |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | function return_header($feedback_type = null, $counter = null, $score = null) |
207 | 207 | { |
208 | 208 | $header = parent::return_header($feedback_type, $counter, $score); |
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
209 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
210 | 210 | <tr> |
211 | 211 | <th>'.get_lang("Choice").'</th> |
212 | 212 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | $time = time(); |
15 | 15 | $doc_url = str_replace(array('../', '\\', '\\0', '..'), array('', '', '', ''), urldecode($_GET['file'])); |
16 | 16 | $cid = api_get_course_id(); |
17 | -$document_path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'; |
|
18 | -$document_web_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document'; |
|
17 | +$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
18 | +$document_web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'; |
|
19 | 19 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
20 | 20 | $learnpath_id = isset($_REQUEST['learnpath_id']) ? $_REQUEST['learnpath_id'] : null; |
21 | 21 | $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? $_REQUEST['learnpath_item_id'] : null; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $my_file = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($my_file)); |
70 | 70 | |
71 | 71 | $title = GetQuizName($my_file, $documentPath); |
72 | -if ($title =='') { |
|
72 | +if ($title == '') { |
|
73 | 73 | $title = basename($my_file); |
74 | 74 | } |
75 | 75 | $nameTools = $title; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | }); |
87 | 87 | </script>'; |
88 | 88 | |
89 | -$interbreadcrumb[]= array ("url"=>"./exercise.php", "name"=> get_lang('Exercises')); |
|
89 | +$interbreadcrumb[] = array("url"=>"./exercise.php", "name"=> get_lang('Exercises')); |
|
90 | 90 | if ($origin == 'learnpath') { |
91 | 91 | Display::display_reduced_header($nameTools, "Exercise"); |
92 | 92 | } else { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | if ($title == '') { |
67 | 67 | $title = basename($fname); |
68 | 68 | } |
69 | - return (string)$title; |
|
69 | + return (string) $title; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($src == '') { |
177 | 177 | return ''; |
178 | 178 | } else { |
179 | - $tmp_src = basename($src) ; |
|
179 | + $tmp_src = basename($src); |
|
180 | 180 | if ($tmp_src == '') { |
181 | 181 | return $src; |
182 | 182 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | // Select src tag from img tag. |
200 | 200 | $match = array(); |
201 | - preg_match("|(src=\".*\" )|U", $imgtag, $match); //src |
|
201 | + preg_match("|(src=\".*\" )|U", $imgtag, $match); //src |
|
202 | 202 | list($key, $srctag) = each($match); |
203 | 203 | $src = substr($srctag, 5, (strlen($srctag) - 7)); |
204 | 204 | if (stristr($src, 'http') === false) { |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | while (list($key, $imgtag) = each($match)) { |
231 | 231 | $imgname = GetImgName($imgtag); |
232 | 232 | if ($imgname != '' && !in_array($imgname, $imgparams)) { |
233 | - array_push($imgparams, $imgname); // name (+ type) of the images in the html test |
|
234 | - $imgcount = $imgcount + 1; // number of images in the html test |
|
233 | + array_push($imgparams, $imgname); // name (+ type) of the images in the html test |
|
234 | + $imgcount = $imgcount + 1; // number of images in the html test |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | if ($file != '..') { |
405 | 405 | $full_name = $folder.'/'.$file; |
406 | 406 | if (is_dir($full_name)) { |
407 | - $dflag = 1; // first directory |
|
407 | + $dflag = 1; // first directory |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | } |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | use ChamiloSession as Session; |
48 | 48 | |
49 | 49 | require_once '../inc/global.inc.php'; |
50 | -$current_course_tool = TOOL_QUIZ; |
|
50 | +$current_course_tool = TOOL_QUIZ; |
|
51 | 51 | $this_section = SECTION_COURSES; |
52 | 52 | |
53 | 53 | // Access control |
54 | 54 | api_protect_course_script(true); |
55 | 55 | |
56 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true); |
|
56 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true); |
|
57 | 57 | $sessionId = api_get_session_id(); |
58 | 58 | |
59 | 59 | if (!$is_allowedToEdit) { |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /* stripslashes POST data */ |
64 | -if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
65 | - foreach($_POST as $key=>$val) { |
|
66 | - if(is_string($val)) { |
|
67 | - $_POST[$key]=stripslashes($val); |
|
68 | - } elseif(is_array($val)) { |
|
69 | - foreach($val as $key2=>$val2) { |
|
70 | - $_POST[$key][$key2]=stripslashes($val2); |
|
64 | +if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
65 | + foreach ($_POST as $key=>$val) { |
|
66 | + if (is_string($val)) { |
|
67 | + $_POST[$key] = stripslashes($val); |
|
68 | + } elseif (is_array($val)) { |
|
69 | + foreach ($val as $key2=>$val2) { |
|
70 | + $_POST[$key][$key2] = stripslashes($val2); |
|
71 | 71 | } |
72 | 72 | } |
73 | - $GLOBALS[$key]=$_POST[$key]; |
|
73 | + $GLOBALS[$key] = $_POST[$key]; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | if (empty($exerciseId)) { |
78 | - $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0'; |
|
78 | + $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']) : '0'; |
|
79 | 79 | } |
80 | 80 | if (empty($newQuestion)) { |
81 | 81 | $newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $objQuestion = $objQuestion->swapSimpleAnswerTypes(); |
124 | 124 | $_SESSION['objQuestion'] = $objQuestion; |
125 | 125 | } |
126 | -$objAnswer = isset($_SESSION['objAnswer']) ? $_SESSION['objAnswer'] : null; |
|
126 | +$objAnswer = isset($_SESSION['objAnswer']) ? $_SESSION['objAnswer'] : null; |
|
127 | 127 | |
128 | 128 | // document path |
129 | 129 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) { |
149 | 149 | require_once 'export/qti2/qti2_export.php'; |
150 | 150 | $export = export_question_qti($_GET['questionId'], true); |
151 | - $qid = (int)$_GET['questionId']; |
|
151 | + $qid = (int) $_GET['questionId']; |
|
152 | 152 | $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
153 | 153 | $temp_dir_short = uniqid(); |
154 | 154 | $temp_zip_dir = $archive_path."/".$temp_dir_short; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if (!$fromExercise) { |
195 | 195 | // gets the right exercise ID, and if 0 creates a new exercise |
196 | 196 | if (!$exerciseId = $objExercise->selectId()) { |
197 | - $modifyExercise='yes'; |
|
197 | + $modifyExercise = 'yes'; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | exit(); |
245 | 245 | } else { |
246 | 246 | // goes back to the question viewing |
247 | - $editQuestion=$modifyQuestion; |
|
248 | - unset($newQuestion,$modifyQuestion); |
|
247 | + $editQuestion = $modifyQuestion; |
|
248 | + unset($newQuestion, $modifyQuestion); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | // if cancelling answer creation/modification |
273 | 273 | if ($cancelAnswers) { |
274 | 274 | // goes back to the question viewing |
275 | - $editQuestion=$modifyAnswers; |
|
275 | + $editQuestion = $modifyAnswers; |
|
276 | 276 | unset($modifyAnswers); |
277 | 277 | } |
278 | 278 | $nameTools = null; |
@@ -281,27 +281,27 @@ discard block |
||
281 | 281 | $nameTools = get_lang('QuestionManagement'); |
282 | 282 | } |
283 | 283 | |
284 | -if (isset($_SESSION['gradebook'])){ |
|
285 | - $gradebook= $_SESSION['gradebook']; |
|
284 | +if (isset($_SESSION['gradebook'])) { |
|
285 | + $gradebook = $_SESSION['gradebook']; |
|
286 | 286 | } |
287 | 287 | |
288 | -if (!empty($gradebook) && $gradebook=='view') { |
|
289 | - $interbreadcrumb[]= array( |
|
288 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
289 | + $interbreadcrumb[] = array( |
|
290 | 290 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
291 | 291 | 'name' => get_lang('ToolGradebook') |
292 | 292 | ); |
293 | 293 | } |
294 | 294 | |
295 | -$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
296 | -if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) { |
|
295 | +$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
296 | +if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) { |
|
297 | 297 | $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name); |
298 | 298 | } else { |
299 | 299 | $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name); |
300 | 300 | } |
301 | 301 | |
302 | 302 | // shows a link to go back to the question pool |
303 | -if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){ |
|
304 | - $interbreadcrumb[]=array( |
|
303 | +if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) { |
|
304 | + $interbreadcrumb[] = array( |
|
305 | 305 | "url" => api_get_path(WEB_CODE_PATH)."exercice/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), |
306 | 306 | "name" => get_lang('QuestionPool') |
307 | 307 | ); |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | |
310 | 310 | // if the question is duplicated, disable the link of tool name |
311 | 311 | if ($modifyIn == 'thisExercise') { |
312 | - if($buttonBack) { |
|
313 | - $modifyIn='allExercises'; |
|
312 | + if ($buttonBack) { |
|
313 | + $modifyIn = 'allExercises'; |
|
314 | 314 | } else { |
315 | - $noPHP_SELF=true; |
|
315 | + $noPHP_SELF = true; |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | $htmlHeadXtra[] = '<script> |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | $htmlHeadXtra[] = $template->fetch('default/exercise/submit.js.tpl'); |
345 | 345 | $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js'); |
346 | 346 | |
347 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
348 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
347 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
348 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
349 | 349 | |
350 | -Display::display_header($nameTools,'Exercise'); |
|
350 | +Display::display_header($nameTools, 'Exercise'); |
|
351 | 351 | /* |
352 | 352 | if ($objExercise->exercise_was_added_in_lp) { |
353 | 353 | if ($objExercise->force_edit_exercise_in_lp == true) { |
@@ -364,22 +364,22 @@ discard block |
||
364 | 364 | echo '<div class="actions">'; |
365 | 365 | if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) |
366 | 366 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidReq().'">'. |
367 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
367 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
368 | 368 | |
369 | - if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
|
369 | + if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
|
370 | 370 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidReq().'">'. |
371 | - Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
371 | + Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
372 | 372 | } |
373 | 373 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'. |
374 | - Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
374 | + Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
375 | 375 | |
376 | 376 | echo Display::url( |
377 | - Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM), |
|
377 | + Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM), |
|
378 | 378 | api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id |
379 | 379 | ); |
380 | 380 | |
381 | 381 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
382 | - Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
382 | + Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
383 | 383 | |
384 | 384 | $maxScoreAllQuestions = 0; |
385 | 385 | if (!empty($objExercise->questionList)) { |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | // we are in create a new question from question pool not in a test |
398 | 398 | echo '<div class="actions">'; |
399 | 399 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'">'. |
400 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
400 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
401 | 401 | echo '</div>'; |
402 | 402 | } else { |
403 | 403 | // If we are in question_pool but not in an test, go back to question create in pool |
404 | 404 | echo '<div class="actions">'; |
405 | 405 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/question_pool.php?'.api_get_cidreq().'">'. |
406 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM). |
|
406 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM). |
|
407 | 407 | '</a>'; |
408 | 408 | echo '</div>'; |
409 | 409 | } |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | for ($i = 1; $i <= $answer->nbrAnswers; $i++) { |
68 | 68 | if ($answer->isCorrect($i)) { |
69 | 69 | $nb_matches++; |
70 | - $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i); |
|
71 | - $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1); |
|
72 | - $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i]; |
|
70 | + $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i); |
|
71 | + $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1); |
|
72 | + $defaults['matches['.$nb_matches.']'] = $answer->correct[$i]; |
|
73 | 73 | } else { |
74 | 74 | $nb_options++; |
75 | - $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i); |
|
75 | + $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | $html = '<table class="table table-striped table-hover"> |
104 | 104 | <thead> |
105 | 105 | <tr> |
106 | - <th width="10">' . get_lang('Number') . '</th> |
|
107 | - <th width="85%">' . get_lang('Answer') . '</th> |
|
108 | - <th width="15%">' . get_lang('MatchesTo') . '</th> |
|
109 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
106 | + <th width="10">' . get_lang('Number').'</th> |
|
107 | + <th width="85%">' . get_lang('Answer').'</th> |
|
108 | + <th width="15%">' . get_lang('MatchesTo').'</th> |
|
109 | + <th width="10">' . get_lang('Weighting').'</th> |
|
110 | 110 | </tr> |
111 | 111 | </thead> |
112 | 112 | <tbody>'; |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | $html = '<table class="table table-striped table-hover"> |
155 | 155 | <thead> |
156 | 156 | <tr> |
157 | - <th width="15%">' . get_lang('Number') . '</th> |
|
158 | - <th width="85%">' . get_lang('Answer') . '</th> |
|
157 | + <th width="15%">' . get_lang('Number').'</th> |
|
158 | + <th width="85%">' . get_lang('Answer').'</th> |
|
159 | 159 | </tr> |
160 | 160 | </thead> |
161 | 161 | <tbody>'; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | $form->addHtml('<tr>'); |
179 | - $form->addHtml('<td>' . chr(64 + $i) . '</td>'); |
|
179 | + $form->addHtml('<td>'.chr(64 + $i).'</td>'); |
|
180 | 180 | $form->addText("option[$i]", null); |
181 | 181 | $form->addHtml('</tr>'); |
182 | 182 | } |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | public function return_header($feedback_type = null, $counter = null, $score = null) |
259 | 259 | { |
260 | 260 | $header = parent::return_header($feedback_type, $counter, $score); |
261 | - $header .= '<table class="' . $this->question_table_class . '"> |
|
261 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
262 | 262 | <tr> |
263 | - <th>' . get_lang('ElementList') . '</th> |
|
264 | - <th>' . get_lang('CorrespondsTo') . '</th> |
|
263 | + <th>' . get_lang('ElementList').'</th> |
|
264 | + <th>' . get_lang('CorrespondsTo').'</th> |
|
265 | 265 | </tr>'; |
266 | 266 | |
267 | 267 | return $header; |