Completed
Push — 1.10.x ( 812a9a...914b0e )
by Angel Fernando Quiroz
43:28
created
main/exercice/multiple_answer.class.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
 
169
-	/**
170
-	 * abstract function which creates the form to create / edit the answers of the question
171
-	 * @param the formvalidator instance
172
-	 * @param the answers number to display
173
-	 */
174
-	function processAnswersCreation($form)
169
+    /**
170
+     * abstract function which creates the form to create / edit the answers of the question
171
+     * @param the formvalidator instance
172
+     * @param the answers number to display
173
+     */
174
+    function processAnswersCreation($form)
175 175
     {
176 176
         $questionWeighting = $nbrGoodAnswers = 0;
177 177
         $objAnswer  = new Answer($this->id);
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
         // sets the total weighting of the question
202 202
         $this->updateWeighting($questionWeighting);
203 203
         $this->save();
204
-	}
204
+    }
205 205
 
206
-	function return_header($feedback_type = null, $counter = null, $score = null)
206
+    function return_header($feedback_type = null, $counter = null, $score = null)
207 207
     {
208
-	    $header = parent::return_header($feedback_type, $counter, $score);
209
-	    $header .= '<table class="'.$this->question_table_class .'">
208
+        $header = parent::return_header($feedback_type, $counter, $score);
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>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $header .= '<th>'.get_lang("Comment").'</th>';
215 215
         $header .= '</tr>';
216 216
         return $header;
217
-	}
217
+    }
218 218
 
219 219
 
220 220
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
main/exercice/showinframes.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 $content = ReadFileCont($full_file_path.$user_id.'.t.html');
29 29
 
30 30
 if ($content == '') {
31
-	$content = ReadFileCont($full_file_path);
31
+    $content = ReadFileCont($full_file_path);
32 32
     // Do not move this like:
33
-	$mit = "function Finish(){";
34
-	$js_content = "
33
+    $mit = "function Finish(){";
34
+    $js_content = "
35 35
     // Code added - start
36 36
     var SaveScoreVariable = 0;
37 37
     function mySaveScore() {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
main/exercice/hotpotatoes.lib.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 block discarded – undo
344 344
                     if (is_dir($full_name)) {
345 345
                         $filelist[] = $file;
346 346
                     }
347
-               }
347
+                }
348 348
             }
349 349
         }
350 350
     }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
  * @param    reference    Reference to the array to search
260 260
  * @param    string       Node we are looking for in the array
261 261
  * @param string $node
262
- * @return   mixed        Node name or false if not found
262
+ * @return   false|string        Node name or false if not found
263 263
  */
264 264
 function myarraysearch(&$array, $node)
265 265
 {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
  * Searches an image name into an array.
281 281
  * @param    reference        Reference to an array to search
282 282
  * @param    string           String to look for
283
- * @return   mixed            String given if found, false otherwise
283
+ * @return   false|string            String given if found, false otherwise
284 284
  * @uses     myarraysearch    This function is just an additional layer on the myarraysearch() function
285 285
  */
286 286
 function CheckImageName(&$imgparams, $string)
Please login to merge, or discard this patch.
main/exercice/admin.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -362,9 +362,10 @@
 block discarded – undo
362 362
 
363 363
 if ($inATest) {
364 364
     echo '<div class="actions">';
365
-    if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
366
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
365
+    if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
366
+            echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
367 367
             Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
368
+    }
368 369
 
369 370
     if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) &&  !isset($_GET['editQuestion'])) {
370 371
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq().'">'.
Please login to merge, or discard this patch.
main/exercice/MatchingDraggable.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
main/exercice/unique_answer_no_option.class.php 3 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class UniqueAnswerNoOption extends Question
14 14
 {
15
-	static $typePicture = 'mcuao.png';
16
-	static $explanationLangVar = 'UniqueAnswerNoOption';
15
+    static $typePicture = 'mcuao.png';
16
+    static $explanationLangVar = 'UniqueAnswerNoOption';
17 17
 
18
-	/**
19
-	 * Constructor
20
-	 */
21
-	public function __construct()
18
+    /**
19
+     * Constructor
20
+     */
21
+    public function __construct()
22 22
     {
23
-		//this is highly important
24
-		parent::__construct();
25
-		$this -> type = UNIQUE_ANSWER_NO_OPTION;
26
-		$this -> isContent = $this-> getIsContent();
27
-	}
23
+        //this is highly important
24
+        parent::__construct();
25
+        $this -> type = UNIQUE_ANSWER_NO_OPTION;
26
+        $this -> isContent = $this-> getIsContent();
27
+    }
28 28
 
29
-	/**
29
+    /**
30 30
      * function which redifines Question::createAnswersForm
31 31
      * @param the formvalidator instance
32 32
      * @param the answers number to display
@@ -283,37 +283,37 @@  discard block
 block discarded – undo
283 283
     }
284 284
 
285 285
     /**
286
-	 * Function which creates the form to create / edit the answers of the question
287
-	 * @param the formvalidator instance
288
-	 * @param the answers number to display
289
-	 */
290
-	function processAnswersCreation($form)
286
+     * Function which creates the form to create / edit the answers of the question
287
+     * @param the formvalidator instance
288
+     * @param the answers number to display
289
+     */
290
+    function processAnswersCreation($form)
291 291
     {
292
-		$questionWeighting = $nbrGoodAnswers = 0;
293
-		$correct = $form -> getSubmitValue('correct');
294
-		$objAnswer = new Answer($this->id);
295
-		$nb_answers = $form -> getSubmitValue('nb_answers');
296
-		$minus = 1;
297
-		if ($form -> getSubmitValue('new_question')) {
298
-		    $minus = 0;
299
-		}
300
-
301
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
292
+        $questionWeighting = $nbrGoodAnswers = 0;
293
+        $correct = $form -> getSubmitValue('correct');
294
+        $objAnswer = new Answer($this->id);
295
+        $nb_answers = $form -> getSubmitValue('nb_answers');
296
+        $minus = 1;
297
+        if ($form -> getSubmitValue('new_question')) {
298
+            $minus = 0;
299
+        }
300
+
301
+        for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
+            $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
+            $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
304 304
             $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
305 305
             $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
306 306
             $scenario   = $form -> getSubmitValue('scenario');
307 307
 
308
-           	//$list_destination = $form -> getSubmitValue('destination'.$i);
309
-           	//$destination_str = $form -> getSubmitValue('destination'.$i);
308
+                //$list_destination = $form -> getSubmitValue('destination'.$i);
309
+                //$destination_str = $form -> getSubmitValue('destination'.$i);
310 310
 
311
- 		    $try           = $scenario['try'.$i];
311
+                $try           = $scenario['try'.$i];
312 312
             $lp            = $scenario['lp'.$i];
313
- 			$destination   = $scenario['destination'.$i];
314
- 			$url           = trim($scenario['url'.$i]);
313
+                $destination   = $scenario['destination'.$i];
314
+                $url           = trim($scenario['url'.$i]);
315 315
 
316
- 			/*
316
+                /*
317 317
  			How we are going to parse the destination value
318 318
 
319 319
 			here we parse the destination value which is a string
@@ -326,41 +326,41 @@  discard block
 block discarded – undo
326 326
 			selected_questions= ids of questions
327 327
 			url= an url
328 328
 			*/
329
-			/*
329
+            /*
330 330
  			$destination_str='';
331 331
  			foreach ($list_destination as $destination_id)
332 332
  			{
333 333
  				$destination_str.=$destination_id.';';
334 334
  			}*/
335 335
 
336
-        	$goodAnswer= ($correct == $i) ? true : false;
336
+            $goodAnswer= ($correct == $i) ? true : false;
337 337
 
338
-        	if ($goodAnswer) {
339
-        		$nbrGoodAnswers++;
340
-        		$weighting = abs($weighting);
341
-        		if($weighting > 0) {
338
+            if ($goodAnswer) {
339
+                $nbrGoodAnswers++;
340
+                $weighting = abs($weighting);
341
+                if($weighting > 0) {
342 342
                     $questionWeighting += $weighting;
343 343
                 }
344
-        	}
344
+            }
345 345
 
346
- 			if (empty($try))
347
- 				$try=0;
346
+                if (empty($try))
347
+                    $try=0;
348 348
 
349
- 			if (empty($lp)) {
350
- 				$lp=0;
351
- 			}
349
+                if (empty($lp)) {
350
+                    $lp=0;
351
+                }
352 352
 
353
- 			if (empty($destination)) {
354
- 				$destination=0;
355
- 			}
353
+                if (empty($destination)) {
354
+                    $destination=0;
355
+                }
356 356
 
357
- 			if ($url=='') {
358
- 				$url=0;
359
- 			}
357
+                if ($url=='') {
358
+                    $url=0;
359
+                }
360 360
 
361
- 			//1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
-			$dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
-        	$objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
361
+                //1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
+            $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
+            $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
364 364
         }
365 365
 
366 366
         //Create 666 answer
@@ -373,18 +373,18 @@  discard block
 block discarded – undo
373 373
 
374 374
         $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
375 375
 
376
-    	// saves the answers into the data base
376
+        // saves the answers into the data base
377 377
         $objAnswer -> save();
378 378
 
379 379
         // sets the total weighting of the question
380 380
         $this -> updateWeighting($questionWeighting);
381 381
         $this -> save();
382
-	}
382
+    }
383 383
 
384
-	function return_header($feedback_type = null, $counter = null, $score = null)
384
+    function return_header($feedback_type = null, $counter = null, $score = null)
385 385
     {
386
-	    $header = parent::return_header($feedback_type, $counter, $score);
387
-	    $header .= '<table class="'.$this->question_table_class .'">
386
+        $header = parent::return_header($feedback_type, $counter, $score);
387
+        $header .= '<table class="'.$this->question_table_class .'">
388 388
 			<tr>
389 389
 				<th>'.get_lang("Choice").'</th>
390 390
 				<th>'. get_lang("ExpectedChoice").'</th>
@@ -392,5 +392,5 @@  discard block
 block discarded – undo
392 392
         $header .= '<th>'.get_lang("Comment").'</th>';
393 393
         $header .= '</tr>';
394 394
         return $header;
395
-	}
395
+    }
396 396
 }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
40 40
 
41 41
         //this line define how many question by default appear when creating a choice question
42
-        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3;  // The previous default value was 2. See task #1759.
42
+        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3; // The previous default value was 2. See task #1759.
43 43
         $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
44 44
 
45 45
         /*
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
         if ($obj_ex->selectFeedbackType() == 1) {
56 56
             $editor_config['Width'] = '250';
57 57
             $editor_config['Height'] = '110';
58
-            $comment_title = '<th width="50%" >' . get_lang('Comment') . '</th>';
59
-            $feedback_title = '<th width="50%" >' . get_lang('Scenario') . '</th>';
58
+            $comment_title = '<th width="50%" >'.get_lang('Comment').'</th>';
59
+            $feedback_title = '<th width="50%" >'.get_lang('Scenario').'</th>';
60 60
         } else {
61
-            $comment_title = '<th width="50%">' . get_lang('Comment') . '</th>';
61
+            $comment_title = '<th width="50%">'.get_lang('Comment').'</th>';
62 62
         }
63 63
 
64 64
         $html = '<table class="table table-striped table-hover">';
65 65
         $html .= '<thead>';
66 66
         $html .= '<tr>';
67
-        $html .= '<th>' . get_lang('Number') . '</th>';
68
-        $html .= '<th>' . get_lang('True') . '</th>';
69
-        $html .= '<th width="50%">' . get_lang('Answer') . '</th>';
70
-        $html .= $comment_title . $feedback_title;
71
-        $html .= '<th>' . get_lang('Weighting') . '</th>';
67
+        $html .= '<th>'.get_lang('Number').'</th>';
68
+        $html .= '<th>'.get_lang('True').'</th>';
69
+        $html .= '<th width="50%">'.get_lang('Answer').'</th>';
70
+        $html .= $comment_title.$feedback_title;
71
+        $html .= '<th>'.get_lang('Weighting').'</th>';
72 72
         $html .= '</tr>';
73 73
         $html .= '</thead>';
74 74
         $html .= '<tbody>';
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
                         $weight_result = '0';
136 136
                     }
137 137
 
138
-                    $defaults['answer[' . $i . ']'] = $answer_result;
139
-                    $defaults['comment[' . $i . ']'] = $answer->comment[$i];
140
-                    $defaults['weighting[' . $i . ']'] = $weight_result;
138
+                    $defaults['answer['.$i.']'] = $answer_result;
139
+                    $defaults['comment['.$i.']'] = $answer->comment[$i];
140
+                    $defaults['weighting['.$i.']'] = $weight_result;
141 141
 
142 142
                     $item_list = explode('@@', $answer->destination[$i]);
143 143
 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
                     else
157 157
                         $url_result = $url;
158 158
 
159
-                    $temp_scenario['url' . $i] = $url_result;
160
-                    $temp_scenario['try' . $i] = $try_result;
161
-                    $temp_scenario['lp' . $i] = $lp;
162
-                    $temp_scenario['destination' . $i] = $list_dest;
159
+                    $temp_scenario['url'.$i] = $url_result;
160
+                    $temp_scenario['try'.$i] = $try_result;
161
+                    $temp_scenario['lp'.$i] = $lp;
162
+                    $temp_scenario['destination'.$i] = $list_dest;
163 163
                 }
164 164
             }
165 165
 
@@ -172,30 +172,30 @@  discard block
 block discarded – undo
172 172
             );
173 173
             $renderer->setElementTemplate(
174 174
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
175
-                'counter[' . $i . ']'
175
+                'counter['.$i.']'
176 176
             );
177 177
             $renderer->setElementTemplate(
178 178
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
179
-                'answer[' . $i . ']'
179
+                'answer['.$i.']'
180 180
             );
181 181
             $renderer->setElementTemplate(
182 182
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
183
-                'comment[' . $i . ']'
183
+                'comment['.$i.']'
184 184
             );
185 185
             $renderer->setElementTemplate(
186 186
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
187
-                'weighting[' . $i . ']'
187
+                'weighting['.$i.']'
188 188
             );
189 189
 
190
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
190
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
191 191
             $answer_number->freeze();
192 192
 
193 193
 
194 194
             $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
195
-            $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
195
+            $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
196 196
 
197
-            $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
198
-            $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => 'width: 60px;', 'value' => '0'));
197
+            $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
198
+            $form->addElement('text', 'weighting['.$i.']', null, array('style' => 'width: 60px;', 'value' => '0'));
199 199
             $form->addElement('html', '</tr>');
200 200
             $i++;
201 201
         }
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
         $i = 666;
210 210
         $form->addHtml('<tr>');
211 211
 
212
-        $defaults['answer[' . $i . ']'] = get_lang('DontKnow');
213
-        $defaults['weighting[' . $i . ']'] = 0;
212
+        $defaults['answer['.$i.']'] = get_lang('DontKnow');
213
+        $defaults['weighting['.$i.']'] = 0;
214 214
         $defaults['scenario'] = $temp_scenario;
215 215
         $renderer = & $form->defaultRenderer();
216 216
 
@@ -220,31 +220,31 @@  discard block
 block discarded – undo
220 220
         );
221 221
         $renderer->setElementTemplate(
222 222
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
223
-            'counter[' . $i . ']'
223
+            'counter['.$i.']'
224 224
         );
225 225
         $renderer->setElementTemplate(
226 226
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
227
-            'answer[' . $i . ']'
227
+            'answer['.$i.']'
228 228
         );
229 229
         $renderer->setElementTemplate(
230 230
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
231
-            'comment[' . $i . ']'
231
+            'comment['.$i.']'
232 232
         );
233 233
         $renderer->setElementTemplate(
234 234
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
235
-            'weighting[' . $i . ']'
235
+            'weighting['.$i.']'
236 236
         );
237 237
 
238
-        $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="-"');
238
+        $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="-"');
239 239
         $answer_number->freeze();
240 240
 
241
-        $form->addElement('hidden', 'position[' . $i . ']', '666');
241
+        $form->addElement('hidden', 'position['.$i.']', '666');
242 242
 
243 243
         $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
244
-        $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
244
+        $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
245 245
 
246
-        $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
247
-        $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
246
+        $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
247
+        $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
248 248
 
249 249
         //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
250 250
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 		    $minus = 0;
299 299
 		}
300 300
 
301
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
302
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
303
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
301
+		for ($i = 1; $i <= $nb_answers - $minus; $i++) {
302
+		    $position = trim($form -> getSubmitValue('position['.$i.']'));
303
+        	$answer = trim($form -> getSubmitValue('answer['.$i.']'));
304 304
             $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
305 305
             $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
306 306
             $scenario   = $form -> getSubmitValue('scenario');
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
            	//$list_destination = $form -> getSubmitValue('destination'.$i);
309 309
            	//$destination_str = $form -> getSubmitValue('destination'.$i);
310 310
 
311
- 		    $try           = $scenario['try'.$i];
312
-            $lp            = $scenario['lp'.$i];
311
+ 		    $try = $scenario['try'.$i];
312
+            $lp = $scenario['lp'.$i];
313 313
  			$destination   = $scenario['destination'.$i];
314 314
  			$url           = trim($scenario['url'.$i]);
315 315
 
@@ -333,34 +333,34 @@  discard block
 block discarded – undo
333 333
  				$destination_str.=$destination_id.';';
334 334
  			}*/
335 335
 
336
-        	$goodAnswer= ($correct == $i) ? true : false;
336
+        	$goodAnswer = ($correct == $i) ? true : false;
337 337
 
338 338
         	if ($goodAnswer) {
339 339
         		$nbrGoodAnswers++;
340 340
         		$weighting = abs($weighting);
341
-        		if($weighting > 0) {
341
+        		if ($weighting > 0) {
342 342
                     $questionWeighting += $weighting;
343 343
                 }
344 344
         	}
345 345
 
346 346
  			if (empty($try))
347
- 				$try=0;
347
+ 				$try = 0;
348 348
 
349 349
  			if (empty($lp)) {
350
- 				$lp=0;
350
+ 				$lp = 0;
351 351
  			}
352 352
 
353 353
  			if (empty($destination)) {
354
- 				$destination=0;
354
+ 				$destination = 0;
355 355
  			}
356 356
 
357
- 			if ($url=='') {
358
- 				$url=0;
357
+ 			if ($url == '') {
358
+ 				$url = 0;
359 359
  			}
360 360
 
361 361
  			//1@@1;2;@@2;4;4;@@http://www.chamilo.org
362
-			$dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
-        	$objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
362
+			$dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
363
+        	$objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
364 364
         }
365 365
 
366 366
         //Create 666 answer
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
         $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
369 369
         $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
370 370
         $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
371
-        $goodAnswer= ($correct == $i) ? true : false;
371
+        $goodAnswer = ($correct == $i) ? true : false;
372 372
         $dest       = '';
373 373
 
374
-        $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
374
+        $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
375 375
 
376 376
     	// saves the answers into the data base
377 377
         $objAnswer -> save();
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	function return_header($feedback_type = null, $counter = null, $score = null)
385 385
     {
386 386
 	    $header = parent::return_header($feedback_type, $counter, $score);
387
-	    $header .= '<table class="'.$this->question_table_class .'">
387
+	    $header .= '<table class="'.$this->question_table_class.'">
388 388
 			<tr>
389 389
 				<th>'.get_lang("Choice").'</th>
390 390
 				<th>'. get_lang("ExpectedChoice").'</th>
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -146,15 +146,17 @@  discard block
 block discarded – undo
146 146
                     $list_dest = $item_list[2];
147 147
                     $url = $item_list[3];
148 148
 
149
-                    if ($try == 0)
150
-                        $try_result = 0;
151
-                    else
152
-                        $try_result = 1;
149
+                    if ($try == 0) {
150
+                                            $try_result = 0;
151
+                    } else {
152
+                                            $try_result = 1;
153
+                    }
153 154
 
154
-                    if ($url == 0)
155
-                        $url_result = '';
156
-                    else
157
-                        $url_result = $url;
155
+                    if ($url == 0) {
156
+                                            $url_result = '';
157
+                    } else {
158
+                                            $url_result = $url;
159
+                    }
158 160
 
159 161
                     $temp_scenario['url' . $i] = $url_result;
160 162
                     $temp_scenario['try' . $i] = $try_result;
@@ -343,8 +345,9 @@  discard block
 block discarded – undo
343 345
                 }
344 346
         	}
345 347
 
346
- 			if (empty($try))
347
- 				$try=0;
348
+ 			if (empty($try)) {
349
+ 			 				$try=0;
350
+ 			}
348 351
 
349 352
  			if (empty($lp)) {
350 353
  				$lp=0;
Please login to merge, or discard this patch.
main/exercice/adminhp.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 */
9 9
 require_once '../inc/global.inc.php';
10 10
 
11
-$this_section=SECTION_COURSES;
11
+$this_section = SECTION_COURSES;
12 12
 
13 13
 if (isset($_REQUEST["cancel"])) {
14
-    if ($_REQUEST["cancel"]==get_lang('Cancel')) {
14
+    if ($_REQUEST["cancel"] == get_lang('Cancel')) {
15 15
         header("Location: exercise.php");
16 16
     }
17 17
 }
18 18
 
19 19
 //$is_courseAdmin = $_SESSION['is_courseAdmin'];
20
-$newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
21
-$hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_REQUEST['hotpotatoesName']:'');
20
+$newName = (!empty($_REQUEST['newName']) ? $_REQUEST['newName'] : '');
21
+$hotpotatoesName = (!empty($_REQUEST['hotpotatoesName']) ? $_REQUEST['hotpotatoesName'] : '');
22 22
 
23
-$is_allowedToEdit=api_is_allowed_to_edit(null,true);
23
+$is_allowedToEdit = api_is_allowed_to_edit(null, true);
24 24
 
25 25
 // document path
26
-$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
26
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
27 27
 
28 28
 // picture path
29
-$picturePath=$documentPath.'/images';
29
+$picturePath = $documentPath.'/images';
30 30
 
31 31
 // audio path
32
-$audioPath=$documentPath.'/audio';
32
+$audioPath = $documentPath.'/audio';
33 33
 
34 34
 // Database table definitions
35 35
 if (!$is_allowedToEdit) {
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 if (isset($_SESSION['gradebook'])) {
40
-    $gradebook=	$_SESSION['gradebook'];
40
+    $gradebook = $_SESSION['gradebook'];
41 41
 }
42 42
 
43
-if (!empty($gradebook) && $gradebook=='view') {
44
-    $interbreadcrumb[]= array (
43
+if (!empty($gradebook) && $gradebook == 'view') {
44
+    $interbreadcrumb[] = array(
45 45
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
46 46
         'name' => get_lang('ToolGradebook')
47 47
     );
48 48
 }
49 49
 
50
-$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
50
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
51 51
 
52 52
 $nameTools = get_lang('adminHP');
53 53
 
54
-Display::display_header($nameTools,"Exercise");
54
+Display::display_header($nameTools, "Exercise");
55 55
 
56 56
 /** @todo probably wrong !!!! */
57 57
 require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php');
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
 <?php
66 66
 if (isset($newName)) {
67
-    if ($newName!="") {
67
+    if ($newName != "") {
68 68
         //alter database record for that test
69
-        SetComment($hotpotatoesName,$newName);
69
+        SetComment($hotpotatoesName, $newName);
70 70
         echo "<script language='Javascript' type='text/javascript'> window.location='exercise.php'; </script>";
71 71
     }
72 72
 }
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
 $lstrComment = "";
80 80
 $lstrComment = GetComment($hotpotatoesName);
81
-if ($lstrComment=="") {
82
-    $lstrComment = GetQuizName($hotpotatoesName,$documentPath);
81
+if ($lstrComment == "") {
82
+    $lstrComment = GetQuizName($hotpotatoesName, $documentPath);
83 83
 }
84
-if ($lstrComment=="") {
85
-    $lstrComment = basename($hotpotatoesName,$documentPath);
84
+if ($lstrComment == "") {
85
+    $lstrComment = basename($hotpotatoesName, $documentPath);
86 86
 }
87 87
 
88 88
 echo $lstrComment;
Please login to merge, or discard this patch.
main/exercice/question_pool.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 }
173 173
 
174 174
 if (isset($_SESSION['gradebook'])){
175
-	$gradebook=	$_SESSION['gradebook'];
175
+    $gradebook=	$_SESSION['gradebook'];
176 176
 }
177 177
 
178 178
 if (!empty($gradebook) && $gradebook=='view') {
179
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
179
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
180 180
 }
181 181
 
182 182
 // if admin of course
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 echo '</div>';
228 228
 
229 229
 if ($displayMessage != "") {
230
-	Display::display_confirmation_message($displayMessage);
231
-	$displayMessage = "";
230
+    Display::display_confirmation_message($displayMessage);
231
+    $displayMessage = "";
232 232
 }
233 233
 
234 234
 // Form
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 // Title
237 237
 echo '<legend>'.$nameTools.' - '.$titleAdd.'</legend>';
238 238
 if (isset($type)) {
239
-	echo '<input type="hidden" name="type" value="1">';
239
+    echo '<input type="hidden" name="type" value="1">';
240 240
 }
241 241
 echo '<input type="hidden" name="fromExercise" value="'.$fromExercise.'">';
242 242
 
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 foreach ($course_list as $item) {
284 284
     $courseItemId = $item['real_id'];
285 285
     $courseInfo = api_get_course_info_by_id($courseItemId);
286
-	$course_select_list[$courseItemId] = "";
287
-	if ($courseItemId == api_get_course_int_id()) {
288
-		$course_select_list[$courseItemId] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
289
-	}
290
-	$course_select_list[$courseItemId] .= $courseInfo['title'];
286
+    $course_select_list[$courseItemId] = "";
287
+    if ($courseItemId == api_get_course_int_id()) {
288
+        $course_select_list[$courseItemId] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
289
+    }
290
+    $course_select_list[$courseItemId] .= $courseInfo['title'];
291 291
 }
292 292
 
293 293
 $select_course_html =  Display::select(
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
     // no course selected, reset menu test / difficult� / type de reponse
305 305
     reset_menu_exo_lvl_type();
306 306
 } else {
307
-	$course_info = api_get_course_info_by_id($selected_course);
307
+    $course_info = api_get_course_info_by_id($selected_course);
308 308
 }
309 309
 // If course has changed, reset the menu default
310 310
 if ($course_id_changed) {
311
-	reset_menu_exo_lvl_type();
311
+    reset_menu_exo_lvl_type();
312 312
 }
313 313
 
314 314
 $course_id = $course_info['real_id'];
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 }
357 357
 
358 358
 if ($exercise_id_changed == 1) {
359
-	reset_menu_lvl_type();
359
+    reset_menu_lvl_type();
360 360
 }
361 361
 $select_exercise_html =  Display::select(
362 362
     'exerciseId',
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
 // if we have selected an exercise in the list-box 'Filter'
435 435
 
436 436
 if ($exerciseId > 0) {
437
-	$where = '';
438
-	$from = '';
439
-	if (isset($courseCategoryId) && $courseCategoryId > 0) {
440
-		$from = ", $TBL_COURSE_REL_CATEGORY crc ";
441
-		$where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
442
-	}
443
-	if (isset($exerciseLevel) && $exerciseLevel != -1) {
444
-		$where .= ' AND level='.$exerciseLevel;
445
-	}
446
-	if (isset($answerType) && $answerType > 0) {
447
-		$where .= ' AND type='.$answerType;
448
-	}
449
-	$sql = "SELECT DISTINCT
437
+    $where = '';
438
+    $from = '';
439
+    if (isset($courseCategoryId) && $courseCategoryId > 0) {
440
+        $from = ", $TBL_COURSE_REL_CATEGORY crc ";
441
+        $where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
442
+    }
443
+    if (isset($exerciseLevel) && $exerciseLevel != -1) {
444
+        $where .= ' AND level='.$exerciseLevel;
445
+    }
446
+    if (isset($answerType) && $answerType > 0) {
447
+        $where .= ' AND type='.$answerType;
448
+    }
449
+    $sql = "SELECT DISTINCT
450 450
 	            id,
451 451
 	            question,
452 452
 	            type,
@@ -468,22 +468,22 @@  discard block
 block discarded – undo
468 468
         $mainQuestionList[] = $row;
469 469
     }
470 470
 } elseif ($exerciseId == -1) {
471
-	// If we have selected the option 'Orphan questions' in the list-box 'Filter'
472
-	$level_where = '';
473
-	$from = '';
474
-	if (isset($courseCategoryId) && $courseCategoryId > 0) {
475
-		$from = " INNER JOIN  $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id ";
476
-		$level_where .= " AND
471
+    // If we have selected the option 'Orphan questions' in the list-box 'Filter'
472
+    $level_where = '';
473
+    $from = '';
474
+    if (isset($courseCategoryId) && $courseCategoryId > 0) {
475
+        $from = " INNER JOIN  $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id ";
476
+        $level_where .= " AND
477 477
 		        crc.c_id = $selected_course AND
478 478
 		        crc.category_id = $courseCategoryId";
479
-	}
480
-	if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
481
-		$level_where = ' AND level='.$exerciseLevel;
482
-	}
483
-	$answer_where = '';
484
-	if (isset($answerType) && $answerType >0 -1 ) {
485
-		$answer_where = ' AND type='.$answerType;
486
-	}
479
+    }
480
+    if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
481
+        $level_where = ' AND level='.$exerciseLevel;
482
+    }
483
+    $answer_where = '';
484
+    if (isset($answerType) && $answerType >0 -1 ) {
485
+        $answer_where = ' AND type='.$answerType;
486
+    }
487 487
 
488 488
     // @todo fix this query with the new id field
489 489
     $sql = " (
@@ -525,24 +525,24 @@  discard block
 block discarded – undo
525 525
         $mainQuestionList[] = $row;
526 526
     }
527 527
 } else {
528
-	// All tests for selected course
528
+    // All tests for selected course
529 529
     // If we have not selected any option in the list-box 'Filter'
530
-	$filter = '';
531
-	$from = '';
530
+    $filter = '';
531
+    $from = '';
532 532
 
533
-	if (isset($courseCategoryId) && $courseCategoryId > 0) {
534
-		$from = ", $TBL_COURSE_REL_CATEGORY crc ";
535
-		$filter .= " AND
533
+    if (isset($courseCategoryId) && $courseCategoryId > 0) {
534
+        $from = ", $TBL_COURSE_REL_CATEGORY crc ";
535
+        $filter .= " AND
536 536
 		            crc.c_id = $selected_course AND
537 537
 		            crc.question_id = qu.id AND
538 538
 		            crc.category_id = $courseCategoryId";
539
-	}
540
-	if (isset($exerciseLevel) && $exerciseLevel != -1) {
541
-		$filter .= ' AND level='.$exerciseLevel.' ';
542
-	}
543
-	if (isset($answerType) && $answerType > 0) {
544
-		$filter .= ' AND qu.type='.$answerType.' ';
545
-	}
539
+    }
540
+    if (isset($exerciseLevel) && $exerciseLevel != -1) {
541
+        $filter .= ' AND level='.$exerciseLevel.' ';
542
+    }
543
+    if (isset($answerType) && $answerType > 0) {
544
+        $filter .= ' AND qu.type='.$answerType.' ';
545
+    }
546 546
 
547 547
     if (!empty($session_id) && $session_id != '-1') {
548 548
         $mainQuestionList = array();
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             $mainQuestionList[] = $row;
645 645
         }
646 646
     }
647
-	// forces the value to 0
647
+    // forces the value to 0
648 648
     $exerciseId = 0;
649 649
 }
650 650
 
@@ -670,33 +670,33 @@  discard block
 block discarded – undo
670 670
 //
671 671
 if ($fromExercise <= 0) {
672 672
     // NOT IN A TEST - IN THE COURSE
673
-	if ($selected_course == api_get_course_int_id()) {
674
-		$actionLabel = get_lang('Modify');
675
-		$actionIcon1 = "edit";
676
-		$actionIcon2 = "delete";
673
+    if ($selected_course == api_get_course_int_id()) {
674
+        $actionLabel = get_lang('Modify');
675
+        $actionIcon1 = "edit";
676
+        $actionIcon2 = "delete";
677 677
         // We are in the course, question title can be a link to the question edit page
678
-		$questionTagA = 1;
678
+        $questionTagA = 1;
679 679
     } else { // NOT IN A TEST - NOT IN THE COURSE
680
-		$actionLabel = get_lang('Reuse');
681
-		$actionIcon1 = get_lang('MustBeInATest');
682
-		$actionIcon2 = "";
680
+        $actionLabel = get_lang('Reuse');
681
+        $actionIcon1 = get_lang('MustBeInATest');
682
+        $actionIcon2 = "";
683 683
         // We are not in this course, to messy if we link to the question in another course
684
-		$questionTagA = 0;
685
-	}
684
+        $questionTagA = 0;
685
+    }
686 686
 } else {
687 687
     // IN A TEST - IN THE COURSE
688
-	if ($selected_course == api_get_course_int_id()) {
689
-		$actionLabel = get_lang('Reuse');
690
-		$actionIcon1 = "add";
691
-		$actionIcon2 = "";
692
-		$questionTagA = 1;
688
+    if ($selected_course == api_get_course_int_id()) {
689
+        $actionLabel = get_lang('Reuse');
690
+        $actionIcon1 = "add";
691
+        $actionIcon2 = "";
692
+        $questionTagA = 1;
693 693
     } else {
694 694
         // IN A TEST - NOT IN THE COURSE
695
-		$actionLabel = get_lang('Reuse');
696
-		$actionIcon1 = "clone";
697
-		$actionIcon2 = "";
698
-		$questionTagA = 0;
699
-	}
695
+        $actionLabel = get_lang('Reuse');
696
+        $actionIcon1 = "clone";
697
+        $actionIcon2 = "";
698
+        $questionTagA = 0;
699
+    }
700 700
 }
701 701
 // Display table
702 702
 $header = array(
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 );
790 790
 
791 791
 if (!$nbrQuestions) {
792
-	echo get_lang('NoQuestion');
792
+    echo get_lang('NoQuestion');
793 793
 }
794 794
 
795 795
 Display::display_footer();
@@ -801,9 +801,9 @@  discard block
 block discarded – undo
801 801
 */
802 802
 function reset_menu_lvl_type()
803 803
 {
804
-	global $exerciseLevel, $answerType;
805
-	$answerType = -1;
806
-	$exerciseLevel = -1;
804
+    global $exerciseLevel, $answerType;
805
+    $answerType = -1;
806
+    $exerciseLevel = -1;
807 807
 }
808 808
 
809 809
 /**
@@ -813,10 +813,10 @@  discard block
 block discarded – undo
813 813
 */
814 814
 function reset_menu_exo_lvl_type()
815 815
 {
816
-	global $exerciseId, $courseCategoryId;
817
-	reset_menu_lvl_type();
818
-	$exerciseId = 0;
819
-	$courseCategoryId = 0;
816
+    global $exerciseId, $courseCategoryId;
817
+    reset_menu_lvl_type();
818
+    $exerciseId = 0;
819
+    $courseCategoryId = 0;
820 820
 }
821 821
 
822 822
 /**
@@ -838,17 +838,17 @@  discard block
 block discarded – undo
838 838
     $in_questionname,
839 839
     $sessionId
840 840
 ) {
841
-	$res = $in_questionname;
841
+    $res = $in_questionname;
842 842
     $sessionIcon = null;
843
-	if ($in_addA) {
843
+    if ($in_addA) {
844 844
         if (!empty($sessionId) && $sessionId != -1) {
845 845
             $sessionIcon = ' '.Display::return_icon('star.png', get_lang('Session'));
846 846
         }
847
-		$res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>".
847
+        $res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>".
848 848
             $res.$sessionIcon.
849 849
             "</a>";
850
-	}
851
-	return $res;
850
+    }
851
+    return $res;
852 852
 }
853 853
 
854 854
 /**
@@ -878,16 +878,16 @@  discard block
 block discarded – undo
878 878
     $in_session_id,
879 879
     $in_exercise_id
880 880
 ) {
881
-	$res = "";
882
-	$getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id";
883
-	switch ($in_action) {
884
-		case "delete" :
885
-			$res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>";
886
-			$res .= Display::return_icon("delete.png", get_lang('Delete'));
887
-			$res .= "</a>";
888
-			break;
889
-		case "edit" :
890
-			$res = get_a_tag_for_question(
881
+    $res = "";
882
+    $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id";
883
+    switch ($in_action) {
884
+        case "delete" :
885
+            $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>";
886
+            $res .= Display::return_icon("delete.png", get_lang('Delete'));
887
+            $res .= "</a>";
888
+            break;
889
+        case "edit" :
890
+            $res = get_a_tag_for_question(
891 891
                 1,
892 892
                 $from_exercise,
893 893
                 $in_questionid,
@@ -895,33 +895,33 @@  discard block
 block discarded – undo
895 895
                 Display::return_icon("edit.png", get_lang('Modify')),
896 896
                 $in_session_id
897 897
             );
898
-			break;
899
-		case "add":
900
-			// add if question is not already in test
901
-			$myObjEx = new Exercise();
902
-			$myObjEx->read($from_exercise);
903
-			if (!$myObjEx->isInList($in_questionid)) {
904
-				$res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>";
905
-				$res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
906
-				$res .= "</a>";
898
+            break;
899
+        case "add":
900
+            // add if question is not already in test
901
+            $myObjEx = new Exercise();
902
+            $myObjEx->read($from_exercise);
903
+            if (!$myObjEx->isInList($in_questionid)) {
904
+                $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>";
905
+                $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
906
+                $res .= "</a>";
907 907
             } else {
908
-				$res = "-";
909
-			}
910
-			unset($myObjEx);
911
-			break;
912
-		case "clone":
908
+                $res = "-";
909
+            }
910
+            unset($myObjEx);
911
+            break;
912
+        case "clone":
913 913
             $url = api_get_self()."?".api_get_cidreq().$getParams."&question_copy=$in_questionid&course_id=$in_selected_course&fromExercise=$from_exercise";
914 914
             $res = Display::url(
915 915
                 Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')),
916 916
                 $url
917 917
             );
918
-			break;
919
-		default :
920
-			$res = $in_action;
921
-			break;
922
-	}
918
+            break;
919
+        default :
920
+            $res = $in_action;
921
+            break;
922
+    }
923 923
 
924
-	return $res;
924
+    return $res;
925 925
 }
926 926
 
927 927
 /**
@@ -930,14 +930,14 @@  discard block
 block discarded – undo
930 930
  */
931 931
 function get_question_type_for_question($in_selectedcourse, $in_questionid)
932 932
 {
933
-	$myObjQuestion = Question::read($in_questionid, $in_selectedcourse);
933
+    $myObjQuestion = Question::read($in_questionid, $in_selectedcourse);
934 934
     $questionType = null;
935 935
     if (!empty($myObjQuestion)) {
936 936
         list($typeImg, $typeExpl) = $myObjQuestion->get_type_icon_html();
937 937
         $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), 32), array());
938 938
         unset($myObjQuestion);
939 939
     }
940
-	return $questionType;
940
+    return $questionType;
941 941
 }
942 942
 
943 943
 /**
@@ -946,6 +946,6 @@  discard block
 block discarded – undo
946 946
  */
947 947
 function get_question_categorie_for_question($in_courseid, $in_questionid)
948 948
 {
949
-	$cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid);
950
-	return $cat;
949
+    $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid);
950
+    return $cat;
951 951
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 $nameTools = get_lang('QuestionPool');
51
-$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
51
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
52 52
 
53 53
 if (!empty($objExercise)) {
54 54
     $interbreadcrumb[] = array(
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         if ($old_question_obj) {
75 75
             $old_question_obj->updateTitle(
76
-                $old_question_obj->selectTitle() . ' - ' . get_lang('Copy')
76
+                $old_question_obj->selectTitle().' - '.get_lang('Copy')
77 77
             );
78 78
             //Duplicating the source question, in the current course
79 79
             $new_id = $old_question_obj->duplicate($current_course);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         }
108 108
         // destruction of the Question object
109 109
         unset($objQuestionTmp);
110
-    } elseif($recup && $fromExercise) {
110
+    } elseif ($recup && $fromExercise) {
111 111
         // gets an existing question and copies it into a new exercise
112 112
         $objQuestionTmp = Question :: read($recup);
113 113
         // if the question exists
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 $old_question_obj = Question::read($old_question_id, $origin_course_id);
140 140
                 if ($old_question_obj) {
141 141
                     $old_question_obj->updateTitle(
142
-                        $old_question_obj->selectTitle() . ' - ' . get_lang('Copy')
142
+                        $old_question_obj->selectTitle().' - '.get_lang('Copy')
143 143
                     );
144 144
 
145 145
                     //Duplicating the source question, in the current course
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
                 }
168 168
             }
169 169
         }
170
-        Session::write('objExercise',$objExercise);
170
+        Session::write('objExercise', $objExercise);
171 171
     }
172 172
 }
173 173
 
174
-if (isset($_SESSION['gradebook'])){
175
-	$gradebook=	$_SESSION['gradebook'];
174
+if (isset($_SESSION['gradebook'])) {
175
+	$gradebook = $_SESSION['gradebook'];
176 176
 }
177 177
 
178
-if (!empty($gradebook) && $gradebook=='view') {
179
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
178
+if (!empty($gradebook) && $gradebook == 'view') {
179
+	$interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook'));
180 180
 }
181 181
 
182 182
 // if admin of course
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 }
217 217
 if (isset($fromExercise) && $fromExercise > 0) {
218 218
     echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$fromExercise.'">'.
219
-            Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
219
+            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
220 220
     $titleAdd = get_lang('AddQuestionToTest');
221 221
 } else {
222 222
     echo '<a href="exercise.php?'.api_get_cidReq().'">'.
223
-        Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
223
+        Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
224 224
     echo "<a href='admin.php?exerciseId=0'>".Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM)."</a>";
225 225
     $titleAdd = get_lang('ManageAllQuestions');
226 226
 }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 foreach ($sessionList as $item) {
250 250
     $session_select_list[$item['session_id']] = $item['session_name'];
251 251
 }
252
-$select_session_html =  Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
252
+$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
253 253
 echo Display::form_row($labelFormRow, $select_session_html);
254 254
 
255 255
 // Course list, get course list of session, or for course where user is admin
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	$course_select_list[$courseItemId] .= $courseInfo['title'];
291 291
 }
292 292
 
293
-$select_course_html =  Display::select(
293
+$select_course_html = Display::select(
294 294
     'selected_course',
295 295
     $course_select_list,
296 296
     $selected_course,
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 $my_exercise_list['0']  = get_lang('AllExercises');
347 347
 $my_exercise_list['-1'] = get_lang('OrphanQuestions');
348 348
 if (is_array($exercise_list)) {
349
-    foreach($exercise_list as $row) {
349
+    foreach ($exercise_list as $row) {
350 350
         $my_exercise_list[$row['id']] = "";
351
-        if ($row['id'] ==  $fromExercise && $selected_course == api_get_course_int_id()) {
351
+        if ($row['id'] == $fromExercise && $selected_course == api_get_course_int_id()) {
352 352
             $my_exercise_list[$row['id']] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
353 353
         }
354 354
         $my_exercise_list[$row['id']] .= $row['title'];
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 if ($exercise_id_changed == 1) {
359 359
 	reset_menu_lvl_type();
360 360
 }
361
-$select_exercise_html =  Display::select(
361
+$select_exercise_html = Display::select(
362 362
     'exerciseId',
363 363
     $my_exercise_list,
364 364
     $exerciseId,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 $question_list = Question::get_question_type_list();
392 392
 
393 393
 $new_question_list = array();
394
-$new_question_list['-1']  = get_lang('All');
394
+$new_question_list['-1'] = get_lang('All');
395 395
 if (!empty($_course)) {
396 396
     $objExercise = new Exercise();
397 397
     $objExercise->read($fromExercise);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
             ORDER BY question_order";
465 465
 
466 466
     $result = Database::query($sql);
467
-    while($row = Database::fetch_array($result, 'ASSOC')) {
467
+    while ($row = Database::fetch_array($result, 'ASSOC')) {
468 468
         $mainQuestionList[] = $row;
469 469
     }
470 470
 } elseif ($exerciseId == -1) {
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 		        crc.c_id = $selected_course AND
478 478
 		        crc.category_id = $courseCategoryId";
479 479
 	}
480
-	if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
480
+	if (isset($exerciseLevel) && $exerciseLevel != -1) {
481 481
 		$level_where = ' AND level='.$exerciseLevel;
482 482
 	}
483 483
 	$answer_where = '';
484
-	if (isset($answerType) && $answerType >0 -1 ) {
484
+	if (isset($answerType) && $answerType > 0 - 1) {
485 485
 		$answer_where = ' AND type='.$answerType;
486 486
 	}
487 487
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                     $level_where $answer_where
522 522
              )";
523 523
     $result = Database::query($sql);
524
-    while($row = Database::fetch_array($result, 'ASSOC')) {
524
+    while ($row = Database::fetch_array($result, 'ASSOC')) {
525 525
         $mainQuestionList[] = $row;
526 526
     }
527 527
 } else {
Please login to merge, or discard this patch.
main/gradebook/gradebook_showlog_eval.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 api_block_anonymous_users();
10 10
 GradebookUtils::block_students();
11 11
 
12
-$interbreadcrumb[] = array (
12
+$interbreadcrumb[] = array(
13 13
     'url' => $_SESSION['gradebook_dest'].'?',
14 14
     'name' => get_lang('Gradebook'
15 15
 ));
16
-$interbreadcrumb[] = array (
16
+$interbreadcrumb[] = array(
17 17
     'url' => $_SESSION['gradebook_dest'].'?selectcat='.Security::remove_XSS($_GET['selectcat']),
18 18
     'name' => get_lang('Details'
19 19
 ));
20
-$interbreadcrumb[] = array (
20
+$interbreadcrumb[] = array(
21 21
     'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.Security::remove_XSS($_GET['selectcat']),
22 22
     'name' => get_lang('GradebookQualifyLog')
23 23
 );
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $t_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
30 30
 $t_user = Database :: get_main_table(TABLE_MAIN_USER);
31
-$visible_log=Security::remove_XSS($_GET['visiblelog']);
31
+$visible_log = Security::remove_XSS($_GET['visiblelog']);
32 32
 
33 33
 $evaledit = Evaluation :: load($visible_log);
34 34
 $sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
     $list_info[] = $row;
43 43
 }
44 44
 
45
-foreach($list_info as $key => $info_log) {
46
-    $list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
47
-    $list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
45
+foreach ($list_info as $key => $info_log) {
46
+    $list_info[$key][5] = ($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
47
+    $list_info[$key][3] = ($info_log[3] == 1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
48 48
 }
49 49
 
50 50
 $parameters = array(
Please login to merge, or discard this patch.