Passed
Push — 1.10.x ( cfd85e...c22018 )
by
unknown
46:46
created
main/inc/lib/message.lib.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
      * @param string $type
683 683
      * @return bool
684 684
      */
685
-    public static function update_message_status($user_id, $message_id,$type)
685
+    public static function update_message_status($user_id, $message_id, $type)
686 686
     {
687 687
         $type = intval($type);
688 688
         if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 
997 997
         $receiverUserInfo = api_get_user_info($row['user_receiver_id']);
998 998
 
999
-        $message_content .='<tr>';
999
+        $message_content .= '<tr>';
1000 1000
         if (api_get_setting('allow_social_tool') == 'true') {
1001 1001
             if ($source == 'outbox') {
1002 1002
                 $message_content .= get_lang('From').': <a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> '.
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                 $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
1013 1013
             }
1014 1014
         }
1015
-        $message_content .=' '.get_lang('Date').':  '.api_get_local_time($row['send_date']).'
1015
+        $message_content .= ' '.get_lang('Date').':  '.api_get_local_time($row['send_date']).'
1016 1016
 		        <br />
1017 1017
 		        <hr style="color:#ddd" />
1018 1018
 		        <table height="209px" width="100%">
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
         $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
1039 1039
             Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
1040 1040
 
1041
-        $message_content .='</div></td>
1041
+        $message_content .= '</div></td>
1042 1042
 		      <td width=10></td>
1043 1043
 		    </tr>
1044 1044
 		</table>';
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
                 $items = $topic['count'];
1117 1117
                 $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
1118
-                $label =  Display::label($items.' '.$reply_label);
1118
+                $label = Display::label($items.' '.$reply_label);
1119 1119
                 $topic['title'] = trim($topic['title']);
1120 1120
 
1121 1121
                 if (empty($topic['title'])) {
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         $name = $user_sender_info['complete_name'];
1226 1226
 
1227 1227
         $topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
1228
-        $links.= '<div id="message-reply-link">';
1228
+        $links .= '<div id="message-reply-link">';
1229 1229
         if (($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
1230 1230
             $my_group_role == GROUP_USER_PERMISSION_MODERATOR) ||
1231 1231
             $main_message['user_sender_id'] == $current_user_id
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
                 'group_id' => $group_id,
1238 1238
                 'message_id' => $main_message['id'],
1239 1239
                 'action' => 'edit_message_group',
1240
-                'anchor_topic' => 'topic_' . $main_message['id'],
1240
+                'anchor_topic' => 'topic_'.$main_message['id'],
1241 1241
                 'topics_page_nr' => $topic_page_nr,
1242 1242
                 'items_page_nr' => $items_page_nr,
1243 1243
                 'topic_id' => $main_message['id']
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
             'group_id' => $group_id,
1268 1268
             'message_id' => $main_message['id'],
1269 1269
             'action' => 'reply_message_group',
1270
-            'anchor_topic' => 'topic_' . $main_message['id'],
1270
+            'anchor_topic' => 'topic_'.$main_message['id'],
1271 1271
             'topics_page_nr' => $topic_page_nr,
1272 1272
             'topic_id' => $main_message['id']
1273 1273
         ]);
@@ -1283,10 +1283,10 @@  discard block
 block discarded – undo
1283 1283
             ]
1284 1284
         );
1285 1285
 
1286
-        $links.= '</div>';
1286
+        $links .= '</div>';
1287 1287
 
1288 1288
         $userPicture = $user_sender_info['avatar'];
1289
-        $main_content.= '<div class="message-group-author">
1289
+        $main_content .= '<div class="message-group-author">
1290 1290
                          <img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1291 1291
         $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'&nbsp;</a>';
1292 1292
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
             $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
1300 1300
         }
1301 1301
         $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1302
-        $main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1302
+        $main_content .= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1303 1303
         $main_content = Security::remove_XSS($main_content, STUDENT, true);
1304 1304
 
1305 1305
         $html .= Display::div(Display::div(Display::div($main_content, array('class' => 'group_social_sub_item', 'style' => 'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid'));
@@ -1320,18 +1320,18 @@  discard block
 block discarded – undo
1320 1320
                 $files_attachments = self::get_links_message_attachment_files($topic['id']);
1321 1321
                 $name = $user_sender_info['complete_name'];
1322 1322
 
1323
-                $links.= '<div id="message-reply-link">';
1323
+                $links .= '<div id="message-reply-link">';
1324 1324
                 if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
1325
-                    $links.= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1325
+                    $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1326 1326
                         Display :: return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
1327 1327
                 }
1328
-                $links.= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1329
-                $links.= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
1330
-                $links.= '</div>';
1328
+                $links .= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1329
+                $links .= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
1330
+                $links .= '</div>';
1331 1331
 
1332 1332
                 $userPicture = $user_sender_info['avatar'];
1333 1333
 
1334
-                $html_items.= '<div class="message-group-author"><img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1334
+                $html_items .= '<div class="message-group-author"><img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1335 1335
                 $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
1336 1336
 
1337 1337
                 $date = '';
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                     $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
1344 1344
                 }
1345 1345
                 $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1346
-                $html_items.= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1346
+                $html_items .= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1347 1347
 
1348 1348
                 $base_padding = 20;
1349 1349
 
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     break;
1619 1619
                 case 'deleteone' :
1620 1620
                     MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
1621
-                    $html .=Display::return_message(api_xml_http_response_encode($success), 'normal', false);
1621
+                    $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
1622 1622
                     $html .= '<br/>';
1623 1623
                     break;
1624 1624
             }
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
                 ON m.user_sender_id = u.user_id
1711 1711
                 WHERE
1712 1712
                     m.user_receiver_id = $userId AND
1713
-                    m.msg_status = " . MESSAGE_STATUS_UNREAD . "
1713
+                    m.msg_status = ".MESSAGE_STATUS_UNREAD."
1714 1714
                     AND m.id > $lastId
1715 1715
                 ORDER BY m.send_date DESC";
1716 1716
 
Please login to merge, or discard this patch.
main/exercice/exercise_report.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             Display::addFlash(
249 249
                 Display::return_message(get_lang('MessageSent'))
250 250
             );
251
-            header('Location: ' . api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
251
+            header('Location: '.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
252 252
             exit;
253 253
         }
254 254
     }
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
         api_is_course_tutor() || api_is_course_coach()
279 279
     ) {
280 280
         $actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
281
-        $actions .='<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>';
282
-        $actions .='<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>';
281
+        $actions .= '<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>';
282
+        $actions .= '<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>';
283 283
 
284 284
         $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&exerciseId='.intval($_GET['exerciseId']).'" >'.
285 285
         Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';
Please login to merge, or discard this patch.
main/exercice/exercise_show.php 2 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 $locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE);
93 93
 
94 94
 if (empty($objExercise)) {
95
-	$objExercise = new Exercise();
95
+    $objExercise = new Exercise();
96 96
     $objExercise->read($exercise_id);
97 97
 }
98 98
 $feedback_type = $objExercise->feedback_type;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 //Only users can see their own results
101 101
 if (!$is_allowedToEdit) {
102 102
     if ($student_id != $current_user_id) {
103
-    	api_not_allowed(true);
103
+        api_not_allowed(true);
104 104
     }
105 105
 }
106 106
 
107 107
 if (isset($_SESSION['gradebook'])) {
108
-	$gradebook=	Security::remove_XSS($_SESSION['gradebook']);
108
+    $gradebook=	Security::remove_XSS($_SESSION['gradebook']);
109 109
 }
110 110
 
111 111
 if (!empty($gradebook) && $gradebook=='view') {
112
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
112
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
113 113
 }
114 114
 
115 115
 $fromlink = '';
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
 $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
125 125
 
126 126
 if ($origin != 'learnpath') {
127
-	Display::display_header('');
127
+    Display::display_header('');
128 128
 } else {
129 129
     $htmlHeadXtra[] = "
130 130
     <style>
131 131
     body { background: none;}
132 132
     </style>
133 133
     ";
134
-	Display::display_reduced_header();
134
+    Display::display_reduced_header();
135 135
 }
136 136
 ?>
137 137
 <script>
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
         }
211 211
     }
212 212
 } else {
213
-	Display::display_warning_message(get_lang('CantViewResults'));
214
-	$show_results = false;
213
+    Display::display_warning_message(get_lang('CantViewResults'));
214
+    $show_results = false;
215 215
 }
216 216
 
217 217
 if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) {
218
-	$show_results = false;
218
+    $show_results = false;
219 219
 }
220 220
 
221 221
 if ($show_results || $show_only_total_score) {
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 $exerciseResult = array();
264 264
 
265 265
 while ($row = Database::fetch_array($result)) {
266
-	$question_list_from_database[] = $row['question_id'];
267
-	$exerciseResult[$row['question_id']] = $row['answer'];
266
+    $question_list_from_database[] = $row['question_id'];
267
+    $exerciseResult[$row['question_id']] = $row['answer'];
268 268
 }
269 269
 
270 270
 //Fixing #2073 Fixing order of questions
271 271
 if (!empty($track_exercise_info['data_tracking'])) {
272
-	$temp_question_list = explode(',', $track_exercise_info['data_tracking']);
272
+    $temp_question_list = explode(',', $track_exercise_info['data_tracking']);
273 273
 
274 274
     // Getting question list from data_tracking
275 275
     if (!empty($temp_question_list)) {
@@ -309,23 +309,23 @@  discard block
 block discarded – undo
309 309
 
310 310
 foreach ($questionList as $questionId) {
311 311
 
312
-	$choice = $exerciseResult[$questionId];
313
-	// destruction of the Question object
314
-	unset($objQuestionTmp);
312
+    $choice = $exerciseResult[$questionId];
313
+    // destruction of the Question object
314
+    unset($objQuestionTmp);
315 315
 
316
-	// creates a temporary Question object
317
-	$objQuestionTmp 	= Question::read($questionId);
318
-	$questionWeighting	= $objQuestionTmp->selectWeighting();
319
-	$answerType			= $objQuestionTmp->selectType();
316
+    // creates a temporary Question object
317
+    $objQuestionTmp 	= Question::read($questionId);
318
+    $questionWeighting	= $objQuestionTmp->selectWeighting();
319
+    $answerType			= $objQuestionTmp->selectType();
320 320
 
321
-	// Start buffer
321
+    // Start buffer
322 322
     ob_start();
323 323
 
324 324
     /* Use switch
325 325
     switch ($answerType) {
326 326
     }*/
327 327
 
328
-	if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
328
+    if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
329 329
         $question_result = $objExercise->manage_answer(
330 330
             $id,
331 331
             $questionId,
@@ -441,12 +441,12 @@  discard block
 block discarded – undo
441 441
         );
442 442
         $questionScore = $question_result['score'];
443 443
         $totalScore += $question_result['score'];
444
-	} elseif ($answerType == HOT_SPOT) {
445
-	    if ($show_results) {
446
-		    echo '<table width="500" border="0"><tr>
444
+    } elseif ($answerType == HOT_SPOT) {
445
+        if ($show_results) {
446
+            echo '<table width="500" border="0"><tr>
447 447
                     <td valign="top" align="center" style="padding-left:0px;" >
448 448
                         <table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">';
449
-		}
449
+        }
450 450
         $question_result = $objExercise->manage_answer(
451 451
             $id,
452 452
             $questionId,
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
                 <br>
486 486
             ";
487 487
         }
488
-	} else if($answerType == HOT_SPOT_DELINEATION) {
488
+    } else if($answerType == HOT_SPOT_DELINEATION) {
489 489
 
490 490
         $question_result = $objExercise->manage_answer(
491 491
             $id,
@@ -639,15 +639,15 @@  discard block
 block discarded – undo
639 639
                 </table>
640 640
             ";
641 641
         }
642
-	}
642
+    }
643 643
 
644
-	if ($show_results) {
645
-	    if ($answerType != HOT_SPOT) {
646
-	        echo '</table>';
647
-	    }
648
-	}
644
+    if ($show_results) {
645
+        if ($answerType != HOT_SPOT) {
646
+            echo '</table>';
647
+        }
648
+    }
649 649
 
650
-	$comnt = null;
650
+    $comnt = null;
651 651
 
652 652
     if ($show_results) {
653 653
         if (
@@ -664,40 +664,40 @@  discard block
 block discarded – undo
664 664
 
665 665
         $marksname = '';
666 666
 
667
-		if ($isFeedbackAllowed) {
668
-			$name = "fckdiv".$questionId;
669
-			$marksname = "marksName".$questionId;
670
-			if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
671
-				$url_name = get_lang('EditCommentsAndMarks');
672
-			} else {
673
-				if ($action=='edit') {
674
-					$url_name = get_lang('EditIndividualComment');
675
-				} else {
676
-					$url_name = get_lang('AddComments');
677
-				}
678
-			}
667
+        if ($isFeedbackAllowed) {
668
+            $name = "fckdiv".$questionId;
669
+            $marksname = "marksName".$questionId;
670
+            if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
671
+                $url_name = get_lang('EditCommentsAndMarks');
672
+            } else {
673
+                if ($action=='edit') {
674
+                    $url_name = get_lang('EditIndividualComment');
675
+                } else {
676
+                    $url_name = get_lang('AddComments');
677
+                }
678
+            }
679 679
             echo '<br />';
680 680
             echo Display::url($url_name, 'javascript://', array('class' => 'btn', 'onclick'=>"showfck('".$name."', '".$marksname."');"));
681
-			echo '<br />';
681
+            echo '<br />';
682 682
 
683 683
             echo '<div id="feedback_'.$name.'" style="width:100%">';
684
-			$comnt = trim(Event::get_comments($id, $questionId));
685
-			if (empty($comnt)) {
686
-				echo '<br />';
687
-			} else {
688
-				echo '<div id="question_feedback">'.$comnt.'</div>';
689
-			}
690
-			echo '</div>';
684
+            $comnt = trim(Event::get_comments($id, $questionId));
685
+            if (empty($comnt)) {
686
+                echo '<br />';
687
+            } else {
688
+                echo '<div id="question_feedback">'.$comnt.'</div>';
689
+            }
690
+            echo '</div>';
691 691
 
692 692
             echo '<div id="'.$name.'" style="display:none">';
693
-			$arrid[] = $questionId;
694
-			$feedback_form = new FormValidator('frmcomments'.$questionId,'post','');
695
-			$feedback_form->addElement('html','<br>');
696
-			$renderer =& $feedback_form->defaultRenderer();
697
-			$renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
698
-			$renderer->setCustomElementTemplate('<div align="left">{element}</div>');
699
-			$comnt = Event::get_comments($id, $questionId);
700
-			$default = array('comments_'.$questionId =>  $comnt);
693
+            $arrid[] = $questionId;
694
+            $feedback_form = new FormValidator('frmcomments'.$questionId,'post','');
695
+            $feedback_form->addElement('html','<br>');
696
+            $renderer =& $feedback_form->defaultRenderer();
697
+            $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
698
+            $renderer->setCustomElementTemplate('<div align="left">{element}</div>');
699
+            $comnt = Event::get_comments($id, $questionId);
700
+            $default = array('comments_'.$questionId =>  $comnt);
701 701
 
702 702
             if ($useAdvancedEditor) {
703 703
                 $feedback_form->addElement(
@@ -714,52 +714,52 @@  discard block
 block discarded – undo
714 714
             } else {
715 715
                 $feedback_form->addElement('textarea', 'comments_' . $questionId);
716 716
             }
717
-			$feedback_form->addElement('html','<br>');
718
-			$feedback_form->setDefaults($default);
719
-			$feedback_form->display();
720
-			echo '</div>';
721
-
722
-		} else {
723
-			$comnt = Event::get_comments($id, $questionId);
724
-			echo '<br />';
725
-			if (!empty($comnt)) {
726
-				echo '<b>'.get_lang('Feedback').'</b>';
727
-				echo '<div id="question_feedback">'.$comnt.'</div>';
728
-			}
729
-		}
730
-
731
-		if ($is_allowedToEdit && $isFeedbackAllowed) {
732
-			if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
733
-				$marksname = "marksName".$questionId;
717
+            $feedback_form->addElement('html','<br>');
718
+            $feedback_form->setDefaults($default);
719
+            $feedback_form->display();
720
+            echo '</div>';
721
+
722
+        } else {
723
+            $comnt = Event::get_comments($id, $questionId);
724
+            echo '<br />';
725
+            if (!empty($comnt)) {
726
+                echo '<b>'.get_lang('Feedback').'</b>';
727
+                echo '<div id="question_feedback">'.$comnt.'</div>';
728
+            }
729
+        }
730
+
731
+        if ($is_allowedToEdit && $isFeedbackAllowed) {
732
+            if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
733
+                $marksname = "marksName".$questionId;
734 734
                 echo '<div id="'.$marksname.'" style="display:none">';
735 735
                 echo '<form name="marksform_'.$questionId.'" method="post" action="">';
736
-				$arrmarks[] = $questionId;
737
-				echo get_lang("AssignMarks");
738
-				echo "&nbsp;<select name='marks' id='marks'>";
739
-				for ($i=0;$i<=$questionWeighting;$i++) {
740
-					echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>';
741
-				}
742
-				echo '</select>';
743
-				echo '</form><br /></div>';
744
-
745
-				if ($questionScore == -1 ) {
746
-					$questionScore = 0;
747
-				  	echo Display::return_message(get_lang('notCorrectedYet'));
748
-				}
749
-			} else {
750
-				$arrmarks[] = $questionId;
751
-				echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action="">
736
+                $arrmarks[] = $questionId;
737
+                echo get_lang("AssignMarks");
738
+                echo "&nbsp;<select name='marks' id='marks'>";
739
+                for ($i=0;$i<=$questionWeighting;$i++) {
740
+                    echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>';
741
+                }
742
+                echo '</select>';
743
+                echo '</form><br /></div>';
744
+
745
+                if ($questionScore == -1 ) {
746
+                    $questionScore = 0;
747
+                        echo Display::return_message(get_lang('notCorrectedYet'));
748
+                }
749
+            } else {
750
+                $arrmarks[] = $questionId;
751
+                echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action="">
752 752
 					  <select name="marks" id="marks" style="display:none;"><option>'.$questionScore.'</option></select></form><br/ ></div>';
753
-			}
754
-		} else {
755
-			if ($questionScore == -1) {
756
-				 $questionScore = 0;
757
-			}
758
-		}
759
-	}
753
+            }
754
+        } else {
755
+            if ($questionScore == -1) {
756
+                    $questionScore = 0;
757
+            }
758
+        }
759
+    }
760 760
 
761 761
     $my_total_score  = $questionScore;
762
-	$my_total_weight = $questionWeighting;
762
+    $my_total_weight = $questionWeighting;
763 763
     $totalWeighting += $questionWeighting;
764 764
     $category_was_added_for_this_test = false;
765 765
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
     $score = array();
807 807
     if ($show_results) {
808
-		$score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false);
808
+        $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false);
809 809
         $score['pass']   = $my_total_score >= $my_total_weight ? true : false;
810 810
         $score['type']   = $answerType;
811 811
         $score['score']  = $my_total_score;
@@ -813,18 +813,18 @@  discard block
 block discarded – undo
813 813
         $score['comments'] = isset($comnt) ? $comnt : null;
814 814
     }
815 815
 
816
-	unset($objAnswerTmp);
817
-	$i++;
816
+    unset($objAnswerTmp);
817
+    $i++;
818 818
 
819 819
     $contents = ob_get_clean();
820 820
 
821 821
     $question_content = '<div class="question_row">';
822 822
 
823
- 	if ($show_results) {
823
+        if ($show_results) {
824 824
         //Shows question title an description
825
-	    $question_content .= $objQuestionTmp->return_header(null, $counter, $score);
826
-	}
827
-	$counter++;
825
+        $question_content .= $objQuestionTmp->return_header(null, $counter, $score);
826
+    }
827
+    $counter++;
828 828
     $question_content .= $contents;
829 829
     $question_content .= '</div>';
830 830
     $exercise_content .= $question_content;
@@ -834,12 +834,12 @@  discard block
 block discarded – undo
834 834
 
835 835
 //Total score
836 836
 if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) {
837
-	if ($show_results || $show_only_total_score) {
837
+    if ($show_results || $show_only_total_score) {
838 838
         $total_score_text .= '<div class="question_row">';
839 839
         $my_total_score_temp = $totalScore;
840
-	    if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) {
841
-	        $my_total_score_temp = 0;
842
-	    }
840
+        if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) {
841
+            $my_total_score_temp = 0;
842
+        }
843 843
         $total_score_text .= ExerciseLib::get_question_ribbon(
844 844
             $objExercise,
845 845
             $my_total_score_temp,
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
             true
848 848
         );
849 849
         $total_score_text .= '</div>';
850
-	}
850
+    }
851 851
 }
852 852
 
853 853
 if (!empty($category_list) && ($show_results || $show_only_total_score)) {
@@ -871,26 +871,26 @@  discard block
 block discarded – undo
871 871
 }
872 872
 
873 873
 if ($isFeedbackAllowed) {
874
-	if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) {
875
-		echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
876
-		echo '<input type = "hidden" name="lp_item_id"       value="'.$learnpath_id.'">';
877
-		echo '<input type = "hidden" name="lp_item_view_id"  value="'.$lp_item_view_id.'">';
878
-		echo '<input type = "hidden" name="student_id"       value="'.$student_id.'">';
879
-		echo '<input type = "hidden" name="total_score"      value="'.$totalScore.'"> ';
880
-		echo '<input type = "hidden" name="my_exe_exo_id"    value="'.$exercise_id.'"> ';
881
-	} else {
882
-		echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">';
883
-	}
884
-	if ($origin !='learnpath' && $origin!='student_progress') {
874
+    if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) {
875
+        echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
876
+        echo '<input type = "hidden" name="lp_item_id"       value="'.$learnpath_id.'">';
877
+        echo '<input type = "hidden" name="lp_item_view_id"  value="'.$lp_item_view_id.'">';
878
+        echo '<input type = "hidden" name="student_id"       value="'.$student_id.'">';
879
+        echo '<input type = "hidden" name="total_score"      value="'.$totalScore.'"> ';
880
+        echo '<input type = "hidden" name="my_exe_exo_id"    value="'.$exercise_id.'"> ';
881
+    } else {
882
+        echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">';
883
+    }
884
+    if ($origin !='learnpath' && $origin!='student_progress') {
885 885
         echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>';
886
-		?>
886
+        ?>
887 887
         <br />
888 888
         <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');">
889 889
             <?php echo get_lang('CorrectTest'); ?>
890 890
         </button>
891 891
 		</form>
892 892
 		<?php
893
-	}
893
+    }
894 894
 }
895 895
 
896 896
 //Came from lpstats in a lp
@@ -907,21 +907,21 @@  discard block
 block discarded – undo
907 907
 }
908 908
 
909 909
 if ($origin != 'learnpath') {
910
-	//we are not in learnpath tool
911
-	Display::display_footer();
910
+    //we are not in learnpath tool
911
+    Display::display_footer();
912 912
 } else {
913
-	if (!isset($_GET['fb_type'])) {
914
-		$lp_mode =  $_SESSION['lp_mode'];
915
-		$url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type;
916
-		$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" ';
917
-		echo '<script type="text/javascript">'.$href.'</script>';
918
-		// Record the results in the learning path, using the SCORM interface (API)
919
-		echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>";
920
-		echo '</body></html>';
921
-	} else {
922
-		Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu'));
913
+    if (!isset($_GET['fb_type'])) {
914
+        $lp_mode =  $_SESSION['lp_mode'];
915
+        $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type;
916
+        $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" ';
917
+        echo '<script type="text/javascript">'.$href.'</script>';
918
+        // Record the results in the learning path, using the SCORM interface (API)
919
+        echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>";
920
+        echo '</body></html>';
921
+    } else {
922
+        Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu'));
923 923
         echo '<br />';
924
-	}
924
+    }
925 925
 }
926 926
 
927 927
 // Destroying the session
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 require_once '../inc/global.inc.php';
18 18
 $debug = false;
19
-if (empty($origin) ) {
19
+if (empty($origin)) {
20 20
     $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null;
21 21
 }
22 22
 
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
 $TBL_EXERCISE_QUESTION 	= Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
31 31
 $TBL_QUESTIONS         	= Database::get_course_table(TABLE_QUIZ_QUESTION);
32 32
 $TBL_TRACK_EXERCISES    = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
33
-$TBL_TRACK_ATTEMPT		= Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
33
+$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
34 34
 
35 35
 // General parameters passed via POST/GET
36
-if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST,1)); }
36
+if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST, 1)); }
37 37
 
38 38
 if (empty($formSent)) {            $formSent       = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null; }
39 39
 if (empty($exerciseResult)) {      $exerciseResult = isset($_SESSION['exerciseResult']) ? $_SESSION['exerciseResult'] : null; }
40
-if (empty($questionId)) {          $questionId     = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null;}
41
-if (empty($choice)) {              $choice         = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;}
42
-if (empty($questionNum)) {         $questionNum    = isset($_REQUEST['num']) ? $_REQUEST['num'] : null;}
43
-if (empty($nbrQuestions)) {        $nbrQuestions   = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null;}
44
-if (empty($questionList)) {        $questionList   = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null;}
45
-if (empty($objExercise)) {         $objExercise    = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;}
46
-if (empty($exeId)) {               $exeId          = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;}
47
-if (empty($action)) {              $action         = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;}
40
+if (empty($questionId)) {          $questionId     = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null; }
41
+if (empty($choice)) {              $choice         = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null; }
42
+if (empty($questionNum)) {         $questionNum    = isset($_REQUEST['num']) ? $_REQUEST['num'] : null; }
43
+if (empty($nbrQuestions)) {        $nbrQuestions   = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null; }
44
+if (empty($questionList)) {        $questionList   = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null; }
45
+if (empty($objExercise)) {         $objExercise    = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; }
46
+if (empty($exeId)) {               $exeId          = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; }
47
+if (empty($action)) {              $action         = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; }
48 48
 
49 49
 $id = intval($_REQUEST['id']); //exe id
50 50
 
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 }
106 106
 
107 107
 if (isset($_SESSION['gradebook'])) {
108
-	$gradebook=	Security::remove_XSS($_SESSION['gradebook']);
108
+	$gradebook = Security::remove_XSS($_SESSION['gradebook']);
109 109
 }
110 110
 
111
-if (!empty($gradebook) && $gradebook=='view') {
112
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
111
+if (!empty($gradebook) && $gradebook == 'view') {
112
+	$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
113 113
 }
114 114
 
115 115
 $fromlink = '';
116 116
 
117
-$interbreadcrumb[]= array("url" => "exercise.php?".api_get_cidreq(),"name" => get_lang('Exercises'));
118
-$interbreadcrumb[]= array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(),"name" => $objExercise->name);
119
-$interbreadcrumb[]= array("url" => "#","name" => get_lang('Result'));
117
+$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
118
+$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name);
119
+$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result'));
120 120
 
121 121
 $this_section = SECTION_COURSES;
122 122
 
123
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
124
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
123
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
124
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
125 125
 
126 126
 if ($origin != 'learnpath') {
127 127
 	Display::display_header('');
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 // Avoiding the "Score 0/0" message  when the exe_id is not set
179 179
 if (!empty($track_exercise_info)) {
180 180
     // if the results_disabled of the Quiz is 1 when block the script
181
-    $result_disabled		= $track_exercise_info['results_disabled'];
181
+    $result_disabled = $track_exercise_info['results_disabled'];
182 182
 
183
-    if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) ) {
183
+    if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach())) {
184 184
         if ($result_disabled == 1) {
185 185
             $show_results = false;
186 186
             if ($origin != 'learnpath') {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	$show_results = false;
215 215
 }
216 216
 
217
-if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) {
217
+if ($origin == 'learnpath' && !isset($_GET['fb_type'])) {
218 218
 	$show_results = false;
219 219
 }
220 220
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 $arrques = array();
240 240
 $arrans  = array();
241 241
 
242
-$user_restriction = $is_allowedToEdit ? '' :  "AND user_id=".intval($student_id)." ";
242
+$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." ";
243 243
 $sql = "SELECT attempts.question_id, answer
244 244
         FROM $TBL_TRACK_ATTEMPT as attempts
245 245
         INNER JOIN ".$TBL_TRACK_EXERCISES." AS stats_exercises
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 $total_weighting = 0;
295 295
 foreach ($questionList as $questionId) {
296 296
     $objQuestionTmp = Question::read($questionId);
297
-    $total_weighting +=$objQuestionTmp->selectWeighting();
297
+    $total_weighting += $objQuestionTmp->selectWeighting();
298 298
 }
299 299
 
300 300
 $counter = 1;
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	unset($objQuestionTmp);
315 315
 
316 316
 	// creates a temporary Question object
317
-	$objQuestionTmp 	= Question::read($questionId);
318
-	$questionWeighting	= $objQuestionTmp->selectWeighting();
319
-	$answerType			= $objQuestionTmp->selectType();
317
+	$objQuestionTmp = Question::read($questionId);
318
+	$questionWeighting = $objQuestionTmp->selectWeighting();
319
+	$answerType = $objQuestionTmp->selectType();
320 320
 
321 321
 	// Start buffer
322 322
     ob_start();
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
                 <br>
486 486
             ";
487 487
         }
488
-	} else if($answerType == HOT_SPOT_DELINEATION) {
488
+	} else if ($answerType == HOT_SPOT_DELINEATION) {
489 489
 
490 490
         $question_result = $objExercise->manage_answer(
491 491
             $id,
@@ -518,20 +518,20 @@  discard block
 block discarded – undo
518 518
         if ($show_results) {
519 519
 
520 520
             if ($overlap_color) {
521
-                $overlap_color='green';
521
+                $overlap_color = 'green';
522 522
             } else {
523
-                $overlap_color='red';
523
+                $overlap_color = 'red';
524 524
             }
525 525
 
526 526
             if ($missing_color) {
527
-                $missing_color='green';
527
+                $missing_color = 'green';
528 528
             } else {
529
-                $missing_color='red';
529
+                $missing_color = 'red';
530 530
             }
531 531
             if ($excess_color) {
532
-                $excess_color='green';
532
+                $excess_color = 'green';
533 533
             } else {
534
-                $excess_color='red';
534
+                $excess_color = 'red';
535 535
             }
536 536
 
537 537
             if (!is_numeric($final_overlap)) {
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
                 $final_excess = 0;
546 546
             }
547 547
 
548
-            if ($final_excess>100) {
548
+            if ($final_excess > 100) {
549 549
                 $final_excess = 100;
550 550
             }
551 551
 
552
-            $table_resume='<table class="data_table">
552
+            $table_resume = '<table class="data_table">
553 553
             <tr class="row_odd" >
554 554
             <td></td>
555 555
             <td ><b>'.get_lang('Requirements').'</b></td>
@@ -559,38 +559,38 @@  discard block
 block discarded – undo
559 559
             <tr class="row_even">
560 560
             <td><b>'.get_lang('Overlap').'</b></td>
561 561
             <td>'.get_lang('Min').' '.$threadhold1.'</td>
562
-                <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
562
+                <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
563 563
             </tr>
564 564
 
565 565
             <tr>
566 566
                 <td><b>'.get_lang('Excess').'</b></td>
567 567
                 <td>'.get_lang('Max').' '.$threadhold2.'</td>
568
-                <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
568
+                <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
569 569
             </tr>
570 570
 
571 571
             <tr class="row_even">
572 572
                 <td><b>'.get_lang('Missing').'</b></td>
573 573
                 <td>'.get_lang('Max').' '.$threadhold3.'</td>
574
-                <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
574
+                <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
575 575
             </tr></table>';
576 576
 
577
-            if ($answerType!= HOT_SPOT_DELINEATION) {
578
-                $item_list = explode('@@',$destination);
577
+            if ($answerType != HOT_SPOT_DELINEATION) {
578
+                $item_list = explode('@@', $destination);
579 579
 
580 580
                 $try = $item_list[0];
581 581
                 $lp = $item_list[1];
582 582
                 $destinationid = $item_list[2];
583 583
                 $url = $item_list[3];
584
-                $table_resume='';
584
+                $table_resume = '';
585 585
             } else {
586
-                if ($next==0) {
586
+                if ($next == 0) {
587 587
                     $try = $try_hotspot;
588 588
                     $lp = $lp_hotspot;
589
-                    $destinationid= $select_question_hotspot;
590
-                    $url=$url_hotspot;
589
+                    $destinationid = $select_question_hotspot;
590
+                    $url = $url_hotspot;
591 591
                 } else {
592 592
                     //show if no error
593
-                    $comment=$answerComment = $objAnswerTmp->selectComment($nbrAnswers);
593
+                    $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
594 594
                     $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
595 595
                 }
596 596
             }
@@ -598,14 +598,14 @@  discard block
 block discarded – undo
598 598
             echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
599 599
             if ($answerType == HOT_SPOT_DELINEATION) {
600 600
                 if ($organs_at_risk_hit > 0) {
601
-                    $message='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
602
-                    $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
601
+                    $message = '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
602
+                    $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
603 603
                 } else {
604
-                    $message='<p>'.get_lang('YourDelineation').'</p>';
605
-                    $message.=$table_resume;
606
-                    $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
604
+                    $message = '<p>'.get_lang('YourDelineation').'</p>';
605
+                    $message .= $table_resume;
606
+                    $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
607 607
                 }
608
-                $message.='<p>'.$comment.'</p>';
608
+                $message .= '<p>'.$comment.'</p>';
609 609
                 echo $message;
610 610
             } else {
611 611
                 echo '<p>'.$comment.'</p>';
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
             //showing the score
615 615
             $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." WHERE exe_id = ".intval($id)." and question_id= ".intval($questionId)."";
616 616
             $resfree = Database::query($queryfree);
617
-            $questionScore= Database::result($resfree,0,"marks");
618
-            $totalScore+=$questionScore;
617
+            $questionScore = Database::result($resfree, 0, "marks");
618
+            $totalScore += $questionScore;
619 619
             $relPath = api_get_path(REL_PATH);
620 620
             echo '</table></td></tr>';
621 621
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 			if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
671 671
 				$url_name = get_lang('EditCommentsAndMarks');
672 672
 			} else {
673
-				if ($action=='edit') {
673
+				if ($action == 'edit') {
674 674
 					$url_name = get_lang('EditIndividualComment');
675 675
 				} else {
676 676
 					$url_name = get_lang('AddComments');
@@ -691,9 +691,9 @@  discard block
 block discarded – undo
691 691
 
692 692
             echo '<div id="'.$name.'" style="display:none">';
693 693
 			$arrid[] = $questionId;
694
-			$feedback_form = new FormValidator('frmcomments'.$questionId,'post','');
695
-			$feedback_form->addElement('html','<br>');
696
-			$renderer =& $feedback_form->defaultRenderer();
694
+			$feedback_form = new FormValidator('frmcomments'.$questionId, 'post', '');
695
+			$feedback_form->addElement('html', '<br>');
696
+			$renderer = & $feedback_form->defaultRenderer();
697 697
 			$renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
698 698
 			$renderer->setCustomElementTemplate('<div align="left">{element}</div>');
699 699
 			$comnt = Event::get_comments($id, $questionId);
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
             if ($useAdvancedEditor) {
703 703
                 $feedback_form->addElement(
704 704
                     'html_editor',
705
-                    'comments_' . $questionId,
705
+                    'comments_'.$questionId,
706 706
                     null,
707 707
                     null,
708 708
                     array(
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
                     )
713 713
                 );
714 714
             } else {
715
-                $feedback_form->addElement('textarea', 'comments_' . $questionId);
715
+                $feedback_form->addElement('textarea', 'comments_'.$questionId);
716 716
             }
717
-			$feedback_form->addElement('html','<br>');
717
+			$feedback_form->addElement('html', '<br>');
718 718
 			$feedback_form->setDefaults($default);
719 719
 			$feedback_form->display();
720 720
 			echo '</div>';
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 				$arrmarks[] = $questionId;
737 737
 				echo get_lang("AssignMarks");
738 738
 				echo "&nbsp;<select name='marks' id='marks'>";
739
-				for ($i=0;$i<=$questionWeighting;$i++) {
740
-					echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>';
739
+				for ($i = 0; $i <= $questionWeighting; $i++) {
740
+					echo '<option '.(($i == $questionScore) ? "selected='selected'" : '').'>'.$i.'</option>';
741 741
 				}
742 742
 				echo '</select>';
743 743
 				echo '</form><br /></div>';
744 744
 
745
-				if ($questionScore == -1 ) {
745
+				if ($questionScore == -1) {
746 746
 					$questionScore = 0;
747 747
 				  	echo Display::return_message(get_lang('notCorrectedYet'));
748 748
 				}
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
     }
779 779
 
780 780
     if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
781
-        foreach($objQuestionTmp->category_list as $category_id) {
781
+        foreach ($objQuestionTmp->category_list as $category_id) {
782 782
             $category_list[$category_id]['score'] += $my_total_score;
783 783
             $category_list[$category_id]['total'] += $my_total_weight;
784 784
             $category_was_added_for_this_test = true;
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 $total_score_text = null;
834 834
 
835 835
 //Total score
836
-if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) {
836
+if ($origin != 'learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) {
837 837
 	if ($show_results || $show_only_total_score) {
838 838
         $total_score_text .= '<div class="question_row">';
839 839
         $my_total_score_temp = $totalScore;
@@ -865,13 +865,13 @@  discard block
 block discarded – undo
865 865
 
866 866
 if ($isFeedbackAllowed) {
867 867
     if (is_array($arrid) && is_array($arrmarks)) {
868
-        $strids = implode(",",$arrid);
869
-        $marksid = implode(",",$arrmarks);
868
+        $strids = implode(",", $arrid);
869
+        $marksid = implode(",", $arrmarks);
870 870
     }
871 871
 }
872 872
 
873 873
 if ($isFeedbackAllowed) {
874
-	if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) {
874
+	if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) {
875 875
 		echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
876 876
 		echo '<input type = "hidden" name="lp_item_id"       value="'.$learnpath_id.'">';
877 877
 		echo '<input type = "hidden" name="lp_item_view_id"  value="'.$lp_item_view_id.'">';
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 	} else {
882 882
 		echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">';
883 883
 	}
884
-	if ($origin !='learnpath' && $origin!='student_progress') {
884
+	if ($origin != 'learnpath' && $origin != 'student_progress') {
885 885
         echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>';
886 886
 		?>
887 887
         <br />
@@ -894,14 +894,14 @@  discard block
 block discarded – undo
894 894
 }
895 895
 
896 896
 //Came from lpstats in a lp
897
-if ($origin =='student_progress') { ?>
897
+if ($origin == 'student_progress') { ?>
898 898
 	<button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>" >
899
-	<?php echo get_lang('Back');?></button>
899
+	<?php echo get_lang('Back'); ?></button>
900 900
 <?php
901
-} else if($origin=='myprogress') {
901
+} else if ($origin == 'myprogress') {
902 902
 ?>
903 903
 	<button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" >
904
-        <?php echo get_lang('Finish');?>
904
+        <?php echo get_lang('Finish'); ?>
905 905
     </button>
906 906
 <?php
907 907
 }
@@ -911,9 +911,9 @@  discard block
 block discarded – undo
911 911
 	Display::display_footer();
912 912
 } else {
913 913
 	if (!isset($_GET['fb_type'])) {
914
-		$lp_mode =  $_SESSION['lp_mode'];
914
+		$lp_mode = $_SESSION['lp_mode'];
915 915
 		$url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type;
916
-		$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" ';
916
+		$href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" ';
917 917
 		echo '<script type="text/javascript">'.$href.'</script>';
918 918
 		// Record the results in the learning path, using the SCORM interface (API)
919 919
 		echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>";
Please login to merge, or discard this patch.