Completed
Push — 1.10.x ( c82817...6a93c3 )
by Yannick
202:42 queued 149:59
created
main/exercice/question_admin.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if (isset($_GET['editQuestion'])) {
14
-    $objQuestion = Question::read ($_GET['editQuestion']);
14
+    $objQuestion = Question::read($_GET['editQuestion']);
15 15
     $action = api_get_self()."?".api_get_cidreq()."&myid=1&modifyQuestion=".$modifyQuestion."&editQuestion=".$objQuestion->id;
16 16
 } else {
17 17
     $objQuestion = Question :: getInstance($_REQUEST['answerType']);
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (is_object($objQuestion)) {
22 22
     // FORM CREATION
23
-    $form = new FormValidator('question_admin_form','post', $action);
23
+    $form = new FormValidator('question_admin_form', 'post', $action);
24 24
     if (isset($_GET['editQuestion'])) {
25 25
         $class = "btn btn-default";
26 26
         $text = get_lang('ModifyQuestion');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         // redirect
64 64
         if ($objQuestion->type != HOT_SPOT && $objQuestion->type != HOT_SPOT_DELINEATION) {
65
-            if(isset($_GET['editQuestion'])) {
65
+            if (isset($_GET['editQuestion'])) {
66 66
                 echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&message=ItemUpdated"</script>';
67 67
             } else {
68 68
                 //New question
Please login to merge, or discard this patch.
main/exercice/hotspot_updatescore.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $questionId   = $_GET['questionId'];
15 15
 $coordinates  = $_GET['coord'];
16 16
 $objExcercise = $_SESSION['objExercise'];
17
-$hotspotId	  = $_GET['hotspotId'];
17
+$hotspotId = $_GET['hotspotId'];
18 18
 $exerciseId   = $objExcercise->selectId();
19 19
 if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
20 20
 	$hit = 0;
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 }
40 40
 
41 41
 //round-up the coordinates
42
-$coords = explode('/',$coordinates);
42
+$coords = explode('/', $coordinates);
43 43
 $coordinates = '';
44 44
 foreach ($coords as $coord) {
45
-    list($x,$y) = explode(';',$coord);
45
+    list($x, $y) = explode(';', $coord);
46 46
     $coordinates .= round($x).';'.round($y).'/';
47 47
 }
48
-$coordinates = substr($coordinates,0,-1);
48
+$coordinates = substr($coordinates, 0, -1);
49 49
 
50
-$TBL_TRACK_E_HOTSPOT   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
50
+$TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
51 51
 
52 52
 // update db
53 53
 $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];
Please login to merge, or discard this patch.
main/exercice/hotspot_savescore.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $objExcercise = $_SESSION['objExercise'];
15 15
 $exerciseId   = $objExcercise->selectId();
16 16
 // Save clicking order
17
-$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
17
+$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids']) + 1;
18 18
 if ($_GET['answerId'] == "0") // click is NOT on a hotspot
19 19
 {
20 20
 	$hit = 0;
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 else // user clicked ON a hotspot
24 24
 {
25 25
 	$hit = 1;
26
-	$answerId = api_substr($_GET['answerId'],22,2);
26
+	$answerId = api_substr($_GET['answerId'], 22, 2);
27 27
 	// Save into session
28 28
 	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
29 29
 }
30 30
 //round-up the coordinates
31
-$coords = explode('/',$coordinates);
31
+$coords = explode('/', $coordinates);
32 32
 $coordinates = '';
33 33
 foreach ($coords as $coord) {
34
-    list($x,$y) = explode(';',$coord);
34
+    list($x, $y) = explode(';', $coord);
35 35
     $coordinates .= round($x).';'.round($y).'/';
36 36
 }
37
-$coordinates = substr($coordinates,0,-1);
37
+$coordinates = substr($coordinates, 0, -1);
38 38
 
39 39
 $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
40 40
 // Save into db
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     'quiz_id' => $exerciseId,
45 45
     'question_id' => $questionId,
46 46
     'answer_id' =>  $answerId,
47
-    'correct' => $hit ,
47
+    'correct' => $hit,
48 48
     'coordinate' => $coordinates
49 49
 ];
50 50
 // Save insert id into session if users changes answer.
Please login to merge, or discard this patch.
main/exercice/answer.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $objExercise->read($exerciseId);
74 74
 
75 75
         if ($objExercise->random_answers == '1') {
76
-            $this->readOrderedBy('rand()', '');// randomize answers
76
+            $this->readOrderedBy('rand()', ''); // randomize answers
77 77
         } else {
78 78
             $this->read(); // natural order
79 79
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 ORDER BY position";
115 115
 
116 116
         $result = Database::query($sql);
117
-        $i=1;
117
+        $i = 1;
118 118
 
119 119
         // while a record is found
120 120
         while ($object = Database::fetch_object($result)) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $this->autoId[$i] = $object->id_auto;
131 131
             $i++;
132 132
         }
133
-        $this->nbrAnswers = $i-1;
133
+        $this->nbrAnswers = $i - 1;
134 134
     }
135 135
 
136 136
     /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         foreach ($this->autoId as $key => $autoId) {
144 144
             if ($autoId == $id) {
145
-                $result =  [
145
+                $result = [
146 146
                     'answer' => $this->answer[$key],
147 147
                     'correct' => $this->correct[$key],
148 148
                     'comment' => $this->comment[$key],
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
167 167
         $questionId = $this->questionId;
168 168
 
169
-        $sql="SELECT id FROM
169
+        $sql = "SELECT id FROM
170 170
               $TBL_ANSWER
171 171
               WHERE c_id = {$this->course_id} AND question_id ='".$questionId."'";
172 172
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
      * @param	string	DESC or ASC
189 189
      * @author 	Frederic Vauthier
190 190
      */
191
-    public function readOrderedBy($field, $order='ASC')
191
+    public function readOrderedBy($field, $order = 'ASC')
192 192
     {
193 193
 		$field = Database::escape_string($field);
194 194
 		if (empty($field)) {
195 195
 			$field = 'position';
196 196
 		}
197 197
 
198
-		if ($order != 'ASC' && $order!='DESC') {
198
+		if ($order != 'ASC' && $order != 'DESC') {
199 199
 			$order = 'ASC';
200 200
 		}
201 201
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                     c_id = {$this->course_id} AND
231 231
                     question_id='".$questionId."'
232 232
                 ORDER BY $field $order";
233
-		$result=Database::query($sql);
233
+		$result = Database::query($sql);
234 234
 
235 235
 		$i = 1;
236 236
 		// while a record is found
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             $this->autoId[$i] = $doubt_data->id_auto;
261 261
             $i++;
262 262
 	    }
263
-        $this->nbrAnswers = $i-1;
263
+        $this->nbrAnswers = $i - 1;
264 264
 	}
265 265
 
266 266
 	/**
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
     public function getGradesList()
403 403
      {
404 404
 	 	$list = array();
405
-	 	for ($i = 0; $i<$this->nbrAnswers;$i++){
406
-	 		if(!empty($this->answer[$i])){
405
+	 	for ($i = 0; $i < $this->nbrAnswers; $i++) {
406
+	 		if (!empty($this->answer[$i])) {
407 407
 	 			$list[$i] = $this->weighting[$i];
408 408
 	 		}
409 409
 	 	}
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 	$sql = "SELECT type FROM $TBL_QUESTIONS
422 422
 	 	        WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'";
423 423
 	 	$res = Database::query($sql);
424
-	 	if (Database::num_rows($res)<=0){
424
+	 	if (Database::num_rows($res) <= 0) {
425 425
 	 		return null;
426 426
 	 	}
427 427
 	 	$row = Database::fetch_array($res);
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         $correctList = [];
594 594
         $answerList = [];
595 595
 
596
-		for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
596
+		for ($i = 1; $i <= $this->new_nbrAnswers; $i++) {
597 597
 			$answer = $this->new_answer[$i];
598 598
 			$correct = $this->new_correct[$i];
599 599
 			$comment = $this->new_comment[$i];
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
             $destination_options = Question::readQuestionOption($newQuestionId, $course_info['real_id']);
749 749
             $i = 0;
750 750
             if (!empty($destination_options)) {
751
-                foreach($destination_options as $item) {
751
+                foreach ($destination_options as $item) {
752 752
                     $fixed_list[$new_option_list[$i]] = $item['id'];
753 753
                     $i++;
754 754
                 }
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 			// inserts new answers into data base
761 761
 			$c_id = $course_info['real_id'];
762 762
 
763
-			for ($i=1;$i <= $this->nbrAnswers;$i++) {
763
+			for ($i = 1; $i <= $this->nbrAnswers; $i++) {
764 764
                 if ($this->course['id'] != $course_info['id']) {
765 765
                     $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
766 766
                         $this->answer[$i],
Please login to merge, or discard this patch.
main/exercice/exercise_history.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,40 +11,40 @@  discard block
 block discarded – undo
11 11
  * Code
12 12
  */
13 13
 require_once '../inc/global.inc.php';
14
-$this_section=SECTION_COURSES;
14
+$this_section = SECTION_COURSES;
15 15
 api_protect_course_script(true);
16 16
 
17
-$show=(isset($_GET['show']) && $_GET['show'] == 'result')?'result':'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
17
+$show = (isset($_GET['show']) && $_GET['show'] == 'result') ? 'result' : 'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
18 18
 
19 19
 /* 	Constants and variables */
20
-$is_allowedToEdit = api_is_allowed_to_edit(null,true);
20
+$is_allowedToEdit = api_is_allowed_to_edit(null, true);
21 21
 $is_tutor = api_is_allowed_to_edit(true);
22 22
 
23
-if (!$is_allowedToEdit){
23
+if (!$is_allowedToEdit) {
24 24
     header('Location: /main/exercice/exercise.php?cidReq='.Security::remove_XSS($_GET['cidReq']));
25 25
     exit;
26 26
 }
27 27
 
28
-$interbreadcrumb[]= array ('url' => 'exercise_report.php?'.api_get_cidreq(),'name' => get_lang('Exercises'));
29
-$interbreadcrumb[]= array ('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(),'name' => get_lang('StudentScore'));
30
-$interbreadcrumb[]= array ('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
28
+$interbreadcrumb[] = array('url' => 'exercise_report.php?'.api_get_cidreq(), 'name' => get_lang('Exercises'));
29
+$interbreadcrumb[] = array('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(), 'name' => get_lang('StudentScore'));
30
+$interbreadcrumb[] = array('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
31 31
 
32 32
 $TBL_USER          	    = Database::get_main_table(TABLE_MAIN_USER);
33
-$TBL_EXERCISES			= Database::get_course_table(TABLE_QUIZ_TEST);
33
+$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
34 34
 $TBL_EXERCISES_QUESTION	= Database::get_course_table(TABLE_QUIZ_QUESTION);
35
-$TBL_TRACK_ATTEMPT_RECORDING= Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
36
-Display::display_header($nameTools,get_lang('Exercise'));
35
+$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
36
+Display::display_header($nameTools, get_lang('Exercise'));
37 37
 
38 38
 if (isset($_GET['message'])) {
39 39
     if (in_array($_GET['message'], array('ExerciseEdited'))) {
40
-        $my_message_history=Security::remove_XSS($_GET['message']);
40
+        $my_message_history = Security::remove_XSS($_GET['message']);
41 41
         Display::display_confirmation_message(get_lang($my_message_history));
42 42
     }
43 43
 }
44 44
 
45 45
 echo '<div class="actions">';
46
-echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' .
47
-    Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>';
46
+echo '<a href="exercise_report.php?'.api_get_cidreq().'&filter=2">'.
47
+    Display :: return_icon('back.png', get_lang('BackToResultList'), '', ICON_SIZE_MEDIUM).'</a>';
48 48
 echo '</div>';
49 49
 
50 50
 ?>
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 <?php
61 61
 
62 62
 $sql = "SELECT *, quiz_question.question, firstname, lastname FROM $TBL_TRACK_ATTEMPT_RECORDING t, $TBL_USER,$TBL_EXERCISES_QUESTION quiz_question
63
-      WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int)$_GET['exe_id']."' ORDER BY position";
63
+      WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int) $_GET['exe_id']."' ORDER BY position";
64 64
 $query = Database::query($sql);
65
-while($row = Database::fetch_array($query)){
65
+while ($row = Database::fetch_array($query)) {
66 66
     echo '<tr';
67
-    if ($i%2==0) {
67
+    if ($i % 2 == 0) {
68 68
         echo 'class="row_odd"';
69 69
     } else {
70 70
         echo 'class="row_even"';
Please login to merge, or discard this patch.
main/exercice/fill_blanks.class.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
             ['id' => 'answer', 'onkeyup' => "javascript: updateBlanks(this);"],
261 261
             array('ToolbarSet' => 'TestQuestionDescription')
262 262
         );
263
-        $form->addRule('answer',get_lang('GiveText'),'required');
263
+        $form->addRule('answer', get_lang('GiveText'), 'required');
264 264
 
265 265
         //added multiple answers
266
-        $form->addElement('checkbox','multiple_answer','', get_lang('FillInBlankSwitchable'));
266
+        $form->addElement('checkbox', 'multiple_answer', '', get_lang('FillInBlankSwitchable'));
267 267
         $form->addElement(
268 268
             'select',
269 269
             'select_separator',
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
             null,
277 277
             '<input type="button" onclick="updateBlanks()" value="'.get_lang('RefreshBlanks').'" class="btn btn-default" />'
278 278
         );
279
-        $form->addElement('html','<div id="blanks_weighting"></div>');
279
+        $form->addElement('html', '<div id="blanks_weighting"></div>');
280 280
 
281 281
         global $text;
282 282
         // setting the save button here and not in the question class.php
283
-        $form->addElement('html','<div id="defineoneblank" style="color:#D04A66; margin-left:160px">'.get_lang('DefineBlanks').'</div>');
283
+        $form->addElement('html', '<div id="defineoneblank" style="color:#D04A66; margin-left:160px">'.get_lang('DefineBlanks').'</div>');
284 284
         $form->addButtonSave($text, 'submitQuestion');
285 285
 
286 286
         if (!empty($this->id)) {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         // remove spaces at the beginning and the end of text in square brackets
321 321
         $answer = preg_replace_callback(
322 322
             "/".$blankStartSeparatorRegexp."[^]]+".$blankEndSeparatorRegexp."/",
323
-            function ($matches) use ($blankStartSeparator, $blankEndSeparator) {
323
+            function($matches) use ($blankStartSeparator, $blankEndSeparator) {
324 324
                 $matchingResult = $matches[0];
325 325
                 $matchingResult = trim($matchingResult, $blankStartSeparator);
326 326
                 $matchingResult = trim($matchingResult, $blankEndSeparator);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         if ($nb > 0) {
366 366
             $answer .= '::';
367 367
             // weighting
368
-            for ($i=0; $i < $nb; ++$i) {
368
+            for ($i = 0; $i < $nb; ++$i) {
369 369
                 // enter the weighting of word $i
370 370
                 $answer .= $form->getSubmitValue('weighting['.$i.']');
371 371
                 // not the last word, add ","
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
             // input width
380 380
             $answer .= ":";
381
-            for ($i=0; $i < $nb; ++$i) {
381
+            for ($i = 0; $i < $nb; ++$i) {
382 382
                 // enter the width of input for word $i
383 383
                 $answer .= $form->getSubmitValue('sizeofinput['.$i.']');
384 384
                 // not the last word, add ","
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         // Allow answers order switches
405 405
         $is_multiple = $form -> getSubmitValue('multiple_answer');
406
-        $answer.= '@'.$is_multiple;
406
+        $answer .= '@'.$is_multiple;
407 407
 
408 408
         $this->save();
409 409
         $objAnswer = new Answer($this->id);
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     public function return_header($feedback_type = null, $counter = null, $score = null)
421 421
     {
422 422
         $header = parent::return_header($feedback_type, $counter, $score);
423
-        $header .= '<table class="'.$this->question_table_class .'">
423
+        $header .= '<table class="'.$this->question_table_class.'">
424 424
             <tr>
425 425
                 <th>'.get_lang("Answer").'</th>
426 426
             </tr>';
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
                 // if display for student, shuffle the correct answer menu
465 465
                 $listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent);
466 466
                 $result .= '<select name="choice['.$questionId.'][]">';
467
-                for ($k=0; $k < count($listMenu); $k++) {
467
+                for ($k = 0; $k < count($listMenu); $k++) {
468 468
                     $selected = "";
469 469
                     if ($correctItem == $listMenu[$k]) {
470 470
                         $selected = " selected=selected ";
471 471
                     }
472 472
                     // if in teacher view, display the first item by default, which is the right answer
473
-                    if ($k==0 && !$displayForStudent) {
473
+                    if ($k == 0 && !$displayForStudent) {
474 474
                         $selected = " selected=selected ";
475 475
                     }
476 476
                     $optionMenu .= '<option '.$selected.' value="'.$listMenu[$k].'">'.$listMenu[$k].'</option>';
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
         if (count($listDetails) < 3) {
643 643
             $listWeightings = explode(',', $listDetails[0]);
644 644
             $listSizeOfInput = array();
645
-            for ($i=0; $i < count($listWeightings); $i++) {
645
+            for ($i = 0; $i < count($listWeightings); $i++) {
646 646
                 $listSizeOfInput[] = 200;
647 647
             }
648
-            $blankSeparatorNumber = 0;    // 0 is [...]
648
+            $blankSeparatorNumber = 0; // 0 is [...]
649 649
         } else {
650 650
             $listWeightings = explode(',', $listDetails[0]);
651 651
             $listSizeOfInput = explode(',', $listDetails[1]);
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
             // remove [ and ] in string
678 678
             array_walk(
679 679
                 $listWords[0],
680
-                function (&$value, $key, $tabBlankChar) {
680
+                function(&$value, $key, $tabBlankChar) {
681 681
                     $trimChars = "";
682
-                    for ($i=0; $i < count($tabBlankChar); $i++) {
682
+                    for ($i = 0; $i < count($tabBlankChar); $i++) {
683 683
                         $trimChars .= $tabBlankChar[$i];
684 684
                     }
685 685
                     $value = trim($value, $trimChars);
@@ -699,18 +699,18 @@  discard block
 block discarded – undo
699 699
         // if student answer, the second [] is the student answer,
700 700
         // the third is if student scored or not
701 701
         $listBrackets = array();
702
-        $listWords =  array();
702
+        $listWords = array();
703 703
 
704 704
         if ($isStudentAnswer) {
705
-            for ($i=0; $i < count($listAnswerResults['tabwords']); $i++) {
705
+            for ($i = 0; $i < count($listAnswerResults['tabwords']); $i++) {
706 706
                 $listBrackets[] = $listAnswerResults['tabwordsbracket'][$i];
707 707
                 $listWords[] = $listAnswerResults['tabwords'][$i];
708
-                if ($i+1 < count($listAnswerResults['tabwords'])) {
708
+                if ($i + 1 < count($listAnswerResults['tabwords'])) {
709 709
                     // should always be
710 710
                     $i++;
711 711
                 }
712 712
                 $listAnswerResults['studentanswer'][] = $listAnswerResults['tabwords'][$i];
713
-                if ($i+1 < count($listAnswerResults['tabwords'])) {
713
+                if ($i + 1 < count($listAnswerResults['tabwords'])) {
714 714
                     // should always be
715 715
                     $i++;
716 716
                 }
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
                            break;
803 803
                        default :
804 804
                            if (FillBlanks::isGoodStudentAnswer($tabAnswer['studentanswer'][$bracketNumber], $tabAnswer['tabwords'][$bracketNumber])) {
805
-                               $tabUserResult[$data['user_id']][$bracketNumber] = 0;   //  right answer
805
+                               $tabUserResult[$data['user_id']][$bracketNumber] = 0; //  right answer
806 806
                            } else {
807
-                               $tabUserResult[$data['user_id']][$bracketNumber] = -1;  // wrong answer
807
+                               $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer
808 808
                            }
809 809
                    }
810 810
                } else {
@@ -812,11 +812,11 @@  discard block
 block discarded – undo
812 812
                    if ($useLastAnswerredAttempt) {
813 813
                        // if we take into account the last answered attempt
814 814
                        if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) {
815
-                           $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
815
+                           $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered
816 816
                        }
817 817
                    } else {
818 818
                        // we take the last attempt, even if the student answer the question before
819
-                       $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
819
+                       $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered
820 820
                    }
821 821
                }
822 822
            }
@@ -837,10 +837,10 @@  discard block
 block discarded – undo
837 837
     {
838 838
         $outRes = 0;
839 839
         // for each student in group
840
-        foreach($resultList as $userId => $tabValue) {
840
+        foreach ($resultList as $userId => $tabValue) {
841 841
             $trouve = false;
842 842
             // for each bracket, if student has at leat one answer ( choice > -2) then he pass the question
843
-            foreach($tabValue as $i => $choice) {
843
+            foreach ($tabValue as $i => $choice) {
844 844
                 if ($choice > -2 && !$trouve) {
845 845
                     $outRes++;
846 846
                     $trouve = true;
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
         $separatorEnd = $listWithStudentAnswer['blankseparatorend'];
863 863
         // lets rebuild the sentence with [correct answer][student answer][answer is correct]
864 864
         $result = "";
865
-        for ($i=0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) {
865
+        for ($i = 0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) {
866 866
             $result .= $listWithStudentAnswer['commonwords'][$i];
867 867
             $result .= $listWithStudentAnswer['tabwordsbracket'][$i];
868 868
             $result .= $separatorStart.$listWithStudentAnswer['studentanswer'][$i].$separatorEnd;
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
             ")",
945 945
         ];
946 946
         $result = $text;
947
-        for ($i=0; $i < count($listRegexpCharacters); $i++) {
947
+        for ($i = 0; $i < count($listRegexpCharacters); $i++) {
948 948
             $result = str_replace($listRegexpCharacters[$i], "\\".$listRegexpCharacters[$i], $result);
949 949
         }
950 950
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
     {
1007 1007
         $listResults = array();
1008 1008
         $fillBlanksAllowedSeparator = self::getAllowedSeparator();
1009
-        for ($i=0; $i < count($fillBlanksAllowedSeparator); $i++) {
1009
+        for ($i = 0; $i < count($fillBlanksAllowedSeparator); $i++) {
1010 1010
             $listResults[] = $fillBlanksAllowedSeparator[$i][0]."...".$fillBlanksAllowedSeparator[$i][1];
1011 1011
         }
1012 1012
 
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
     {
1025 1025
         $listSeparators = self::getAllowedSeparator();
1026 1026
         $result = 0;
1027
-        for ($i=0; $i < count($listSeparators); $i++) {
1027
+        for ($i = 0; $i < count($listSeparators); $i++) {
1028 1028
             if ($listSeparators[$i][0] == $startSeparator &&
1029 1029
                 $listSeparators[$i][1] == $endSeparator
1030 1030
             ) {
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 
1050 1050
         // rebuild the answer with good HTML style
1051 1051
         // this is the student answer, right or wrong
1052
-        for ($i=0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) {
1052
+        for ($i = 0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) {
1053 1053
             if ($listStudentAnswerInfo['studentscore'][$i] == 1) {
1054 1054
                 $listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlRightAnswer(
1055 1055
                     $listStudentAnswerInfo['studentanswer'][$i],
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 
1068 1068
 
1069 1069
         // rebuild the sentence with student answer inserted
1070
-        for ($i=0; $i < count($listStudentAnswerInfo['commonwords']); $i++) {
1070
+        for ($i = 0; $i < count($listStudentAnswerInfo['commonwords']); $i++) {
1071 1071
             $result .= isset($listStudentAnswerInfo['commonwords'][$i]) ? $listStudentAnswerInfo['commonwords'][$i] : '';
1072 1072
             $result .= isset($listStudentAnswerInfo['studentanswer'][$i]) ? $listStudentAnswerInfo['studentanswer'][$i] : '';
1073 1073
         }
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
                 $listPossibleAnswers = FillBlanks::getFillTheBlankMenuAnswers($correct, false);
1101 1101
                 $correctAnswerHtml .= "<span style='color: green'>".$listPossibleAnswers[0]."</span>";
1102 1102
                 $correctAnswerHtml .= " <span style='font-weight:normal'>(";
1103
-                for ($i=1; $i < count($listPossibleAnswers); $i++) {
1103
+                for ($i = 1; $i < count($listPossibleAnswers); $i++) {
1104 1104
                     $correctAnswerHtml .= $listPossibleAnswers[$i];
1105 1105
                     if ($i != count($listPossibleAnswers) - 1) {
1106 1106
                         $correctAnswerHtml .= " | ";
Please login to merge, or discard this patch.
main/exercice/exercise.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 if (!empty($gradebook) && $gradebook == 'view') {
110 110
     $interbreadcrumb[] = array(
111
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
111
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
112 112
         'name' => get_lang('ToolGradebook')
113 113
     );
114 114
 }
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
                     );
699 699
 
700 700
                     // Exercise results
701
-                    $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
701
+                    $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
702 702
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
703 703
 
704 704
                     // Export
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
                         }
763 763
                     }
764 764
 
765
-                    $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
765
+                    $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
766 766
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
767 767
                     $actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
768 768
                 }
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
                 $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
953 953
             } else {
954 954
                 if ($isDrhOfCourse) {
955
-                    $actions ='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
955
+                    $actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
956 956
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
957 957
                     $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
958 958
                 }
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
                 'tr',
963 963
                 $item,
964 964
                 array(
965
-                    'id' => 'exercise_list_' . $my_exercise_id,
965
+                    'id' => 'exercise_list_'.$my_exercise_id,
966 966
                 )
967 967
             );
968 968
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
                 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path
1034 1034
             );
1035 1035
 
1036
-            $actions .='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1036
+            $actions .= '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1037 1037
                 Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
1038 1038
 
1039 1039
             // if active
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
                 $actions .= '      <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
1043 1043
                     Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
1044 1044
             } else { // else if not active
1045
-                $actions .='    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1045
+                $actions .= '    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1046 1046
                     Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
1047 1047
             }
1048 1048
             $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'.
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
                 $item .= Display::tag('td', $attemptText);
1076 1076
 
1077 1077
                 if ($isDrhOfCourse) {
1078
-                    $actions ='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1078
+                    $actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1079 1079
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
1080 1080
 
1081 1081
                     $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
Please login to merge, or discard this patch.
main/exercice/Draggable.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
64 64
                     if ($answer->isCorrect($i)) {
65 65
                         $nb_matches++;
66
-                        $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
67
-                        $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
66
+                        $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i);
67
+                        $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1);
68 68
                         $answerInfo = $answer->getAnswerByAutoId($answer->correct[$i]);
69
-                        $defaults['matches[' . $nb_matches . ']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
69
+                        $defaults['matches['.$nb_matches.']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
70 70
                     } else {
71 71
                         $nb_options++;
72
-                        $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
72
+                        $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i);
73 73
                     }
74 74
                 }
75 75
             }
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
         $html = '<table class="table table-striped table-hover">
93 93
             <thead>
94 94
                 <tr>
95
-                    <th width="85%">' . get_lang('Answer') . '</th>
96
-                    <th width="15%">' . get_lang('MatchesTo') . '</th>
97
-                    <th width="10">' . get_lang('Weighting') . '</th>
95
+                    <th width="85%">' . get_lang('Answer').'</th>
96
+                    <th width="15%">' . get_lang('MatchesTo').'</th>
97
+                    <th width="10">' . get_lang('Weighting').'</th>
98 98
                 </tr>
99 99
             </thead>
100 100
             <tbody>';
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
         for ($i = 1; $i <= $nb_matches; ++$i) {
190 190
             $position++;
191 191
 
192
-            $answer = $form->getSubmitValue('answer[' . $i . ']');
193
-            $matches = $form->getSubmitValue('matches[' . $i . ']');
194
-            $weighting = $form->getSubmitValue('weighting[' . $i . ']');
192
+            $answer = $form->getSubmitValue('answer['.$i.']');
193
+            $matches = $form->getSubmitValue('matches['.$i.']');
194
+            $weighting = $form->getSubmitValue('weighting['.$i.']');
195 195
             $this->weighting += $weighting;
196 196
             $objAnswer->createAnswer(
197 197
                 $answer,
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
     public function return_header($feedback_type = null, $counter = null, $score = null)
217 217
     {
218 218
         $header = parent::return_header($feedback_type, $counter, $score);
219
-        $header .= '<table class="' . $this->question_table_class . '">
219
+        $header .= '<table class="'.$this->question_table_class.'">
220 220
             <tr>
221
-                <th>' . get_lang('ElementList') . '</th>
222
-                <th>' . get_lang('Status') . '</th>
221
+                <th>' . get_lang('ElementList').'</th>
222
+                <th>' . get_lang('Status').'</th>
223 223
             </tr>';
224 224
 
225 225
         return $header;
Please login to merge, or discard this patch.
main/exercice/exercise_reminder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 // notice for unauthorized people.
15 15
 api_protect_course_script(true);
16 16
 
17
-if ($debug>0) {
17
+if ($debug > 0) {
18 18
     error_log('Entered exercise_result.php: '.print_r($_POST, 1));
19 19
 }
20 20
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 if (isset($_SESSION['exe_id'])) {
94 94
     $exe_id = intval($_SESSION['exe_id']);
95 95
 }
96
-$exercise_stat_info	= $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
96
+$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
97 97
 if (!empty($exercise_stat_info['data_tracking'])) {
98 98
     $question_list = explode(',', $exercise_stat_info['data_tracking']);
99 99
 }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 $remind_list = $exercise_stat_info['questions_to_check'];
174 174
 $remind_list = explode(',', $remind_list);
175 175
 
176
-$exercise_result    = array();
176
+$exercise_result = array();
177 177
 
178 178
 foreach ($attempt_list as $question_id => $options) {
179 179
     foreach ($options as $item) {
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
     unset($objQuestionTmp);
205 205
 
206 206
     // creates a temporary Question object
207
-    $objQuestionTmp        = Question :: read($questionId);
207
+    $objQuestionTmp = Question :: read($questionId);
208 208
 
209 209
     $quesId         = $objQuestionTmp->selectId();
210
-    $check_id 		= 'remind_list['.$questionId.']';
210
+    $check_id = 'remind_list['.$questionId.']';
211 211
     $attributes     = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');");
212 212
 
213 213
     if (in_array($questionId, $remind_list)) {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 echo Display::div($table, array('class'=>'span10'));
240 240
 
241 241
 $exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-warning'));
242
-$exercise_actions .=  '&nbsp;'.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn btn-success'));
242
+$exercise_actions .= '&nbsp;'.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();', 'class'=>'btn btn-success'));
243 243
 
244 244
 echo Display::div('', array('class'=>'clear'));
245 245
 echo Display::div($exercise_actions, array('class'=>'form-actions'));
Please login to merge, or discard this patch.