Completed
Push — 1.11.x ( 55a6a1...a914dc )
by José
60:32 queued 35:06
created
main/auth/profile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -628,7 +628,7 @@
 block discarded – undo
628 628
 
629 629
     foreach ($user_data as $key => $value) {
630 630
         if (substr($key, 0, 6) === 'extra_') { //an extra field
631
-           continue;
631
+            continue;
632 632
         } elseif (strpos($key, 'remove_extra_') !== false) {
633 633
         } else {
634 634
             if (in_array($key, $available_values_to_modify)) {
Please login to merge, or discard this patch.
main/course_home/course_home.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             if (Database::num_rows($result) ==  0) {
204 204
                 $condition = '';
205 205
             } else {
206
-            	//great, there is an specific auto launch for this session we leave the $condition
206
+                //great, there is an specific auto launch for this session we leave the $condition
207 207
             }
208 208
         }
209 209
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $lp_data = Database::fetch_array($result,'ASSOC');
216 216
             if (!empty($lp_data['id'])) {
217 217
                 if (api_is_platform_admin() || api_is_allowed_to_edit()) {
218
-                	$show_autolaunch_lp_warning = true;
218
+                    $show_autolaunch_lp_warning = true;
219 219
                 } else {
220 220
                     $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
221 221
                     if (!isset($_SESSION[$session_key])) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         //if (!isset($_SESSION[$forumKey])) {
245 245
             //redirecting to the LP
246 246
             $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&id_session='.$session_id;
247
-          //  $_SESSION[$forumKey] = true;
247
+            //  $_SESSION[$forumKey] = true;
248 248
             header("Location: $url");
249 249
             exit;
250 250
         //}
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 }
281 281
 
282 282
 if (api_get_setting('homepage_view') === 'activity' || api_get_setting('homepage_view') === 'activity_big') {
283
-	require 'activity.php';
283
+    require 'activity.php';
284 284
 } elseif (api_get_setting('homepage_view') === '2column') {
285
-	require '2column.php';
285
+    require '2column.php';
286 286
 } elseif (api_get_setting('homepage_view') === '3column') {
287
-	require '3column.php';
287
+    require '3column.php';
288 288
 } elseif (api_get_setting('homepage_view') === 'vertical_activity') {
289
-	require 'vertical_activity.php';
289
+    require 'vertical_activity.php';
290 290
 }
291 291
 
292 292
 $content = '<div id="course_tools">'.$content.'</div>';
Please login to merge, or discard this patch.
main/install/update-configuration.inc.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         if (stripos($line, '$_configuration[\'system_version\']') !== false) {
39 39
             $found_version = true;
40 40
             $line = '$_configuration[\'system_version\'] = \'' . $GLOBALS['new_version'] . '\';' . "\r\n";
41
-       } elseif (stripos($line, '$_configuration[\'system_stable\']') !== false) {
41
+        } elseif (stripos($line, '$_configuration[\'system_stable\']') !== false) {
42 42
             $found_stable = true;
43 43
             $line = '$_configuration[\'system_stable\'] = ' . ($GLOBALS['new_version_stable'] ? 'true' : 'false') . ';' . "\r\n";
44 44
         } elseif (stripos($line, '$_configuration[\'software_name\']') !== false) {
Please login to merge, or discard this patch.
main/install/install.lib.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1745,7 +1745,7 @@  discard block
 block discarded – undo
1745 1745
         $html .= '<label class="checkbox-inline">
1746 1746
                         <input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1747 1747
                     </label>';
1748
-         $html .= '<label class="checkbox-inline">
1748
+            $html .= '<label class="checkbox-inline">
1749 1749
                     <input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1750 1750
                 </label>';
1751 1751
         $html .= '</div>';
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
     </div>';
1780 1780
 
1781 1781
     echo panel($html, get_lang('Platform'), 'platform');
1782
- ?>
1782
+    ?>
1783 1783
     <div class='form-group'>
1784 1784
         <div class="col-sm-6">
1785 1785
             <button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button>
Please login to merge, or discard this patch.
main/social/profile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -596,7 +596,7 @@
 block discarded – undo
596 596
                                 .' width="40px">';
597 597
                     $userInfo = api_get_user_info($user_invitation_id);
598 598
                     $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'
599
-                                 .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>';
599
+                                    .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>';
600 600
 
601 601
                     $invitations .='<div class="pull-right">';
602 602
                     $invitations .= Display::toolbarButton(
Please login to merge, or discard this patch.
main/upload/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
39 39
 if (!$is_allowed_to_edit) {
40
-	api_not_allowed(true);
40
+    api_not_allowed(true);
41 41
 }
42 42
 
43 43
 $courseDir = $_course['path'] . "/document";
Please login to merge, or discard this patch.
main/exercise/question_list_admin.inc.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
  *	Code library for HotPotatoes integration.
6 6
  *	@package chamilo.exercise
7 7
  *	@author Olivier Brouckaert & Julio Montoya & Hubert Borderiou 21-10-2011 (Question by category)
8
-
9 8
  *	QUESTION LIST ADMINISTRATION
10 9
  *
11 10
  *	This script allows to manage the question list
Please login to merge, or discard this patch.
main/exercise/answer.class.php 1 patch
Indentation   +319 added lines, -319 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     public $new_destination; // id of the next question if feedback option is set to Directfeedback
40 40
     public $course; //Course information
41 41
     public $iid;
42
-	public $questionJSId;
43
-	public $standalone;
42
+    public $questionJSId;
43
+    public $standalone;
44 44
 
45 45
     /**
46 46
      * constructor of the class
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
         return [];
162 162
     }
163 163
 
164
-     /**
165
-     * returns all answer ids from this question Id
166
-     *
167
-     * @author Yoselyn Castillo
168
-     * @return array - $id (answer ids)
169
-     */
164
+        /**
165
+         * returns all answer ids from this question Id
166
+         *
167
+         * @author Yoselyn Castillo
168
+         * @return array - $id (answer ids)
169
+         */
170 170
     public function selectAnswerId()
171 171
     {
172 172
         $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         }
187 187
 
188 188
         return $id;
189
-	}
189
+    }
190 190
 
191 191
     /**
192 192
      * Reads answer information from the data base ordered by parameter
@@ -197,23 +197,23 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function readOrderedBy($field, $order='ASC')
199 199
     {
200
-		$field = Database::escape_string($field);
201
-		if (empty($field)) {
202
-			$field = 'position';
203
-		}
200
+        $field = Database::escape_string($field);
201
+        if (empty($field)) {
202
+            $field = 'position';
203
+        }
204 204
 
205
-		if ($order != 'ASC' && $order!='DESC') {
206
-			$order = 'ASC';
207
-		}
205
+        if ($order != 'ASC' && $order!='DESC') {
206
+            $order = 'ASC';
207
+        }
208 208
 
209
-		$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
210
-		$TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION);
211
-		$questionId = intval($this->questionId);
209
+        $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
210
+        $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION);
211
+        $questionId = intval($this->questionId);
212 212
 
213
-		$sql = "SELECT type FROM $TBL_QUIZ
213
+        $sql = "SELECT type FROM $TBL_QUIZ
214 214
 		        WHERE c_id = {$this->course_id} AND id = $questionId";
215
-		$result_question = Database::query($sql);
216
-		$questionType = Database::fetch_array($result_question);
215
+        $result_question = Database::query($sql);
216
+        $questionType = Database::fetch_array($result_question);
217 217
 
218 218
         if ($questionType['type'] == DRAGGABLE) {
219 219
             // Random is done by submit.js.tpl
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             return true;
223 223
         }
224 224
 
225
-		$sql = "SELECT
225
+        $sql = "SELECT
226 226
 		            answer,
227 227
 		            correct,
228 228
 		            comment,
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
                     c_id = {$this->course_id} AND
239 239
                     question_id='".$questionId."'
240 240
                 ORDER BY $field $order";
241
-		$result=Database::query($sql);
242
-
243
-		$i = 1;
244
-		// while a record is found
245
-		$doubt_data = null;
246
-		while ($object = Database::fetch_object($result)) {
247
-		    if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) {
248
-		        $doubt_data = $object;
241
+        $result=Database::query($sql);
242
+
243
+        $i = 1;
244
+        // while a record is found
245
+        $doubt_data = null;
246
+        while ($object = Database::fetch_object($result)) {
247
+            if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) {
248
+                $doubt_data = $object;
249 249
                 continue;
250
-		    }
250
+            }
251 251
             $this->answer[$i] = $object->answer;
252 252
             $this->correct[$i] = $object->correct;
253 253
             $this->comment[$i] = $object->comment;
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
             $this->autoId[$i] = $object->id_auto;
260 260
             $this->iid[$i] = $object->iid;
261 261
             $i++;
262
-		}
262
+        }
263 263
 
264
-		if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) {
264
+        if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) {
265 265
             $this->answer[$i] = $doubt_data->answer;
266 266
             $this->correct[$i] = $doubt_data->correct;
267 267
             $this->comment[$i] = $doubt_data->comment;
@@ -273,88 +273,88 @@  discard block
 block discarded – undo
273 273
             $this->autoId[$i] = $doubt_data->id_auto;
274 274
             $this->iid[$i] = $doubt_data->iid;
275 275
             $i++;
276
-	    }
276
+        }
277 277
         $this->nbrAnswers = $i-1;
278
-	}
279
-
280
-	/**
281
-	 * returns the autoincrement id identificator
282
-	 *
283
-	 * @author Juan Carlos Ra�a
284
-	 * @return integer - answer num
285
-	 */
278
+    }
279
+
280
+    /**
281
+     * returns the autoincrement id identificator
282
+     *
283
+     * @author Juan Carlos Ra�a
284
+     * @return integer - answer num
285
+     */
286 286
     public function selectAutoId($id)
287 287
     {
288
-		return isset($this->autoId[$id]) ? $this->autoId[$id] : 0;
289
-	}
290
-
291
-	/**
292
-	 * returns the number of answers in this question
293
-	 *
294
-	 * @author Olivier Brouckaert
295
-	 * @return integer - number of answers
296
-	 */
297
-	public function selectNbrAnswers()
288
+        return isset($this->autoId[$id]) ? $this->autoId[$id] : 0;
289
+    }
290
+
291
+    /**
292
+     * returns the number of answers in this question
293
+     *
294
+     * @author Olivier Brouckaert
295
+     * @return integer - number of answers
296
+     */
297
+    public function selectNbrAnswers()
298 298
     {
299
-		return $this->nbrAnswers;
300
-	}
301
-
302
-	/**
303
-	 * returns the question ID which the answers belong to
304
-	 *
305
-	 * @author Olivier Brouckaert
306
-	 * @return integer - the question ID
307
-	 */
308
-	public function selectQuestionId()
299
+        return $this->nbrAnswers;
300
+    }
301
+
302
+    /**
303
+     * returns the question ID which the answers belong to
304
+     *
305
+     * @author Olivier Brouckaert
306
+     * @return integer - the question ID
307
+     */
308
+    public function selectQuestionId()
309 309
     {
310
-		return $this->questionId;
311
-	}
312
-
313
-	/**
314
-	 * returns the question ID of the destination question
315
-	 *
316
-	 * @author Julio Montoya
317
-	 * @param integer $id
318
-	 * @return integer - the question ID
319
-	 */
320
-	public function selectDestination($id)
310
+        return $this->questionId;
311
+    }
312
+
313
+    /**
314
+     * returns the question ID of the destination question
315
+     *
316
+     * @author Julio Montoya
317
+     * @param integer $id
318
+     * @return integer - the question ID
319
+     */
320
+    public function selectDestination($id)
321 321
     {
322
-		return isset($this->destination[$id]) ? $this->destination[$id] : null;
323
-	}
322
+        return isset($this->destination[$id]) ? $this->destination[$id] : null;
323
+    }
324 324
 
325 325
     /**
326
-	 * returns the answer title
327
-	 *
328
-	 * @author Olivier Brouckaert
329
-	 * @param - integer $id - answer ID
330
-	 * @return string - answer title
331
-	 */
332
-	public function selectAnswer($id)
333
-	{
334
-		return isset($this->answer[$id]) ? $this->answer[$id] : null;
335
-	}
336
-
337
-	/**
338
-	 * return array answer by id else return a bool
339
-	 * @param integer $auto_id
340
-	 */
341
-	public function selectAnswerByAutoId($auto_id)
342
-	{
343
-		$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
344
-
345
-		$auto_id = intval($auto_id);
346
-		$sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER
326
+     * returns the answer title
327
+     *
328
+     * @author Olivier Brouckaert
329
+     * @param - integer $id - answer ID
330
+     * @return string - answer title
331
+     */
332
+    public function selectAnswer($id)
333
+    {
334
+        return isset($this->answer[$id]) ? $this->answer[$id] : null;
335
+    }
336
+
337
+    /**
338
+     * return array answer by id else return a bool
339
+     * @param integer $auto_id
340
+     */
341
+    public function selectAnswerByAutoId($auto_id)
342
+    {
343
+        $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
344
+
345
+        $auto_id = intval($auto_id);
346
+        $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER
347 347
 				WHERE c_id = {$this->course_id} AND id_auto='$auto_id'";
348
-		$rs = Database::query($sql);
348
+        $rs = Database::query($sql);
349 349
 
350
-		if (Database::num_rows($rs) > 0) {
351
-			$row = Database::fetch_array($rs, 'ASSOC');
350
+        if (Database::num_rows($rs) > 0) {
351
+            $row = Database::fetch_array($rs, 'ASSOC');
352 352
 
353
-			return $row;
354
-		}
353
+            return $row;
354
+        }
355 355
 
356
-		return false;
357
-	}
356
+        return false;
357
+    }
358 358
 
359 359
     /**
360 360
      * returns the answer title from an answer's position
@@ -363,18 +363,18 @@  discard block
 block discarded – undo
363 363
      * @param - integer $id - answer ID
364 364
      * @return bool - answer title
365 365
      */
366
-	public function selectAnswerIdByPosition($pos)
367
-	{
368
-		foreach ($this->position as $k => $v) {
369
-			if ($v != $pos) {
370
-				continue;
371
-			}
366
+    public function selectAnswerIdByPosition($pos)
367
+    {
368
+        foreach ($this->position as $k => $v) {
369
+            if ($v != $pos) {
370
+                continue;
371
+            }
372 372
 
373
-			return $k;
374
-		}
373
+            return $k;
374
+        }
375 375
 
376
-		return false;
377
-	}
376
+        return false;
377
+    }
378 378
 
379 379
     /**
380 380
      * Returns a list of answers
@@ -383,18 +383,18 @@  discard block
 block discarded – undo
383 383
      * of (id, answer, comment, grade) and grade=weighting
384 384
      */
385 385
     public function getAnswersList($decode = false)
386
-     {
387
-	 	$list = array();
388
-         for ($i = 1; $i <= $this->nbrAnswers; $i++) {
389
-             if (!empty($this->answer[$i])) {
390
-
391
-	 			//Avoid problems when parsing elements with accents
392
-	 			if ($decode) {
393
-	        		$this->answer[$i] 	= api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding());
394
-	        		$this->comment[$i]	= api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding());
395
-	 			}
396
-
397
-	 			$list[] = array(
386
+        {
387
+            $list = array();
388
+            for ($i = 1; $i <= $this->nbrAnswers; $i++) {
389
+                if (!empty($this->answer[$i])) {
390
+
391
+                    //Avoid problems when parsing elements with accents
392
+                    if ($decode) {
393
+                    $this->answer[$i] 	= api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding());
394
+                    $this->comment[$i]	= api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding());
395
+                    }
396
+
397
+                    $list[] = array(
398 398
                     'id' => $i,
399 399
                     'answer' => $this->answer[$i],
400 400
                     'comment' => $this->comment[$i],
@@ -403,137 +403,137 @@  discard block
 block discarded – undo
403 403
                     'hotspot_type' => $this->hotspot_type[$i],
404 404
                     'correct' => $this->correct[$i],
405 405
                     'destination' => $this->destination[$i]
406
-				);
406
+                );
407
+            }
407 408
             }
408
-	 	}
409 409
 
410
-	 	return $list;
411
-	 }
410
+            return $list;
411
+        }
412 412
 
413
-	/**
414
-	 * Returns a list of grades
415
-	 * @author Yannick Warnier <[email protected]>
416
-	 * @return array	List of grades where grade=weighting (?)
417
-	 */
413
+    /**
414
+     * Returns a list of grades
415
+     * @author Yannick Warnier <[email protected]>
416
+     * @return array	List of grades where grade=weighting (?)
417
+     */
418 418
     public function getGradesList()
419
-     {
420
-	 	$list = array();
421
-	 	for ($i = 0; $i<$this->nbrAnswers;$i++){
422
-	 		if(!empty($this->answer[$i])){
423
-	 			$list[$i] = $this->weighting[$i];
424
-	 		}
425
-	 	}
426
-	 	return $list;
427
-	 }
428
-
429
-	 /**
430
-	  * Returns the question type
431
-	  * @author	Yannick Warnier <[email protected]>
432
-	  * @return	integer	The type of the question this answer is bound to
433
-	  */
419
+        {
420
+            $list = array();
421
+            for ($i = 0; $i<$this->nbrAnswers;$i++){
422
+                if(!empty($this->answer[$i])){
423
+                    $list[$i] = $this->weighting[$i];
424
+                }
425
+            }
426
+            return $list;
427
+        }
428
+
429
+        /**
430
+         * Returns the question type
431
+         * @author	Yannick Warnier <[email protected]>
432
+         * @return	integer	The type of the question this answer is bound to
433
+         */
434 434
     public function getQuestionType()
435
-     {
436
-	 	$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
437
-	 	$sql = "SELECT type FROM $TBL_QUESTIONS
435
+        {
436
+            $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
437
+            $sql = "SELECT type FROM $TBL_QUESTIONS
438 438
 	 	        WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'";
439
-	 	$res = Database::query($sql);
440
-	 	if (Database::num_rows($res)<=0){
441
-	 		return null;
442
-	 	}
443
-	 	$row = Database::fetch_array($res);
444
-
445
-	 	return $row['type'];
446
-	 }
447
-
448
-
449
-	/**
450
-	 * tells if answer is correct or not
451
-	 *
452
-	 * @author Olivier Brouckaert
453
-	 * @param - integer $id - answer ID
454
-	 * @return integer - 0 if bad answer, not 0 if good answer
455
-	 */
439
+            $res = Database::query($sql);
440
+            if (Database::num_rows($res)<=0){
441
+                return null;
442
+            }
443
+            $row = Database::fetch_array($res);
444
+
445
+            return $row['type'];
446
+        }
447
+
448
+
449
+    /**
450
+     * tells if answer is correct or not
451
+     *
452
+     * @author Olivier Brouckaert
453
+     * @param - integer $id - answer ID
454
+     * @return integer - 0 if bad answer, not 0 if good answer
455
+     */
456 456
     public function isCorrect($id)
457
-	{
458
-		return isset($this->correct[$id]) ? $this->correct[$id] : null;
459
-	}
460
-
461
-	/**
462
-	 * returns answer comment
463
-	 *
464
-	 * @author Olivier Brouckaert
465
-	 * @param - integer $id - answer ID
466
-	 * @return string - answer comment
467
-	 */
457
+    {
458
+        return isset($this->correct[$id]) ? $this->correct[$id] : null;
459
+    }
460
+
461
+    /**
462
+     * returns answer comment
463
+     *
464
+     * @author Olivier Brouckaert
465
+     * @param - integer $id - answer ID
466
+     * @return string - answer comment
467
+     */
468 468
     public function selectComment($id)
469
-	{
469
+    {
470 470
         return isset($this->comment[$id]) ? $this->comment[$id] : null;
471
-	}
472
-
473
-	/**
474
-	 * returns answer weighting
475
-	 *
476
-	 * @author Olivier Brouckaert
477
-	 * @param - integer $id - answer ID
478
-	 * @param integer $id
479
-	 * @return integer - answer weighting
480
-	 */
471
+    }
472
+
473
+    /**
474
+     * returns answer weighting
475
+     *
476
+     * @author Olivier Brouckaert
477
+     * @param - integer $id - answer ID
478
+     * @param integer $id
479
+     * @return integer - answer weighting
480
+     */
481 481
     public function selectWeighting($id)
482
-	{
483
-		return isset($this->weighting[$id]) ? $this->weighting[$id] : null;
484
-	}
485
-
486
-	/**
487
-	 * returns answer position
488
-	 *
489
-	 * @author Olivier Brouckaert
490
-	 * @param - integer $id - answer ID
491
-	 * @return integer - answer position
492
-	 */
493
-	function selectPosition($id)
494
-	{
495
-		return isset($this->position[$id]) ? $this->position[$id] : null;
496
-	}
497
-
498
-	/**
499
-	 * returns answer hotspot coordinates
500
-	 *
501
-	 * @author	Olivier Brouckaert
502
-	 * @param	integer	Answer ID
503
-	 * @param integer $id
504
-	 * @return	integer	Answer position
505
-	 */
482
+    {
483
+        return isset($this->weighting[$id]) ? $this->weighting[$id] : null;
484
+    }
485
+
486
+    /**
487
+     * returns answer position
488
+     *
489
+     * @author Olivier Brouckaert
490
+     * @param - integer $id - answer ID
491
+     * @return integer - answer position
492
+     */
493
+    function selectPosition($id)
494
+    {
495
+        return isset($this->position[$id]) ? $this->position[$id] : null;
496
+    }
497
+
498
+    /**
499
+     * returns answer hotspot coordinates
500
+     *
501
+     * @author	Olivier Brouckaert
502
+     * @param	integer	Answer ID
503
+     * @param integer $id
504
+     * @return	integer	Answer position
505
+     */
506 506
     public function selectHotspotCoordinates($id)
507
-	{
508
-		return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null;
509
-	}
510
-
511
-	/**
512
-	 * returns answer hotspot type
513
-	 *
514
-	 * @author	Toon Keppens
515
-	 * @param	integer		Answer ID
516
-	 * @param integer $id
517
-	 * @return	integer		Answer position
518
-	 */
507
+    {
508
+        return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null;
509
+    }
510
+
511
+    /**
512
+     * returns answer hotspot type
513
+     *
514
+     * @author	Toon Keppens
515
+     * @param	integer		Answer ID
516
+     * @param integer $id
517
+     * @return	integer		Answer position
518
+     */
519 519
     public function selectHotspotType($id)
520
-	{
521
-		return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null;
522
-	}
523
-
524
-	/**
525
-	 * Creates a new answer
526
-	 *
527
-	 * @author Olivier Brouckaert
528
-	 * @param string 	$answer answer title
529
-	 * @param integer 	$correct 0 if bad answer, not 0 if good answer
530
-	 * @param string 	$comment answer comment
531
-	 * @param integer 	$weighting answer weighting
532
-	 * @param integer 	$position answer position
533
-	 * @param array    $new_hotspot_coordinates Coordinates for hotspot exercises (optional)
534
-	 * @param integer	$new_hotspot_type Type for hotspot exercises (optional)
520
+    {
521
+        return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null;
522
+    }
523
+
524
+    /**
525
+     * Creates a new answer
526
+     *
527
+     * @author Olivier Brouckaert
528
+     * @param string 	$answer answer title
529
+     * @param integer 	$correct 0 if bad answer, not 0 if good answer
530
+     * @param string 	$comment answer comment
531
+     * @param integer 	$weighting answer weighting
532
+     * @param integer 	$position answer position
533
+     * @param array    $new_hotspot_coordinates Coordinates for hotspot exercises (optional)
534
+     * @param integer	$new_hotspot_type Type for hotspot exercises (optional)
535 535
      * @param string   $destination
536
-	 */
536
+     */
537 537
     public function createAnswer(
538 538
         $answer,
539 539
         $correct,
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
         $new_hotspot_type = null,
545 545
         $destination = ''
546 546
     ) {
547
-		$this->new_nbrAnswers++;
547
+        $this->new_nbrAnswers++;
548 548
         $id = $this->new_nbrAnswers;
549 549
         $this->new_answer[$id] = $answer;
550 550
         $this->new_correct[$id] = $correct;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
         $this->new_hotspot_coordinates[$id] = $new_hotspot_coordinates;
555 555
         $this->new_hotspot_type[$id] = $new_hotspot_type;
556 556
         $this->new_destination[$id] = $destination;
557
-	}
557
+    }
558 558
 
559 559
     /**
560 560
      * Updates an answer
@@ -597,32 +597,32 @@  discard block
 block discarded – undo
597 597
 
598 598
         $em->merge($quizAnswer);
599 599
         $em->flush();
600
-	}
600
+    }
601 601
 
602
-	/**
603
-	 * Records answers into the data base
604
-	 *
605
-	 * @author Olivier Brouckaert
606
-	 */
602
+    /**
603
+     * Records answers into the data base
604
+     *
605
+     * @author Olivier Brouckaert
606
+     */
607 607
     public function save()
608 608
     {
609
-		$answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER);
609
+        $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER);
610 610
         $em = Database::getManager();
611
-		$questionId = intval($this->questionId);
611
+        $questionId = intval($this->questionId);
612 612
 
613
-		$c_id = $this->course['real_id'];
613
+        $c_id = $this->course['real_id'];
614 614
         $correctList = [];
615 615
         $answerList = [];
616 616
 
617
-		for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
618
-			$answer = $this->new_answer[$i];
619
-			$correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : '';
620
-			$comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : '';
621
-			$weighting = isset($this->new_weighting[$i]) ? $this->new_weighting[$i] : '';
622
-			$position = isset($this->new_position[$i]) ? $this->new_position[$i] : '';
623
-			$hotspot_coordinates = isset($this->new_hotspot_coordinates[$i]) ? $this->new_hotspot_coordinates[$i] : '';
624
-			$hotspot_type = isset($this->new_hotspot_type[$i]) ? $this->new_hotspot_type[$i] : '';
625
-			$destination = isset($this->new_destination[$i]) ? $this->new_destination[$i] : '';
617
+        for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
618
+            $answer = $this->new_answer[$i];
619
+            $correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : '';
620
+            $comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : '';
621
+            $weighting = isset($this->new_weighting[$i]) ? $this->new_weighting[$i] : '';
622
+            $position = isset($this->new_position[$i]) ? $this->new_position[$i] : '';
623
+            $hotspot_coordinates = isset($this->new_hotspot_coordinates[$i]) ? $this->new_hotspot_coordinates[$i] : '';
624
+            $hotspot_type = isset($this->new_hotspot_type[$i]) ? $this->new_hotspot_type[$i] : '';
625
+            $destination = isset($this->new_destination[$i]) ? $this->new_destination[$i] : '';
626 626
             $autoId = $this->selectAutoId($i);
627 627
             $iid = isset($this->iid[$i]) ? $this->iid[$i] : 0;
628 628
 
@@ -664,11 +664,11 @@  discard block
 block discarded – undo
664 664
                         $answer->read();
665 665
                         $correctAnswerId = $answer->selectAnswerIdByPosition($correct);
666 666
 
667
-						// Continue to avoid matching question bug if $correctAnswerId returns false
668
-						// See : https://support.chamilo.org/issues/8334
669
-						if ($questionType == MATCHING && !$correctAnswerId) {
670
-							continue;
671
-						}
667
+                        // Continue to avoid matching question bug if $correctAnswerId returns false
668
+                        // See : https://support.chamilo.org/issues/8334
669
+                        if ($questionType == MATCHING && !$correctAnswerId) {
670
+                            continue;
671
+                        }
672 672
 
673 673
                         $correctAnswerAutoId = $answer->selectAutoId($correct);
674 674
                         $quizAnswer->setCorrect($correctAnswerAutoId ? $correctAnswerAutoId : 0);
@@ -734,28 +734,28 @@  discard block
 block discarded – undo
734 734
             }
735 735
         }
736 736
 
737
-		// moves $new_* arrays
738
-		$this->answer = $this->new_answer;
739
-		$this->correct = $this->new_correct;
740
-		$this->comment = $this->new_comment;
741
-		$this->weighting = $this->new_weighting;
742
-		$this->position = $this->new_position;
743
-		$this->hotspot_coordinates = $this->new_hotspot_coordinates;
744
-		$this->hotspot_type = $this->new_hotspot_type;
745
-		$this->nbrAnswers = $this->new_nbrAnswers;
746
-		$this->destination = $this->new_destination;
747
-
748
-		$this->cancel();
749
-	}
750
-
751
-	/**
752
-	 * Duplicates answers by copying them into another question
753
-	 *
754
-	 * @author Olivier Brouckaert
755
-	 * @param  int question id
737
+        // moves $new_* arrays
738
+        $this->answer = $this->new_answer;
739
+        $this->correct = $this->new_correct;
740
+        $this->comment = $this->new_comment;
741
+        $this->weighting = $this->new_weighting;
742
+        $this->position = $this->new_position;
743
+        $this->hotspot_coordinates = $this->new_hotspot_coordinates;
744
+        $this->hotspot_type = $this->new_hotspot_type;
745
+        $this->nbrAnswers = $this->new_nbrAnswers;
746
+        $this->destination = $this->new_destination;
747
+
748
+        $this->cancel();
749
+    }
750
+
751
+    /**
752
+     * Duplicates answers by copying them into another question
753
+     *
754
+     * @author Olivier Brouckaert
755
+     * @param  int question id
756 756
      * @param  array destination course info (result of the function api_get_course_info() )
757 757
      * @param string $newQuestionId
758
-	 */
758
+     */
759 759
     public function duplicate($newQuestionId, $course_info = null)
760 760
     {
761 761
         if (empty($course_info)) {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
             if (!empty($origin_options)) {
777 777
                 foreach ($origin_options as $item) {
778
-            	   $new_option_list[] = $item['id'];
778
+                    $new_option_list[] = $item['id'];
779 779
                 }
780 780
             }
781 781
 
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
             }
790 790
         }
791 791
 
792
-		// if at least one answer
793
-		if ($this->nbrAnswers) {
794
-			// inserts new answers into data base
795
-			$c_id = $course_info['real_id'];
792
+        // if at least one answer
793
+        if ($this->nbrAnswers) {
794
+            // inserts new answers into data base
795
+            $c_id = $course_info['real_id'];
796 796
 
797
-			for ($i=1;$i <= $this->nbrAnswers;$i++) {
797
+            for ($i=1;$i <= $this->nbrAnswers;$i++) {
798 798
                 if ($this->course['id'] != $course_info['id']) {
799 799
                     $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
800 800
                         $this->answer[$i],
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
                     );
809 809
                 }
810 810
 
811
-				$correct = $this->correct[$i];
811
+                $correct = $this->correct[$i];
812 812
 
813 813
                 if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE ||
814 814
                     self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 
841 841
                 $em->merge($quizAnswer);
842 842
                 $em->flush();
843
-			}
843
+            }
844 844
         }
845
-	}
845
+    }
846 846
 
847 847
     /**
848 848
      * Get the necessary JavaScript for some answers
@@ -860,25 +860,25 @@  discard block
 block discarded – undo
860 860
             </script>";
861 861
     }
862 862
 
863
-	/**
864
-	 * Check if a answer is correct by an answer auto id
865
-	 * @param $needle int The answer auto id
866
-	 * @return bool
867
-	 */
868
-	public function isCorrectByAutoId($needle)
869
-	{
870
-		$key = 0;
871
-
872
-		foreach ($this->autoId as $autoIdKey => $autoId) {
873
-			if ($autoId == $needle) {
874
-				$key = $autoIdKey;
875
-			}
876
-		}
877
-
878
-		if (!$key) {
879
-			return false;
880
-		}
881
-
882
-		return $this->isCorrect($key) ? true : false;
883
-	}
863
+    /**
864
+     * Check if a answer is correct by an answer auto id
865
+     * @param $needle int The answer auto id
866
+     * @return bool
867
+     */
868
+    public function isCorrectByAutoId($needle)
869
+    {
870
+        $key = 0;
871
+
872
+        foreach ($this->autoId as $autoIdKey => $autoId) {
873
+            if ($autoId == $needle) {
874
+                $key = $autoIdKey;
875
+            }
876
+        }
877
+
878
+        if (!$key) {
879
+            return false;
880
+        }
881
+
882
+        return $this->isCorrect($key) ? true : false;
883
+    }
884 884
 }
Please login to merge, or discard this patch.
main/glossary/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
             if (!empty($glossary_data['update_date'])) {
134 134
                 $glossary_data['update_date'] = Display::dateToStringAgoAndLongDate($glossary_data['update_date']);
135 135
             } else {
136
-                 $glossary_data['update_date'] = '';
136
+                    $glossary_data['update_date'] = '';
137 137
             }
138 138
 
139 139
             $form->addLabel(get_lang('CreationDate'), $glossary_data['insert_date']);
Please login to merge, or discard this patch.