Completed
Push — master ( 1ab056...1759c8 )
by Julito
55:42 queued 24:21
created
main/attendance/attendance_controller.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -550,17 +550,17 @@  discard block
 block discarded – undo
550 550
             }
551 551
         }
552 552
         $max_cols_per_page = 12; //10 dates + 2 name and number
553
-        $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;//10
553
+        $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2; //10
554 554
         $rows = count($data_table);
555 555
 
556 556
         if ($cols > $max_cols_per_page) {
557
-            $number_tables = round(($cols-2)/$max_dates_per_page);
557
+            $number_tables = round(($cols - 2) / $max_dates_per_page);
558 558
             $headers = $data_table[0];
559 559
             $all = array();
560 560
             $tables = array();
561 561
             $changed = 1;
562 562
 
563
-            for ($i= 0; $i <= $rows; $i++) {
563
+            for ($i = 0; $i <= $rows; $i++) {
564 564
                 $row = isset($data_table[$i]) ? $data_table[$i] : null;
565 565
                 $key = 1;
566 566
                 $max_dates_per_page = 10;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
                     foreach ($item as $value) {
572 572
                         if ($count_j >= $max_dates_per_page) {
573 573
                             $key++;
574
-                            $max_dates_per_page = $max_dates_per_page_original*$key;
574
+                            $max_dates_per_page = $max_dates_per_page_original * $key;
575 575
                             //magic hack
576 576
                             $tables[$key][$i][] = $tables[1][$i][0];
577 577
                             $tables[$key][$i][] = $tables[1][$i][1];
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
             $form = new FormValidator(
629 629
                 'search',
630 630
                 'post',
631
-                api_get_self() . '?' . api_get_cidreq(
632
-                ) . '&action=calendar_logins'
631
+                api_get_self().'?'.api_get_cidreq(
632
+                ).'&action=calendar_logins'
633 633
             );
634 634
             $form->addDateRangePicker('range', get_lang('DateRange'));
635 635
             $form->addButton('submit', get_lang('Submit'));
Please login to merge, or discard this patch.
main/forum/viewthread_nested.inc.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     $indent = $post['indent_cnt'];
53 53
 
54 54
     $html = '';
55
-    $html .= '<div class="col-md-offset-' . $indent . '" >';
55
+    $html .= '<div class="col-md-offset-'.$indent.'" >';
56 56
     $html .= '<div class="panel panel-default forum-post">';
57 57
     $html .= '<div class="panel-body">';
58 58
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     if ($origin != 'learnpath') {
71 71
         if (api_get_course_setting('allow_user_image_forum')) {
72
-            $html .= '<div class="thumbnail">' . display_user_image($post['user_id'], $name, $origin) . '</div>';
72
+            $html .= '<div class="thumbnail">'.display_user_image($post['user_id'], $name, $origin).'</div>';
73 73
         }
74 74
 
75 75
         $html .= Display::tag(
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         );
80 80
     } else {
81 81
         if (api_get_course_setting('allow_user_image_forum')) {
82
-            $html .= '<div class="thumbnail">' . display_user_image($post['user_id'], $name, $origin) . '</div>';
82
+            $html .= '<div class="thumbnail">'.display_user_image($post['user_id'], $name, $origin).'</div>';
83 83
         }
84 84
 
85 85
         $html .= Display::tag(
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
     // The course admin him/herself can do this off course always
116 116
 
117 117
     if (
118
-    (isset($groupInfo['iid']) &&GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo['iid'])) ||
118
+    (isset($groupInfo['iid']) && GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo['iid'])) ||
119 119
         ($current_forum['allow_edit'] == 1 && $post['user_id'] == $userId) ||
120 120
         (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId))
121 121
     ) {
122 122
         if ($locked == false) {
123
-            $iconEdit .= "<a href=\"editpost.php?" . api_get_cidreq()
123
+            $iconEdit .= "<a href=\"editpost.php?".api_get_cidreq()
124 124
                 . "&forum=$clean_forum_id&thread=$clean_thread_id&post={$post['post_id']}&id_attach=$id_attach"
125 125
                 . "\">"
126 126
                 . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL)
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)
135 135
     ) {
136 136
         if ($locked == false) {
137
-            $deleteUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
137
+            $deleteUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
138 138
                     'forum' => $clean_forum_id,
139 139
                     'thread' => $clean_thread_id,
140 140
                     'action' => 'delete',
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
         );
173 173
 
174 174
         if ($count > 0) {
175
-            $iconEdit .= "<a href=\"viewthread.php?" . api_get_cidreq()
175
+            $iconEdit .= "<a href=\"viewthread.php?".api_get_cidreq()
176 176
                 . "&forum=$clean_forum_id&thread=$clean_thread_id&action=move&post={$post['post_id']}"
177
-                . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>";
177
+                . "\">".Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL)."</a>";
178 178
         }
179 179
     }
180 180
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
                 '1', $post['user_id'], $_GET['thread']
194 194
             );
195 195
             if ($locked == false) {
196
-                $iconEdit .= "<a href=\"forumqualify.php?" . api_get_cidreq()
196
+                $iconEdit .= "<a href=\"forumqualify.php?".api_get_cidreq()
197 197
                     . "&forum=$clean_forum_id&thread=$clean_thread_id&action=list&post={$post['post_id']}"
198 198
                     . "&user={$post['user_id']}&user_id={$post['user_id']}"
199 199
                     . "&idtextqualify=$current_qualify_thread"
200
-                    . "\" >" . Display::return_icon('quiz.png', get_lang('Qualify')) . "</a>";
200
+                    . "\" >".Display::return_icon('quiz.png', get_lang('Qualify'))."</a>";
201 201
             }
202 202
         }
203 203
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     $statusIcon = getPostStatus($current_forum, $post);
206 206
 
207 207
     if ($iconEdit != '') {
208
-        $html .= '<div class="tools-icons">' . $iconEdit . ' '.$statusIcon.'</div>';
208
+        $html .= '<div class="tools-icons">'.$iconEdit.' '.$statusIcon.'</div>';
209 209
     }
210 210
 
211 211
     if (($current_forum_category && $current_forum_category['locked'] == 0) &&
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
216 216
                 $buttonReply = Display::toolbarButton(
217 217
                     get_lang('ReplyToMessage'),
218
-                    'reply.php?' . api_get_cidreq() . '&' . http_build_query([
218
+                    'reply.php?'.api_get_cidreq().'&'.http_build_query([
219 219
                         'forum' => $clean_forum_id,
220 220
                         'thread' => $clean_thread_id,
221 221
                         'post' => $post['post_id'],
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
                 $buttonQuote = Display::toolbarButton(
230 230
                     get_lang('QuoteMessage'),
231
-                    'reply.php?' . api_get_cidreq() . '&' . http_build_query([
231
+                    'reply.php?'.api_get_cidreq().'&'.http_build_query([
232 232
                         'forum' => $clean_forum_id,
233 233
                         'thread' => $clean_thread_id,
234 234
                         'post' => $post['post_id'],
@@ -244,21 +244,21 @@  discard block
 block discarded – undo
244 244
         if ($current_forum_category && $current_forum_category['locked'] == 1) {
245 245
             $closedPost = Display::tag(
246 246
                 'div',
247
-                '<em class="fa fa-exclamation-triangle"></em> ' . get_lang('ForumcategoryLocked'),
247
+                '<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumcategoryLocked'),
248 248
                 array('class' => 'alert alert-warning post-closed')
249 249
             );
250 250
         }
251 251
         if ($current_forum['locked'] == 1) {
252 252
             $closedPost = Display::tag(
253 253
                 'div',
254
-                '<em class="fa fa-exclamation-triangle"></em> ' . get_lang('ForumLocked'),
254
+                '<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumLocked'),
255 255
                 array('class' => 'alert alert-warning post-closed')
256 256
             );
257 257
         }
258 258
         if ($current_thread['locked'] == 1) {
259 259
             $closedPost = Display::tag(
260 260
                 'div',
261
-                '<em class="fa fa-exclamation-triangle"></em> ' . get_lang('ThreadLocked'),
261
+                '<em class="fa fa-exclamation-triangle"></em> '.get_lang('ThreadLocked'),
262 262
                 array('class' => 'alert alert-warning post-closed')
263 263
             );
264 264
         }
@@ -310,23 +310,23 @@  discard block
 block discarded – undo
310 310
             $html .= Display::return_icon('attachment.gif', get_lang('Attachment'));
311 311
             $html .= '<a href="download.php?file=';
312 312
             $html .= $realname;
313
-            $html .= ' "> ' . $user_filename . ' </a>';
314
-            $html .= '<span class="forum_attach_comment" >' . $attachment['comment'] . '</span>';
313
+            $html .= ' "> '.$user_filename.' </a>';
314
+            $html .= '<span class="forum_attach_comment" >'.$attachment['comment'].'</span>';
315 315
             if (($current_forum['allow_edit'] == 1 && $post['user_id'] == $userId) ||
316 316
                 (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId))
317 317
             ) {
318
-                $html .= '&nbsp;&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=delete_attach&id_attach='
319
-                    . $attachment['iid'] . '&forum=' . $clean_forum_id . '&thread=' . $clean_thread_id
318
+                $html .= '&nbsp;&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_attach&id_attach='
319
+                    . $attachment['iid'].'&forum='.$clean_forum_id.'&thread='.$clean_thread_id
320 320
                     . '" onclick="javascript:if(!confirm(\''
321
-                    . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . '\')) return false;">'
322
-                    . Display::return_icon('delete.gif', get_lang('Delete')) . '</a><br />';
321
+                    . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'
322
+                    . Display::return_icon('delete.gif', get_lang('Delete')).'</a><br />';
323 323
             }
324 324
         }
325 325
     }
326 326
 
327 327
     $html .= '</div>';
328 328
     $html .= '<div class="col-md-6 text-right">';
329
-    $html .= $buttonReply . ' ' . $buttonQuote;
329
+    $html .= $buttonReply.' '.$buttonQuote;
330 330
     $html .= '</div>';
331 331
     $html .= '</div>';
332 332
     // The post has been displayed => it can be removed from the what's new array
Please login to merge, or discard this patch.
main/exercise/exercise_submit_modal.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 $learnpath_id = 0;
42 42
 
43 43
 if (isset($_REQUEST['learnpath_id'])) {
44
-	$learnpath_id = intval($_REQUEST['learnpath_id']);
44
+    $learnpath_id = intval($_REQUEST['learnpath_id']);
45 45
 }
46 46
 
47 47
 $learnpath_item_id = 0;
48 48
 
49 49
 if (isset($_REQUEST['learnpath_item_id'])) {
50
-	$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
50
+    $learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
51 51
 }
52 52
 
53 53
 $_SESSION['hotspot_coord']=array();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 // Getting the options by js
92 92
 if (empty($choice_value)) {
93 93
 
94
-	echo "<script>
94
+    echo "<script>
95 95
 		// this works for only radio buttons
96 96
 		var f = self.parent.window.document.frm_exercise;
97 97
 		var choice_js='';
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 
122 122
 	";
123
-	// IMPORTANT
124
-	//this is the real redirect function
125
-	//echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
123
+    // IMPORTANT
124
+    //this is the real redirect function
125
+    //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
126 126
     echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
127 127
     echo "$('#global-modal .modal-body').load(url);";
128
-	echo '</script>';
128
+    echo '</script>';
129 129
 
130 130
     exit;
131 131
 }
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 
179 179
 // creates a temporary Question object
180 180
 if (in_array($questionid, $questionList)) {
181
-	$objQuestionTmp 	= Question :: read($questionid);
182
-	$questionName		=$objQuestionTmp->selectTitle();
183
-	$questionDescription=$objQuestionTmp->selectDescription();
184
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
185
-	$answerType			=$objQuestionTmp->selectType();
186
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
181
+    $objQuestionTmp 	= Question :: read($questionid);
182
+    $questionName		=$objQuestionTmp->selectTitle();
183
+    $questionDescription=$objQuestionTmp->selectDescription();
184
+    $questionWeighting	=$objQuestionTmp->selectWeighting();
185
+    $answerType			=$objQuestionTmp->selectType();
186
+    $quesId				=$objQuestionTmp->selectId(); //added by priya saini
187 187
 }
188 188
 
189 189
 $objAnswerTmp=new Answer($questionid);
@@ -206,43 +206,43 @@  discard block
 block discarded – undo
206 206
 $totalScore = 0;
207 207
 
208 208
 if (!empty($choice_value)) {
209
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
210
-		$answer            = $objAnswerTmp->selectAnswer($answerId);
211
-		$answerComment     = $objAnswerTmp->selectComment($answerId);
212
-		$answerDestination = $objAnswerTmp->selectDestination($answerId);
213
-
214
-		$answerCorrect     = $objAnswerTmp->isCorrect($answerId);
215
-		$answerWeighting   = $objAnswerTmp->selectWeighting($answerId);
216
-		$numAnswer         = $objAnswerTmp->selectAutoId($answerId);
217
-
218
-		//delineation
219
-		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
220
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
209
+    for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
210
+        $answer            = $objAnswerTmp->selectAnswer($answerId);
211
+        $answerComment     = $objAnswerTmp->selectComment($answerId);
212
+        $answerDestination = $objAnswerTmp->selectDestination($answerId);
213
+
214
+        $answerCorrect     = $objAnswerTmp->isCorrect($answerId);
215
+        $answerWeighting   = $objAnswerTmp->selectWeighting($answerId);
216
+        $numAnswer         = $objAnswerTmp->selectAutoId($answerId);
217
+
218
+        //delineation
219
+        $delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
220
+        $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
221 221
         if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
222 222
 
223
-		switch($answerType) {
224
-			// for unique answer
225
-			case UNIQUE_ANSWER :
226
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
227
-				if ($studentChoice) {
228
-					$questionScore	+=$answerWeighting;
229
-					$totalScore		+=$answerWeighting;
230
-					$newquestionList[]=$questionid;
231
-				}
232
-				break;
233
-			case HOT_SPOT_DELINEATION :
234
-			    $studentChoice=$choice[$answerId];
235
-				if ($studentChoice) {
236
-					$newquestionList[]=$questionid;
237
-				}
238
-				if ($answerId===1) {
239
-					$questionScore	+=$answerWeighting;
240
-					$totalScore		+=$answerWeighting;
241
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
242
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
243
-				}
244
-				break;
245
-		}
223
+        switch($answerType) {
224
+            // for unique answer
225
+            case UNIQUE_ANSWER :
226
+                $studentChoice = ($choice_value == $numAnswer)?1:0;
227
+                if ($studentChoice) {
228
+                    $questionScore	+=$answerWeighting;
229
+                    $totalScore		+=$answerWeighting;
230
+                    $newquestionList[]=$questionid;
231
+                }
232
+                break;
233
+            case HOT_SPOT_DELINEATION :
234
+                $studentChoice=$choice[$answerId];
235
+                if ($studentChoice) {
236
+                    $newquestionList[]=$questionid;
237
+                }
238
+                if ($answerId===1) {
239
+                    $questionScore	+=$answerWeighting;
240
+                    $totalScore		+=$answerWeighting;
241
+                    $_SESSION['hotspot_coord'][1]	=$delineation_cord;
242
+                    $_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
243
+                }
244
+                break;
245
+        }
246 246
 
247 247
 
248 248
         if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                         $lp_hotspot=$destination_items[2];
340 340
                         $select_question_hotspot=$destination_items[3];
341 341
                         $url_hotspot=$destination_items[4];
342
-                         //echo 'show the feedback';
342
+                            //echo 'show the feedback';
343 343
                     }
344 344
                 } elseif($answerId>1) {
345 345
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
                 //we send the error
397 397
             }
398 398
         }
399
-	}
399
+    }
400 400
 
401
-	if ($overlap_color) {
402
-		$overlap_color='green';
401
+    if ($overlap_color) {
402
+        $overlap_color='green';
403 403
     } else {
404
-		$overlap_color='red';
404
+        $overlap_color='red';
405 405
     }
406
-	if ($missing_color) {
407
-		$missing_color='green';
406
+    if ($missing_color) {
407
+        $missing_color='green';
408 408
     } else {
409
-		$missing_color='red';
409
+        $missing_color='red';
410 410
     }
411
-	if ($excess_color) {
412
-		$excess_color='green';
411
+    if ($excess_color) {
412
+        $excess_color='green';
413 413
     } else {
414
-		$excess_color='red';
414
+        $excess_color='red';
415 415
     }
416 416
 
417 417
     if (!is_numeric($final_overlap)) {
418
-    	$final_overlap = 0;
418
+        $final_overlap = 0;
419 419
     }
420 420
 
421 421
     if (!is_numeric($final_missing)) {
422
-    	$final_missing = 0;
422
+        $final_missing = 0;
423 423
     }
424 424
     if (!is_numeric($final_excess)) {
425
-    	$final_excess = 0;
425
+        $final_excess = 0;
426 426
     }
427 427
 
428 428
     if ($final_excess>100) {
429
-    	$final_excess = 100;
429
+        $final_excess = 100;
430 430
     }
431 431
 
432 432
 
433
-	$table_resume = '<table class="data_table" >
433
+    $table_resume = '<table class="data_table" >
434 434
 	<tr class="row_odd" >
435 435
 		<td></td>
436 436
 		<td ><b>'.get_lang('Requirements').'</b></td>
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
456 456
 	</tr>
457 457
 	</table>';
458
-	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
458
+    //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
459 459
 }
460 460
 $_SESSION['newquestionList'] = $newquestionList;
461 461
 
@@ -472,68 +472,68 @@  discard block
 block discarded – undo
472 472
 if ($answerType != HOT_SPOT_DELINEATION) {
473 473
     if (!empty($destination)) {
474 474
         $item_list = explode('@@',$destination);
475
-    	//print_R($item_list);
476
-    	$try = $item_list[0];
477
-    	$lp = $item_list[1];
478
-    	$destinationid= $item_list[2];
479
-    	$url=$item_list[3];
475
+        //print_R($item_list);
476
+        $try = $item_list[0];
477
+        $lp = $item_list[1];
478
+        $destinationid= $item_list[2];
479
+        $url=$item_list[3];
480 480
     }
481
-	$table_resume='';
481
+    $table_resume='';
482 482
 } else {
483
-		$try = $try_hotspot;
484
-		$lp = $lp_hotspot;
485
-		$destinationid= $select_question_hotspot;
486
-		$url=$url_hotspot;
487
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
488
-		// no error = no oar and no wrong result for delineation
489
-		//show if no error
490
-		//echo 'no error';
491
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
492
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
493
-
494
-		//we send the error
495
-		$destination_items= explode('@@', $answerDestination);
496
-		$try=$destination_items[1];
497
-		$lp=$destination_items[2];
498
-		$destinationid=$destination_items[3];
499
-		$url=$destination_items[4];
500
-		$exerciseResult[$questionid] = 1;
501
-	} else {
502
-		$exerciseResult[$questionid] = 0;
503
-	}
483
+        $try = $try_hotspot;
484
+        $lp = $lp_hotspot;
485
+        $destinationid= $select_question_hotspot;
486
+        $url=$url_hotspot;
487
+    if ($organs_at_risk_hit==0 && $wrong_results==false ) {
488
+        // no error = no oar and no wrong result for delineation
489
+        //show if no error
490
+        //echo 'no error';
491
+        $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
492
+        $answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
493
+
494
+        //we send the error
495
+        $destination_items= explode('@@', $answerDestination);
496
+        $try=$destination_items[1];
497
+        $lp=$destination_items[2];
498
+        $destinationid=$destination_items[3];
499
+        $url=$destination_items[4];
500
+        $exerciseResult[$questionid] = 1;
501
+    } else {
502
+        $exerciseResult[$questionid] = 0;
503
+    }
504 504
 }
505 505
 
506 506
 // the link to retry the question
507 507
 if (isset($try) && $try==1) {
508
-	$num_value_array= (array_keys($questionList, $questionid));
509
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
508
+    $num_value_array= (array_keys($questionList, $questionid));
509
+    $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
510 510
 }
511 511
 
512 512
 // the link to theory (a learning path)
513 513
 if (!empty($lp)) {
514
-	$lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
515
-	$list = new LearnpathList(api_get_user_id());
516
-	$flat_list = $list->get_flat_list();
517
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
514
+    $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
515
+    $list = new LearnpathList(api_get_user_id());
516
+    $flat_list = $list->get_flat_list();
517
+    $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
518 518
 }
519 519
 $links.='<br />';
520 520
 
521 521
 // the link to an external website or link
522 522
 if (!empty($url)) {
523
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
523
+    $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
524 524
 }
525 525
 
526 526
 // the link to finish the test
527 527
 if ($destinationid==-1) {
528
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
528
+    $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
529 529
 } else {
530
-	// the link to other question
531
-	if (in_array($destinationid,$questionList)) {
532
-		$objQuestionTmp = Question :: read($destinationid);
533
-		$questionName=$objQuestionTmp->selectTitle();
534
-		$num_value_array= (array_keys($questionList, $destinationid));
535
-		$links.= Display :: return_icon('quiz.png', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
536
-	}
530
+    // the link to other question
531
+    if (in_array($destinationid,$questionList)) {
532
+        $objQuestionTmp = Question :: read($destinationid);
533
+        $questionName=$objQuestionTmp->selectTitle();
534
+        $num_value_array= (array_keys($questionList, $destinationid));
535
+        $links.= Display :: return_icon('quiz.png', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
536
+    }
537 537
 }
538 538
 
539 539
 echo '<script>
@@ -550,43 +550,43 @@  discard block
 block discarded – undo
550 550
 </script>';
551 551
 
552 552
 if ($links!='') {
553
-	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
553
+    /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
554 554
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
555
-	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
556
-
557
-	if ($answerType == HOT_SPOT_DELINEATION) {
558
-		if ($organs_at_risk_hit > 0) {
559
-			//$message='<p>'.get_lang('YourDelineation').'</p>';
560
-			//$message.=$table_resume;
561
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
562
-			//if ($wrong_results) { }
563
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
564
-			$message.='<p>'.$comment.'</p>';
565
-		} else {
566
-			$message='<p>'.get_lang('YourDelineation').'</p>';
567
-			$message.=$table_resume;
568
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
569
-			$message.='<p>'.$comment.'</p>';
570
-		}
571
-		echo $message;
572
-	} else {
573
-		echo '<p>'.$comment.'</p>';
574
-	}
575
-	echo '<h3>'.$links.'</h3>';
576
-	echo '</div>';
577
-
578
-	$_SESSION['hot_spot_result']=$message;
579
-	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
580
-	//reseting the exerciseResult variable
581
-	Session::write('exerciseResult',$exerciseResult);
582
-
583
-	//save this variables just in case the exercise loads an LP with other exercise
584
-	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
585
-	$_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
586
-	$_SESSION['questionListExtra'.$exerciseId]	 = $_SESSION['questionList'];
555
+    echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
556
+
557
+    if ($answerType == HOT_SPOT_DELINEATION) {
558
+        if ($organs_at_risk_hit > 0) {
559
+            //$message='<p>'.get_lang('YourDelineation').'</p>';
560
+            //$message.=$table_resume;
561
+            $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
562
+            //if ($wrong_results) { }
563
+            $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
564
+            $message.='<p>'.$comment.'</p>';
565
+        } else {
566
+            $message='<p>'.get_lang('YourDelineation').'</p>';
567
+            $message.=$table_resume;
568
+            $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
569
+            $message.='<p>'.$comment.'</p>';
570
+        }
571
+        echo $message;
572
+    } else {
573
+        echo '<p>'.$comment.'</p>';
574
+    }
575
+    echo '<h3>'.$links.'</h3>';
576
+    echo '</div>';
577
+
578
+    $_SESSION['hot_spot_result']=$message;
579
+    $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
580
+    //reseting the exerciseResult variable
581
+    Session::write('exerciseResult',$exerciseResult);
582
+
583
+    //save this variables just in case the exercise loads an LP with other exercise
584
+    $_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
585
+    $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
586
+    $_SESSION['questionListExtra'.$exerciseId]	 = $_SESSION['questionList'];
587 587
 } else {
588
-	$questionNum++;
589
-	echo '<script>
588
+    $questionNum++;
589
+    echo '<script>
590 590
 			self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
591 591
    			//self.parent.tb_remove();
592 592
  	 	</script>';
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
51 51
 }
52 52
 
53
-$_SESSION['hotspot_coord']=array();
54
-$newquestionList= isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : [];
55
-$questionList 	= $_SESSION['questionList'];
53
+$_SESSION['hotspot_coord'] = array();
54
+$newquestionList = isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : [];
55
+$questionList = $_SESSION['questionList'];
56 56
 
57 57
 $exerciseId		= intval($_GET['exerciseId']);
58 58
 $exerciseType	= intval($_GET['exerciseType']);
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 $choice_value = '';
84 84
 
85
-$user_array = substr($user_array,0,-1);
85
+$user_array = substr($user_array, 0, -1);
86 86
 
87
-if (isset($_GET['choice'])){
87
+if (isset($_GET['choice'])) {
88 88
     $choice_value = intval($_GET['choice']);
89 89
 }
90 90
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 }
132 132
 
133 133
 $choice = array();
134
-$questionid= $questionList[$questionNum];
134
+$questionid = $questionList[$questionNum];
135 135
 // $choice_value => value of the user selection
136 136
 $choice[$questionid] = isset($choice_value) ? $choice_value : null;
137 137
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
         $exerciseResult = $choice;
149 149
     } else {
150 150
         // gets the question ID from $choice. It is the key of the array
151
-        list($key)=array_keys($choice);
151
+        list($key) = array_keys($choice);
152 152
         // if the user didn't already answer this question
153
-        if(!isset($exerciseResult[$key])) {
153
+        if (!isset($exerciseResult[$key])) {
154 154
             // stores the user answer into the array
155
-            $exerciseResult[$key]=$choice[$key];
155
+            $exerciseResult[$key] = $choice[$key];
156 156
         }
157 157
     }
158 158
 }
@@ -178,26 +178,26 @@  discard block
 block discarded – undo
178 178
 
179 179
 // creates a temporary Question object
180 180
 if (in_array($questionid, $questionList)) {
181
-	$objQuestionTmp 	= Question :: read($questionid);
182
-	$questionName		=$objQuestionTmp->selectTitle();
183
-	$questionDescription=$objQuestionTmp->selectDescription();
184
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
185
-	$answerType			=$objQuestionTmp->selectType();
186
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
181
+	$objQuestionTmp = Question :: read($questionid);
182
+	$questionName = $objQuestionTmp->selectTitle();
183
+	$questionDescription = $objQuestionTmp->selectDescription();
184
+	$questionWeighting = $objQuestionTmp->selectWeighting();
185
+	$answerType = $objQuestionTmp->selectType();
186
+	$quesId = $objQuestionTmp->selectId(); //added by priya saini
187 187
 }
188 188
 
189
-$objAnswerTmp=new Answer($questionid);
190
-$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
189
+$objAnswerTmp = new Answer($questionid);
190
+$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
191 191
 //echo 'answe_type '.$answerType;echo '<br />';
192 192
 
193 193
 $choice = $exerciseResult[$questionid];
194
-$destination=array();
195
-$comment='';
196
-$next=1;
194
+$destination = array();
195
+$comment = '';
196
+$next = 1;
197 197
 $_SESSION['hotspot_coord'] = array();
198 198
 $_SESSION['hotspot_dest'] = array();
199 199
 
200
-$overlap_color = $missing_color = $excess_color=false;
200
+$overlap_color = $missing_color = $excess_color = false;
201 201
 $organs_at_risk_hit = 0;
202 202
 $wrong_results = false;
203 203
 $hot_spot_load = false;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 $totalScore = 0;
207 207
 
208 208
 if (!empty($choice_value)) {
209
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
209
+	for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
210 210
 		$answer            = $objAnswerTmp->selectAnswer($answerId);
211 211
 		$answerComment     = $objAnswerTmp->selectComment($answerId);
212 212
 		$answerDestination = $objAnswerTmp->selectDestination($answerId);
@@ -217,29 +217,29 @@  discard block
 block discarded – undo
217 217
 
218 218
 		//delineation
219 219
 		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
220
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
221
-        if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
220
+		$answer_delineation_destination = $objAnswerTmp->selectDestination(1);
221
+        if ($dbg_local > 0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination, 0); }
222 222
 
223
-		switch($answerType) {
223
+		switch ($answerType) {
224 224
 			// for unique answer
225 225
 			case UNIQUE_ANSWER :
226
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
226
+				$studentChoice = ($choice_value == $numAnswer) ? 1 : 0;
227 227
 				if ($studentChoice) {
228
-					$questionScore	+=$answerWeighting;
229
-					$totalScore		+=$answerWeighting;
230
-					$newquestionList[]=$questionid;
228
+					$questionScore += $answerWeighting;
229
+					$totalScore		+= $answerWeighting;
230
+					$newquestionList[] = $questionid;
231 231
 				}
232 232
 				break;
233 233
 			case HOT_SPOT_DELINEATION :
234
-			    $studentChoice=$choice[$answerId];
234
+			    $studentChoice = $choice[$answerId];
235 235
 				if ($studentChoice) {
236
-					$newquestionList[]=$questionid;
236
+					$newquestionList[] = $questionid;
237 237
 				}
238
-				if ($answerId===1) {
239
-					$questionScore	+=$answerWeighting;
240
-					$totalScore		+=$answerWeighting;
241
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
242
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
238
+				if ($answerId === 1) {
239
+					$questionScore += $answerWeighting;
240
+					$totalScore += $answerWeighting;
241
+					$_SESSION['hotspot_coord'][1] = $delineation_cord;
242
+					$_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
243 243
 				}
244 244
 				break;
245 245
 		}
@@ -251,27 +251,27 @@  discard block
 block discarded – undo
251 251
                 $destination = $answerDestination;
252 252
                 $comment = $answerComment;
253 253
             }
254
-        } elseif($answerType == HOT_SPOT_DELINEATION) {
254
+        } elseif ($answerType == HOT_SPOT_DELINEATION) {
255 255
             if ($next) {
256
-                if ($dbg_local>0) { error_log(__LINE__.' - next',0);}
256
+                if ($dbg_local > 0) { error_log(__LINE__.' - next', 0); }
257 257
                 $hot_spot_load = true; //apparently the script is called twice
258 258
                 $user_answer = $user_array;
259
-                $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php
259
+                $_SESSION['exerciseResultCoordinates'][$questionid] = $user_answer; //needed for exercise_result.php
260 260
 
261 261
                 // we compare only the delineation not the other points
262
-                $answer_question	= $_SESSION['hotspot_coord'][1];
263
-                $answerDestination	= $_SESSION['hotspot_dest'][1];
262
+                $answer_question = $_SESSION['hotspot_coord'][1];
263
+                $answerDestination = $_SESSION['hotspot_dest'][1];
264 264
 
265
-                $poly_user 				= convert_coordinates($user_answer,'/');
266
-                $poly_answer 			= convert_coordinates($answer_question,'|');
267
-                $max_coord 				= poly_get_max($poly_user,$poly_answer);
265
+                $poly_user 				= convert_coordinates($user_answer, '/');
266
+                $poly_answer = convert_coordinates($answer_question, '|');
267
+                $max_coord 				= poly_get_max($poly_user, $poly_answer);
268 268
 
269 269
                 if (empty($_GET['hotspot'])) { //no user response
270 270
                     $overlap = -2;
271 271
                 } else {
272
-                    $poly_user_compiled 	= poly_compile($poly_user,$max_coord);
273
-                    $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord);
274
-                    $poly_results 			= poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
272
+                    $poly_user_compiled = poly_compile($poly_user, $max_coord);
273
+                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
274
+                    $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord);
275 275
 
276 276
                     $overlap = $poly_results['both'];
277 277
                     $poly_answer_area = $poly_results['s1'];
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 }
282 282
 
283 283
                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
284
-                if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);}
284
+                if ($dbg_local > 0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); }
285 285
                 if ($overlap < 1) {
286 286
                     //shortcut to avoid complicated calculations
287 287
                     $final_overlap = 0;
@@ -289,27 +289,27 @@  discard block
 block discarded – undo
289 289
                     $final_excess  = 100;
290 290
                 } else {
291 291
                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
292
-                    $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100);
293
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);}
292
+                    $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
293
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); }
294 294
                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
295 295
                     $final_missing = 100 - $final_overlap;
296
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);}
296
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final missing is '.$final_missing, 0); }
297 297
                     // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon
298
-                    $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100);
299
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);}
298
+                    $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
299
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final excess is '.$final_excess, 0); }
300 300
                 }
301 301
 
302
-                $destination_items= explode('@@', $answerDestination);
302
+                $destination_items = explode('@@', $answerDestination);
303 303
                 $threadhold_total = $destination_items[0];
304
-                $threadhold_items=explode(';',$threadhold_total);
304
+                $threadhold_items = explode(';', $threadhold_total);
305 305
                 $threadhold1 = $threadhold_items[0]; // overlap
306 306
                 $threadhold2 = $threadhold_items[1]; // excess
307
-                $threadhold3 = $threadhold_items[2];	 //missing
307
+                $threadhold3 = $threadhold_items[2]; //missing
308 308
 
309 309
                 // echo $final_overlap.'  '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.'  '. $threadhold3;
310 310
 
311 311
                 // if is delineation
312
-                if ($answerId===1) {
312
+                if ($answerId === 1) {
313 313
                     //setting colors
314 314
                     if ($final_overlap >= $threadhold1) {
315 315
                         $overlap_color = true; //echo 'a';
@@ -325,40 +325,40 @@  discard block
 block discarded – undo
325 325
 
326 326
                     // if pass
327 327
                     //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) {
328
-                    if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
329
-                        $next=1; //go to the oars
330
-                        $result_comment=get_lang('Acceptable');
328
+                    if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) {
329
+                        $next = 1; //go to the oars
330
+                        $result_comment = get_lang('Acceptable');
331 331
                     } else {
332
-                        $next=1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
332
+                        $next = 1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
333 333
                         $wrong_results = true;
334
-                        $result_comment=get_lang('Unacceptable');
335
-                        $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
336
-                        $answerDestination=$objAnswerTmp->selectDestination(1);
337
-                        $destination_items= explode('@@', $answerDestination);
338
-                        $try_hotspot=$destination_items[1];
339
-                        $lp_hotspot=$destination_items[2];
340
-                        $select_question_hotspot=$destination_items[3];
341
-                        $url_hotspot=$destination_items[4];
334
+                        $result_comment = get_lang('Unacceptable');
335
+                        $special_comment = $comment = $answerDestination = $objAnswerTmp->selectComment(1);
336
+                        $answerDestination = $objAnswerTmp->selectDestination(1);
337
+                        $destination_items = explode('@@', $answerDestination);
338
+                        $try_hotspot = $destination_items[1];
339
+                        $lp_hotspot = $destination_items[2];
340
+                        $select_question_hotspot = $destination_items[3];
341
+                        $url_hotspot = $destination_items[4];
342 342
                          //echo 'show the feedback';
343 343
                     }
344
-                } elseif($answerId>1) {
344
+                } elseif ($answerId > 1) {
345 345
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
346
-                        if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);}
346
+                        if ($dbg_local > 0) { error_log(__LINE__.' - answerId is of type noerror', 0); }
347 347
                         //type no error shouldn't be treated
348 348
                         $next = 1;
349 349
                         continue;
350 350
                     }
351
-                    if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);}
351
+                    if ($dbg_local > 0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); }
352 352
                     //check the intersection between the oar and the user
353 353
                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
354 354
                     //echo 'official';print_r($x_list);print_r($y_list);
355 355
                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
356 356
 
357 357
                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
358
-                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
358
+                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
359 359
 
360
-                    $poly_answer 			= convert_coordinates($delineation_cord,'|');
361
-                    $max_coord 				= poly_get_max($poly_user,$poly_answer); //getting max coordinates
360
+                    $poly_answer = convert_coordinates($delineation_cord, '|');
361
+                    $max_coord = poly_get_max($poly_user, $poly_answer); //getting max coordinates
362 362
                     $test = false;
363 363
                     // if ($answerId == 2 ){$test = true;} for test oars
364 364
 
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
                         $overlap = false;
367 367
                     } else {
368 368
                         //	poly_compile really works tested with gnuplot
369
-                        $poly_user_compiled	  	= poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
370
-                        $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord,$test);
371
-                        $overlap 			  	= poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
369
+                        $poly_user_compiled	  	= poly_compile($poly_user, $max_coord, $test); //$poly_user is already set when answerid = 1
370
+                        $poly_answer_compiled 	= poly_compile($poly_answer, $max_coord, $test);
371
+                        $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
372 372
                     }
373 373
 
374 374
                     if ($overlap == false) {
@@ -376,42 +376,42 @@  discard block
 block discarded – undo
376 376
                         $next = 1;
377 377
                         continue;
378 378
                     } else {
379
-                        if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);}
379
+                        if ($dbg_local > 0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); }
380 380
 
381 381
                         $organs_at_risk_hit++;
382 382
                         //show the feedback
383
-                        $next=1;
384
-                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
385
-                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
386
-                        $destination_items= explode('@@', $answerDestination);
387
-                        $try_hotspot=$destination_items[1];
388
-                        $lp_hotspot=$destination_items[2];
389
-                        $select_question_hotspot=$destination_items[3];
390
-                        $url_hotspot=$destination_items[4];
383
+                        $next = 1;
384
+                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
385
+                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
386
+                        $destination_items = explode('@@', $answerDestination);
387
+                        $try_hotspot = $destination_items[1];
388
+                        $lp_hotspot = $destination_items[2];
389
+                        $select_question_hotspot = $destination_items[3];
390
+                        $url_hotspot = $destination_items[4];
391 391
                     }
392 392
                 }
393 393
             } else {
394 394
                 // the first delineation feedback
395
-                if ($dbg_local>0) { error_log(__LINE__.' first',0);}
395
+                if ($dbg_local > 0) { error_log(__LINE__.' first', 0); }
396 396
                 //we send the error
397 397
             }
398 398
         }
399 399
 	}
400 400
 
401 401
 	if ($overlap_color) {
402
-		$overlap_color='green';
402
+		$overlap_color = 'green';
403 403
     } else {
404
-		$overlap_color='red';
404
+		$overlap_color = 'red';
405 405
     }
406 406
 	if ($missing_color) {
407
-		$missing_color='green';
407
+		$missing_color = 'green';
408 408
     } else {
409
-		$missing_color='red';
409
+		$missing_color = 'red';
410 410
     }
411 411
 	if ($excess_color) {
412
-		$excess_color='green';
412
+		$excess_color = 'green';
413 413
     } else {
414
-		$excess_color='red';
414
+		$excess_color = 'red';
415 415
     }
416 416
 
417 417
     if (!is_numeric($final_overlap)) {
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     	$final_excess = 0;
426 426
     }
427 427
 
428
-    if ($final_excess>100) {
428
+    if ($final_excess > 100) {
429 429
     	$final_excess = 100;
430 430
     }
431 431
 
@@ -440,26 +440,26 @@  discard block
 block discarded – undo
440 440
 	<tr class="row_even">
441 441
 		<td><b>'.get_lang('Overlap').'</b></td>
442 442
 		<td>'.get_lang('Min').' '.$threadhold1.'</td>
443
-		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
443
+		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
444 444
 	</tr>
445 445
 
446 446
 	<tr>
447 447
 		<td><b>'.get_lang('Excess').'</b></td>
448 448
 		<td>'.get_lang('Max').' '.$threadhold2.'</td>
449
-		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
449
+		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
450 450
 	</tr>
451 451
 
452 452
 	<tr class="row_even">
453 453
 		<td><b>'.get_lang('Missing').'</b></td>
454 454
 		<td>'.get_lang('Max').' '.$threadhold3.'</td>
455
-		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
455
+		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
456 456
 	</tr>
457 457
 	</table>';
458 458
 	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
459 459
 }
460 460
 $_SESSION['newquestionList'] = $newquestionList;
461 461
 
462
-$links='';
462
+$links = '';
463 463
 
464 464
 if (isset($choice_value) && $choice_value == -1) {
465 465
     if ($answerType != HOT_SPOT_DELINEATION) {
@@ -471,32 +471,32 @@  discard block
 block discarded – undo
471 471
 
472 472
 if ($answerType != HOT_SPOT_DELINEATION) {
473 473
     if (!empty($destination)) {
474
-        $item_list = explode('@@',$destination);
474
+        $item_list = explode('@@', $destination);
475 475
     	//print_R($item_list);
476 476
     	$try = $item_list[0];
477 477
     	$lp = $item_list[1];
478
-    	$destinationid= $item_list[2];
479
-    	$url=$item_list[3];
478
+    	$destinationid = $item_list[2];
479
+    	$url = $item_list[3];
480 480
     }
481
-	$table_resume='';
481
+	$table_resume = '';
482 482
 } else {
483 483
 		$try = $try_hotspot;
484 484
 		$lp = $lp_hotspot;
485
-		$destinationid= $select_question_hotspot;
486
-		$url=$url_hotspot;
487
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
485
+		$destinationid = $select_question_hotspot;
486
+		$url = $url_hotspot;
487
+	if ($organs_at_risk_hit == 0 && $wrong_results == false) {
488 488
 		// no error = no oar and no wrong result for delineation
489 489
 		//show if no error
490 490
 		//echo 'no error';
491
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
492
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
491
+		$comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
492
+		$answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
493 493
 
494 494
 		//we send the error
495
-		$destination_items= explode('@@', $answerDestination);
496
-		$try=$destination_items[1];
497
-		$lp=$destination_items[2];
498
-		$destinationid=$destination_items[3];
499
-		$url=$destination_items[4];
495
+		$destination_items = explode('@@', $answerDestination);
496
+		$try = $destination_items[1];
497
+		$lp = $destination_items[2];
498
+		$destinationid = $destination_items[3];
499
+		$url = $destination_items[4];
500 500
 		$exerciseResult[$questionid] = 1;
501 501
 	} else {
502 502
 		$exerciseResult[$questionid] = 0;
@@ -504,35 +504,35 @@  discard block
 block discarded – undo
504 504
 }
505 505
 
506 506
 // the link to retry the question
507
-if (isset($try) && $try==1) {
508
-	$num_value_array= (array_keys($questionList, $questionid));
509
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
507
+if (isset($try) && $try == 1) {
508
+	$num_value_array = (array_keys($questionList, $questionid));
509
+	$links .= Display :: return_icon('reload.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
510 510
 }
511 511
 
512 512
 // the link to theory (a learning path)
513 513
 if (!empty($lp)) {
514
-	$lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
514
+	$lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
515 515
 	$list = new LearnpathList(api_get_user_id());
516 516
 	$flat_list = $list->get_flat_list();
517
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
517
+	$links .= Display :: return_icon('theory.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
518 518
 }
519
-$links.='<br />';
519
+$links .= '<br />';
520 520
 
521 521
 // the link to an external website or link
522 522
 if (!empty($url)) {
523
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
523
+	$links .= Display :: return_icon('link.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
524 524
 }
525 525
 
526 526
 // the link to finish the test
527
-if ($destinationid==-1) {
528
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
527
+if ($destinationid == -1) {
528
+	$links .= Display :: return_icon('finish.gif', '', array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
529 529
 } else {
530 530
 	// the link to other question
531
-	if (in_array($destinationid,$questionList)) {
531
+	if (in_array($destinationid, $questionList)) {
532 532
 		$objQuestionTmp = Question :: read($destinationid);
533
-		$questionName=$objQuestionTmp->selectTitle();
534
-		$num_value_array= (array_keys($questionList, $destinationid));
535
-		$links.= Display :: return_icon('quiz.png', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
533
+		$questionName = $objQuestionTmp->selectTitle();
534
+		$num_value_array = (array_keys($questionList, $destinationid));
535
+		$links .= Display :: return_icon('quiz.png', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
536 536
 	}
537 537
 }
538 538
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 }
550 550
 </script>';
551 551
 
552
-if ($links!='') {
552
+if ($links != '') {
553 553
 	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
554 554
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
555 555
 	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
@@ -558,15 +558,15 @@  discard block
 block discarded – undo
558 558
 		if ($organs_at_risk_hit > 0) {
559 559
 			//$message='<p>'.get_lang('YourDelineation').'</p>';
560 560
 			//$message.=$table_resume;
561
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
561
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
562 562
 			//if ($wrong_results) { }
563
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
564
-			$message.='<p>'.$comment.'</p>';
563
+			$message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
564
+			$message .= '<p>'.$comment.'</p>';
565 565
 		} else {
566
-			$message='<p>'.get_lang('YourDelineation').'</p>';
567
-			$message.=$table_resume;
568
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
569
-			$message.='<p>'.$comment.'</p>';
566
+			$message = '<p>'.get_lang('YourDelineation').'</p>';
567
+			$message .= $table_resume;
568
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
569
+			$message .= '<p>'.$comment.'</p>';
570 570
 		}
571 571
 		echo $message;
572 572
 	} else {
@@ -575,10 +575,10 @@  discard block
 block discarded – undo
575 575
 	echo '<h3>'.$links.'</h3>';
576 576
 	echo '</div>';
577 577
 
578
-	$_SESSION['hot_spot_result']=$message;
578
+	$_SESSION['hot_spot_result'] = $message;
579 579
 	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
580 580
 	//reseting the exerciseResult variable
581
-	Session::write('exerciseResult',$exerciseResult);
581
+	Session::write('exerciseResult', $exerciseResult);
582 582
 
583 583
 	//save this variables just in case the exercise loads an LP with other exercise
584 584
 	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
Please login to merge, or discard this patch.
main/inc/lib/tracking.lib.php 1 patch
Spacing   +432 added lines, -432 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $extendedAttempt = null,
115 115
         $extendedAll = null,
116 116
         $type = 'classic',
117
-        $allowExtend =  true
117
+        $allowExtend = true
118 118
     ) {
119 119
         if (empty($courseInfo) || empty($lp_id)) {
120 120
             return null;
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
         $extend_all = 0;
139 139
 
140 140
         if ($origin == 'tracking') {
141
-            $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin;
141
+            $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin;
142 142
         } else {
143
-            $url_suffix = '&lp_id=' . $lp_id;
143
+            $url_suffix = '&lp_id='.$lp_id;
144 144
         }
145 145
 
146 146
         if (!empty($extendedAll)) {
147 147
             $extend_all_link = Display::url(
148 148
                 Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
149
-                api_get_self() . '?action=stats' . $url_suffix
149
+                api_get_self().'?action=stats'.$url_suffix
150 150
             );
151 151
 
152 152
             $extend_all = 1;
153 153
         } else {
154 154
             $extend_all_link = Display::url(
155 155
                 Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')),
156
-                api_get_self() . '?action=stats&extend_all=1' . $url_suffix
156
+                api_get_self().'?action=stats&extend_all=1'.$url_suffix
157 157
             );
158 158
         }
159 159
 
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 
166 166
         $actionColumn = null;
167 167
         if ($type == 'classic') {
168
-            $actionColumn = ' <th>' . get_lang('Actions') . '</th>';
168
+            $actionColumn = ' <th>'.get_lang('Actions').'</th>';
169 169
         }
170 170
         $output .= '<div class="table-responsive">';
171 171
         $output .= '<table class="table tracking">
172 172
             <thead>
173 173
             <tr class="table-header">
174
-                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;') . '</th>
174
+                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;').'</th>
175 175
                 <th colspan="4">
176
-                    ' . get_lang('ScormLessonTitle') .'
176
+                    ' . get_lang('ScormLessonTitle').'
177 177
                 </th>
178 178
                 <th colspan="2">
179
-                    ' . get_lang('ScormStatus') . '
179
+                    ' . get_lang('ScormStatus').'
180 180
                 </th>
181 181
                 <th colspan="2">
182
-                    ' . get_lang('ScormScore') . '
182
+                    ' . get_lang('ScormScore').'
183 183
                 </th>
184 184
                 <th colspan="2">
185
-                    ' . get_lang('ScormTime') . '
185
+                    ' . get_lang('ScormTime').'
186 186
                 </th>
187 187
                 '.$actionColumn.'
188 188
                 </tr>
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 // Prepare statement to go through each attempt.
246 246
                 $viewCondition = null;
247 247
                 if (!empty($view)) {
248
-                    $viewCondition =  " AND v.view_count = $view  ";
248
+                    $viewCondition = " AND v.view_count = $view  ";
249 249
                 }
250 250
 
251 251
                 $sql = "SELECT
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                                 FROM $TBL_QUIZ
294 294
                                 WHERE
295 295
                                     c_id = $course_id AND
296
-                                    id ='" . $my_path . "'";
296
+                                    id ='".$my_path."'";
297 297
                         $res_result_disabled = Database::query($sql);
298 298
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
299 299
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                     if (!empty($inter_num)) {
316 316
                         $extend_link = Display::url(
317 317
                               Display::return_icon('visible.gif', get_lang('HideAttemptView')),
318
-                              api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix
318
+                              api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix
319 319
                         );
320 320
                     }
321 321
                     $title = $row['mytitle'];
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
                     $action = null;
335 335
                     if ($type == 'classic') {
336
-                        $action =  '<td></td>';
336
+                        $action = '<td></td>';
337 337
                     }
338 338
 
339 339
                     if (in_array($row['item_type'], $chapterTypes)) {
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
                                 $extend_this_attempt = 1;
378 378
                                 $extend_attempt_link = Display::url(
379 379
                                     Display::return_icon('visible.gif', get_lang('HideAttemptView')),
380
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
380
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
381 381
                                 );
382 382
                             } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
383 383
                                 // The extend button for this attempt has not been clicked.
384 384
                                 $extend_attempt_link = Display::url(
385 385
                                     Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
386
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
386
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
387 387
                                 );
388 388
                             }
389 389
                         }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                         }
417 417
 
418 418
                         // Remove "NaN" if any (@todo: locate the source of these NaN)
419
-                        $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
419
+                        $time = str_replace('NaN', '00'.$h.'00\'00"', $time);
420 420
 
421 421
                         if ($row['item_type'] != 'dir') {
422 422
                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
                                 $action = '<td></td>';
445 445
                             }
446 446
 
447
-                            $output .= '<tr class="' . $oddclass . '">
447
+                            $output .= '<tr class="'.$oddclass.'">
448 448
                                     <td></td>
449
-                                    <td>' . $extend_attempt_link . '</td>
450
-                                    <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td>
451
-                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
452
-                                    <td colspan="2">' . $view_score . '</td>
453
-                                    <td colspan="2">' . $time . '</td>
449
+                                    <td>' . $extend_attempt_link.'</td>
450
+                                    <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td>
451
+                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td>
452
+                                    <td colspan="2">' . $view_score.'</td>
453
+                                    <td colspan="2">' . $time.'</td>
454 454
                                     '.$action.'
455 455
                                 </tr>';
456 456
                             $attemptCount++;
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
                                     if (!$is_allowed_to_edit && $result_disabled_ext_all) {
464 464
                                         $temp[] = '/';
465 465
                                     } else {
466
-                                        $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
466
+                                        $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
467 467
                                     }
468 468
                                 } else {
469
-                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
469
+                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
470 470
                                 }
471 471
                                 $temp[] = $time;
472 472
                                 $csv_content[] = $temp;
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
                                         <td></td>
504 504
                                         <td></td>
505 505
                                         <td></td>
506
-                                        <td>'.$interaction['order_id'] . '</td>
507
-                                        <td>'.$interaction['id'] . '</td>
506
+                                        <td>'.$interaction['order_id'].'</td>
507
+                                        <td>'.$interaction['id'].'</td>
508 508
                                         <td colspan="2">' . $interaction['type'].'</td>
509
-                                        <td>'.$student_response . '</td>
510
-                                        <td>'.$interaction['result'] . '</td>
511
-                                        <td>'.$interaction['latency'] . '</td>
512
-                                        <td>'.$interaction['time'] . '</td>
509
+                                        <td>'.$student_response.'</td>
510
+                                        <td>'.$interaction['result'].'</td>
511
+                                        <td>'.$interaction['latency'].'</td>
512
+                                        <td>'.$interaction['time'].'</td>
513 513
                                         '.$action.'
514 514
                                     </tr>';
515 515
                                 $counter++;
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
                                         <td></td>
527 527
                                         <td></td>
528 528
                                         <td></td>
529
-                                        <td>' . $interaction['order_id'] . '</td>
530
-                                        <td colspan="2">' . $interaction['objective_id'] . '</td>
531
-                                        <td colspan="2">' . $interaction['status'] .'</td>
532
-                                        <td>' . $interaction['score_raw'] . '</td>
533
-                                        <td>' . $interaction['score_max'] . '</td>
534
-                                        <td>' . $interaction['score_min'] . '</td>
529
+                                        <td>' . $interaction['order_id'].'</td>
530
+                                        <td colspan="2">' . $interaction['objective_id'].'</td>
531
+                                        <td colspan="2">' . $interaction['status'].'</td>
532
+                                        <td>' . $interaction['score_raw'].'</td>
533
+                                        <td>' . $interaction['score_max'].'</td>
534
+                                        <td>' . $interaction['score_min'].'</td>
535 535
                                         '.$action.'
536 536
                                      </tr>';
537 537
                                 $counter++;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                         $my_path = Database::escape_string($my_path);
555 555
                         $sql = "SELECT results_disabled
556 556
                                 FROM $TBL_QUIZ
557
-                                WHERE c_id = $course_id AND id ='" . $my_path . "'";
557
+                                WHERE c_id = $course_id AND id ='".$my_path."'";
558 558
                         $res_result_disabled = Database::query($sql);
559 559
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
560 560
 
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
                             $extend_this_attempt = 1;
579 579
                             $extend_attempt_link = Display::url(
580 580
                                 Display::return_icon('visible.gif', get_lang('HideAttemptView')),
581
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
581
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
582 582
                             );
583 583
                         } else {
584 584
                             // Same case if fold_attempt_id is set, so not implemented explicitly.
585 585
                             // The extend button for this attempt has not been clicked.
586 586
                             $extend_attempt_link = Display::url(
587 587
                                 Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
588
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
588
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
589 589
                             );
590 590
                         }
591 591
                     }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
                     if ($inter_num > 1) {
601 601
                         $extend_link = Display::url(
602 602
                             Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
603
-                            api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
603
+                            api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
604 604
                         );
605 605
                     }
606 606
 
@@ -616,15 +616,15 @@  discard block
 block discarded – undo
616 616
 
617 617
                     // Selecting the exe_id from stats attempts tables in order to look the max score value.
618 618
 
619
-                    $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
619
+                    $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
620 620
                              WHERE
621
-                                exe_exo_id="' . $row['path'] . '" AND
622
-                                exe_user_id="' . $user_id . '" AND
623
-                                orig_lp_id = "' . $lp_id . '" AND
624
-                                orig_lp_item_id = "' . $row['myid'] . '" AND
625
-                                c_id = ' . $course_id . ' AND
621
+                                exe_exo_id="' . $row['path'].'" AND
622
+                                exe_user_id="' . $user_id.'" AND
623
+                                orig_lp_id = "' . $lp_id.'" AND
624
+                                orig_lp_item_id = "' . $row['myid'].'" AND
625
+                                c_id = ' . $course_id.' AND
626 626
                                 status <> "incomplete" AND
627
-                                session_id = ' . $session_id . '
627
+                                session_id = ' . $session_id.'
628 628
                              ORDER BY exe_date DESC
629 629
                              LIMIT 1';
630 630
 
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
                                         FROM $TBL_LP_ITEM_VIEW
656 656
                                         WHERE
657 657
                                             c_id = $course_id AND
658
-                                            lp_item_id = '" . (int) $my_id . "' AND
659
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'
658
+                                            lp_item_id = '".(int) $my_id."' AND
659
+                                            lp_view_id = '" . (int) $my_lp_view_id."'
660 660
                                         ORDER BY view_count DESC limit 1";
661 661
                                 $res_score = Database::query($sql);
662 662
                                 $row_score = Database::fetch_array($res_score);
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
                                         FROM $TBL_LP_ITEM_VIEW
666 666
                                         WHERE
667 667
                                             c_id = $course_id AND
668
-                                            lp_item_id = '" . (int) $my_id . "' AND
669
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'";
668
+                                            lp_item_id = '".(int) $my_id."' AND
669
+                                            lp_view_id = '" . (int) $my_lp_view_id."'";
670 670
                                 $res_time = Database::query($sql);
671 671
                                 $row_time = Database::fetch_array($res_time);
672 672
 
@@ -725,16 +725,16 @@  discard block
 block discarded – undo
725 725
                     } else {
726 726
                         $correct_test_link = '-';
727 727
                         if ($row['item_type'] == 'quiz') {
728
-                            $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin;
729
-                            $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
728
+                            $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin;
729
+                            $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
730 730
                                      WHERE
731
-                                        exe_exo_id="' . $row['path'] . '" AND
732
-                                        exe_user_id="' . $user_id . '" AND
733
-                                        orig_lp_id = "' . $lp_id . '" AND
734
-                                        orig_lp_item_id = "' . $row['myid'] . '" AND
735
-                                        c_id = ' . $course_id . ' AND
731
+                                        exe_exo_id="' . $row['path'].'" AND
732
+                                        exe_user_id="' . $user_id.'" AND
733
+                                        orig_lp_id = "' . $lp_id.'" AND
734
+                                        orig_lp_item_id = "' . $row['myid'].'" AND
735
+                                        c_id = ' . $course_id.' AND
736 736
                                         status <> "incomplete" AND
737
-                                        session_id = ' . $session_id . '
737
+                                        session_id = ' . $session_id.'
738 738
                                      ORDER BY exe_date DESC ';
739 739
 
740 740
                             $resultLastAttempt = Database::query($sql);
@@ -746,12 +746,12 @@  discard block
 block discarded – undo
746 746
                                 ) {
747 747
                                     $correct_test_link = Display::url(
748 748
                                         Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
749
-                                        api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
749
+                                        api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
750 750
                                     );
751 751
                                 } else {
752 752
                                     $correct_test_link = Display::url(
753 753
                                         Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')),
754
-                                        api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
754
+                                        api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
755 755
                                     );
756 756
                                 }
757 757
                             }
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
 
762 762
                         $action = null;
763 763
                         if ($type == 'classic') {
764
-                            $action =  '<td>' . $correct_test_link . '</td>';
764
+                            $action = '<td>'.$correct_test_link.'</td>';
765 765
                         }
766 766
 
767 767
                         if ($lp_id == $my_lp_id && false) {
768 768
 
769
-                            $output .= '<tr class =' . $oddclass . '>
770
-                                    <td>' . $extend_link . '</td>
771
-                                    <td colspan="4">' . $title . '</td>
769
+                            $output .= '<tr class ='.$oddclass.'>
770
+                                    <td>' . $extend_link.'</td>
771
+                                    <td colspan="4">' . $title.'</td>
772 772
                                     <td colspan="2">&nbsp;</td>
773 773
                                     <td colspan="2">&nbsp;</td>
774 774
                                     <td colspan="2">&nbsp;</td>
@@ -793,13 +793,13 @@  discard block
 block discarded – undo
793 793
                                     $scoreItem .= ExerciseLib::show_score($score, $maxscore, false);
794 794
                                 }
795 795
                             } else {
796
-                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
796
+                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore);
797 797
                             }
798 798
 
799 799
                             $output .= '
800 800
                                 <td>'.$extend_link.'</td>
801
-                                <td colspan="4">' . $title . '</td>
802
-                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td>
801
+                                <td colspan="4">' . $title.'</td>
802
+                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td>
803 803
                                 <td colspan="2">'.$scoreItem.'</td>
804 804
                                 <td colspan="2">'.$time.'</td>
805 805
                                 '.$action.'
@@ -816,10 +816,10 @@  discard block
 block discarded – undo
816 816
                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
817 817
                                     $temp[] = '/';
818 818
                                 } else {
819
-                                    $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
819
+                                    $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
820 820
                                 }
821 821
                             } else {
822
-                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
822
+                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
823 823
                             }
824 824
                             $temp[] = $time;
825 825
                             $csv_content[] = $temp;
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 
831 831
                     $action = null;
832 832
                     if ($type == 'classic') {
833
-                        $action =  '<td></td>';
833
+                        $action = '<td></td>';
834 834
                     }
835 835
 
836 836
                     if ($extend_this_attempt || $extend_all) {
@@ -867,11 +867,11 @@  discard block
 block discarded – undo
867 867
                                     <td></td>
868 868
                                     <td></td>
869 869
                                     <td></td>
870
-                                    <td>' . $interaction['order_id'] . '</td>
871
-                                    <td colspan="2">'.$interaction['objective_id'] . '</td>
872
-                                    <td colspan="2">' . $interaction['status'] . '</td>
870
+                                    <td>' . $interaction['order_id'].'</td>
871
+                                    <td colspan="2">'.$interaction['objective_id'].'</td>
872
+                                    <td colspan="2">' . $interaction['status'].'</td>
873 873
                                     <td>' . $interaction['score_raw'].'</td>
874
-                                    <td>' . $interaction['score_max'] .'</td>
874
+                                    <td>' . $interaction['score_max'].'</td>
875 875
                                     <td>' . $interaction['score_min'].'</td>
876 876
                                     '.$action.'
877 877
                                </tr>';
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
                     }
881 881
 
882 882
                     // Attempts listing by exercise.
883
-                    if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) {
883
+                    if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) {
884 884
                         // Get attempts of a exercise.
885 885
                         if (!empty($lp_id) &&
886 886
                             !empty($lp_item_id) &&
@@ -895,15 +895,15 @@  discard block
 block discarded – undo
895 895
                             $row_path = Database::fetch_array($res_path);
896 896
 
897 897
                             if (Database::num_rows($res_path) > 0) {
898
-                                $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
898
+                                $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
899 899
                                         WHERE
900
-                                            exe_exo_id="' . (int) $row_path['path'] . '" AND
900
+                                            exe_exo_id="' . (int) $row_path['path'].'" AND
901 901
                                             status <> "incomplete" AND
902
-                                            exe_user_id="' . $user_id . '" AND
903
-                                            orig_lp_id = "' . (int) $lp_id . '" AND
904
-                                            orig_lp_item_id = "' . (int) $lp_item_id . '" AND
905
-                                            c_id = ' . $course_id . '  AND
906
-                                            session_id = ' . $session_id . '
902
+                                            exe_user_id="' . $user_id.'" AND
903
+                                            orig_lp_id = "' . (int) $lp_id.'" AND
904
+                                            orig_lp_item_id = "' . (int) $lp_item_id.'" AND
905
+                                            c_id = ' . $course_id.'  AND
906
+                                            session_id = ' . $session_id.'
907 907
                                         ORDER BY exe_date';
908 908
                                 $res_attempts = Database::query($sql);
909 909
                                 $num_attempts = Database::num_rows($res_attempts);
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
                                         if ($mktime_start_date && $mktime_exe_date) {
922 922
                                             $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date);
923 923
                                             $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime);
924
-                                            $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
924
+                                            $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
925 925
                                         } else {
926 926
                                             $time_attemp = ' - ';
927 927
                                         }
@@ -947,33 +947,33 @@  discard block
 block discarded – undo
947 947
                                             $my_lesson_status = learnpathitem::humanize_status('incomplete');
948 948
                                         }
949 949
 
950
-                                        $output .= '<tr class="' . $oddclass . '" >
950
+                                        $output .= '<tr class="'.$oddclass.'" >
951 951
                                         <td></td>
952
-                                        <td>' . $extend_attempt_link . '</td>
953
-                                        <td colspan="3">' . get_lang('Attempt').' '. $n.'</td>
954
-                                        <td colspan="2">' . $my_lesson_status . '</td>
955
-                                        <td colspan="2">'.$view_score . '</td>
956
-                                        <td colspan="2">'.$time_attemp . '</td>';
952
+                                        <td>' . $extend_attempt_link.'</td>
953
+                                        <td colspan="3">' . get_lang('Attempt').' '.$n.'</td>
954
+                                        <td colspan="2">' . $my_lesson_status.'</td>
955
+                                        <td colspan="2">'.$view_score.'</td>
956
+                                        <td colspan="2">'.$time_attemp.'</td>';
957 957
                                         if ($action == 'classic') {
958 958
                                             if ($origin != 'tracking') {
959 959
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
960 960
                                                     $output .= '<td>
961
-                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
961
+                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
962 962
                                                             </td>';
963 963
                                                 } else {
964 964
                                                     $output .= '<td>
965
-                                                            <a href="../exercise/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
966
-                                                            <img src="' . Display::returnIconPath('quiz.png').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
965
+                                                            <a href="../exercise/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent">
966
+                                                            <img src="' . Display::returnIconPath('quiz.png').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
967 967
                                                             </a></td>';
968 968
                                                 }
969 969
                                             } else {
970 970
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
971 971
                                                     $output .= '<td>
972
-                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
972
+                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>';
973 973
                                                 } else {
974 974
                                                     $output .= '<td>
975
-                                                                    <a href="../exercise/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
976
-                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
975
+                                                                    <a href="../exercise/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent">
976
+                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
977 977
                                                 }
978 978
                                             }
979 979
                                         }
@@ -1032,13 +1032,13 @@  discard block
 block discarded – undo
1032 1032
         }
1033 1033
 
1034 1034
         $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time);
1035
-        $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
1035
+        $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time);
1036 1036
 
1037 1037
         if (!$is_allowed_to_edit && $result_disabled_ext_all) {
1038 1038
             $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
1039 1039
         } else {
1040 1040
             if (is_numeric($total_score)) {
1041
-                $final_score = $total_score . '%';
1041
+                $final_score = $total_score.'%';
1042 1042
             } else {
1043 1043
                 $final_score = $total_score;
1044 1044
             }
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
         $action = null;
1056 1056
         if ($type == 'classic') {
1057
-            $action =  '<td></td>';
1057
+            $action = '<td></td>';
1058 1058
         }
1059 1059
 
1060 1060
         $output .= '<tr class="'.$oddclass.'">
1061 1061
                 <td></td>
1062 1062
                 <td colspan="4">
1063
-                    <i>' . get_lang('AccomplishedStepsTotal') .'</i>
1063
+                    <i>' . get_lang('AccomplishedStepsTotal').'</i>
1064 1064
                 </td>
1065 1065
                 <td colspan="2">'.$progress.'%</td>
1066 1066
                 <td colspan="2">
1067 1067
                     ' . $final_score.'
1068 1068
                 </td>
1069
-                <td colspan="2">' . $total_time . '</div>
1069
+                <td colspan="2">' . $total_time.'</div>
1070 1070
                 '.$action.'
1071 1071
            </tr>';
1072 1072
 
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
     	$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1411 1411
     	if (is_array($user_id)) {
1412 1412
     	    $user_id = array_map('intval', $user_id);
1413
-    		$condition_user = " AND user_id IN (".implode(',',$user_id).") ";
1413
+    		$condition_user = " AND user_id IN (".implode(',', $user_id).") ";
1414 1414
     	} else {
1415 1415
     		$user_id = intval($user_id);
1416 1416
     		$condition_user = " AND user_id = $user_id ";
@@ -1446,13 +1446,13 @@  discard block
 block discarded – undo
1446 1446
     {
1447 1447
     	$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1448 1448
     	$sql = 'SELECT login_date
1449
-    	        FROM ' . $tbl_track_login . '
1450
-                WHERE login_user_id = ' . intval($student_id) . '
1449
+    	        FROM ' . $tbl_track_login.'
1450
+                WHERE login_user_id = ' . intval($student_id).'
1451 1451
                 ORDER BY login_date ASC
1452 1452
                 LIMIT 0,1';
1453 1453
 
1454 1454
     	$rs = Database::query($sql);
1455
-    	if (Database::num_rows($rs)>0) {
1455
+    	if (Database::num_rows($rs) > 0) {
1456 1456
     		if ($first_login_date = Database::result($rs, 0, 0)) {
1457 1457
                 return api_convert_and_format_date(
1458 1458
                     $first_login_date,
@@ -1477,8 +1477,8 @@  discard block
 block discarded – undo
1477 1477
     {
1478 1478
     	$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1479 1479
     	$sql = 'SELECT login_date
1480
-    	        FROM ' . $table . '
1481
-                WHERE login_user_id = ' . intval($student_id) . '
1480
+    	        FROM ' . $table.'
1481
+                WHERE login_user_id = ' . intval($student_id).'
1482 1482
                 ORDER BY login_date
1483 1483
                 DESC LIMIT 0,1';
1484 1484
 
@@ -1487,18 +1487,18 @@  discard block
 block discarded – undo
1487 1487
     		if ($last_login_date = Database::result($rs, 0, 0)) {
1488 1488
     			$last_login_date = api_get_local_time($last_login_date);
1489 1489
     			if ($return_timestamp) {
1490
-    				return api_strtotime($last_login_date,'UTC');
1490
+    				return api_strtotime($last_login_date, 'UTC');
1491 1491
     			} else {
1492 1492
     				if (!$warning_message) {
1493 1493
     					return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1494 1494
     				} else {
1495
-    					$timestamp = api_strtotime($last_login_date,'UTC');
1495
+    					$timestamp = api_strtotime($last_login_date, 'UTC');
1496 1496
     					$currentTimestamp = time();
1497 1497
 
1498 1498
     					//If the last connection is > than 7 days, the text is red
1499 1499
     					//345600 = 7 days in seconds
1500 1500
     					if ($currentTimestamp - $timestamp > 604800) {
1501
-    						return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
1501
+    						return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>';
1502 1502
     					} else {
1503 1503
     						return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1504 1504
     					}
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
         $sql = "$select
1534 1534
                 FROM $tbl_track_login
1535 1535
                 WHERE
1536
-                    login_user_id IN (' ". implode("','", $studentList) . "' ) AND
1536
+                    login_user_id IN (' ".implode("','", $studentList)."' ) AND
1537 1537
                     login_date < '$date'
1538 1538
                 ";
1539 1539
         $rs = Database::query($sql);
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
                               '.Display::return_icon('messagebox_warning.gif').'
1633 1633
                              </a>'
1634 1634
                             : null;
1635
-    					return $icon. Display::label($last_login_date, 'warning');
1635
+    					return $icon.Display::label($last_login_date, 'warning');
1636 1636
     				} else {
1637 1637
     					return $last_login_date;
1638 1638
     				}
@@ -1667,8 +1667,8 @@  discard block
 block discarded – undo
1667 1667
 
1668 1668
         // Given we're storing in cache, round the start and end times
1669 1669
         // to the lower minute
1670
-        $roundedStart = substr($start, 0, -2) . '00';
1671
-        $roundedStop = substr($stop, 0, -2) . '00';
1670
+        $roundedStart = substr($start, 0, -2).'00';
1671
+        $roundedStop = substr($stop, 0, -2).'00';
1672 1672
         $roundedStart = Database::escape_string($roundedStart);
1673 1673
         $roundedStop = Database::escape_string($roundedStop);
1674 1674
 
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
     	$session_id  = intval($session_id);
1679 1679
     	$count = 0;
1680 1680
         $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1681
-        $sql =  "SELECT count(*) as count_connections
1681
+        $sql = "SELECT count(*) as count_connections
1682 1682
                 FROM $tbl_track_e_course_access
1683 1683
                 WHERE
1684 1684
                     c_id = $courseId AND
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
                 $count = apcu_fetch($apc_var);
1701 1701
             } else {
1702 1702
                 $rs = Database::query($sql);
1703
-                if (Database::num_rows($rs)>0) {
1703
+                if (Database::num_rows($rs) > 0) {
1704 1704
                     $row = Database::fetch_object($rs);
1705 1705
                     $count = $row->count_connections;
1706 1706
                 }
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             }
1710 1710
         } else {
1711 1711
             $rs = Database::query($sql);
1712
-            if (Database::num_rows($rs)>0) {
1712
+            if (Database::num_rows($rs) > 0) {
1713 1713
                 $row = Database::fetch_object($rs);
1714 1714
                 $count = $row->count_connections;
1715 1715
             }
@@ -1731,14 +1731,14 @@  discard block
 block discarded – undo
1731 1731
     	$tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1732 1732
 
1733 1733
     	$sql = 'SELECT DISTINCT c_id
1734
-                FROM ' . $tbl_course_rel_user . '
1734
+                FROM ' . $tbl_course_rel_user.'
1735 1735
                 WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH;
1736 1736
     	$rs = Database::query($sql);
1737 1737
     	$nb_courses = Database::num_rows($rs);
1738 1738
 
1739 1739
     	if ($include_sessions) {
1740 1740
     		$sql = 'SELECT DISTINCT c_id
1741
-                    FROM ' . $tbl_session_course_rel_user . '
1741
+                    FROM ' . $tbl_session_course_rel_user.'
1742 1742
                     WHERE user_id = ' . $user_id;
1743 1743
     		$rs = Database::query($sql);
1744 1744
     		$nb_courses += Database::num_rows($rs);
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
     		$condition_quiz = "";
1786 1786
     		if (!empty($exercise_id)) {
1787 1787
     			$exercise_id = intval($exercise_id);
1788
-    			$condition_quiz =" AND id = $exercise_id ";
1788
+    			$condition_quiz = " AND id = $exercise_id ";
1789 1789
     		}
1790 1790
 
1791 1791
     		// Compose a filter based on optional session id given
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
                         }
1839 1839
                     }
1840 1840
                     if (!empty($exercise_list)) {
1841
-                        $exercise_id = implode("','",$exercise_list);
1841
+                        $exercise_id = implode("','", $exercise_list);
1842 1842
                     }
1843 1843
     			}
1844 1844
 
@@ -1863,10 +1863,10 @@  discard block
 block discarded – undo
1863 1863
     			$quiz_avg_score = null;
1864 1864
 
1865 1865
     			if (!empty($row['avg_score'])) {
1866
-    				$quiz_avg_score = round($row['avg_score'],2);
1866
+    				$quiz_avg_score = round($row['avg_score'], 2);
1867 1867
     			}
1868 1868
 
1869
-    			if(!empty($row['num_attempts'])) {
1869
+    			if (!empty($row['num_attempts'])) {
1870 1870
     				$quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
1871 1871
     			}
1872 1872
     			if (is_array($student_id)) {
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
             $row = Database::fetch_row($rs);
1997 1997
             $count = $row[0];
1998 1998
         }
1999
-        $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%';
1999
+        $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%';
2000 2000
         return $count;
2001 2001
     }
2002 2002
 
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
                 );
2022 2022
 
2023 2023
                 if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) {
2024
-                    $result += $best_attempt['exe_result']/$best_attempt['exe_weighting'];
2024
+                    $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting'];
2025 2025
                 }
2026 2026
             }
2027 2027
             $result = $result / count($exercise_list);
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
         $query = sprintf($sql, intval($courseId), $sessionId);
2059 2059
         $rs = Database::query($query);
2060 2060
         $teachers = array();
2061
-        while ($teacher = Database::fetch_array($rs,'ASSOC')) {
2061
+        while ($teacher = Database::fetch_array($rs, 'ASSOC')) {
2062 2062
             $teachers[] = $teacher;
2063 2063
         }
2064 2064
         $data = array();
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
             $data[] = array(
2183 2183
                 'course' => $course['title'],
2184 2184
                 'session' => $teacher['name'],
2185
-                'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'],
2185
+                'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'],
2186 2186
                 'documents' => $totalDocuments,
2187 2187
                 'links' => $totalLinks,
2188 2188
                 'forums' => $totalForums,
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
             for ($i = 0; $i < count($lpIdList); $i++) {
2246 2246
                 $placeHolders[] = '?';
2247 2247
             }
2248
-            $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList;
2248
+            $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList;
2249 2249
         }
2250 2250
 
2251 2251
         if ($onlySeriousGame) {
@@ -2265,14 +2265,14 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
         $conditions = [
2267 2267
             " c_id = {$courseInfo['real_id']} ",
2268
-            " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") "
2268
+            " lp_view.lp_id IN(".implode(', ', $filteredLP).") "
2269 2269
         ];
2270 2270
 
2271 2271
         $groupBy = 'GROUP BY lp_id';
2272 2272
 
2273 2273
         if (is_array($studentId)) {
2274 2274
             $studentId = array_map('intval', $studentId);
2275
-            $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ")  ";
2275
+            $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).")  ";
2276 2276
 
2277 2277
 
2278 2278
         } else {
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
             // Compose a filter based on optional learning paths list given
2408 2408
             $condition_lp = "";
2409 2409
             if (count($lp_ids) > 0) {
2410
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2410
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2411 2411
             }
2412 2412
 
2413 2413
             // Compose a filter based on optional session id
@@ -2447,9 +2447,9 @@  discard block
 block discarded – undo
2447 2447
             // prepare filter on users
2448 2448
             if (is_array($student_id)) {
2449 2449
                 array_walk($student_id, 'intval');
2450
-                $condition_user1 =" AND user_id IN (".implode(',', $student_id).") ";
2450
+                $condition_user1 = " AND user_id IN (".implode(',', $student_id).") ";
2451 2451
             } else {
2452
-                $condition_user1 =" AND user_id = $student_id ";
2452
+                $condition_user1 = " AND user_id = $student_id ";
2453 2453
             }
2454 2454
 
2455 2455
             if ($count_row_lp > 0 && !empty($student_id)) {
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
                                     ORDER BY lp_item_id";
2493 2493
                             $res_lp_item = Database::query($sql);
2494 2494
 
2495
-                            while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) {
2495
+                            while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) {
2496 2496
                                 $my_lp_item_id = $row_lp_item['lp_item_id'];
2497 2497
 
2498 2498
                                 // Getting the most recent attempt
@@ -2515,8 +2515,8 @@  discard block
 block discarded – undo
2515 2515
                                         ORDER BY view_count DESC
2516 2516
                                         LIMIT 1";
2517 2517
                                 $res_lp_item_result = Database::query($sql);
2518
-                                while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) {
2519
-                                    $list[]= $row_max_score;
2518
+                                while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) {
2519
+                                    $list[] = $row_max_score;
2520 2520
                                 }
2521 2521
                             }
2522 2522
                         } else {
@@ -2540,8 +2540,8 @@  discard block
 block discarded – undo
2540 2540
                             if ($debug) echo $sql.'<br />';
2541 2541
                             $res_max_score = Database::query($sql);
2542 2542
 
2543
-                            while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
2544
-                                $list[]= $row_max_score;
2543
+                            while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) {
2544
+                                $list[] = $row_max_score;
2545 2545
                             }
2546 2546
                         }
2547 2547
 
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2557 2557
                             $score = $row_max_score['score'];
2558 2558
 
2559
-                            if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2559
+                            if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>';
2560 2560
 
2561 2561
                             if ($row_max_score['item_type'] == 'sco') {
2562 2562
                                 /* Check if it is sco (easier to get max_score)
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
                                 }
2575 2575
                                 // Avoid division by zero errors
2576 2576
                                 if (!empty($max_score)) {
2577
-                                    $lp_partial_total += $score/$max_score;
2577
+                                    $lp_partial_total += $score / $max_score;
2578 2578
                                 }
2579 2579
                                 if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2580 2580
                             } else {
@@ -2598,10 +2598,10 @@  discard block
 block discarded – undo
2598 2598
                                         ORDER BY exe_date DESC
2599 2599
                                         LIMIT 1";
2600 2600
 
2601
-                                if ($debug) echo $sql .'<br />';
2601
+                                if ($debug) echo $sql.'<br />';
2602 2602
                                 $result_last_attempt = Database::query($sql);
2603 2603
                                 $num = Database :: num_rows($result_last_attempt);
2604
-                                if ($num > 0 ) {
2604
+                                if ($num > 0) {
2605 2605
                                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
2606 2606
                                     if ($debug) echo $id_last_attempt.'<br />';
2607 2607
 
@@ -2630,13 +2630,13 @@  discard block
 block discarded – undo
2630 2630
                                         $max_score = $row_max_score_bis['maxscore'];
2631 2631
                                     }
2632 2632
                                     if (!empty($max_score) && floatval($max_score) > 0) {
2633
-                                        $lp_partial_total += $score/$max_score;
2633
+                                        $lp_partial_total += $score / $max_score;
2634 2634
                                     }
2635 2635
                                     if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2636 2636
                                 }
2637 2637
                             }
2638 2638
 
2639
-                            if (in_array($row_max_score['item_type'], array('quiz','sco'))) {
2639
+                            if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) {
2640 2640
                                 // Normal way
2641 2641
                                 if ($use_max_score[$lp_id]) {
2642 2642
                                     $count_items++;
@@ -2671,8 +2671,8 @@  discard block
 block discarded – undo
2671 2671
                     if ($debug) echo $sql;
2672 2672
                     $result_have_quiz = Database::query($sql);
2673 2673
 
2674
-                    if (Database::num_rows($result_have_quiz) > 0 ) {
2675
-                        $row = Database::fetch_array($result_have_quiz,'ASSOC');
2674
+                    if (Database::num_rows($result_have_quiz) > 0) {
2675
+                        $row = Database::fetch_array($result_have_quiz, 'ASSOC');
2676 2676
                         if (is_numeric($row['count']) && $row['count'] != 0) {
2677 2677
                             $lp_with_quiz++;
2678 2678
                         }
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
 
2685 2685
                 if ($lp_with_quiz != 0) {
2686 2686
                     if (!$return_array) {
2687
-                        $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
2687
+                        $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2);
2688 2688
                         if ($debug) var_dump($score_of_scorm_calculate);
2689 2689
                         if (empty($lp_ids)) {
2690 2690
                             if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
@@ -2758,9 +2758,9 @@  discard block
 block discarded – undo
2758 2758
 
2759 2759
         if (is_array($student_id)) {
2760 2760
             array_walk($student_id, 'intval');
2761
-            $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") ";
2761
+            $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") ";
2762 2762
         } else {
2763
-            $conditions[] =" lp_view.user_id = $student_id ";
2763
+            $conditions[] = " lp_view.user_id = $student_id ";
2764 2764
         }
2765 2765
 
2766 2766
         $conditionsToString = implode('AND ', $conditions);
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
             // Compose a filter based on optional learning paths list given
2815 2815
             $condition_lp = "";
2816 2816
             if (count($lp_ids) > 0) {
2817
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2817
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2818 2818
             }
2819 2819
 
2820 2820
             // Compose a filter based on optional session id
@@ -2876,7 +2876,7 @@  discard block
 block discarded – undo
2876 2876
 
2877 2877
         if (!empty($course)) {
2878 2878
 
2879
-            $course_id	 = $course['real_id'];
2879
+            $course_id = $course['real_id'];
2880 2880
 
2881 2881
             $lp_table    = Database :: get_course_table(TABLE_LP_MAIN);
2882 2882
             $t_lpv       = Database :: get_course_table(TABLE_LP_VIEW);
@@ -2890,8 +2890,8 @@  discard block
 block discarded – undo
2890 2890
             // calculates last connection time
2891 2891
             if ($count_row_lp > 0) {
2892 2892
                 $sql = 'SELECT MAX(start_time)
2893
-                        FROM ' . $t_lpiv . ' AS item_view
2894
-                        INNER JOIN ' . $t_lpv . ' AS view
2893
+                        FROM ' . $t_lpiv.' AS item_view
2894
+                        INNER JOIN ' . $t_lpv.' AS view
2895 2895
                             ON item_view.lp_view_id = view.id
2896 2896
                         WHERE
2897 2897
                             item_view.c_id 		= '.$course_id.' AND
@@ -2927,15 +2927,15 @@  discard block
 block discarded – undo
2927 2927
 
2928 2928
         // At first, courses where $coach_id is coach of the course //
2929 2929
         $sql = 'SELECT session_id, c_id
2930
-                FROM ' . $tbl_session_course_user . '
2930
+                FROM ' . $tbl_session_course_user.'
2931 2931
                 WHERE user_id=' . $coach_id.' AND status=2';
2932 2932
 
2933 2933
         if (api_is_multiple_url_enabled()) {
2934
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2934
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2935 2935
             $access_url_id = api_get_current_access_url_id();
2936 2936
             if ($access_url_id != -1) {
2937 2937
                 $sql = 'SELECT scu.session_id, scu.c_id
2938
-                    FROM ' . $tbl_session_course_user . ' scu
2938
+                    FROM ' . $tbl_session_course_user.' scu
2939 2939
                     INNER JOIN '.$tbl_session_rel_access_url.'  sru
2940 2940
                     ON (scu.session_id=sru.session_id)
2941 2941
                     WHERE
@@ -2969,28 +2969,28 @@  discard block
 block discarded – undo
2969 2969
 
2970 2970
         // Then, courses where $coach_id is coach of the session    //
2971 2971
         $sql = 'SELECT session_course_user.user_id
2972
-                FROM ' . $tbl_session_course_user . ' as session_course_user
2972
+                FROM ' . $tbl_session_course_user.' as session_course_user
2973 2973
                 INNER JOIN     '.$tbl_session_user.' sru
2974 2974
                 ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id
2975
-                INNER JOIN ' . $tbl_session_course . ' as session_course
2975
+                INNER JOIN ' . $tbl_session_course.' as session_course
2976 2976
                 ON session_course.c_id = session_course_user.c_id
2977 2977
                 AND session_course_user.session_id = session_course.session_id
2978
-                INNER JOIN ' . $tbl_session . ' as session
2978
+                INNER JOIN ' . $tbl_session.' as session
2979 2979
                 ON session.id = session_course.session_id
2980 2980
                 AND session.id_coach = ' . $coach_id;
2981 2981
         if (api_is_multiple_url_enabled()) {
2982
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2982
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2983 2983
             $access_url_id = api_get_current_access_url_id();
2984
-            if ($access_url_id != -1){
2984
+            if ($access_url_id != -1) {
2985 2985
                 $sql = 'SELECT session_course_user.user_id
2986
-                        FROM ' . $tbl_session_course_user . ' as session_course_user
2986
+                        FROM ' . $tbl_session_course_user.' as session_course_user
2987 2987
                         INNER JOIN     '.$tbl_session_user.' sru
2988 2988
                             ON session_course_user.user_id = sru.user_id AND
2989 2989
                                session_course_user.session_id = sru.session_id
2990
-                        INNER JOIN ' . $tbl_session_course . ' as session_course
2990
+                        INNER JOIN ' . $tbl_session_course.' as session_course
2991 2991
                             ON session_course.c_id = session_course_user.c_id AND
2992 2992
                             session_course_user.session_id = session_course.session_id
2993
-                        INNER JOIN ' . $tbl_session . ' as session
2993
+                        INNER JOIN ' . $tbl_session.' as session
2994 2994
                             ON session.id = session_course.session_id AND
2995 2995
                             session.id_coach = ' . $coach_id.'
2996 2996
                         INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
@@ -3020,8 +3020,8 @@  discard block
 block discarded – undo
3020 3020
 
3021 3021
         $students = [];
3022 3022
         // At first, courses where $coach_id is coach of the course //
3023
-        $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . '
3024
-                WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2';
3023
+        $sql = 'SELECT c_id FROM '.$tbl_session_course_user.'
3024
+                WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2';
3025 3025
         $result = Database::query($sql);
3026 3026
 
3027 3027
         while ($a_courses = Database::fetch_array($result)) {
@@ -3031,7 +3031,7 @@  discard block
 block discarded – undo
3031 3031
                     FROM $tbl_session_course_user AS srcru
3032 3032
                     WHERE
3033 3033
                         c_id = '$courseId' AND
3034
-                        session_id = '" . $id_session . "'";
3034
+                        session_id = '".$id_session."'";
3035 3035
             $rs = Database::query($sql);
3036 3036
             while ($row = Database::fetch_array($rs)) {
3037 3037
                 $students[$row['user_id']] = $row['user_id'];
@@ -3039,15 +3039,15 @@  discard block
 block discarded – undo
3039 3039
         }
3040 3040
 
3041 3041
         // Then, courses where $coach_id is coach of the session
3042
-        $sql = 'SELECT id_coach FROM ' . $tbl_session . '
3043
-                WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"';
3042
+        $sql = 'SELECT id_coach FROM '.$tbl_session.'
3043
+                WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"';
3044 3044
         $result = Database::query($sql);
3045 3045
 
3046 3046
         //He is the session_coach so we select all the users in the session
3047 3047
         if (Database::num_rows($result) > 0) {
3048 3048
             $sql = 'SELECT DISTINCT srcru.user_id
3049
-                    FROM ' . $tbl_session_course_user . ' AS srcru
3050
-                    WHERE session_id="' . $id_session . '"';
3049
+                    FROM ' . $tbl_session_course_user.' AS srcru
3050
+                    WHERE session_id="' . $id_session.'"';
3051 3051
             $result = Database::query($sql);
3052 3052
             while ($row = Database::fetch_array($result)) {
3053 3053
                 $students[$row['user_id']] = $row['user_id'];
@@ -3074,8 +3074,8 @@  discard block
 block discarded – undo
3074 3074
 
3075 3075
         // At first, courses where $coach_id is coach of the course //
3076 3076
 
3077
-        $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . '
3078
-                WHERE user_id=' . $coach_id .' AND status=2';
3077
+        $sql = 'SELECT 1 FROM '.$tbl_session_course_user.'
3078
+                WHERE user_id=' . $coach_id.' AND status=2';
3079 3079
         $result = Database::query($sql);
3080 3080
         if (Database::num_rows($result) > 0) {
3081 3081
             return true;
@@ -3083,12 +3083,12 @@  discard block
 block discarded – undo
3083 3083
 
3084 3084
         // Then, courses where $coach_id is coach of the session
3085 3085
         $sql = 'SELECT session_course_user.user_id
3086
-                FROM ' . $tbl_session_course_user . ' as session_course_user
3087
-                INNER JOIN ' . $tbl_session_course . ' as session_course
3086
+                FROM ' . $tbl_session_course_user.' as session_course_user
3087
+                INNER JOIN ' . $tbl_session_course.' as session_course
3088 3088
                     ON session_course.c_id = session_course_user.c_id
3089
-                INNER JOIN ' . $tbl_session . ' as session
3089
+                INNER JOIN ' . $tbl_session.' as session
3090 3090
                     ON session.id = session_course.session_id
3091
-                    AND session.id_coach = ' . $coach_id . '
3091
+                    AND session.id_coach = ' . $coach_id.'
3092 3092
                 WHERE user_id = ' . $student_id;
3093 3093
         $result = Database::query($sql);
3094 3094
         if (Database::num_rows($result) > 0) {
@@ -3120,16 +3120,16 @@  discard block
 block discarded – undo
3120 3120
         // At first, courses where $coach_id is coach of the course.
3121 3121
 
3122 3122
         $sql = 'SELECT DISTINCT c.code
3123
-                FROM ' . $tbl_session_course_user . ' sc
3123
+                FROM ' . $tbl_session_course_user.' sc
3124 3124
                 INNER JOIN '.$tbl_course.' c
3125 3125
                 ON (c.id = sc.c_id)
3126 3126
                 WHERE user_id = ' . $coach_id.' AND status = 2';
3127 3127
 
3128 3128
         if (api_is_multiple_url_enabled()) {
3129 3129
             $access_url_id = api_get_current_access_url_id();
3130
-            if ($access_url_id != -1){
3130
+            if ($access_url_id != -1) {
3131 3131
                 $sql = 'SELECT DISTINCT c.code
3132
-                        FROM ' . $tbl_session_course_user . ' scu
3132
+                        FROM ' . $tbl_session_course_user.' scu
3133 3133
                         INNER JOIN '.$tbl_course.' c
3134 3134
                         ON (c.code = scu.c_id)
3135 3135
                         INNER JOIN '.$tbl_course_rel_access_url.' cru
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
         }
3143 3143
 
3144 3144
         if (!empty($id_session)) {
3145
-            $sql .= ' AND session_id=' . $id_session;
3145
+            $sql .= ' AND session_id='.$id_session;
3146 3146
         }
3147 3147
 
3148 3148
         $courseList = array();
@@ -3154,25 +3154,25 @@  discard block
 block discarded – undo
3154 3154
         // Then, courses where $coach_id is coach of the session
3155 3155
 
3156 3156
         $sql = 'SELECT DISTINCT course.code
3157
-                FROM ' . $tbl_session_course . ' as session_course
3158
-                INNER JOIN ' . $tbl_session . ' as session
3157
+                FROM ' . $tbl_session_course.' as session_course
3158
+                INNER JOIN ' . $tbl_session.' as session
3159 3159
                     ON session.id = session_course.session_id
3160
-                    AND session.id_coach = ' . $coach_id . '
3161
-                INNER JOIN ' . $tbl_course . ' as course
3160
+                    AND session.id_coach = ' . $coach_id.'
3161
+                INNER JOIN ' . $tbl_course.' as course
3162 3162
                     ON course.id = session_course.c_id';
3163 3163
 
3164 3164
         if (api_is_multiple_url_enabled()) {
3165 3165
             $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
3166 3166
             $access_url_id = api_get_current_access_url_id();
3167
-            if ($access_url_id != -1){
3167
+            if ($access_url_id != -1) {
3168 3168
                 $sql = 'SELECT DISTINCT c.code
3169
-                    FROM ' . $tbl_session_course . ' as session_course
3169
+                    FROM ' . $tbl_session_course.' as session_course
3170 3170
                     INNER JOIN '.$tbl_course.' c
3171 3171
                     ON (c.id = session_course.c_id)
3172
-                    INNER JOIN ' . $tbl_session . ' as session
3172
+                    INNER JOIN ' . $tbl_session.' as session
3173 3173
                     ON session.id = session_course.session_id
3174
-                        AND session.id_coach = ' . $coach_id . '
3175
-                    INNER JOIN ' . $tbl_course . ' as course
3174
+                        AND session.id_coach = ' . $coach_id.'
3175
+                    INNER JOIN ' . $tbl_course.' as course
3176 3176
                         ON course.id = session_course.c_id
3177 3177
                      INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url
3178 3178
                     ON (course_rel_url.c_id = c.id)';
@@ -3180,12 +3180,12 @@  discard block
 block discarded – undo
3180 3180
         }
3181 3181
 
3182 3182
         if (!empty ($id_session)) {
3183
-            $sql .= ' WHERE session_course.session_id=' . $id_session;
3183
+            $sql .= ' WHERE session_course.session_id='.$id_session;
3184 3184
             if (api_is_multiple_url_enabled())
3185
-            $sql .=  ' AND access_url_id = '.$access_url_id;
3186
-        }  else {
3185
+            $sql .= ' AND access_url_id = '.$access_url_id;
3186
+        } else {
3187 3187
             if (api_is_multiple_url_enabled())
3188
-            $sql .=  ' WHERE access_url_id = '.$access_url_id;
3188
+            $sql .= ' WHERE access_url_id = '.$access_url_id;
3189 3189
         }
3190 3190
 
3191 3191
         $result = Database::query($sql);
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
             }
3242 3242
         }
3243 3243
 
3244
-        $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3244
+        $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3245 3245
         $access_url_id = api_get_current_access_url_id();
3246 3246
 
3247 3247
         $sql = "
@@ -3365,7 +3365,7 @@  discard block
 block discarded – undo
3365 3365
             // table definition
3366 3366
             $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
3367 3367
             $tbl_document = Database :: get_course_table(TABLE_DOCUMENT);
3368
-            $course_id	 = $a_course['real_id'];
3368
+            $course_id = $a_course['real_id'];
3369 3369
             if (is_array($student_id)) {
3370 3370
                 $studentList = array_map('intval', $student_id);
3371 3371
                 $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') ";
@@ -3418,7 +3418,7 @@  discard block
 block discarded – undo
3418 3418
         $a_course = CourseManager::get_course_information($course_code);
3419 3419
         if (!empty($a_course)) {
3420 3420
             $course_id = $a_course['real_id'];
3421
-            $conditions[]= " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3421
+            $conditions[] = " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3422 3422
         }
3423 3423
 
3424 3424
         // table definition
@@ -3427,14 +3427,14 @@  discard block
 block discarded – undo
3427 3427
 
3428 3428
         if (is_array($student_id)) {
3429 3429
             $studentList = array_map('intval', $student_id);
3430
-            $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3430
+            $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3431 3431
         } else {
3432 3432
             $student_id = intval($student_id);
3433
-            $conditions[]= " ip.insert_user_id = '$student_id' ";
3433
+            $conditions[] = " ip.insert_user_id = '$student_id' ";
3434 3434
         }
3435 3435
         if (isset($session_id)) {
3436 3436
             $session_id = intval($session_id);
3437
-            $conditions[]= " pub.session_id = $session_id ";
3437
+            $conditions[] = " pub.session_id = $session_id ";
3438 3438
         }
3439 3439
         $conditionToString = implode('AND', $conditions);
3440 3440
 
@@ -3471,10 +3471,10 @@  discard block
 block discarded – undo
3471 3471
         $conditions = array();
3472 3472
         if (is_array($student_id)) {
3473 3473
             $studentList = array_map('intval', $student_id);
3474
-            $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') ";
3474
+            $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') ";
3475 3475
         } else {
3476 3476
             $student_id = intval($student_id);
3477
-            $conditions[]= " post.poster_id = '$student_id' ";
3477
+            $conditions[] = " post.poster_id = '$student_id' ";
3478 3478
         }
3479 3479
 
3480 3480
         $conditionsToString = implode('AND ', $conditions);
@@ -3500,13 +3500,13 @@  discard block
 block discarded – undo
3500 3500
         if (!empty($courseInfo)) {
3501 3501
             $forums = get_forums('', $courseCode, true, $session_id);
3502 3502
             $course_id = $courseInfo['real_id'];
3503
-            $conditions[]= " post.c_id  = $course_id ";
3503
+            $conditions[] = " post.c_id  = $course_id ";
3504 3504
         }
3505 3505
 
3506 3506
         if (!empty($forums)) {
3507 3507
             $idList = array_column($forums, 'forum_id');
3508 3508
             $idListToString = implode("', '", $idList);
3509
-            $conditions[]= " post.forum_id  IN ('$idListToString')";
3509
+            $conditions[] = " post.forum_id  IN ('$idListToString')";
3510 3510
         }
3511 3511
 
3512 3512
         $conditionsToString = implode('AND ', $conditions);
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
             $condition_session = '';
3542 3542
             if (isset($session_id)) {
3543 3543
                 $session_id = intval($session_id);
3544
-                $condition_session = api_get_session_condition($session_id, true,  false, 'f.session_id');
3544
+                $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id');
3545 3545
             }
3546 3546
 
3547 3547
             $course_id = $courseInfo['real_id'];
@@ -3597,7 +3597,7 @@  discard block
 block discarded – undo
3597 3597
         $condition_session = '';
3598 3598
         if (isset($session_id)) {
3599 3599
             $session_id = intval($session_id);
3600
-            $condition_session = ' AND f.session_id = '. $session_id;
3600
+            $condition_session = ' AND f.session_id = '.$session_id;
3601 3601
         }
3602 3602
 
3603 3603
         $groupId = intval($groupId);
@@ -3658,7 +3658,7 @@  discard block
 block discarded – undo
3658 3658
         $condition_session = '';
3659 3659
         if (isset($session_id)) {
3660 3660
              $session_id = intval($session_id);
3661
-             $condition_session = ' AND f.session_id = '. $session_id;
3661
+             $condition_session = ' AND f.session_id = '.$session_id;
3662 3662
         }
3663 3663
 
3664 3664
         $groupId = intval($groupId);
@@ -3737,7 +3737,7 @@  discard block
 block discarded – undo
3737 3737
     {
3738 3738
         $student_id = intval($student_id);
3739 3739
         $courseId = intval($courseId);
3740
-        $session_id    = intval($session_id);
3740
+        $session_id = intval($session_id);
3741 3741
         $date_time  = '';
3742 3742
 
3743 3743
         // table definition
@@ -3806,7 +3806,7 @@  discard block
 block discarded – undo
3806 3806
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
3807 3807
 
3808 3808
         $sql = 'SELECT 1
3809
-                FROM ' . $table . '
3809
+                FROM ' . $table.'
3810 3810
                 WHERE down_user_id = '.$student_id.'
3811 3811
                 AND c_id  = "'.$courseId.'"
3812 3812
                 AND down_session_id = '.$session_id.' ';
@@ -3884,30 +3884,30 @@  discard block
 block discarded – undo
3884 3884
                 '.$inner.'
3885 3885
                 WHERE c.id = '.$courseId.'
3886 3886
                 GROUP BY stats_login.user_id
3887
-                HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date ';
3887
+                HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date ';
3888 3888
 
3889 3889
         if ($since == 'never') {
3890 3890
             if (empty($session_id)) {
3891 3891
                 $sql = 'SELECT course_user.user_id
3892
-                        FROM ' . $table_course_rel_user . ' course_user
3893
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3892
+                        FROM ' . $table_course_rel_user.' course_user
3893
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3894 3894
                         ON course_user.user_id = stats_login.user_id AND
3895
-                        relation_type<>' . COURSE_RELATION_TYPE_RRHH . '
3896
-                        INNER JOIN ' . $tableCourse . ' c
3895
+                        relation_type<>' . COURSE_RELATION_TYPE_RRHH.'
3896
+                        INNER JOIN ' . $tableCourse.' c
3897 3897
                         ON (c.id = course_user.c_id)
3898 3898
                         WHERE
3899
-                            course_user.c_id = ' . $courseId . ' AND
3899
+                            course_user.c_id = ' . $courseId.' AND
3900 3900
                             stats_login.login_course_date IS NULL
3901 3901
                         GROUP BY course_user.user_id';
3902 3902
             } else {
3903 3903
                 $sql = 'SELECT session_course_user.user_id
3904 3904
                         FROM '.$tbl_session_course_user.' session_course_user
3905
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3905
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3906 3906
                         ON session_course_user.user_id = stats_login.user_id
3907
-                        INNER JOIN ' . $tableCourse . ' c
3907
+                        INNER JOIN ' . $tableCourse.' c
3908 3908
                         ON (c.id = session_course_user.c_id)
3909 3909
                         WHERE
3910
-                            session_course_user.c_id = ' . $courseId . ' AND
3910
+                            session_course_user.c_id = ' . $courseId.' AND
3911 3911
                             stats_login.login_course_date IS NULL
3912 3912
                         GROUP BY session_course_user.user_id';
3913 3913
             }
@@ -3915,7 +3915,7 @@  discard block
 block discarded – undo
3915 3915
 
3916 3916
         $rs = Database::query($sql);
3917 3917
         $inactive_users = array();
3918
-        while($user = Database::fetch_array($rs)) {
3918
+        while ($user = Database::fetch_array($rs)) {
3919 3919
             $inactive_users[] = $user['user_id'];
3920 3920
         }
3921 3921
 
@@ -3937,10 +3937,10 @@  discard block
 block discarded – undo
3937 3937
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
3938 3938
 
3939 3939
         $sql = 'SELECT '.$student_id.'
3940
-                FROM ' . $table . '
3940
+                FROM ' . $table.'
3941 3941
                 WHERE
3942
-                    access_user_id=' . $student_id . ' AND
3943
-                    c_id="' . $courseId . '" AND
3942
+                    access_user_id=' . $student_id.' AND
3943
+                    c_id="' . $courseId.'" AND
3944 3944
                     access_session_id = "'.$session_id.'" ';
3945 3945
 
3946 3946
         $rs = Database::query($sql);
@@ -3958,13 +3958,13 @@  discard block
 block discarded – undo
3958 3958
     {
3959 3959
         $hr_dept_id = intval($hr_dept_id);
3960 3960
         $a_students = array();
3961
-        $tbl_user     = Database :: get_main_table(TABLE_MAIN_USER);
3961
+        $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
3962 3962
 
3963 3963
         $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user
3964 3964
                 WHERE hr_dept_id='.$hr_dept_id;
3965 3965
         $rs = Database::query($sql);
3966 3966
 
3967
-        while($user = Database :: fetch_array($rs)) {
3967
+        while ($user = Database :: fetch_array($rs)) {
3968 3968
             $a_students[$user['user_id']] = $user['user_id'];
3969 3969
         }
3970 3970
 
@@ -3989,7 +3989,7 @@  discard block
 block discarded – undo
3989 3989
         $condition_session     = '';
3990 3990
         if (isset($session_id)) {
3991 3991
             $session_id = intval($session_id);
3992
-            $condition_session = ' AND access_session_id = '. $session_id;
3992
+            $condition_session = ' AND access_session_id = '.$session_id;
3993 3993
         }
3994 3994
         $sql = "SELECT
3995 3995
                     access_tool,
@@ -4101,7 +4101,7 @@  discard block
 block discarded – undo
4101 4101
             if (!empty($date_from) && !empty($date_to)) {
4102 4102
                 $fieldStartDate = $fields['start_date'];
4103 4103
                 if (!isset($fields['end_date'])) {
4104
-                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ;
4104
+                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to);
4105 4105
                 } else {
4106 4106
                     $fieldEndDate = $fields['end_date'];
4107 4107
                     $where .= sprintf(" AND fieldStartDate >= '%s'
@@ -4117,12 +4117,12 @@  discard block
 block discarded – undo
4117 4117
                 $where
4118 4118
                 GROUP BY %s";
4119 4119
             $sql = sprintf($sql,
4120
-                $fields['user'],    //user field
4121
-                $tableName,         //FROM
4122
-                $fields['course'],  //course condition
4123
-                $course['real_id'],    //course condition
4124
-                $fields['user'],    //user condition
4125
-                $userId,            //user condition
4120
+                $fields['user'], //user field
4121
+                $tableName, //FROM
4122
+                $fields['course'], //course condition
4123
+                $course['real_id'], //course condition
4124
+                $fields['user'], //user condition
4125
+                $userId, //user condition
4126 4126
                 $fields['user']     //GROUP BY
4127 4127
                 );
4128 4128
             $rs = Database::query($sql);
@@ -4130,7 +4130,7 @@  discard block
 block discarded – undo
4130 4130
             //iterate query
4131 4131
             if (Database::num_rows($rs) > 0) {
4132 4132
                 while ($row = Database::fetch_array($rs)) {
4133
-                    $data[$row['user']] = (isset($data[$row['user']])) ?  $data[$row['user']] + $row[total]: $row['total'];
4133
+                    $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total'];
4134 4134
                 }
4135 4135
             }
4136 4136
         }
@@ -4153,11 +4153,11 @@  discard block
 block discarded – undo
4153 4153
         $courseId = api_get_course_int_id($course_code);
4154 4154
         $data = array();
4155 4155
 
4156
-        $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4156
+        $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4157 4157
         $condition_session = '';
4158 4158
         $session_id = intval($session_id);
4159 4159
         if (!empty($session_id)) {
4160
-            $condition_session = ' AND down_session_id = '. $session_id;
4160
+            $condition_session = ' AND down_session_id = '.$session_id;
4161 4161
         }
4162 4162
         $sql = "SELECT 
4163 4163
                     down_doc_path, 
@@ -4345,7 +4345,7 @@  discard block
 block discarded – undo
4345 4345
 
4346 4346
             $final_course_data = array();
4347 4347
 
4348
-            foreach($my_course_data as $course_id => $value) {
4348
+            foreach ($my_course_data as $course_id => $value) {
4349 4349
                 $final_course_data[$course_id] = $course_list[$course_id];
4350 4350
             }
4351 4351
             $course_in_session[$my_session_id]['course_list'] = $final_course_data;
@@ -4368,7 +4368,7 @@  discard block
 block discarded – undo
4368 4368
                           '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).'
4369 4369
                           '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4370 4370
                           '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).'
4371
-                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).'
4371
+                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4372 4372
                           '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4373 4373
                           '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4374 4374
                         </tr>';
@@ -4457,7 +4457,7 @@  discard block
 block discarded – undo
4457 4457
             $all_exercise_start_time = array();
4458 4458
 
4459 4459
             foreach ($course_in_session as $my_session_id => $session_data) {
4460
-                $course_list  = $session_data['course_list'];
4460
+                $course_list = $session_data['course_list'];
4461 4461
                 $user_count = count(SessionManager::get_users_by_session($my_session_id));
4462 4462
                 $exercise_graph_name_list = array();
4463 4463
                 //$user_results = array();
@@ -4502,20 +4502,20 @@  discard block
 block discarded – undo
4502 4502
 
4503 4503
                             $score = 0;
4504 4504
                             if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
4505
-                                $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100);
4505
+                                $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100);
4506 4506
                             }
4507 4507
                             $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
4508 4508
                             $all_exercise_start_time[] = $time;
4509 4509
                             $my_results[] = $score;
4510
-                            if (count($exercise_list)<=10) {
4510
+                            if (count($exercise_list) <= 10) {
4511 4511
                                 $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30);
4512
-                                $exercise_graph_name_list[]= $title;
4512
+                                $exercise_graph_name_list[] = $title;
4513 4513
                                 $all_exercise_graph_name_list[] = $title;
4514 4514
                             } else {
4515 4515
                                 // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
4516 4516
                                 $title = cut($exercise_data['title'], 30);
4517
-                                $exercise_graph_name_list[]= $title;
4518
-                                $all_exercise_graph_name_list[]= $title;
4517
+                                $exercise_graph_name_list[] = $title;
4518
+                                $all_exercise_graph_name_list[] = $title;
4519 4519
                             }
4520 4520
                         }
4521 4521
                     }
@@ -4548,7 +4548,7 @@  discard block
 block discarded – undo
4548 4548
             }
4549 4549
 
4550 4550
             $html .= Display::page_subheader(
4551
-                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions')
4551
+                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions')
4552 4552
             );
4553 4553
 
4554 4554
             $html .= '<div class="table-responsive">';
@@ -4602,7 +4602,7 @@  discard block
 block discarded – undo
4602 4602
                                 $courseInfo['real_id'],
4603 4603
                                 $my_session_id
4604 4604
                             );
4605
-                            if ($attempts > 1)  {
4605
+                            if ($attempts > 1) {
4606 4606
                                 $answered_exercises++;
4607 4607
                             }
4608 4608
                         }
@@ -4615,7 +4615,7 @@  discard block
 block discarded – undo
4615 4615
                     $all_average += $average;
4616 4616
                 }
4617 4617
 
4618
-                $all_average = $all_average /  count($course_list);
4618
+                $all_average = $all_average / count($course_list);
4619 4619
 
4620 4620
                 if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
4621 4621
                     $html .= '<tr style="background-color:#FBF09D">';
@@ -4641,16 +4641,16 @@  discard block
 block discarded – undo
4641 4641
             }
4642 4642
             $html .= '</tbody>';
4643 4643
             $html .= '</table></div><br />';
4644
-            $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
4644
+            $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;'));
4645 4645
 
4646 4646
             // Checking selected session.
4647 4647
 
4648 4648
             if (isset($_GET['session_id'])) {
4649 4649
                 $session_id_from_get = intval($_GET['session_id']);
4650
-                $session_data 	= $course_in_session[$session_id_from_get];
4651
-                $course_list 	= $session_data['course_list'];
4650
+                $session_data = $course_in_session[$session_id_from_get];
4651
+                $course_list = $session_data['course_list'];
4652 4652
 
4653
-                $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList'));
4653
+                $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList'));
4654 4654
 
4655 4655
                 $html .= '<div class="table-responsive">';
4656 4656
                 $html .= '<table class="table table-hover table-striped">';
@@ -4659,15 +4659,15 @@  discard block
 block discarded – undo
4659 4659
                     <thead>
4660 4660
                     <tr>
4661 4661
                       <th width="300px">'.get_lang('Course').'</th>
4662
-                      '.Display::tag('th', get_lang('PublishedExercises'),    	array('class'=>'head')).'
4663
-                      '.Display::tag('th', get_lang('NewExercises'),    		array('class'=>'head')).'
4664
-                      '.Display::tag('th', get_lang('MyAverage'), 				array('class'=>'head')).'
4665
-                      '.Display::tag('th', get_lang('AverageExerciseResult'), 	array('class'=>'head')).'
4666
-                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'),    array('class'=>'head')).'
4667
-                      '.Display::tag('th', get_lang('LPProgress')     ,      	array('class'=>'head')).'
4668
-                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4669
-                      '.Display::tag('th', get_lang('LastConnexion'),         	array('class'=>'head')).'
4670
-                      '.Display::tag('th', get_lang('Details'),               	array('class'=>'head')).'
4662
+                      '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).'
4663
+                      '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).'
4664
+                      '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).'
4665
+                      '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
4666
+                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4667
+                      '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).'
4668
+                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4669
+                      '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4670
+                      '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4671 4671
                     </tr>
4672 4672
                     </thead>
4673 4673
                     <tbody>
@@ -4686,14 +4686,14 @@  discard block
 block discarded – undo
4686 4686
                         $count_exercises = count($exercises);
4687 4687
                     }
4688 4688
                     $answered_exercises = 0;
4689
-                    foreach($exercises as $exercise_item) {
4689
+                    foreach ($exercises as $exercise_item) {
4690 4690
                         $attempts = Event::count_exercise_attempts_by_user(
4691 4691
                             api_get_user_id(),
4692 4692
                             $exercise_item['id'],
4693 4693
                             $courseId,
4694 4694
                             $session_id_from_get
4695 4695
                         );
4696
-                        if ($attempts > 1)  {
4696
+                        if ($attempts > 1) {
4697 4697
                             $answered_exercises++;
4698 4698
                         }
4699 4699
                     }
@@ -4702,7 +4702,7 @@  discard block
 block discarded – undo
4702 4702
 
4703 4703
                     // Average
4704 4704
                     $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get);
4705
-                    $my_average	= ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4705
+                    $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4706 4706
 
4707 4707
                     $stats_array[$course_code] = array(
4708 4708
                         'exercises' => $count_exercises,
@@ -4779,7 +4779,7 @@  discard block
 block discarded – undo
4779 4779
 
4780 4780
                     if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) {
4781 4781
                         $details = '<a href="#">';
4782
-                        $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4782
+                        $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4783 4783
                     } else {
4784 4784
                         $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">';
4785 4785
                         $details .= Display::return_icon('2rightarrow.png', get_lang('Details'));
@@ -4879,7 +4879,7 @@  discard block
 block discarded – undo
4879 4879
                     );
4880 4880
 
4881 4881
                     $html .= '<tr class="row_even">';
4882
-                    $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
4882
+                    $url = api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
4883 4883
 
4884 4884
                     if ($visible_return['value'] == true) {
4885 4885
                         $exercices['title'] = Display::url(
@@ -4908,7 +4908,7 @@  discard block
 block discarded – undo
4908 4908
                         );
4909 4909
 
4910 4910
                         $latest_attempt_url = '';
4911
-                        $best_score = $position = $percentage_score_result  = '-';
4911
+                        $best_score = $position = $percentage_score_result = '-';
4912 4912
                         $graph = $normal_graph = null;
4913 4913
 
4914 4914
                         // Getting best results
@@ -4940,11 +4940,11 @@  discard block
 block discarded – undo
4940 4940
                                 $weighting      = $exercise_stat['exe_weighting'];
4941 4941
                                 $exe_id         = $exercise_stat['exe_id'];
4942 4942
 
4943
-                                $latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id;
4943
+                                $latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id;
4944 4944
                                 $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url);
4945 4945
                                 $my_score = 0;
4946 4946
                                 if (!empty($weighting) && intval($weighting) != 0) {
4947
-                                    $my_score = $score/$weighting;
4947
+                                    $my_score = $score / $weighting;
4948 4948
                                 }
4949 4949
                                 //@todo this function slows the page
4950 4950
                                 if (is_int($user_list)) {
@@ -4958,14 +4958,14 @@  discard block
 block discarded – undo
4958 4958
                         }
4959 4959
                         $html .= Display::div(
4960 4960
                             $normal_graph,
4961
-                            array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none')
4961
+                            array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none')
4962 4962
                         );
4963 4963
 
4964 4964
                         if (empty($graph)) {
4965 4965
                             $graph = '-';
4966 4966
                         } else {
4967 4967
                             $graph = Display::url(
4968
-                                '<img src="' . $graph . '" >',
4968
+                                '<img src="'.$graph.'" >',
4969 4969
                                 $normal_graph,
4970 4970
                                 array(
4971 4971
                                     'id' => $exercices['id'],
@@ -4999,7 +4999,7 @@  discard block
 block discarded – undo
4999 4999
 
5000 5000
             // LP table results
5001 5001
             $html .= '<div class="table-responsive">';
5002
-            $html .='<table class="table table-striped table-hover">';
5002
+            $html .= '<table class="table table-striped table-hover">';
5003 5003
             $html .= '<thead><tr>';
5004 5004
             $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000'));
5005 5005
             $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000'));
@@ -5035,7 +5035,7 @@  discard block
 block discarded – undo
5035 5035
                     $time_spent_in_lp = api_time_to_hms($time_spent_in_lp);
5036 5036
 
5037 5037
                     $html .= '<tr class="row_even">';
5038
-                    $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view";
5038
+                    $url = api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view";
5039 5039
 
5040 5040
                     if ($learnpath['lp_visibility'] == 0) {
5041 5041
                         $html .= Display::tag('td', $learnpath['lp_name']);
@@ -5054,7 +5054,7 @@  discard block
 block discarded – undo
5054 5054
                     if (!empty($last_connection_in_lp)) {
5055 5055
                         $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG);
5056 5056
                     }
5057
-                    $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px'));
5057
+                    $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px'));
5058 5058
                     $html .= "</tr>";
5059 5059
                 }
5060 5060
             } else {
@@ -5064,7 +5064,7 @@  discard block
 block discarded – undo
5064 5064
                         </td>
5065 5065
                       </tr>';
5066 5066
             }
5067
-            $html .='</tbody></table></div>';
5067
+            $html .= '</tbody></table></div>';
5068 5068
 
5069 5069
             $html .= self::displayUserSkills($user_id, $course_info['id'], $session_id);
5070 5070
         }
@@ -5093,7 +5093,7 @@  discard block
 block discarded – undo
5093 5093
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
5094 5094
         $myData->setSerieDescription('Serie2', get_lang('AverageScore'));
5095 5095
         $myData->setAxisUnit(0, '%');
5096
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5096
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5097 5097
         // Cache definition
5098 5098
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5099 5099
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
@@ -5101,9 +5101,9 @@  discard block
 block discarded – undo
5101 5101
 
5102 5102
         if ($myCache->isInCache($chartHash)) {
5103 5103
             //if we already created the img
5104
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5104
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5105 5105
             $myCache->saveFromCache($chartHash, $imgPath);
5106
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5106
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5107 5107
         } else {
5108 5108
             /* Define width, height and angle */
5109 5109
             $mainWidth = 860;
@@ -5132,7 +5132,7 @@  discard block
 block discarded – undo
5132 5132
             /* Set the default font */
5133 5133
             $myPicture->setFontProperties(
5134 5134
                 array(
5135
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5135
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5136 5136
                     'FontSize' => 10)
5137 5137
             );
5138 5138
             /* Write the chart title */
@@ -5149,7 +5149,7 @@  discard block
 block discarded – undo
5149 5149
             /* Set the default font */
5150 5150
             $myPicture->setFontProperties(
5151 5151
                 array(
5152
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5152
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5153 5153
                     'FontSize' => 6
5154 5154
                 )
5155 5155
             );
@@ -5191,7 +5191,7 @@  discard block
 block discarded – undo
5191 5191
             /* Draw the line chart */
5192 5192
             $myPicture->setFontProperties(
5193 5193
                 array(
5194
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5194
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5195 5195
                     'FontSize' => 10
5196 5196
                 )
5197 5197
             );
@@ -5224,12 +5224,12 @@  discard block
 block discarded – undo
5224 5224
             );
5225 5225
 
5226 5226
             $myCache->writeToCache($chartHash, $myPicture);
5227
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5227
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5228 5228
             $myCache->saveFromCache($chartHash, $imgPath);
5229
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5229
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5230 5230
         }
5231 5231
 
5232
-        $html = '<img src="' . $imgPath . '">';
5232
+        $html = '<img src="'.$imgPath.'">';
5233 5233
 
5234 5234
         return $html;
5235 5235
     }
@@ -5250,12 +5250,12 @@  discard block
 block discarded – undo
5250 5250
 
5251 5251
         foreach ($attempts as $attempt) {
5252 5252
             if (api_get_user_id() == $attempt['exe_user_id']) {
5253
-                if ($attempt['exe_weighting'] != 0 ) {
5254
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5253
+                if ($attempt['exe_weighting'] != 0) {
5254
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5255 5255
                 }
5256 5256
             } else {
5257
-                if ($attempt['exe_weighting'] != 0 ) {
5258
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5257
+                if ($attempt['exe_weighting'] != 0) {
5258
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5259 5259
                 }
5260 5260
             }
5261 5261
         }
@@ -5264,27 +5264,27 @@  discard block
 block discarded – undo
5264 5264
         rsort($my_exercise_result_array);
5265 5265
         $my_exercise_result = 0;
5266 5266
         if (isset($my_exercise_result_array[0])) {
5267
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5267
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5268 5268
         }
5269 5269
 
5270 5270
         $max     = 100;
5271
-        $pieces  = 5 ;
5271
+        $pieces  = 5;
5272 5272
         $part    = round($max / $pieces);
5273 5273
         $x_axis = array();
5274 5274
         $final_array = array();
5275 5275
         $my_final_array = array();
5276 5276
 
5277
-        for ($i=1; $i <=$pieces; $i++) {
5277
+        for ($i = 1; $i <= $pieces; $i++) {
5278 5278
             $sum = 1;
5279 5279
             if ($i == 1) {
5280 5280
                 $sum = 0;
5281 5281
             }
5282
-            $min = ($i-1)*$part + $sum;
5283
-            $max = ($i)*$part;
5284
-            $x_axis[]= $min." - ".$max;
5282
+            $min = ($i - 1) * $part + $sum;
5283
+            $max = ($i) * $part;
5284
+            $x_axis[] = $min." - ".$max;
5285 5285
             $count = 0;
5286
-            foreach($exercise_result as $result) {
5287
-                $percentage = $result*100;
5286
+            foreach ($exercise_result as $result) {
5287
+                $percentage = $result * 100;
5288 5288
                 //echo $percentage.' - '.$min.' - '.$max."<br />";
5289 5289
                 if ($percentage >= $min && $percentage <= $max) {
5290 5290
                     //echo ' is > ';
@@ -5292,7 +5292,7 @@  discard block
 block discarded – undo
5292 5292
                 }
5293 5293
             }
5294 5294
             //echo '<br />';
5295
-            $final_array[]= $count;
5295
+            $final_array[] = $count;
5296 5296
 
5297 5297
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5298 5298
                 $my_final_array[] = 1;
@@ -5302,9 +5302,9 @@  discard block
 block discarded – undo
5302 5302
         }
5303 5303
 
5304 5304
         //Fix to remove the data of the user with my data
5305
-        for($i = 0; $i<=count($my_final_array); $i++) {
5305
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5306 5306
             if (!empty($my_final_array[$i])) {
5307
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5307
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5308 5308
                 $final_array[$i] = 0;
5309 5309
             }
5310 5310
         }
@@ -5314,16 +5314,16 @@  discard block
 block discarded – undo
5314 5314
         $dataSet->addPoints($final_array, 'Serie1');
5315 5315
         $dataSet->addPoints($my_final_array, 'Serie2');
5316 5316
         $dataSet->normalize(100, "%");
5317
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5317
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5318 5318
 
5319 5319
         // Cache definition
5320 5320
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5321 5321
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
5322 5322
         $chartHash = $myCache->getHash($dataSet);
5323 5323
         if ($myCache->isInCache($chartHash)) {
5324
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5324
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5325 5325
             $myCache->saveFromCache($chartHash, $imgPath);
5326
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5326
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5327 5327
         } else {
5328 5328
             /* Create the pChart object */
5329 5329
             $widthSize = 80;
@@ -5339,7 +5339,7 @@  discard block
 block discarded – undo
5339 5339
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5340 5340
 
5341 5341
             /* Set the default font */
5342
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5342
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5343 5343
 
5344 5344
             /* Do not write the chart title */
5345 5345
 
@@ -5403,9 +5403,9 @@  discard block
 block discarded – undo
5403 5403
 
5404 5404
             /* Save and write in cache */
5405 5405
             $myCache->writeToCache($chartHash, $myPicture);
5406
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5406
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5407 5407
             $myCache->saveFromCache($chartHash, $imgPath);
5408
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5408
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5409 5409
         }
5410 5410
 
5411 5411
         return $imgPath;
@@ -5425,12 +5425,12 @@  discard block
 block discarded – undo
5425 5425
         }
5426 5426
         foreach ($attempts as $attempt) {
5427 5427
             if (api_get_user_id() == $attempt['exe_user_id']) {
5428
-                if ($attempt['exe_weighting'] != 0 ) {
5429
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5428
+                if ($attempt['exe_weighting'] != 0) {
5429
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5430 5430
                 }
5431 5431
             } else {
5432
-                if ($attempt['exe_weighting'] != 0 ) {
5433
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5432
+                if ($attempt['exe_weighting'] != 0) {
5433
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5434 5434
                 }
5435 5435
             }
5436 5436
         }
@@ -5439,32 +5439,32 @@  discard block
 block discarded – undo
5439 5439
         rsort($my_exercise_result_array);
5440 5440
         $my_exercise_result = 0;
5441 5441
         if (isset($my_exercise_result_array[0])) {
5442
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5442
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5443 5443
         }
5444 5444
 
5445 5445
         $max = 100;
5446
-        $pieces = 5 ;
5446
+        $pieces = 5;
5447 5447
         $part = round($max / $pieces);
5448 5448
         $x_axis = array();
5449 5449
         $final_array = array();
5450 5450
         $my_final_array = array();
5451 5451
 
5452
-        for ($i=1; $i <=$pieces; $i++) {
5452
+        for ($i = 1; $i <= $pieces; $i++) {
5453 5453
             $sum = 1;
5454 5454
             if ($i == 1) {
5455 5455
                 $sum = 0;
5456 5456
             }
5457
-            $min = ($i-1)*$part + $sum;
5458
-            $max = ($i)*$part;
5459
-            $x_axis[]= $min." - ".$max;
5457
+            $min = ($i - 1) * $part + $sum;
5458
+            $max = ($i) * $part;
5459
+            $x_axis[] = $min." - ".$max;
5460 5460
             $count = 0;
5461
-            foreach($exercise_result as $result) {
5462
-                $percentage = $result*100;
5461
+            foreach ($exercise_result as $result) {
5462
+                $percentage = $result * 100;
5463 5463
                 if ($percentage >= $min && $percentage <= $max) {
5464 5464
                     $count++;
5465 5465
                 }
5466 5466
             }
5467
-            $final_array[]= $count;
5467
+            $final_array[] = $count;
5468 5468
 
5469 5469
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5470 5470
                 $my_final_array[] = 1;
@@ -5475,9 +5475,9 @@  discard block
 block discarded – undo
5475 5475
 
5476 5476
         //Fix to remove the data of the user with my data
5477 5477
 
5478
-        for($i = 0; $i<=count($my_final_array); $i++) {
5478
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5479 5479
             if (!empty($my_final_array[$i])) {
5480
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5480
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5481 5481
                 $final_array[$i] = 0;
5482 5482
             }
5483 5483
         }
@@ -5495,7 +5495,7 @@  discard block
 block discarded – undo
5495 5495
         $dataSet->setXAxisName(get_lang('Score'));
5496 5496
         $dataSet->normalize(100, "%");
5497 5497
 
5498
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5498
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5499 5499
 
5500 5500
         // Cache definition
5501 5501
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -5503,9 +5503,9 @@  discard block
 block discarded – undo
5503 5503
         $chartHash = $myCache->getHash($dataSet);
5504 5504
 
5505 5505
         if ($myCache->isInCache($chartHash)) {
5506
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5506
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5507 5507
             $myCache->saveFromCache($chartHash, $imgPath);
5508
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5508
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5509 5509
         } else {
5510 5510
             /* Create the pChart object */
5511 5511
             $widthSize = 480;
@@ -5521,7 +5521,7 @@  discard block
 block discarded – undo
5521 5521
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5522 5522
 
5523 5523
             /* Set the default font */
5524
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5524
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5525 5525
 
5526 5526
             /* Write the chart title */
5527 5527
             $myPicture->drawText(
@@ -5580,9 +5580,9 @@  discard block
 block discarded – undo
5580 5580
 
5581 5581
             /* Write and save into cache */
5582 5582
             $myCache->writeToCache($chartHash, $myPicture);
5583
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5583
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5584 5584
             $myCache->saveFromCache($chartHash, $imgPath);
5585
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5585
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5586 5586
         }
5587 5587
 
5588 5588
         return $imgPath;
@@ -5657,7 +5657,7 @@  discard block
 block discarded – undo
5657 5657
         $tquiz_answer = Database::get_course_table(TABLE_QUIZ_ANSWER);
5658 5658
         $tquiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
5659 5659
         $tquiz_rel_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
5660
-        $ttrack_exercises  = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
5660
+        $ttrack_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
5661 5661
         $ttrack_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
5662 5662
 
5663 5663
         $sessions = array();
@@ -5709,7 +5709,7 @@  discard block
 block discarded – undo
5709 5709
                         $whereSessionParams .= $sessionIdx.',';
5710 5710
                     }
5711 5711
                 }
5712
-                $whereSessionParams = substr($whereSessionParams,0,-1);
5712
+                $whereSessionParams = substr($whereSessionParams, 0, -1);
5713 5713
             }
5714 5714
 
5715 5715
             if (!empty($exerciseId)) {
@@ -5773,7 +5773,7 @@  discard block
 block discarded – undo
5773 5773
                     qq.position = rq.question_order AND
5774 5774
                     ta.question_id = rq.question_id
5775 5775
                 WHERE
5776
-                    te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")."
5776
+                    te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")."
5777 5777
                     AND q.c_id = $courseIdx
5778 5778
                     $where $order $limit";
5779 5779
             $sql_query = vsprintf($sql, $whereParams);
@@ -5821,7 +5821,7 @@  discard block
 block discarded – undo
5821 5821
             // Now fill users data
5822 5822
             $sqlUsers = "SELECT user_id, username, lastname, firstname
5823 5823
                          FROM $tuser
5824
-                         WHERE user_id IN (".implode(',',$userIds).")";
5824
+                         WHERE user_id IN (".implode(',', $userIds).")";
5825 5825
             $resUsers = Database::query($sqlUsers);
5826 5826
             while ($rowUser = Database::fetch_assoc($resUsers)) {
5827 5827
                 $users[$rowUser['user_id']] = $rowUser;
@@ -5925,7 +5925,7 @@  discard block
 block discarded – undo
5925 5925
                 <table class="table" id="skillList">
5926 5926
                     <thead>
5927 5927
                         <tr>
5928
-                            <th>' . get_lang('AchievedSkills') . '</th>
5928
+                            <th>' . get_lang('AchievedSkills').'</th>
5929 5929
                         </tr>
5930 5930
                     </thead>
5931 5931
                     <tbody>
@@ -5944,10 +5944,10 @@  discard block
 block discarded – undo
5944 5944
 
5945 5945
                 $html .= '
5946 5946
                                             <li class="thumbnail">
5947
-                                                <a href="' . api_get_path(WEB_PATH) . 'badge/' . $userSkill->getId() . '/user/' . $userId . '" target="_blank">
5948
-                                                    <img class="img-responsive" title="' . $skill->getName() . '" src="' . $skill->getWebIconPath() . '" width="64" height="64">
5947
+                                                <a href="' . api_get_path(WEB_PATH).'badge/'.$userSkill->getId().'/user/'.$userId.'" target="_blank">
5948
+                                                    <img class="img-responsive" title="' . $skill->getName().'" src="'.$skill->getWebIconPath().'" width="64" height="64">
5949 5949
                                                     <div class="caption">
5950
-                                                        <p class="text-center">' . $skill->getName() . '</p>
5950
+                                                        <p class="text-center">' . $skill->getName().'</p>
5951 5951
                                                     </div>
5952 5952
                                                 </a>
5953 5953
                                             </li>
@@ -5997,7 +5997,7 @@  discard block
 block discarded – undo
5997 5997
     	        WHERE
5998 5998
                     track_resource.c_id = $course_id AND
5999 5999
                     track_resource.insert_user_id = user.user_id AND
6000
-                    session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6000
+                    session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6001 6001
 
6002 6002
     	if (isset($_GET['keyword'])) {
6003 6003
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -6055,7 +6055,7 @@  discard block
 block discarded – undo
6055 6055
                 WHERE
6056 6056
                   track_resource.c_id = $course_id AND
6057 6057
                   track_resource.insert_user_id = user.user_id AND
6058
-                  session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6058
+                  session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6059 6059
 
6060 6060
     	if (isset($_GET['keyword'])) {
6061 6061
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -6355,7 +6355,7 @@  discard block
 block discarded – undo
6355 6355
     public static function display_additional_profile_fields()
6356 6356
     {
6357 6357
     	// getting all the extra profile fields that are defined by the platform administrator
6358
-    	$extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC');
6358
+    	$extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC');
6359 6359
 
6360 6360
     	// creating the form
6361 6361
     	$return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">';
@@ -6367,8 +6367,8 @@  discard block
 block discarded – undo
6367 6367
     	$extra_fields_to_show = 0;
6368 6368
     	foreach ($extra_fields as $key=>$field) {
6369 6369
     		// show only extra fields that are visible + and can be filtered, added by J.Montoya
6370
-    		if ($field[6]==1 && $field[8] == 1) {
6371
-    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) {
6370
+    		if ($field[6] == 1 && $field[8] == 1) {
6371
+    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) {
6372 6372
     				$selected = 'selected="selected"';
6373 6373
     			} else {
6374 6374
     				$selected = '';
@@ -6380,8 +6380,8 @@  discard block
 block discarded – undo
6380 6380
     	$return .= '</select>';
6381 6381
 
6382 6382
     	// the form elements for the $_GET parameters (because the form is passed through GET
6383
-    	foreach ($_GET as $key=>$value){
6384
-    		if ($key <> 'additional_profile_field')    {
6383
+    	foreach ($_GET as $key=>$value) {
6384
+    		if ($key <> 'additional_profile_field') {
6385 6385
     			$return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />';
6386 6386
     		}
6387 6387
     	}
@@ -6418,21 +6418,21 @@  discard block
 block discarded – undo
6418 6418
     	$result_extra_field = UserManager::get_extra_field_information($field_id);
6419 6419
 
6420 6420
     	if (!empty($users)) {
6421
-    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) {
6422
-    			foreach($users as $user_id) {
6421
+    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) {
6422
+    			foreach ($users as $user_id) {
6423 6423
     				$user_result = UserManager::get_user_tags($user_id, $field_id);
6424 6424
     				$tag_list = array();
6425
-    				foreach($user_result as $item) {
6425
+    				foreach ($user_result as $item) {
6426 6426
     					$tag_list[] = $item['tag'];
6427 6427
     				}
6428
-    				$return[$user_id][] = implode(', ',$tag_list);
6428
+    				$return[$user_id][] = implode(', ', $tag_list);
6429 6429
     			}
6430 6430
     		} else {
6431 6431
     			$new_user_array = array();
6432 6432
     			foreach ($users as $user_id) {
6433
-    				$new_user_array[]= "'".$user_id."'";
6433
+    				$new_user_array[] = "'".$user_id."'";
6434 6434
     			}
6435
-    			$users = implode(',',$new_user_array);
6435
+    			$users = implode(',', $new_user_array);
6436 6436
                 $extraFieldType = EntityExtraField::USER_FIELD_TYPE;
6437 6437
     			// Selecting only the necessary information NOT ALL the user list
6438 6438
     			$sql = "SELECT user.user_id, v.value
@@ -6447,7 +6447,7 @@  discard block
 block discarded – undo
6447 6447
                             user.user_id IN ($users)";
6448 6448
 
6449 6449
     			$result = Database::query($sql);
6450
-    			while($row = Database::fetch_array($result)) {
6450
+    			while ($row = Database::fetch_array($result)) {
6451 6451
     				// get option value for field type double select by id
6452 6452
     				if (!empty($row['value'])) {
6453 6453
     					if ($result_extra_field['field_type'] ==
@@ -6486,7 +6486,7 @@  discard block
 block discarded – undo
6486 6486
 
6487 6487
     public function sort_users_desc($a, $b)
6488 6488
     {
6489
-    	return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6489
+    	return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6490 6490
     }
6491 6491
 
6492 6492
     /**
@@ -6521,7 +6521,7 @@  discard block
 block discarded – undo
6521 6521
     	// get all users data from a course for sortable with limit
6522 6522
     	if (is_array($user_ids)) {
6523 6523
     		$user_ids = array_map('intval', $user_ids);
6524
-    		$condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") ";
6524
+    		$condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") ";
6525 6525
     	} else {
6526 6526
     		$user_ids = intval($user_ids);
6527 6527
     		$condition_user = " WHERE user.user_id = $user_ids ";
@@ -6529,7 +6529,7 @@  discard block
 block discarded – undo
6529 6529
 
6530 6530
     	if (!empty($_GET['user_keyword'])) {
6531 6531
     		$keyword = trim(Database::escape_string($_GET['user_keyword']));
6532
-    		$condition_user .=  " AND (
6532
+    		$condition_user .= " AND (
6533 6533
                 user.firstname LIKE '%".$keyword."%' OR
6534 6534
                 user.lastname LIKE '%".$keyword."%'  OR
6535 6535
                 user.username LIKE '%".$keyword."%'  OR
@@ -6547,7 +6547,7 @@  discard block
 block discarded – undo
6547 6547
         $invitedUsersCondition = '';
6548 6548
 
6549 6549
         if (!$includeInvitedUsers) {
6550
-            $invitedUsersCondition = " AND user.status != " . INVITEE;
6550
+            $invitedUsersCondition = " AND user.status != ".INVITEE;
6551 6551
         }
6552 6552
 
6553 6553
     	$sql = "SELECT  user.user_id as user_id,
@@ -6558,7 +6558,7 @@  discard block
 block discarded – undo
6558 6558
                 FROM $tbl_user as user $url_table
6559 6559
     	        $condition_user $url_condition $invitedUsersCondition";
6560 6560
 
6561
-    	if (!in_array($direction, array('ASC','DESC'))) {
6561
+    	if (!in_array($direction, array('ASC', 'DESC'))) {
6562 6562
     		$direction = 'ASC';
6563 6563
     	}
6564 6564
 
@@ -6694,7 +6694,7 @@  discard block
 block discarded – undo
6694 6694
     		}
6695 6695
 
6696 6696
             if (empty($session_id)) {
6697
-                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys;
6697
+                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys;
6698 6698
             }
6699 6699
 
6700 6700
     		$user['link'] = '<center>
@@ -6706,37 +6706,37 @@  discard block
 block discarded – undo
6706 6706
     		// store columns in array $users
6707 6707
     		$is_western_name_order = api_is_western_name_order();
6708 6708
             $user_row = array();
6709
-            $user_row[]= $user['official_code']; //0
6709
+            $user_row[] = $user['official_code']; //0
6710 6710
             if ($is_western_name_order) {
6711
-                $user_row[]= $user['firstname'];
6712
-                $user_row[]= $user['lastname'];
6711
+                $user_row[] = $user['firstname'];
6712
+                $user_row[] = $user['lastname'];
6713 6713
             } else {
6714
-                $user_row[]= $user['lastname'];
6715
-                $user_row[]= $user['firstname'];
6714
+                $user_row[] = $user['lastname'];
6715
+                $user_row[] = $user['firstname'];
6716 6716
             }
6717
-            $user_row[]= $user['username'];
6718
-            $user_row[]= $user['time'];
6719
-            $user_row[]= $user['average_progress'];
6720
-            $user_row[]= $user['exercise_progress'];
6721
-            $user_row[]= $user['exercise_average_best_attempt'];
6722
-            $user_row[]= $user['student_score'];
6723
-            $user_row[]= $user['count_assignments'];
6724
-            $user_row[]= $user['count_messages'];
6717
+            $user_row[] = $user['username'];
6718
+            $user_row[] = $user['time'];
6719
+            $user_row[] = $user['average_progress'];
6720
+            $user_row[] = $user['exercise_progress'];
6721
+            $user_row[] = $user['exercise_average_best_attempt'];
6722
+            $user_row[] = $user['student_score'];
6723
+            $user_row[] = $user['count_assignments'];
6724
+            $user_row[] = $user['count_messages'];
6725 6725
 
6726 6726
             $userGroupManager = new UserGroup();
6727 6727
             $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS);
6728 6728
 
6729 6729
             if (empty($session_id)) {
6730
-                $user_row[]= $user['survey'];
6730
+                $user_row[] = $user['survey'];
6731 6731
             }
6732 6732
 
6733
-            $user_row[]= $user['first_connection'];
6734
-            $user_row[]= $user['last_connection'];
6733
+            $user_row[] = $user['first_connection'];
6734
+            $user_row[] = $user['last_connection'];
6735 6735
             if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
6736
-                $user_row[]= $user['additional'];
6736
+                $user_row[] = $user['additional'];
6737 6737
             }
6738 6738
 
6739
-            $user_row[]= $user['link'];
6739
+            $user_row[] = $user['link'];
6740 6740
 
6741 6741
             $users[] = $user_row;
6742 6742
 
@@ -6781,8 +6781,8 @@  discard block
 block discarded – undo
6781 6781
 
6782 6782
     	$track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
6783 6783
     	$tempView = $view;
6784
-    	if(substr($view,0,1) == '1') {
6785
-    		$new_view = substr_replace($view,'0',0,1);
6784
+    	if (substr($view, 0, 1) == '1') {
6785
+    		$new_view = substr_replace($view, '0', 0, 1);
6786 6786
     		echo "
6787 6787
                 <tr>
6788 6788
                     <td valign='top'>
@@ -6815,9 +6815,9 @@  discard block
 block discarded – undo
6815 6815
                 </tr>";
6816 6816
     		$total = 0;
6817 6817
     		if (is_array($results)) {
6818
-    			for($j = 0 ; $j < count($results) ; $j++) {
6818
+    			for ($j = 0; $j < count($results); $j++) {
6819 6819
     				echo "<tr>";
6820
-    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>";
6820
+    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>";
6821 6821
     				echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>";
6822 6822
     				echo"</tr>";
6823 6823
     				$total = $total + $results[$j][1];
@@ -6834,7 +6834,7 @@  discard block
 block discarded – undo
6834 6834
     		echo "</table>";
6835 6835
     		echo "</td></tr>";
6836 6836
     	} else {
6837
-    		$new_view = substr_replace($view,'1',0,1);
6837
+    		$new_view = substr_replace($view, '1', 0, 1);
6838 6838
     		echo "
6839 6839
                 <tr>
6840 6840
                     <td valign='top'>
@@ -6857,8 +6857,8 @@  discard block
 block discarded – undo
6857 6857
     {
6858 6858
     	global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
6859 6859
         $courseId = api_get_course_int_id($courseCode);
6860
-    	if(substr($view,1,1) == '1') {
6861
-    		$new_view = substr_replace($view,'0',1,1);
6860
+    	if (substr($view, 1, 1) == '1') {
6861
+    		$new_view = substr_replace($view, '0', 1, 1);
6862 6862
     		echo "<tr>
6863 6863
                     <td valign='top'>
6864 6864
                         <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>]
@@ -6900,7 +6900,7 @@  discard block
 block discarded – undo
6900 6900
                 </tr>";
6901 6901
 
6902 6902
     		if (is_array($results)) {
6903
-    			for($i = 0; $i < sizeof($results); $i++) {
6903
+    			for ($i = 0; $i < sizeof($results); $i++) {
6904 6904
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6905 6905
     				echo "<tr>\n";
6906 6906
     				echo "<td class='content'>".$results[$i][0]."</td>\n";
@@ -6915,8 +6915,8 @@  discard block
 block discarded – undo
6915 6915
 
6916 6916
     		// The Result of Tests
6917 6917
     		if (is_array($hpresults)) {
6918
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
6919
-    				$title = GetQuizName($hpresults[$i][0],'');
6918
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
6919
+    				$title = GetQuizName($hpresults[$i][0], '');
6920 6920
     				if ($title == '')
6921 6921
     				$title = basename($hpresults[$i][0]);
6922 6922
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
@@ -6942,7 +6942,7 @@  discard block
 block discarded – undo
6942 6942
     		echo "</table>";
6943 6943
     		echo "</td>\n</tr>\n";
6944 6944
     	} else {
6945
-    		$new_view = substr_replace($view,'1',1,1);
6945
+    		$new_view = substr_replace($view, '1', 1, 1);
6946 6946
     		echo "
6947 6947
                 <tr>
6948 6948
                     <td valign='top'>
@@ -6961,8 +6961,8 @@  discard block
 block discarded – undo
6961 6961
     	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
6962 6962
         $_course = api_get_course_info_by_id($course_id);
6963 6963
 
6964
-    	if (substr($view,2,1) == '1') {
6965
-    		$new_view = substr_replace($view,'0',2,1);
6964
+    	if (substr($view, 2, 1) == '1') {
6965
+    		$new_view = substr_replace($view, '0', 2, 1);
6966 6966
     		echo "<tr>
6967 6967
                     <td valign='top'>
6968 6968
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
@@ -6976,7 +6976,7 @@  discard block
 block discarded – undo
6976 6976
                         AND u.c_id = '".intval($course_id)."'
6977 6977
                     ORDER BY u.upload_date DESC";
6978 6978
     		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6979
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
6979
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
6980 6980
     		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6981 6981
     		echo "<tr>
6982 6982
                     <td class='secLine' width='40%'>
@@ -6990,7 +6990,7 @@  discard block
 block discarded – undo
6990 6990
                     </td>
6991 6991
                 </tr>";
6992 6992
     		if (is_array($results)) {
6993
-    			for($j = 0 ; $j < count($results) ; $j++) {
6993
+    			for ($j = 0; $j < count($results); $j++) {
6994 6994
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
6995 6995
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
6996 6996
     				echo "<tr>";
@@ -7009,7 +7009,7 @@  discard block
 block discarded – undo
7009 7009
     		echo "</table>";
7010 7010
     		echo "</td></tr>";
7011 7011
     	} else {
7012
-    		$new_view = substr_replace($view,'1',2,1);
7012
+    		$new_view = substr_replace($view, '1', 2, 1);
7013 7013
     		echo "
7014 7014
                 <tr>
7015 7015
                     <td valign='top'>
@@ -7028,8 +7028,8 @@  discard block
 block discarded – undo
7028 7028
     {
7029 7029
     	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
7030 7030
         $courseId = api_get_course_int_id($courseCode);
7031
-    	if (substr($view,3,1) == '1') {
7032
-    		$new_view = substr_replace($view,'0',3,1);
7031
+    	if (substr($view, 3, 1) == '1') {
7032
+    		$new_view = substr_replace($view, '0', 3, 1);
7033 7033
     		echo "
7034 7034
                 <tr>
7035 7035
                         <td valign='top'>
@@ -7053,7 +7053,7 @@  discard block
 block discarded – undo
7053 7053
                     </td>
7054 7054
                 </tr>";
7055 7055
     		if (is_array($results)) {
7056
-    			for($j = 0 ; $j < count($results) ; $j++) {
7056
+    			for ($j = 0; $j < count($results); $j++) {
7057 7057
     				echo "<tr>";
7058 7058
     				echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>";
7059 7059
     				echo"</tr>";
@@ -7066,7 +7066,7 @@  discard block
 block discarded – undo
7066 7066
     		echo "</table>";
7067 7067
     		echo "</td></tr>";
7068 7068
     	} else {
7069
-    		$new_view = substr_replace($view,'1',3,1);
7069
+    		$new_view = substr_replace($view, '1', 3, 1);
7070 7070
     		echo "
7071 7071
                 <tr>
7072 7072
                     <td valign='top'>
@@ -7093,8 +7093,8 @@  discard block
 block discarded – undo
7093 7093
     	$session_id = intval($session_id);
7094 7094
 
7095 7095
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7096
-    	if(substr($view,4,1) == '1') {
7097
-    		$new_view = substr_replace($view,'0',4,1);
7096
+    	if (substr($view, 4, 1) == '1') {
7097
+    		$new_view = substr_replace($view, '0', 4, 1);
7098 7098
     		echo "
7099 7099
                 <tr>
7100 7100
                     <td valign='top'>
@@ -7120,7 +7120,7 @@  discard block
 block discarded – undo
7120 7120
                     </td>
7121 7121
                 </tr>";
7122 7122
     		if (is_array($results)) {
7123
-    			for($j = 0 ; $j < count($results) ; $j++) {
7123
+    			for ($j = 0; $j < count($results); $j++) {
7124 7124
     				echo "<tr>";
7125 7125
     				echo "<td class='content'>".$results[$j]."</td>";
7126 7126
     				echo"</tr>";
@@ -7133,7 +7133,7 @@  discard block
 block discarded – undo
7133 7133
     		echo "</table>";
7134 7134
     		echo "</td></tr>";
7135 7135
     	} else {
7136
-    		$new_view = substr_replace($view,'1',4,1);
7136
+    		$new_view = substr_replace($view, '1', 4, 1);
7137 7137
     		echo "
7138 7138
                 <tr>
7139 7139
                     <td valign='top'>
@@ -7167,11 +7167,11 @@  discard block
 block discarded – undo
7167 7167
                    ORDER BY login_date DESC LIMIT 1";
7168 7168
         $ip = '';
7169 7169
         $res_ip = Database::query($sql_ip);
7170
-        if ($res_ip !== false && Database::num_rows($res_ip)>0) {
7170
+        if ($res_ip !== false && Database::num_rows($res_ip) > 0) {
7171 7171
             $row_ip = Database::fetch_row($res_ip);
7172 7172
             if ($return_as_link) {
7173 7173
                 $ip = Display::url(
7174
-                    (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
7174
+                    (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
7175 7175
                     array('title'=>get_lang('TraceIP'), 'target'=>'_blank')
7176 7176
                 );
7177 7177
             } else {
@@ -7207,9 +7207,9 @@  discard block
 block discarded – undo
7207 7207
     	$course_id  = intval($course_id);
7208 7208
 
7209 7209
     	$tempView = $view;
7210
-    	if (substr($view,0,1) == '1') {
7211
-    		$new_view = substr_replace($view,'0',0,1);
7212
-    		$title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7210
+    	if (substr($view, 0, 1) == '1') {
7211
+    		$new_view = substr_replace($view, '0', 0, 1);
7212
+    		$title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7213 7213
     		$sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
7214 7214
                     FROM $track_access_table
7215 7215
                     WHERE access_user_id = $user_id
@@ -7219,20 +7219,20 @@  discard block
 block discarded – undo
7219 7219
                     ORDER BY YEAR(access_date),MONTH(access_date) ASC";
7220 7220
     		//$results = getManyResults2Col($sql);
7221 7221
     		$results = getManyResults3Col($sql);
7222
-    		$title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7223
-    		$line='';
7222
+    		$title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7223
+    		$line = '';
7224 7224
     		$total = 0;
7225 7225
     		if (is_array($results)) {
7226
-    			for($j = 0 ; $j < count($results) ; $j++) {
7226
+    			for ($j = 0; $j < count($results); $j++) {
7227 7227
     				$line .= $results[$j][0].';'.$results[$j][1]."\n";
7228 7228
     				$total = $total + $results[$j][1];
7229 7229
     			}
7230 7230
     			$line .= get_lang('Total').";".$total."\n";
7231 7231
     		} else {
7232
-    			$line= get_lang('NoResult')."</center></td>";
7232
+    			$line = get_lang('NoResult')."</center></td>";
7233 7233
     		}
7234 7234
     	} else {
7235
-    		$new_view = substr_replace($view,'1',0,1);
7235
+    		$new_view = substr_replace($view, '1', 0, 1);
7236 7236
     	}
7237 7237
     	return array($title_line, $line);
7238 7238
     }
@@ -7250,8 +7250,8 @@  discard block
 block discarded – undo
7250 7250
     	global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
7251 7251
         $courseId = api_get_course_int_id($courseCode);
7252 7252
         $userId = intval($userId);
7253
-    	if (substr($view,1,1) == '1') {
7254
-    		$new_view = substr_replace($view,'0',1,1);
7253
+    	if (substr($view, 1, 1) == '1') {
7254
+    		$new_view = substr_replace($view, '0', 1, 1);
7255 7255
     		$title[1] = get_lang('ExercicesDetails');
7256 7256
     		$line = '';
7257 7257
     		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
@@ -7275,7 +7275,7 @@  discard block
 block discarded – undo
7275 7275
     		$title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
7276 7276
 
7277 7277
     		if (is_array($results)) {
7278
-    			for($i = 0; $i < sizeof($results); $i++)
7278
+    			for ($i = 0; $i < sizeof($results); $i++)
7279 7279
     			{
7280 7280
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
7281 7281
     				$line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
@@ -7287,8 +7287,8 @@  discard block
 block discarded – undo
7287 7287
 
7288 7288
     		// The Result of Tests
7289 7289
     		if (is_array($hpresults)) {
7290
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
7291
-    				$title = GetQuizName($hpresults[$i][0],'');
7290
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
7291
+    				$title = GetQuizName($hpresults[$i][0], '');
7292 7292
 
7293 7293
     				if ($title == '')
7294 7294
     				$title = basename($hpresults[$i][0]);
@@ -7302,10 +7302,10 @@  discard block
 block discarded – undo
7302 7302
     		}
7303 7303
 
7304 7304
     		if ($NoTestRes == 1 && $NoHPTestRes == 1) {
7305
-    			$line=get_lang('NoResult');
7305
+    			$line = get_lang('NoResult');
7306 7306
     		}
7307 7307
     	} else {
7308
-    		$new_view = substr_replace($view,'1',1,1);
7308
+    		$new_view = substr_replace($view, '1', 1, 1);
7309 7309
     	}
7310 7310
     	return array($title_line, $line);
7311 7311
     }
@@ -7321,7 +7321,7 @@  discard block
 block discarded – undo
7321 7321
         $user_id = intval($user_id);
7322 7322
         $course_id = intval($course_id);
7323 7323
 
7324
-    	if (substr($view,2,1) == '1') {
7324
+    	if (substr($view, 2, 1) == '1') {
7325 7325
     		$sql = "SELECT u.upload_date, w.title, w.author, w.url
7326 7326
                     FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w
7327 7327
                     WHERE
@@ -7329,21 +7329,21 @@  discard block
 block discarded – undo
7329 7329
                         u.upload_user_id = '$user_id' AND
7330 7330
                         u.c_id = '$course_id'
7331 7331
                     ORDER BY u.upload_date DESC";
7332
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
7332
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
7333 7333
 
7334
-    		$title[1]=get_lang('WorksDetails');
7335
-    		$line='';
7336
-    		$title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7334
+    		$title[1] = get_lang('WorksDetails');
7335
+    		$line = '';
7336
+    		$title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7337 7337
 
7338 7338
     		if (is_array($results)) {
7339
-    			for($j = 0 ; $j < count($results) ; $j++) {
7339
+    			for ($j = 0; $j < count($results); $j++) {
7340 7340
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
7341 7341
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
7342 7342
     				$line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
7343 7343
     			}
7344 7344
 
7345 7345
     		} else {
7346
-    			$line= get_lang('NoResult');
7346
+    			$line = get_lang('NoResult');
7347 7347
     		}
7348 7348
     	}
7349 7349
     	return array($title_line, $line);
@@ -7359,9 +7359,9 @@  discard block
 block discarded – undo
7359 7359
         $courseId = api_get_course_int_id($courseCode);
7360 7360
         $userId = intval($userId);
7361 7361
         $line = null;
7362
-    	if (substr($view,3,1) == '1') {
7363
-    		$new_view = substr_replace($view,'0',3,1);
7364
-    		$title[1]=get_lang('LinksDetails');
7362
+    	if (substr($view, 3, 1) == '1') {
7363
+    		$new_view = substr_replace($view, '0', 3, 1);
7364
+    		$title[1] = get_lang('LinksDetails');
7365 7365
     		$sql = "SELECT cl.title, cl.url
7366 7366
                         FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7367 7367
                         WHERE sl.links_link_id = cl.id
@@ -7369,16 +7369,16 @@  discard block
 block discarded – undo
7369 7369
                             AND sl.links_user_id = $userId
7370 7370
                         GROUP BY cl.title, cl.url";
7371 7371
     		$results = StatsUtils::getManyResults2Col($sql);
7372
-    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7372
+    		$title_line = get_lang('LinksTitleLinkColumn')."\n";
7373 7373
     		if (is_array($results)) {
7374
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7374
+    			for ($j = 0; $j < count($results); $j++) {
7375 7375
     				$line .= $results[$j][0]."\n";
7376 7376
     			}
7377 7377
     		} else {
7378
-    			$line=get_lang('NoResult');
7378
+    			$line = get_lang('NoResult');
7379 7379
     		}
7380 7380
     	} else {
7381
-    		$new_view = substr_replace($view,'1',3,1);
7381
+    		$new_view = substr_replace($view, '1', 3, 1);
7382 7382
     	}
7383 7383
     	return array($title_line, $line);
7384 7384
     }
@@ -7400,9 +7400,9 @@  discard block
 block discarded – undo
7400 7400
 
7401 7401
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7402 7402
 
7403
-    	if (substr($view,4,1) == '1') {
7404
-    		$new_view = substr_replace($view,'0',4,1);
7405
-    		$title[1]= get_lang('DocumentsDetails');
7403
+    	if (substr($view, 4, 1) == '1') {
7404
+    		$new_view = substr_replace($view, '0', 4, 1);
7405
+    		$title[1] = get_lang('DocumentsDetails');
7406 7406
 
7407 7407
     		$sql = "SELECT down_doc_path
7408 7408
                         FROM $downloads_table
@@ -7415,14 +7415,14 @@  discard block
 block discarded – undo
7415 7415
     		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7416 7416
             $line = null;
7417 7417
     		if (is_array($results)) {
7418
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7418
+    			for ($j = 0; $j < count($results); $j++) {
7419 7419
     				$line .= $results[$j]."\n";
7420 7420
     			}
7421 7421
     		} else {
7422 7422
     			$line = get_lang('NoResult');
7423 7423
     		}
7424 7424
     	} else {
7425
-    		$new_view = substr_replace($view,'1',4,1);
7425
+    		$new_view = substr_replace($view, '1', 4, 1);
7426 7426
     	}
7427 7427
     	return array($title_line, $line);
7428 7428
     }
Please login to merge, or discard this patch.
main/document/create_document.php 2 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 $is_certificate_mode = false;
62 62
 
63 63
 if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
64
-	$is_certificate_mode = true;
64
+    $is_certificate_mode = true;
65 65
 }
66 66
 
67 67
 if ($is_certificate_mode) {
68
-	$nameTools = get_lang('CreateCertificate');
68
+    $nameTools = get_lang('CreateCertificate');
69 69
 } else {
70
-	$nameTools = get_lang('CreateDocument');
70
+    $nameTools = get_lang('CreateDocument');
71 71
 }
72 72
 
73 73
 /*	Constants and variables */
@@ -124,26 +124,26 @@  discard block
 block discarded – undo
124 124
 
125 125
 // Please, do not modify this dirname formatting
126 126
 if (strstr($dir, '..')) {
127
-	$dir = '/';
127
+    $dir = '/';
128 128
 }
129 129
 
130 130
 if ($dir[0] == '.') {
131
-	$dir = substr($dir, 1);
131
+    $dir = substr($dir, 1);
132 132
 }
133 133
 
134 134
 if ($dir[0] != '/') {
135
-	$dir = '/'.$dir;
135
+    $dir = '/'.$dir;
136 136
 }
137 137
 
138 138
 if ($dir[strlen($dir) - 1] != '/') {
139
-	$dir .= '/';
139
+    $dir .= '/';
140 140
 }
141 141
 
142 142
 if ($is_certificate_mode) {
143
-	$document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
144
-	$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
145
-	$folder_id = $document_data['id'];
146
-	$dir = '/certificates/';
143
+    $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
144
+    $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
145
+    $folder_id = $document_data['id'];
146
+    $dir = '/certificates/';
147 147
 }
148 148
 
149 149
 $doc_tree  = explode('/', $dir);
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 
155 155
     // Level correction for group documents.
156 156
     if (!empty($group_properties['directory'])) {
157
-    	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
157
+        $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
158 158
     }
159 159
 }
160 160
 $relative_url = '';
161 161
 for ($i = 0; $i < ($count_dir); $i++) {
162
-	$relative_url .= '../';
162
+    $relative_url .= '../';
163 163
 }
164 164
 
165 165
 if ($relative_url== '') {
166
-	$relative_url = '/';
166
+    $relative_url = '/';
167 167
 }
168 168
 
169 169
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
     'cols-size' => [2, 10, 0],
176 176
     'FullPage' => true,
177 177
     'InDocument' => true,
178
-	'CreateDocumentDir' => $relative_url,
179
-	'CreateDocumentWebDir' => (empty($group_properties['directory']))
180
-                        		? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
181
-                        		: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
182
-	'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
178
+    'CreateDocumentDir' => $relative_url,
179
+    'CreateDocumentWebDir' => (empty($group_properties['directory']))
180
+                                ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
181
+                                : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
182
+    'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
183 183
 );
184 184
 
185 185
 if ($is_certificate_mode) {
@@ -191,41 +191,41 @@  discard block
 block discarded – undo
191 191
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
192 192
 
193 193
 if (!is_dir($filepath)) {
194
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
195
-	$dir = '/';
194
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
195
+    $dir = '/';
196 196
 }
197 197
 
198 198
 $to_group_id = 0;
199 199
 if (!$is_certificate_mode) {
200
-	if (api_is_in_group()) {
200
+    if (api_is_in_group()) {
201 201
         $interbreadcrumb[] = array(
202 202
             "url" => "../group/group_space.php?".api_get_cidreq(),
203 203
             "name" => get_lang('GroupSpace'),
204 204
         );
205
-		$noPHP_SELF = true;
206
-		$to_group_id = $group_properties['iid'];
207
-		$path = explode('/', $dir);
208
-		if ('/'.$path[1] != $group_properties['directory']) {
209
-			api_not_allowed(true);
210
-		}
211
-	}
205
+        $noPHP_SELF = true;
206
+        $to_group_id = $group_properties['iid'];
207
+        $path = explode('/', $dir);
208
+        if ('/'.$path[1] != $group_properties['directory']) {
209
+            api_not_allowed(true);
210
+        }
211
+    }
212 212
     $interbreadcrumb[] = array(
213 213
         "url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(),
214 214
         "name" => get_lang('Documents'),
215 215
     );
216 216
 } else {
217
-	$interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
217
+    $interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
218 218
 }
219 219
 
220 220
 if (!api_is_allowed_in_course()) {
221
-	api_not_allowed(true);
221
+    api_not_allowed(true);
222 222
 }
223 223
 
224 224
 if (!($is_allowed_to_edit ||
225 225
     $groupRights ||
226 226
     DocumentManager::is_my_shared_folder($userId, $dir, api_get_session_id()))
227 227
 ) {
228
-	api_not_allowed(true);
228
+    api_not_allowed(true);
229 229
 }
230 230
 
231 231
 /*	Header */
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 
234 234
 $display_dir = $dir;
235 235
 if (isset($group_properties)) {
236
-	$display_dir = explode('/', $dir);
237
-	unset($display_dir[0]);
238
-	unset($display_dir[1]);
239
-	$display_dir = implode('/', $display_dir);
236
+    $display_dir = explode('/', $dir);
237
+    unset($display_dir[0]);
238
+    unset($display_dir[1]);
239
+    $display_dir = implode('/', $display_dir);
240 240
 }
241 241
 
242 242
 $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null;
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 $form->addElement('header', $nameTools);
254 254
 
255 255
 if ($is_certificate_mode) {//added condition for certicate in gradebook
256
-	$form->addElement('hidden','certificate','true',array('id'=>'certificate'));
257
-	if (isset($_GET['selectcat'])) {
258
-		$form->addElement('hidden','selectcat', $select_cat);
256
+    $form->addElement('hidden','certificate','true',array('id'=>'certificate'));
257
+    if (isset($_GET['selectcat'])) {
258
+        $form->addElement('hidden','selectcat', $select_cat);
259 259
     }
260 260
 }
261 261
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 // new document created
315 315
 
316 316
 if (!$is_certificate_mode &&
317
-	!DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
317
+    !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
318 318
 ) {
319 319
     $folders = DocumentManager::get_all_document_folders(
320 320
         $_course,
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         array('cols-size' => [2, 10, 0])
330 330
     );
331 331
 
332
-	$folder_titles = array();
332
+    $folder_titles = array();
333 333
     if (is_array($folders)) {
334 334
         $escaped_folders = array();
335 335
         foreach ($folders as $key => & $val) {
@@ -366,22 +366,22 @@  discard block
 block discarded – undo
366 366
         }
367 367
     }
368 368
 
369
-	if (empty($group_dir)) {
370
-		$parent_select -> addOption(get_lang('HomeDirectory'), '/');
371
-		if (is_array($folders)) {
372
-			foreach ($folders as & $folder) {
373
-				//Hide some folders
374
-				if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
369
+    if (empty($group_dir)) {
370
+        $parent_select -> addOption(get_lang('HomeDirectory'), '/');
371
+        if (is_array($folders)) {
372
+            foreach ($folders as & $folder) {
373
+                //Hide some folders
374
+                if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
375 375
                     continue;
376
-				}
377
-				//Admin setting for Hide/Show the folders of all users
378
-				if (api_get_setting('show_users_folders') == 'false' &&
376
+                }
377
+                //Admin setting for Hide/Show the folders of all users
378
+                if (api_get_setting('show_users_folders') == 'false' &&
379 379
                     (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))
380 380
                 ){
381
-					continue;
382
-				}
383
-				//Admin setting for Hide/Show Default folders to all users
384
-				if (api_get_setting('show_default_folders') == 'false' &&
381
+                    continue;
382
+                }
383
+                //Admin setting for Hide/Show Default folders to all users
384
+                if (api_get_setting('show_default_folders') == 'false' &&
385 385
                     (
386 386
                         $folder == '/images' ||
387 387
                         $folder == '/flash' ||
@@ -391,82 +391,82 @@  discard block
 block discarded – undo
391 391
                         $folder == '/video/flv'
392 392
                     )
393 393
                 ){
394
-					continue;
395
-				}
396
-				//Admin setting for Hide/Show chat history folder
397
-				if (api_get_setting('show_chat_folder') == 'false' &&
394
+                    continue;
395
+                }
396
+                //Admin setting for Hide/Show chat history folder
397
+                if (api_get_setting('show_chat_folder') == 'false' &&
398 398
                     $folder=='/chat_files'
399 399
                 ){
400
-					continue;
401
-				}
400
+                    continue;
401
+                }
402 402
 
403
-				$selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
404
-				$path_parts = explode('/', $folder);
405
-				$folder_titles[$folder] = cut($folder_titles[$folder], 80);
403
+                $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
404
+                $path_parts = explode('/', $folder);
405
+                $folder_titles[$folder] = cut($folder_titles[$folder], 80);
406 406
                 $space_counter =count($path_parts) - 2;
407 407
                 if ($space_counter > 0) {
408 408
                     $label = str_repeat('&nbsp;&nbsp;&nbsp;', $space_counter).' &mdash; '.$folder_titles[$folder];
409 409
                 } else {
410 410
                     $label = ' &mdash; '.$folder_titles[$folder];
411 411
                 }
412
-				$parent_select -> addOption($label, $folder);
413
-				if ($selected != '') {
414
-					$parent_select->setSelected($folder);
415
-				}
416
-			}
417
-		}
418
-	} else {
419
-		if (is_array($folders) && !empty($folders)) {
420
-			foreach ($folders as & $folder) {
421
-				$selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
422
-				$label = $folder_titles[$folder];
423
-				if ($folder == $group_dir) {
424
-					$label = '/ (' . get_lang('HomeDirectory') . ')';
425
-				} else {
426
-					$path_parts = explode('/', str_replace($group_dir, '', $folder));
427
-					$label = cut($label, 80);
428
-					$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
429
-				}
430
-				$parent_select->addOption($label, $folder);
431
-				if ($selected != '') {
432
-					$parent_select->setSelected($folder);
433
-				}
434
-			}
435
-		}
436
-	}
412
+                $parent_select -> addOption($label, $folder);
413
+                if ($selected != '') {
414
+                    $parent_select->setSelected($folder);
415
+                }
416
+            }
417
+        }
418
+    } else {
419
+        if (is_array($folders) && !empty($folders)) {
420
+            foreach ($folders as & $folder) {
421
+                $selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
422
+                $label = $folder_titles[$folder];
423
+                if ($folder == $group_dir) {
424
+                    $label = '/ (' . get_lang('HomeDirectory') . ')';
425
+                } else {
426
+                    $path_parts = explode('/', str_replace($group_dir, '', $folder));
427
+                    $label = cut($label, 80);
428
+                    $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
429
+                }
430
+                $parent_select->addOption($label, $folder);
431
+                if ($selected != '') {
432
+                    $parent_select->setSelected($folder);
433
+                }
434
+            }
435
+        }
436
+    }
437 437
 }
438 438
 
439 439
 $form->addHidden('dirValue', '');
440 440
 
441 441
 if ($is_certificate_mode) {
442
-	$form->addButtonCreate(get_lang('CreateCertificate'));
442
+    $form->addButtonCreate(get_lang('CreateCertificate'));
443 443
 } else {
444
-	$form->addButtonCreate(get_lang('CreateDoc'));
444
+    $form->addButtonCreate(get_lang('CreateDoc'));
445 445
 }
446 446
 
447 447
 $form->setDefaults($defaults);
448 448
 
449 449
 // If form validates -> save the new document
450 450
 if ($form->validate()) {
451
-	$values = $form->exportValues();
452
-	$readonly = isset($values['readonly']) ? 1 : 0;
453
-	$values['title'] = trim($values['title']);
451
+    $values = $form->exportValues();
452
+    $readonly = isset($values['readonly']) ? 1 : 0;
453
+    $values['title'] = trim($values['title']);
454 454
 
455 455
     if (!empty($values['dirValue'])) {
456 456
         $dir = $values['dirValue'];
457 457
     }
458 458
 
459 459
     if ($dir[strlen($dir) - 1] != '/') {
460
-		$dir .= '/';
461
-	}
460
+        $dir .= '/';
461
+    }
462 462
     $filepath = $filepath.$dir;
463 463
 
464 464
     // Setting the filename
465
-	$filename = $values['title'];
466
-	$filename = addslashes(trim($filename));
467
-	$filename = Security::remove_XSS($filename);
468
-	$filename = api_replace_dangerous_char($filename);
469
-	$filename = disable_dangerous_file($filename);
465
+    $filename = $values['title'];
466
+    $filename = addslashes(trim($filename));
467
+    $filename = Security::remove_XSS($filename);
468
+    $filename = api_replace_dangerous_char($filename);
469
+    $filename = disable_dangerous_file($filename);
470 470
     $filename .= DocumentManager::getDocumentSuffix(
471 471
         $_course,
472 472
         api_get_session_id(),
@@ -474,14 +474,14 @@  discard block
 block discarded – undo
474 474
     );
475 475
 
476 476
     // Setting the title
477
-	$title = $values['title'];
477
+    $title = $values['title'];
478 478
 
479 479
     // Setting the extension
480
-	$extension = 'html';
480
+    $extension = 'html';
481 481
 
482
-	$content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
482
+    $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
483 483
 
484
-	/*if (strpos($content, '/css/frames.css') == false) {
484
+    /*if (strpos($content, '/css/frames.css') == false) {
485 485
 		$content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
486 486
 	}*/
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
         exit;
495 495
     }
496 496
 
497
-	if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
498
-		//$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
499
-		$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].api_get_path(REL_COURSE_PATH), $content);
497
+    if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
498
+        //$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
499
+        $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].api_get_path(REL_COURSE_PATH), $content);
500 500
 
501
-		fputs($fp, $content);
502
-		fclose($fp);
503
-		chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
501
+        fputs($fp, $content);
502
+        fclose($fp);
503
+        chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
504 504
 
505 505
 
506
-		$file_size = filesize($filepath.$filename.'.'.$extension);
507
-		$save_file_path = $dir.$filename.'.'.$extension;
506
+        $file_size = filesize($filepath.$filename.'.'.$extension);
507
+        $save_file_path = $dir.$filename.'.'.$extension;
508 508
 
509 509
         $document_id = add_document(
510 510
             $_course,
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
             $readonly
517 517
         );
518 518
 
519
-		if ($document_id) {
520
-			api_item_property_update(
519
+        if ($document_id) {
520
+            api_item_property_update(
521 521
                 $_course,
522 522
                 TOOL_DOCUMENT,
523 523
                 $document_id,
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
                 null,
530 530
                 $current_session_id
531 531
             );
532
-			// Update parent folders
533
-			item_property_update_on_folder($_course, $dir, $userId);
534
-			$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
535
-			$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
532
+            // Update parent folders
533
+            item_property_update_on_folder($_course, $dir, $userId);
534
+            $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
535
+            $new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
536 536
             $new_title = htmlspecialchars($new_title);
537
-			if ($new_comment || $new_title) {
538
-				$ct = '';
537
+            if ($new_comment || $new_title) {
538
+                $ct = '';
539 539
                 $params = [];
540 540
                 if ($new_comment) {
541 541
                     $params['comment'] = $new_comment;
@@ -550,39 +550,39 @@  discard block
 block discarded – undo
550 550
                         ['c_id = ? AND id = ?' => [$course_id, $document_id]]
551 551
                     );
552 552
                 }
553
-			}
554
-			$dir= substr($dir,0,-1);
555
-			$selectcat = '';
553
+            }
554
+            $dir= substr($dir,0,-1);
555
+            $selectcat = '';
556 556
             if (isset($_REQUEST['selectcat'])) {
557 557
                 $selectcat = "&selectcat=".intval($_REQUEST['selectcat']);
558 558
             }
559
-			$certificate_condition = '';
560
-			if ($is_certificate_mode) {
561
-				$df = DocumentManager::get_default_certificate_id($_course['real_id']);
559
+            $certificate_condition = '';
560
+            if ($is_certificate_mode) {
561
+                $df = DocumentManager::get_default_certificate_id($_course['real_id']);
562 562
                 if (!isset($df)) {
563 563
                     DocumentManager::attach_gradebook_certificate($_course['real_id'], $document_id);
564
-				}
565
-				$certificate_condition = '&certificate=true&curdirpath=/certificates';
566
-			}
564
+                }
565
+                $certificate_condition = '&certificate=true&curdirpath=/certificates';
566
+            }
567 567
             Display::addFlash(Display::return_message(get_lang('ItemAdded')));
568
-			header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
569
-			exit();
570
-		} else {
571
-			Display :: display_header($nameTools, 'Doc');
572
-			Display :: display_error_message(get_lang('Impossible'));
573
-			Display :: display_footer();
574
-		}
575
-	} else {
576
-		Display :: display_header($nameTools, 'Doc');
577
-		Display :: display_error_message(get_lang('Impossible'));
578
-		Display :: display_footer();
579
-	}
568
+            header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
569
+            exit();
570
+        } else {
571
+            Display :: display_header($nameTools, 'Doc');
572
+            Display :: display_error_message(get_lang('Impossible'));
573
+            Display :: display_footer();
574
+        }
575
+    } else {
576
+        Display :: display_header($nameTools, 'Doc');
577
+        Display :: display_error_message(get_lang('Impossible'));
578
+        Display :: display_footer();
579
+    }
580 580
 } else {
581
-	// Copied from document.php
582
-	$dir_array = explode('/', $dir);
583
-	$array_len = count($dir_array);
581
+    // Copied from document.php
582
+    $dir_array = explode('/', $dir);
583
+    $array_len = count($dir_array);
584 584
 
585
-	// Breadcrumb for the current directory root path
585
+    // Breadcrumb for the current directory root path
586 586
     if (!empty($document_data)) {
587 587
         if (empty($document_data['parents'])) {
588 588
             $interbreadcrumb[] = array(
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
         }
600 600
     }
601 601
 
602
-	Display :: display_header($nameTools, "Doc");
603
-	// actions
602
+    Display :: display_header($nameTools, "Doc");
603
+    // actions
604 604
 
605
-	// link back to the documents overview
606
-	if ($is_certificate_mode) {
605
+    // link back to the documents overview
606
+    if ($is_certificate_mode) {
607 607
             $actionsLeft =  '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
608 608
                 Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
609 609
             $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
@@ -618,19 +618,19 @@  discard block
 block discarded – undo
618 618
 
619 619
     echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft));
620 620
 
621
-	if ($is_certificate_mode) {
621
+    if ($is_certificate_mode) {
622 622
         $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
623 623
             api_get_user_id(),
624 624
             api_get_course_id()
625 625
         );
626 626
 
627
-		$str_info = '';
628
-		foreach ($all_information_by_create_certificate[0] as $info_value) {
629
-			$str_info.=$info_value.'<br/>';
630
-		}
631
-		$create_certificate = get_lang('CreateCertificateWithTags');
632
-		Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
633
-	}
627
+        $str_info = '';
628
+        foreach ($all_information_by_create_certificate[0] as $info_value) {
629
+            $str_info.=$info_value.'<br/>';
630
+        }
631
+        $create_certificate = get_lang('CreateCertificateWithTags');
632
+        Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
633
+    }
634 634
 
635 635
     // HTML-editor
636 636
     echo '<div class="page-create">
@@ -646,5 +646,5 @@  discard block
 block discarded – undo
646 646
                 '.$form->returnForm().'
647 647
             </div>
648 648
           </div></div>';
649
-	Display :: display_footer();
649
+    Display :: display_footer();
650 650
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     $.ajax({
40 40
         contentType: "application/x-www-form-urlencoded",
41 41
         data: "dirValue="+dirValue,
42
-        url: "' . api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?a=document_destination",
42
+        url: "' . api_get_path(WEB_AJAX_PATH).'document.ajax.php?a=document_destination",
43 43
         type: "POST",
44 44
         success: function(response) {
45 45
             $("[name=\'dirValue\']").val(response)
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 }
148 148
 
149 149
 $doc_tree  = explode('/', $dir);
150
-$count_dir = count($doc_tree) -2; // "2" because at the begin and end there are 2 "/"
150
+$count_dir = count($doc_tree) - 2; // "2" because at the begin and end there are 2 "/"
151 151
 
152 152
 if (api_is_in_group()) {
153 153
     $group_properties = GroupManager::get_group_properties(api_get_group_id());
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	$relative_url .= '../';
163 163
 }
164 164
 
165
-if ($relative_url== '') {
165
+if ($relative_url == '') {
166 166
 	$relative_url = '/';
167 167
 }
168 168
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         "name" => get_lang('Documents'),
215 215
     );
216 216
 } else {
217
-	$interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
217
+	$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
218 218
 }
219 219
 
220 220
 if (!api_is_allowed_in_course()) {
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 $form->addElement('header', $nameTools);
254 254
 
255 255
 if ($is_certificate_mode) {//added condition for certicate in gradebook
256
-	$form->addElement('hidden','certificate','true',array('id'=>'certificate'));
256
+	$form->addElement('hidden', 'certificate', 'true', array('id'=>'certificate'));
257 257
 	if (isset($_GET['selectcat'])) {
258
-		$form->addElement('hidden','selectcat', $select_cat);
258
+		$form->addElement('hidden', 'selectcat', $select_cat);
259 259
     }
260 260
 }
261 261
 
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
         $escaped_folders = array();
335 335
         foreach ($folders as $key => & $val) {
336 336
             // Hide some folders
337
-            if ($val=='/HotPotatoes_files' || $val=='/certificates' || basename($val)=='css'){
337
+            if ($val == '/HotPotatoes_files' || $val == '/certificates' || basename($val) == 'css') {
338 338
                 continue;
339 339
             }
340 340
             // Admin setting for Hide/Show the folders of all users
341
-            if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))){
341
+            if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))) {
342 342
                 continue;
343 343
             }
344 344
             // Admin setting for Hide/Show Default folders to all users
345
-            if (api_get_setting('show_default_folders') == 'false' && ($val=='/images' || $val=='/flash' || $val=='/audio' || $val=='/video' || strstr($val, '/images/gallery') || $val=='/video/flv')){
345
+            if (api_get_setting('show_default_folders') == 'false' && ($val == '/images' || $val == '/flash' || $val == '/audio' || $val == '/video' || strstr($val, '/images/gallery') || $val == '/video/flv')) {
346 346
                 continue;
347 347
             }
348 348
             // Admin setting for Hide/Show chat history folder
349
-            if (api_get_setting('show_chat_folder') == 'false' && $val=='/chat_files'){
349
+            if (api_get_setting('show_chat_folder') == 'false' && $val == '/chat_files') {
350 350
                 continue;
351 351
             }
352 352
 
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 		if (is_array($folders)) {
372 372
 			foreach ($folders as & $folder) {
373 373
 				//Hide some folders
374
-				if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
374
+				if ($folder == '/HotPotatoes_files' || $folder == '/certificates' || basename($folder) == 'css') {
375 375
                     continue;
376 376
 				}
377 377
 				//Admin setting for Hide/Show the folders of all users
378 378
 				if (api_get_setting('show_users_folders') == 'false' &&
379 379
                     (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))
380
-                ){
380
+                ) {
381 381
 					continue;
382 382
 				}
383 383
 				//Admin setting for Hide/Show Default folders to all users
@@ -390,20 +390,20 @@  discard block
 block discarded – undo
390 390
                         strstr($folder, '/images/gallery') ||
391 391
                         $folder == '/video/flv'
392 392
                     )
393
-                ){
393
+                ) {
394 394
 					continue;
395 395
 				}
396 396
 				//Admin setting for Hide/Show chat history folder
397 397
 				if (api_get_setting('show_chat_folder') == 'false' &&
398
-                    $folder=='/chat_files'
399
-                ){
398
+                    $folder == '/chat_files'
399
+                ) {
400 400
 					continue;
401 401
 				}
402 402
 
403
-				$selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
403
+				$selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
404 404
 				$path_parts = explode('/', $folder);
405 405
 				$folder_titles[$folder] = cut($folder_titles[$folder], 80);
406
-                $space_counter =count($path_parts) - 2;
406
+                $space_counter = count($path_parts) - 2;
407 407
                 if ($space_counter > 0) {
408 408
                     $label = str_repeat('&nbsp;&nbsp;&nbsp;', $space_counter).' &mdash; '.$folder_titles[$folder];
409 409
                 } else {
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
 				$selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
422 422
 				$label = $folder_titles[$folder];
423 423
 				if ($folder == $group_dir) {
424
-					$label = '/ (' . get_lang('HomeDirectory') . ')';
424
+					$label = '/ ('.get_lang('HomeDirectory').')';
425 425
 				} else {
426 426
 					$path_parts = explode('/', str_replace($group_dir, '', $folder));
427 427
 					$label = cut($label, 80);
428
-					$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
428
+					$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
429 429
 				}
430 430
 				$parent_select->addOption($label, $folder);
431 431
 				if ($selected != '') {
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                     );
552 552
                 }
553 553
 			}
554
-			$dir= substr($dir,0,-1);
554
+			$dir = substr($dir, 0, -1);
555 555
 			$selectcat = '';
556 556
             if (isset($_REQUEST['selectcat'])) {
557 557
                 $selectcat = "&selectcat=".intval($_REQUEST['selectcat']);
@@ -604,16 +604,16 @@  discard block
 block discarded – undo
604 604
 
605 605
 	// link back to the documents overview
606 606
 	if ($is_certificate_mode) {
607
-            $actionsLeft =  '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
608
-                Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
607
+            $actionsLeft = '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.
608
+                Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
609 609
             $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
610
-                Display::return_icon('expand.png',get_lang('Back'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Back'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>';
610
+                Display::return_icon('expand.png', get_lang('Back'), array('id'=>'expand'), ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Back'), array('id'=>'contract', 'class'=>'hide'), ICON_SIZE_MEDIUM).'</a>';
611 611
         } else {
612 612
             $actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
613
-                Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
613
+                Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
614 614
             $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
615
-                Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).
616
-                Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>';
615
+                Display::return_icon('expand.png', get_lang('Expand'), array('id'=>'expand'), ICON_SIZE_MEDIUM).
616
+                Display::return_icon('contract.png', get_lang('Collapse'), array('id'=>'contract', 'class'=>'hide'), ICON_SIZE_MEDIUM).'</a>';
617 617
         }
618 618
 
619 619
     echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft));
@@ -626,10 +626,10 @@  discard block
 block discarded – undo
626 626
 
627 627
 		$str_info = '';
628 628
 		foreach ($all_information_by_create_certificate[0] as $info_value) {
629
-			$str_info.=$info_value.'<br/>';
629
+			$str_info .= $info_value.'<br/>';
630 630
 		}
631 631
 		$create_certificate = get_lang('CreateCertificateWithTags');
632
-		Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
632
+		Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info, false);
633 633
 	}
634 634
 
635 635
     // HTML-editor
Please login to merge, or discard this patch.
main/inc/lib/document.lib.php 1 patch
Spacing   +331 added lines, -331 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             return true;
291 291
         } else {
292 292
             $tbl_document = Database::get_course_table(TABLE_DOCUMENT);
293
-            $tbl_item_property = $this_course . 'item_property';
293
+            $tbl_item_property = $this_course.'item_property';
294 294
             $doc_url = Database::escape_string($doc_url);
295 295
             $query = "SELECT 1 FROM $tbl_document AS docs,$tbl_item_property AS props
296 296
                       WHERE
@@ -340,18 +340,18 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             header('Content-type: application/octet-stream');
343
-            header('Content-length: ' . $len);
343
+            header('Content-length: '.$len);
344 344
             if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
345
-                header('Content-Disposition: filename= ' . $filename);
345
+                header('Content-Disposition: filename= '.$filename);
346 346
             } else {
347
-                header('Content-Disposition: attachment; filename= ' . $filename);
347
+                header('Content-Disposition: attachment; filename= '.$filename);
348 348
             }
349 349
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
350 350
                 header('Pragma: ');
351 351
                 header('Cache-Control: ');
352 352
                 header('Cache-Control: public'); // IE cannot download from sessions without a cache
353 353
             }
354
-            header('Content-Description: ' . $filename);
354
+            header('Content-Description: '.$filename);
355 355
             header('Content-Transfer-Encoding: binary');
356 356
 
357 357
             $res = fopen($full_file_name, 'r');
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
                     } else {
379 379
                         $encoding = @api_detect_encoding_html(file_get_contents($full_file_name));
380 380
                         if (!empty($encoding)) {
381
-                            $content_type .= '; charset=' . $encoding;
381
+                            $content_type .= '; charset='.$encoding;
382 382
                         }
383 383
                     }
384 384
                     break;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                     } else {
389 389
                         $encoding = @api_detect_encoding(strip_tags(file_get_contents($full_file_name)));
390 390
                         if (!empty($encoding)) {
391
-                            $content_type .= '; charset=' . $encoding;
391
+                            $content_type .= '; charset='.$encoding;
392 392
                         }
393 393
                     }
394 394
                     break;
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
                     header('Content-type: application/octet-stream');
398 398
                     break;
399 399
             }
400
-            header('Content-type: ' . $content_type);
401
-            header('Content-Length: ' . $len);
400
+            header('Content-type: '.$content_type);
401
+            header('Content-Length: '.$len);
402 402
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
403 403
             if (strpos($user_agent, 'msie')) {
404
-                header('Content-Disposition: ; filename= ' . $filename);
404
+                header('Content-Disposition: ; filename= '.$filename);
405 405
             } else {
406
-                header('Content-Disposition: inline; filename= ' . $filename);
406
+                header('Content-Disposition: inline; filename= '.$filename);
407 407
             }
408 408
 
409 409
             if ($fixLinksHttpToHttps) {
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
 
445 445
             header('Content-type: application/octet-stream');
446 446
             //header('Content-Type: application/force-download');
447
-            header('Content-length: ' . $len);
447
+            header('Content-length: '.$len);
448 448
             if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
449
-                header('Content-Disposition: filename= ' . $filename);
449
+                header('Content-Disposition: filename= '.$filename);
450 450
             } else {
451
-                header('Content-Disposition: attachment; filename= ' . $filename);
451
+                header('Content-Disposition: attachment; filename= '.$filename);
452 452
             }
453 453
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
454 454
                 header('Pragma: ');
455 455
                 header('Cache-Control: ');
456 456
                 header('Cache-Control: public'); // IE cannot download from sessions without a cache
457 457
             }
458
-            header('Content-Description: ' . $filename);
458
+            header('Content-Description: '.$filename);
459 459
             header('Content-transfer-encoding: binary');
460 460
             echo $full_string;
461 461
 
@@ -468,30 +468,30 @@  discard block
 block discarded – undo
468 468
 
469 469
             $content_type = self::file_get_mime_type($filename);
470 470
             header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
471
-            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
471
+            header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
472 472
             header('Cache-Control: no-cache, must-revalidate');
473 473
             header('Pragma: no-cache');
474 474
             switch ($content_type) {
475 475
                 case 'text/html':
476 476
                     $encoding = @api_detect_encoding_html($full_string);
477 477
                     if (!empty($encoding)) {
478
-                        $content_type .= '; charset=' . $encoding;
478
+                        $content_type .= '; charset='.$encoding;
479 479
                     }
480 480
                     break;
481 481
                 case 'text/plain':
482 482
                     $encoding = @api_detect_encoding(strip_tags($full_string));
483 483
                     if (!empty($encoding)) {
484
-                        $content_type .= '; charset=' . $encoding;
484
+                        $content_type .= '; charset='.$encoding;
485 485
                     }
486 486
                     break;
487 487
             }
488
-            header('Content-type: ' . $content_type);
489
-            header('Content-Length: ' . $len);
488
+            header('Content-type: '.$content_type);
489
+            header('Content-Length: '.$len);
490 490
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
491 491
             if (strpos($user_agent, 'msie')) {
492
-                header('Content-Disposition: ; filename= ' . $filename);
492
+                header('Content-Disposition: ; filename= '.$filename);
493 493
             } else {
494
-                header('Content-Disposition: inline; filename= ' . $filename);
494
+                header('Content-Disposition: inline; filename= '.$filename);
495 495
             }
496 496
             echo($full_string);
497 497
             //You have to ensure that the calling script then stops processing (exit();)
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
             if (!empty($students)) {
587 587
                 $conditionList = array();
588 588
                 foreach ($students as $studentId => $studentInfo) {
589
-                    $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
589
+                    $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
590 590
                 }
591
-                $sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")';
591
+                $sharedCondition .= ' AND docs.path IN ("'.implode('","', $conditionList).'")';
592 592
             }
593 593
         }
594 594
 
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
                     last.tool = '".TOOL_DOCUMENT."' AND 
616 616
                     docs.c_id = {$_course['real_id']} AND
617 617
                     last.c_id = {$_course['real_id']} AND
618
-                    docs.path LIKE '" . Database::escape_string($path . $added_slash.'%'). "' AND
619
-                    docs.path NOT LIKE '" . Database::escape_string($path . $added_slash.'%/%')."' AND
618
+                    docs.path LIKE '".Database::escape_string($path.$added_slash.'%')."' AND
619
+                    docs.path NOT LIKE '" . Database::escape_string($path.$added_slash.'%/%')."' AND
620 620
                     docs.path NOT LIKE '%_DELETED_%' AND
621 621
                     $userGroupFilter AND
622 622
                     last.visibility $visibility_bit
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                     $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES);
658 658
                     $sql = "SELECT id FROM $table_template
659 659
                             WHERE
660
-                                course_code = '" . $_course['code'] . "' AND
660
+                                course_code = '".$_course['code']."' AND
661 661
                                 user_id = '".api_get_user_id()."' AND
662 662
                                 ref_doc = '".$row['id']."'";
663 663
                     $template_result = Database::query($sql);
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
         $conditionList = array();
770 770
         if (!empty($students)) {
771 771
             foreach ($students as $studentId => $studentInfo) {
772
-                $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
772
+                $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
773 773
             }
774 774
         }
775 775
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
                        INNER JOIN $TABLE_DOCUMENT  AS docs
799 799
                        ON (
800 800
                             docs.id = last.ref AND
801
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
801
+                            last.tool = '".TOOL_DOCUMENT."' AND
802 802
                             last.c_id = {$_course['real_id']} AND
803 803
                             docs.c_id = {$_course['real_id']}
804 804
                        )
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
                         INNER JOIN $TABLE_DOCUMENT  AS docs
816 816
                         ON (
817 817
                             docs.id = last.ref AND
818
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
818
+                            last.tool = '".TOOL_DOCUMENT."' AND
819 819
                             last.c_id = {$_course['real_id']} AND
820 820
                             docs.c_id = {$_course['real_id']}
821 821
                         )
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                         ON (docs.id = last.ref AND last.c_id = docs.c_id)
874 874
                     WHERE
875 875
                         $fileType
876
-                        last.tool = '" . TOOL_DOCUMENT . "' AND
876
+                        last.tool = '".TOOL_DOCUMENT."' AND
877 877
                         $groupCondition AND
878 878
                         $visibilityCondition
879 879
                         $show_users_condition
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
                     ON (docs.id = last.ref AND last.c_id = docs.c_id)
902 902
                     WHERE                        
903 903
                         docs.filetype = 'folder' AND
904
-                        last.tool = '" . TOOL_DOCUMENT . "' AND
904
+                        last.tool = '".TOOL_DOCUMENT."' AND
905 905
                         $groupCondition AND
906 906
                         last.visibility = 0 $condition_session AND
907 907
                         last.c_id = {$_course['real_id']} AND
@@ -917,9 +917,9 @@  discard block
 block discarded – undo
917 917
                         FROM $TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs
918 918
                         WHERE
919 919
                             docs.id = last.ref AND
920
-                            docs.path LIKE '" . Database::escape_string($row['path'].'/%') . "' AND
920
+                            docs.path LIKE '".Database::escape_string($row['path'].'/%')."' AND
921 921
                             docs.filetype = 'folder' AND
922
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
922
+                            last.tool = '" . TOOL_DOCUMENT."' AND
923 923
                             $groupCondition AND
924 924
                             last.visibility = 1 $condition_session AND
925 925
                             last.c_id = {$_course['real_id']} AND
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
                                 tp.c_id = $course_id AND
997 997
                                 td.session_id = $sessionId AND
998 998
                                 tp.ref= td.id AND
999
-                                (path='" . $path . "' OR path LIKE BINARY '" . $path . "/%' ) ";
999
+                                (path='".$path."' OR path LIKE BINARY '".$path."/%' ) ";
1000 1000
                     // Get all id's of documents that are deleted
1001 1001
                     $what_to_check_result = Database::query($sql);
1002 1002
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
             $res = Database::query($sql);
1344 1344
             if (Database::num_rows($res) > 0) {
1345 1345
                 $row2 = Database::fetch_array($res);
1346
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
1346
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
1347 1347
                 $di = new ChamiloIndexer();
1348 1348
                 $di->remove_document((int) $row2['search_did']);
1349 1349
             }
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
             Database::query($sql);
1353 1353
 
1354 1354
             // remove terms from db
1355
-            require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
1355
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
1356 1356
             delete_all_values_for_item($course_id, TOOL_DOCUMENT, $document_id);
1357 1357
         }
1358 1358
     }
@@ -1438,12 +1438,12 @@  discard block
 block discarded – undo
1438 1438
             $path = str_replace('%2F', '/', $url_path);
1439 1439
             $pathinfo = pathinfo($row['path']);
1440 1440
 
1441
-            $row['url'] = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?cidReq=' . $course_code . '&id=' . $id;
1442
-            $row['document_url'] = api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . $course_code . '&id=' . $id;
1443
-            $row['absolute_path'] = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path'];
1444
-            $row['absolute_path_from_document'] = '/document' . $row['path'];
1445
-            $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'] . '/';
1446
-            $row['direct_url'] = $www . $path;
1441
+            $row['url'] = api_get_path(WEB_CODE_PATH).'document/showinframes.php?cidReq='.$course_code.'&id='.$id;
1442
+            $row['document_url'] = api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.$course_code.'&id='.$id;
1443
+            $row['absolute_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
1444
+            $row['absolute_path_from_document'] = '/document'.$row['path'];
1445
+            $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'].'/';
1446
+            $row['direct_url'] = $www.$path;
1447 1447
 
1448 1448
             if (dirname($row['path']) == '.') {
1449 1449
                 $row['parent_id'] = '0';
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
                 $real_dir = '';
1463 1463
 
1464 1464
                 for ($i = 1; $i < $array_len; $i++) {
1465
-                    $real_dir .= '/' . (isset($dir_array[$i]) ? $dir_array[$i] : '');
1465
+                    $real_dir .= '/'.(isset($dir_array[$i]) ? $dir_array[$i] : '');
1466 1466
                     $parent_id = self::get_document_id($course_info, $real_dir);
1467 1467
                     if ($session_id != 0 && empty($parent_id)) {
1468 1468
                         $parent_id = self::get_document_id($course_info, $real_dir, 0);
@@ -1536,21 +1536,21 @@  discard block
 block discarded – undo
1536 1536
         $user_id = intval($user_id);
1537 1537
         $document_id = intval($document_id);
1538 1538
 
1539
-        $sql = 'SELECT id FROM ' . $table_template . '
1539
+        $sql = 'SELECT id FROM '.$table_template.'
1540 1540
                 WHERE
1541
-                    course_code="' . $course_code . '" AND
1542
-                    user_id="' . $user_id . '" AND
1543
-                    ref_doc="' . $document_id . '"';
1541
+                    course_code="' . $course_code.'" AND
1542
+                    user_id="' . $user_id.'" AND
1543
+                    ref_doc="' . $document_id.'"';
1544 1544
         $result = Database::query($sql);
1545 1545
         $template_id = Database::result($result, 0, 0);
1546 1546
 
1547
-        my_delete(api_get_path(SYS_CODE_PATH) . 'upload/template_thumbnails/' . $template_id . '.jpg');
1547
+        my_delete(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/'.$template_id.'.jpg');
1548 1548
 
1549
-        $sql = 'DELETE FROM ' . $table_template . '
1549
+        $sql = 'DELETE FROM '.$table_template.'
1550 1550
                 WHERE
1551
-                    course_code="' . $course_code . '" AND
1552
-                    user_id="' . $user_id . '" AND
1553
-                    ref_doc="' . $document_id . '"';
1551
+                    course_code="' . $course_code.'" AND
1552
+                    user_id="' . $user_id.'" AND
1553
+                    ref_doc="' . $document_id.'"';
1554 1554
 
1555 1555
         Database::query($sql);
1556 1556
     }
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
                 INNER JOIN $propTable ip
1612 1612
                 ON (d.id = ip.ref AND d.c_id  = $course_id AND ip.c_id = $course_id)
1613 1613
         		WHERE
1614
-        		    ip.tool = '" . TOOL_DOCUMENT . "' $condition AND
1614
+        		    ip.tool = '".TOOL_DOCUMENT."' $condition AND
1615 1615
         			filetype = '$file_type' AND
1616 1616
         			locate(concat(path,'/'), '$doc_path')=1
1617 1617
                 ";
@@ -1775,12 +1775,12 @@  discard block
 block discarded – undo
1775 1775
         if (empty($session_id)) {
1776 1776
             $sql_session = 'AND (session_id = 0 OR isnull(session_id)) ';
1777 1777
         } elseif ($session_id > 0) {
1778
-            $sql_session = 'AND session_id=' . intval($session_id);
1778
+            $sql_session = 'AND session_id='.intval($session_id);
1779 1779
         } else {
1780 1780
             $sql_session = '';
1781 1781
         }
1782
-        $sql = 'UPDATE ' . $tbl_category . ' SET document_id="' . intval($document_id) . '"
1783
-                WHERE c_id ="' . Database::escape_string($course_id) . '" ' . $sql_session;
1782
+        $sql = 'UPDATE '.$tbl_category.' SET document_id="'.intval($document_id).'"
1783
+                WHERE c_id ="' . Database::escape_string($course_id).'" '.$sql_session;
1784 1784
         Database::query($sql);
1785 1785
     }
1786 1786
 
@@ -1802,12 +1802,12 @@  discard block
 block discarded – undo
1802 1802
         if (empty($session_id)) {
1803 1803
             $sql_session = 'AND (session_id = 0 OR isnull(session_id)) ';
1804 1804
         } elseif ($session_id > 0) {
1805
-            $sql_session = 'AND session_id=' . intval($session_id);
1805
+            $sql_session = 'AND session_id='.intval($session_id);
1806 1806
         } else {
1807 1807
             $sql_session = '';
1808 1808
         }
1809
-        $sql = 'SELECT document_id FROM ' . $tbl_category . '
1810
-                WHERE c_id ="' . Database::escape_string($course_id) . '" ' . $sql_session;
1809
+        $sql = 'SELECT document_id FROM '.$tbl_category.'
1810
+                WHERE c_id ="' . Database::escape_string($course_id).'" '.$sql_session;
1811 1811
 
1812 1812
         $rs = Database::query($sql);
1813 1813
         $num = Database::num_rows($rs);
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
             $all_user_info = array();
1849 1849
             if (Database::num_rows($rs)) {
1850 1850
                 $row = Database::fetch_array($rs);
1851
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path'];
1851
+                $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
1852 1852
                 if (is_file($filepath)) {
1853 1853
                     $my_content_html = file_get_contents($filepath);
1854 1854
                 }
@@ -1931,9 +1931,9 @@  discard block
 block discarded – undo
1931 1931
             $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
1932 1932
         }
1933 1933
 
1934
-        $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
1934
+        $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id'];
1935 1935
 
1936
-        $externalStyleFile = api_get_path(SYS_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/certificate.css';
1936
+        $externalStyleFile = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/certificate.css';
1937 1937
         $externalStyle = '';
1938 1938
 
1939 1939
         if (is_file($externalStyleFile)) {
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
             $course_info['name'],
1956 1956
             $info_grade_certificate['grade'],
1957 1957
             $url,
1958
-            '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>',
1958
+            '<a href="'.$url.'" target="_blank">'.get_lang('CertificateOnlineLink').'</a>',
1959 1959
             '((certificate_barcode))',
1960 1960
             $externalStyle
1961 1961
         );
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
         if (!empty($extraFields)) {
1982 1982
             foreach ($extraFields as $extraField) {
1983 1983
                 $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : '';
1984
-                $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))';
1984
+                $info_to_be_replaced_in_content_html[] = '(('.strtolower($extraField['variable']).'))';
1985 1985
                 $info_to_replace_in_content_html[] = $valueExtra;
1986 1986
             }
1987 1987
         }
@@ -2009,17 +2009,17 @@  discard block
 block discarded – undo
2009 2009
             $tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
2010 2010
             $session_id = api_get_session_id();
2011 2011
             if ($session_id == 0 || is_null($session_id)) {
2012
-                $sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) ';
2012
+                $sql_session = 'AND (session_id='.intval($session_id).' OR isnull(session_id)) ';
2013 2013
             } elseif ($session_id > 0) {
2014
-                $sql_session = 'AND session_id=' . intval($session_id);
2014
+                $sql_session = 'AND session_id='.intval($session_id);
2015 2015
             } else {
2016 2016
                 $sql_session = '';
2017 2017
             }
2018 2018
 
2019
-            $sql = 'UPDATE ' . $tbl_category . ' SET document_id=null
2019
+            $sql = 'UPDATE '.$tbl_category.' SET document_id=null
2020 2020
                     WHERE
2021
-                        c_id = "' . Database::escape_string($course_id) . '" AND
2022
-                        document_id="' . $default_certificate_id . '" ' . $sql_session;
2021
+                        c_id = "' . Database::escape_string($course_id).'" AND
2022
+                        document_id="' . $default_certificate_id.'" '.$sql_session;
2023 2023
             Database::query($sql);
2024 2024
         }
2025 2025
     }
@@ -2035,10 +2035,10 @@  discard block
 block discarded – undo
2035 2035
         if (!empty($courseInfo)) {
2036 2036
             $to_group_id = 0;
2037 2037
             $to_user_id = null;
2038
-            $course_dir = $courseInfo['path'] . "/document/";
2038
+            $course_dir = $courseInfo['path']."/document/";
2039 2039
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
2040
-            $base_work_dir = $sys_course_path . $course_dir;
2041
-            $base_work_dir_test = $base_work_dir . 'certificates';
2040
+            $base_work_dir = $sys_course_path.$course_dir;
2041
+            $base_work_dir_test = $base_work_dir.'certificates';
2042 2042
             $dir_name = '/certificates';
2043 2043
             $post_dir_name = get_lang('CertificatesFiles');
2044 2044
             $visibility_command = 'invisible';
@@ -2263,9 +2263,9 @@  discard block
 block discarded – undo
2263 2263
                                             //$new_abs_path = realpath($dir.'/'.$second_part);
2264 2264
                                             $dir = '';
2265 2265
                                             if (!empty($abs_path)) {
2266
-                                                $dir = dirname($abs_path) . '/';
2266
+                                                $dir = dirname($abs_path).'/';
2267 2267
                                             }
2268
-                                            $new_abs_path = realpath($dir . $second_part);
2268
+                                            $new_abs_path = realpath($dir.$second_part);
2269 2269
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2270 2270
                                             if (count($in_files_list) > 0) {
2271 2271
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2278,9 +2278,9 @@  discard block
 block discarded – undo
2278 2278
                                             $files_list[] = array($second_part, 'local', 'rel');
2279 2279
                                             $dir = '';
2280 2280
                                             if (!empty($abs_path)) {
2281
-                                                $dir = dirname($abs_path) . '/';
2281
+                                                $dir = dirname($abs_path).'/';
2282 2282
                                             }
2283
-                                            $new_abs_path = realpath($dir . $second_part);
2283
+                                            $new_abs_path = realpath($dir.$second_part);
2284 2284
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2285 2285
                                             if (count($in_files_list) > 0) {
2286 2286
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2314,9 +2314,9 @@  discard block
 block discarded – undo
2314 2314
                                             $files_list[] = array($source, 'local', 'rel');
2315 2315
                                             $dir = '';
2316 2316
                                             if (!empty($abs_path)) {
2317
-                                                $dir = dirname($abs_path) . '/';
2317
+                                                $dir = dirname($abs_path).'/';
2318 2318
                                             }
2319
-                                            $new_abs_path = realpath($dir . $source);
2319
+                                            $new_abs_path = realpath($dir.$source);
2320 2320
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2321 2321
                                             if (count($in_files_list) > 0) {
2322 2322
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2329,9 +2329,9 @@  discard block
 block discarded – undo
2329 2329
                                             $files_list[] = array($source, 'local', 'rel');
2330 2330
                                             $dir = '';
2331 2331
                                             if (!empty($abs_path)) {
2332
-                                                $dir = dirname($abs_path) . '/';
2332
+                                                $dir = dirname($abs_path).'/';
2333 2333
                                             }
2334
-                                            $new_abs_path = realpath($dir . $source);
2334
+                                            $new_abs_path = realpath($dir.$source);
2335 2335
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2336 2336
                                             if (count($in_files_list) > 0) {
2337 2337
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2365,9 +2365,9 @@  discard block
 block discarded – undo
2365 2365
                                     $files_list[] = array($source, 'local', 'rel');
2366 2366
                                     $dir = '';
2367 2367
                                     if (!empty($abs_path)) {
2368
-                                        $dir = dirname($abs_path) . '/';
2368
+                                        $dir = dirname($abs_path).'/';
2369 2369
                                     }
2370
-                                    $new_abs_path = realpath($dir . $source);
2370
+                                    $new_abs_path = realpath($dir.$source);
2371 2371
                                     $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2372 2372
                                     if (count($in_files_list) > 0) {
2373 2373
                                         $files_list = array_merge($files_list, $in_files_list);
@@ -2380,9 +2380,9 @@  discard block
 block discarded – undo
2380 2380
                                     $files_list[] = array($source, 'local', 'rel');
2381 2381
                                     $dir = '';
2382 2382
                                     if (!empty($abs_path)) {
2383
-                                        $dir = dirname($abs_path) . '/';
2383
+                                        $dir = dirname($abs_path).'/';
2384 2384
                                     }
2385
-                                    $new_abs_path = realpath($dir . $source);
2385
+                                    $new_abs_path = realpath($dir.$source);
2386 2386
                                     $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2387 2387
                                     if (count($in_files_list) > 0) {
2388 2388
                                         $files_list = array_merge($files_list, $in_files_list);
@@ -2441,24 +2441,24 @@  discard block
 block discarded – undo
2441 2441
             // then possible closing brackets if we were in the opening bracket case
2442 2442
             // OR something like @import()
2443 2443
             $res = preg_match_all(
2444
-                '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' .
2444
+                '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))'.
2445 2445
                 // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much
2446 2446
                 // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name
2447
-                '([ \n\t\r]+)?(' .
2447
+                '([ \n\t\r]+)?('.
2448 2448
                 // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself
2449
-                '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' .
2450
-                '|' .
2449
+                '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))'.
2450
+                '|'.
2451 2451
                 // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself
2452
-                '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' .
2453
-                '))' .
2454
-                '|' .
2452
+                '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))'.
2453
+                '))'.
2454
+                '|'.
2455 2455
                 // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities)
2456 2456
                 '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/',
2457 2457
                 $attrString,
2458 2458
                 $regs
2459 2459
             );
2460 2460
         } catch (Exception $e) {
2461
-            error_log('Caught exception: ' . $e->getMessage(), 0);
2461
+            error_log('Caught exception: '.$e->getMessage(), 0);
2462 2462
         }
2463 2463
         if ($res) {
2464 2464
             for ($i = 0; $i < count($regs[1]); $i++) {
@@ -2536,14 +2536,14 @@  discard block
 block discarded – undo
2536 2536
                 $orig_course_info_path = $origin_course_info_path;
2537 2537
             }
2538 2538
         } else {
2539
-            $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'] . '/';
2539
+            $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'].'/';
2540 2540
             $orig_course_info_path = $orig_course_info['path'];
2541 2541
         }
2542 2542
 
2543 2543
         $destination_course_code = CourseManager::get_course_id_from_path($destination_course_directory);
2544 2544
         $destination_course_info = api_get_course_info($destination_course_code);
2545
-        $dest_course_path = api_get_path(SYS_COURSE_PATH) . $destination_course_directory . '/';
2546
-        $dest_course_path_rel = api_get_path(REL_COURSE_PATH) . $destination_course_directory . '/';
2545
+        $dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/';
2546
+        $dest_course_path_rel = api_get_path(REL_COURSE_PATH).$destination_course_directory.'/';
2547 2547
 
2548 2548
         $user_id = api_get_user_id();
2549 2549
 
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
 
2553 2553
                 // Get information about source url
2554 2554
                 $real_orig_url = $source[0]; // url
2555
-                $scope_url = $source[1];   // scope (local, remote)
2555
+                $scope_url = $source[1]; // scope (local, remote)
2556 2556
                 $type_url = $source[2]; // type (rel, abs, url)
2557 2557
 
2558 2558
                 // Get path and query from origin url
@@ -2564,7 +2564,7 @@  discard block
 block discarded – undo
2564 2564
                 $dest_url_query = '';
2565 2565
 
2566 2566
                 if (!empty($real_orig_query)) {
2567
-                    $dest_url_query = '?' . $real_orig_query;
2567
+                    $dest_url_query = '?'.$real_orig_query;
2568 2568
                     if (strpos($dest_url_query, $origin_course_code) !== false) {
2569 2569
                         $dest_url_query = str_replace($origin_course_code, $destination_course_code, $dest_url_query);
2570 2570
                     }
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
 
2646 2646
                                 //$destination_url = $url_course_path . $destination_course_directory . '/' . $document_file . $dest_url_query;
2647 2647
                                 // See BT#7780
2648
-                                $destination_url = $dest_course_path_rel . $document_file . $dest_url_query;
2648
+                                $destination_url = $dest_course_path_rel.$document_file.$dest_url_query;
2649 2649
 
2650 2650
                                 // If the course code doesn't exist in the path? what we do? Nothing! see BT#1985
2651 2651
                                 if (strpos($real_orig_path, $origin_course_code) === false) {
@@ -2680,14 +2680,14 @@  discard block
 block discarded – undo
2680 2680
     public function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path)
2681 2681
     {
2682 2682
         if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') {
2683
-            $original = $original_path . $file_name;
2683
+            $original = $original_path.$file_name;
2684 2684
         } else {
2685
-            $original = $original_path . '/' . $file_name;
2685
+            $original = $original_path.'/'.$file_name;
2686 2686
         }
2687 2687
         if (substr($destiny_path, strlen($destiny_path) - 1, strlen($destiny_path)) == '/') {
2688
-            $destination = $destiny_path . $file_name;
2688
+            $destination = $destiny_path.$file_name;
2689 2689
         } else {
2690
-            $destination = $destiny_path . '/' . $file_name;
2690
+            $destination = $destiny_path.'/'.$file_name;
2691 2691
         }
2692 2692
         $original_count = count(explode('/', $original));
2693 2693
         $destination_count = count(explode('/', $destination));
@@ -2701,8 +2701,8 @@  discard block
 block discarded – undo
2701 2701
             $mode = 'inside';
2702 2702
         }
2703 2703
         //We do not select the $original_path becayse the file was already moved
2704
-        $content_html = file_get_contents($destiny_path . '/' . $file_name);
2705
-        $destination_file = $destiny_path . '/' . $file_name;
2704
+        $content_html = file_get_contents($destiny_path.'/'.$file_name);
2705
+        $destination_file = $destiny_path.'/'.$file_name;
2706 2706
 
2707 2707
         $pre_original = strstr($original_path, 'document');
2708 2708
         $pre_destin = strstr($destiny_path, 'document');
@@ -2724,11 +2724,11 @@  discard block
 block discarded – undo
2724 2724
         }
2725 2725
 
2726 2726
         if ($pre_original != '') {
2727
-            $pre_original = '..' . $pre_original . '/';
2727
+            $pre_original = '..'.$pre_original.'/';
2728 2728
         }
2729 2729
 
2730 2730
         if ($pre_destin != '') {
2731
-            $pre_destin = '..' . $pre_destin . '/';
2731
+            $pre_destin = '..'.$pre_destin.'/';
2732 2732
         }
2733 2733
 
2734 2734
         $levels = explode('/', $pre_original);
@@ -2746,7 +2746,7 @@  discard block
 block discarded – undo
2746 2746
         //echo '$count_pre_destination_levels '. $count_pre_destination_levels;
2747 2747
         $pre_remove = '';
2748 2748
         for ($i = 1; $i <= $count_pre_destination_levels; $i++) {
2749
-            $pre_remove .='..\/';
2749
+            $pre_remove .= '..\/';
2750 2750
         }
2751 2751
 
2752 2752
         $orig_source_html = DocumentManager::get_resources_from_source_html($content_html);
@@ -2754,9 +2754,9 @@  discard block
 block discarded – undo
2754 2754
         foreach ($orig_source_html as $source) {
2755 2755
 
2756 2756
             // get information about source url
2757
-            $real_orig_url = $source[0];   // url
2758
-            $scope_url = $source[1];   // scope (local, remote)
2759
-            $type_url = $source[2];   // tyle (rel, abs, url)
2757
+            $real_orig_url = $source[0]; // url
2758
+            $scope_url = $source[1]; // scope (local, remote)
2759
+            $type_url = $source[2]; // tyle (rel, abs, url)
2760 2760
             // Get path and query from origin url
2761 2761
             $orig_parse_url = parse_url($real_orig_url);
2762 2762
             $real_orig_path = $orig_parse_url['path'];
@@ -2783,11 +2783,11 @@  discard block
 block discarded – undo
2783 2783
                         $real_orig_url_temp = '';
2784 2784
                         if ($mode == 'inside') {
2785 2785
                             $real_orig_url_temp = str_replace('../', '', $real_orig_url);
2786
-                            $destination_url = $link_to_add . $real_orig_url_temp;
2786
+                            $destination_url = $link_to_add.$real_orig_url_temp;
2787 2787
                         } else {
2788 2788
                             $real_orig_url_temp = $real_orig_url;
2789 2789
 
2790
-                            $destination_url = preg_replace("/" . $pre_remove . "/", '', $real_orig_url, 1);
2790
+                            $destination_url = preg_replace("/".$pre_remove."/", '', $real_orig_url, 1);
2791 2791
                         }
2792 2792
                         if ($real_orig_url == $destination_url) {
2793 2793
                             //echo 'continue2';
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
     {
2814 2814
         $course_data = api_get_course_info($course_code);
2815 2815
         $document_data = self::get_document_data_by_id($document_id, $course_code);
2816
-        $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path'];
2816
+        $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path'];
2817 2817
         $pdf = new PDF('A4-L', 'L');
2818 2818
         $pdf->html_to_pdf($file_path, $document_data['title'], $course_code);
2819 2819
     }
@@ -2848,9 +2848,9 @@  discard block
 block discarded – undo
2848 2848
     ) {
2849 2849
         $course_info = api_get_course_info();
2850 2850
         $sessionId = api_get_session_id();
2851
-        $course_dir = $course_info['path'] . '/document';
2851
+        $course_dir = $course_info['path'].'/document';
2852 2852
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
2853
-        $base_work_dir = $sys_course_path . $course_dir;
2853
+        $base_work_dir = $sys_course_path.$course_dir;
2854 2854
 
2855 2855
         $group_properties = GroupManager::get_group_properties(api_get_group_id());
2856 2856
         $groupIid = isset($group_properties['iid']) ? $group_properties['iid'] : 0;
@@ -3038,7 +3038,7 @@  discard block
 block discarded – undo
3038 3038
         }
3039 3039
         if (isset($output)) {
3040 3040
             foreach ($output as & $line) {
3041
-                $content .= $line . "\n";
3041
+                $content .= $line."\n";
3042 3042
             }
3043 3043
             return $content;
3044 3044
         } else {
@@ -3070,13 +3070,13 @@  discard block
 block discarded – undo
3070 3070
         $group_condition = null;
3071 3071
         if (isset($group_id)) {
3072 3072
             $group_id = intval($group_id);
3073
-            $group_condition = " AND props.to_group_id='" . $group_id . "' ";
3073
+            $group_condition = " AND props.to_group_id='".$group_id."' ";
3074 3074
         }
3075 3075
 
3076 3076
         $session_condition = null;
3077 3077
         if (isset($session_id)) {
3078 3078
             $session_id = intval($session_id);
3079
-            $session_condition = " AND props.session_id='" . $session_id . "' ";
3079
+            $session_condition = " AND props.session_id='".$session_id."' ";
3080 3080
         }
3081 3081
 
3082 3082
         $sql = "SELECT SUM(size)
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
                 WHERE
3087 3087
                     props.c_id 	= $course_id AND
3088 3088
                     docs.c_id 	= $course_id AND
3089
-                    props.tool 	= '" . TOOL_DOCUMENT . "' AND
3089
+                    props.tool 	= '".TOOL_DOCUMENT."' AND
3090 3090
                     props.visibility <> 2
3091 3091
                     $group_condition
3092 3092
                     $session_condition
@@ -3109,8 +3109,8 @@  discard block
 block discarded – undo
3109 3109
         $course_quota_m = round($course_quota / 1048576);
3110 3110
         $already_consumed_space_m = round($already_consumed_space / 1048576);
3111 3111
 
3112
-        $message = get_lang('MaximumAllowedQuota') . ' <strong>' . $course_quota_m . ' megabyte</strong>.<br />';
3113
-        $message .= get_lang('CourseCurrentlyUses') . ' <strong>' . $already_consumed_space_m . ' megabyte</strong>.<br />';
3112
+        $message = get_lang('MaximumAllowedQuota').' <strong>'.$course_quota_m.' megabyte</strong>.<br />';
3113
+        $message .= get_lang('CourseCurrentlyUses').' <strong>'.$already_consumed_space_m.' megabyte</strong>.<br />';
3114 3114
 
3115 3115
         $percentage = round(($already_consumed_space / $course_quota * 100), 1);
3116 3116
 
@@ -3118,33 +3118,33 @@  discard block
 block discarded – undo
3118 3118
 
3119 3119
         // Decide where to place percentage in graph
3120 3120
         if ($percentage >= 50) {
3121
-            $text_in_filled = '&nbsp;' . $other_percentage . '%';
3121
+            $text_in_filled = '&nbsp;'.$other_percentage.'%';
3122 3122
             $text_in_unfilled = '';
3123 3123
         } else {
3124
-            $text_in_unfilled = '&nbsp;' . $other_percentage . '%';
3124
+            $text_in_unfilled = '&nbsp;'.$other_percentage.'%';
3125 3125
             $text_in_filled = '';
3126 3126
         }
3127 3127
 
3128 3128
         // Decide the background colour of the graph
3129 3129
         if ($percentage < 65) {
3130
-            $colour = '#00BB00';        // Safe - green
3130
+            $colour = '#00BB00'; // Safe - green
3131 3131
         } elseif ($percentage < 90) {
3132
-            $colour = '#ffd400';        // Filling up - yelloworange
3132
+            $colour = '#ffd400'; // Filling up - yelloworange
3133 3133
         } else {
3134
-            $colour = '#DD0000';        // Full - red
3134
+            $colour = '#DD0000'; // Full - red
3135 3135
         }
3136 3136
 
3137 3137
         // This is used for the table width: a table of only 100 pixels looks too small
3138 3138
         $visual_percentage = 4 * $percentage;
3139 3139
         $visual_other_percentage = 4 * $other_percentage;
3140 3140
 
3141
-        $message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' .
3142
-            get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />';
3141
+        $message .= get_lang('PercentageQuotaInUse').': <strong>'.$percentage.'%</strong>.<br />'.
3142
+            get_lang('PercentageQuotaFree').': <strong>'.$other_percentage.'%</strong>.<br />';
3143 3143
 
3144
-        $show_percentage = '&nbsp;' . $percentage . '%';
3145
-        $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' .
3146
-            '<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>' .
3147
-            '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>';
3144
+        $show_percentage = '&nbsp;'.$percentage.'%';
3145
+        $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\''.api_get_path(WEB_CODE_PATH).'css/'.api_get_visual_theme().'/images/bg-header4.png\');" class="document-quota-bar">'.
3146
+            '<div style="width:'.$percentage.'%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>'.
3147
+            '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">'.$show_percentage.'</span></div>';
3148 3148
         echo $message;
3149 3149
     }
3150 3150
 
@@ -3160,7 +3160,7 @@  discard block
 block discarded – undo
3160 3160
         $percentage = $already_consumed_space / $course_quota * 100;
3161 3161
         $percentage = round($percentage, 1);
3162 3162
         $message = get_lang('YouAreCurrentlyUsingXOfYourX');
3163
-        $message = sprintf($message, $already_consumed_space_m, $percentage . '%', $course_quota_m . ' ');
3163
+        $message = sprintf($message, $already_consumed_space_m, $percentage.'%', $course_quota_m.' ');
3164 3164
         echo Display::div($message, array('id' => 'document_quota'));
3165 3165
     }
3166 3166
 
@@ -3192,13 +3192,13 @@  discard block
 block discarded – undo
3192 3192
      */
3193 3193
     public static function generate_jplayer_jquery($params = array())
3194 3194
     {
3195
-        $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
3195
+        $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
3196 3196
 
3197 3197
         $js = '
3198
-            $("#jquery_jplayer_' . $params['count'] . '").jPlayer({
3198
+            $("#jquery_jplayer_' . $params['count'].'").jPlayer({
3199 3199
                 ready: function() {
3200 3200
                     $(this).jPlayer("setMedia", {
3201
-                        ' . $params['extension'] . ' : "' . $params['url'] . '"
3201
+                        ' . $params['extension'].' : "'.$params['url'].'"
3202 3202
                     });
3203 3203
                 },
3204 3204
                 play: function() { // To avoid both jPlayers playing together.
@@ -3206,12 +3206,12 @@  discard block
 block discarded – undo
3206 3206
                 },
3207 3207
                 //errorAlerts: true,
3208 3208
                 //warningAlerts: true,
3209
-                swfPath: "' . $js_path . 'jquery-jplayer/jplayer/",
3209
+                swfPath: "' . $js_path.'jquery-jplayer/jplayer/",
3210 3210
                 //supplied: "m4a, oga, mp3, ogg, wav",
3211
-                supplied: "' . $params['extension'] . '",
3211
+                supplied: "' . $params['extension'].'",
3212 3212
                 wmode: "window",
3213 3213
                 solution: "flash, html",  // Do not change this setting
3214
-                cssSelectorAncestor: "#jp_container_' . $params['count'] . '",
3214
+                cssSelectorAncestor: "#jp_container_' . $params['count'].'",
3215 3215
             });  	 ' . "\n\n";
3216 3216
 
3217 3217
         return $js;
@@ -3241,16 +3241,16 @@  discard block
 block discarded – undo
3241 3241
         }
3242 3242
 
3243 3243
         //Shows only the play button
3244
-        $html = '<div id="jquery_jplayer_' . $i . '" class="jp-jplayer"></div>
3245
-                <div id="jp_container_' . $i . '" class="jp-audio">
3244
+        $html = '<div id="jquery_jplayer_'.$i.'" class="jp-jplayer"></div>
3245
+                <div id="jp_container_' . $i.'" class="jp-audio">
3246 3246
                     <div class="jp-type-single">
3247 3247
                         <div class="jp-gui jp-interface">
3248 3248
                             <ul class="jp-controls">
3249 3249
                                 <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
3250 3250
                                 <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
3251
-                                ' . $extra_controls . '
3251
+                                ' . $extra_controls.'
3252 3252
                             </ul>
3253
-                            ' . $progress . '
3253
+                            ' . $progress.'
3254 3254
                         </div>
3255 3255
                     </div>
3256 3256
                 </div>';
@@ -3303,8 +3303,8 @@  discard block
 block discarded – undo
3303 3303
                     </div>
3304 3304
                 </div>
3305 3305
                 <div class="jp-no-solution">
3306
-                    <span>' . get_lang('UpdateRequire') . '</span>
3307
-                    ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile") . '
3306
+                    <span>' . get_lang('UpdateRequire').'</span>
3307
+                    ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile").'
3308 3308
                 </div>
3309 3309
             </div>
3310 3310
         </div>';
@@ -3385,7 +3385,7 @@  discard block
 block discarded – undo
3385 3385
 
3386 3386
         $add_folder_filter = null;
3387 3387
         if (!empty($filter_by_folder)) {
3388
-            $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'";
3388
+            $add_folder_filter = " AND docs.path LIKE '".Database::escape_string($filter_by_folder)."%'";
3389 3389
         }
3390 3390
 
3391 3391
         // If we are in LP display hidden folder https://support.chamilo.org/issues/6679
@@ -3420,7 +3420,7 @@  discard block
 block discarded – undo
3420 3420
 
3421 3421
                 $notLikeCondition = null;
3422 3422
                 for ($i = 1; $i <= $num; $i++) {
3423
-                    $repeat = str_repeat('/%', $i+1);
3423
+                    $repeat = str_repeat('/%', $i + 1);
3424 3424
                     $notLikeCondition .= " AND docs.path NOT LIKE '".Database::escape_string($cleanedPath.$repeat)."' ";
3425 3425
                 }
3426 3426
 
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
                 ON (docs.id = last.ref AND docs.c_id = last.c_id)
3446 3446
                 WHERE
3447 3447
                     docs.path NOT LIKE '%_DELETED_%' AND
3448
-                    last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND
3448
+                    last.tool = '".TOOL_DOCUMENT."' $condition_session AND
3449 3449
                     (last.visibility = '1' $lp_visibility_condition) AND
3450 3450
                     last.visibility <> 2 AND
3451 3451
                     docs.c_id = {$course_info['real_id']} AND
@@ -3475,7 +3475,7 @@  discard block
 block discarded – undo
3475 3475
                 Display::url(
3476 3476
                     Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL),
3477 3477
                     ' javascript:void(0);',
3478
-                    array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div')
3478
+                    array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div')
3479 3479
                 ),
3480 3480
                 array('style' => 'position:absolute;right:10px')
3481 3481
             );
@@ -3582,7 +3582,7 @@  discard block
 block discarded – undo
3582 3582
                     $('#'+tempId).hide();
3583 3583
                 } else {
3584 3584
                     image.addClass('open');
3585
-                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "');
3585
+                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif')."');
3586 3586
                     $('#'+id).hide();
3587 3587
                     $('#'+tempId).show();
3588 3588
 
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
         $target,
3630 3630
         $overwrite_url
3631 3631
     ) {
3632
-        $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/';
3632
+        $img_sys_path = api_get_path(SYS_CODE_PATH).'img/';
3633 3633
         $web_code_path = api_get_path(WEB_CODE_PATH);
3634 3634
 
3635 3635
         $documentId = $resource['id'];
@@ -3644,7 +3644,7 @@  discard block
 block discarded – undo
3644 3644
         // It's a file.
3645 3645
         $icon = choose_image($path);
3646 3646
         $position = strrpos($icon, '.');
3647
-        $icon = substr($icon, 0, $position) . '_small.gif';
3647
+        $icon = substr($icon, 0, $position).'_small.gif';
3648 3648
         $my_file_title = $resource['title'];
3649 3649
         $visibility = $resource['visibility'];
3650 3650
 
@@ -3656,29 +3656,29 @@  discard block
 block discarded – undo
3656 3656
         // Show the "image name" not the filename of the image.
3657 3657
         if ($lp_id) {
3658 3658
             // LP URL
3659
-            $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $documentId . '&amp;lp_id=' . $lp_id;
3659
+            $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type='.TOOL_DOCUMENT.'&amp;file='.$documentId.'&amp;lp_id='.$lp_id;
3660 3660
             if (!empty($overwrite_url)) {
3661
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.'';
3661
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.'';
3662 3662
             }
3663 3663
         } else {
3664 3664
             // Direct document URL
3665
-            $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId;
3665
+            $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId;
3666 3666
             if (!empty($overwrite_url)) {
3667
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId;
3667
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId;
3668 3668
             }
3669 3669
         }
3670 3670
 
3671 3671
         $img = Display::returnIconPath($icon);
3672
-        if (!file_exists($img_sys_path . $icon)) {
3672
+        if (!file_exists($img_sys_path.$icon)) {
3673 3673
             $img = Display::returnIconPath('default_small.gif');
3674 3674
         }
3675 3675
 
3676 3676
         $link = Display::url(
3677
-            '<img alt="" src="' . $img . '" title="" />&nbsp;' . $my_file_title, $url,
3677
+            '<img alt="" src="'.$img.'" title="" />&nbsp;'.$my_file_title, $url,
3678 3678
             array('target' => $target, 'class' => 'moved')
3679 3679
         );
3680 3680
 
3681
-        $directUrl = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId;
3681
+        $directUrl = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId;
3682 3682
 
3683 3683
         $link .= Display::url(
3684 3684
             Display::return_icon('preview_view.png', get_lang('Preview')),
@@ -3693,12 +3693,12 @@  discard block
 block discarded – undo
3693 3693
         $return = null;
3694 3694
 
3695 3695
         if ($lp_id == false) {
3696
-            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3696
+            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3697 3697
         } else {
3698
-            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3698
+            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3699 3699
         }
3700 3700
 
3701
-        $return .= '<div class="item_data" style="margin-left:' . ($num  * 5 ) . 'px;margin-right:5px;">';
3701
+        $return .= '<div class="item_data" style="margin-left:'.($num * 5).'px;margin-right:5px;">';
3702 3702
 
3703 3703
         if ($add_move_button) {
3704 3704
             $return .= '<a class="moved" href="#">';
@@ -3763,7 +3763,7 @@  discard block
 block discarded – undo
3763 3763
             if (isset($resource['visible']) && $resource['visible'] == 0) {
3764 3764
                 $folder_class_hidden = "doc_folder_hidden"; // in base.css
3765 3765
             }
3766
-            $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
3766
+            $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"';
3767 3767
         }
3768 3768
         $return = null;
3769 3769
 
@@ -3771,22 +3771,22 @@  discard block
 block discarded – undo
3771 3771
             $return = '<ul class="lp_resource">';
3772 3772
         }
3773 3773
 
3774
-        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_' . $resource['id'] . '"  style="margin-left:' . ($num * 18) . 'px; ">';
3774
+        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_'.$resource['id'].'"  style="margin-left:'.($num * 18).'px; ">';
3775 3775
 
3776 3776
         $image = Display::returnIconPath('nolines_plus.gif');
3777 3777
         if (empty($path)) {
3778 3778
             $image = Display::returnIconPath('nolines_minus.gif');
3779 3779
         }
3780
-        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'] . '" '.$onclick.'>';
3780
+        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'].'" '.$onclick.'>';
3781 3781
         $return .= Display::return_icon('lp_folder.gif').'&nbsp;';
3782 3782
         $return .= '<span '.$onclick.' style="cursor: pointer;" >'.$title.'</span>';
3783 3783
         $return .= '</li>';
3784 3784
 
3785 3785
         if (empty($path)) {
3786 3786
             if ($folderId == false) {
3787
-                $return .= '<div id="res_' . $resource['id'] . '" >';
3787
+                $return .= '<div id="res_'.$resource['id'].'" >';
3788 3788
             } else {
3789
-                $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >';
3789
+                $return .= '<div id="res_'.$resource['id'].'" style="display: none;" >';
3790 3790
             }
3791 3791
         }
3792 3792
 
@@ -3948,9 +3948,9 @@  discard block
 block discarded – undo
3948 3948
             $session_id = api_get_session_id();
3949 3949
         }
3950 3950
         $course_info = api_get_course_info($course_code);
3951
-        $course_dir = $course_info['path'] . '/document';
3951
+        $course_dir = $course_info['path'].'/document';
3952 3952
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
3953
-        $base_work_dir = $sys_course_path . $course_dir;
3953
+        $base_work_dir = $sys_course_path.$course_dir;
3954 3954
 
3955 3955
         $course_id = $course_info['real_id'];
3956 3956
         $table_document = Database::get_course_table(TABLE_DOCUMENT);
@@ -3959,7 +3959,7 @@  discard block
 block discarded – undo
3959 3959
         $result = Database::query($qry);
3960 3960
         if (Database::num_rows($result) == 1) {
3961 3961
             $row = Database::fetch_array($result);
3962
-            $doc_path = api_get_path(SYS_COURSE_PATH) . $course_dir . $row['path'];
3962
+            $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
3963 3963
             //TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0
3964 3964
             // now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while
3965 3965
             $doc_mime = mime_content_type($doc_path);
@@ -3990,8 +3990,8 @@  discard block
 block discarded – undo
3990 3990
                 $file_content = self::get_text_content($doc_path, $doc_mime);
3991 3991
                 $course_code = Database::escape_string($course_code);
3992 3992
 
3993
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
3994
-                require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
3993
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
3994
+                require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
3995 3995
 
3996 3996
                 $ic_slide = new IndexableChunk();
3997 3997
                 $ic_slide->addValue('title', $file_title);
@@ -4008,7 +4008,7 @@  discard block
 block discarded – undo
4008 4008
                 $di = new ChamiloIndexer();
4009 4009
                 $return = $di->connectDb(null, null, $lang);
4010 4010
 
4011
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
4011
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
4012 4012
                 $specific_fields = get_specific_field_list();
4013 4013
 
4014 4014
                 // process different depending on what to do if file exists
@@ -4045,7 +4045,7 @@  discard block
 block discarded – undo
4045 4045
                             } else { //if the specific field is not defined, force an empty one
4046 4046
                                 $sterms = '';
4047 4047
                             }
4048
-                            $all_specific_terms .= ' ' . $sterms;
4048
+                            $all_specific_terms .= ' '.$sterms;
4049 4049
                             $sterms = explode(',', $sterms);
4050 4050
                             foreach ($sterms as $sterm) {
4051 4051
                                 $sterm = trim($sterm);
@@ -4059,7 +4059,7 @@  discard block
 block discarded – undo
4059 4059
                             }
4060 4060
                         }
4061 4061
                         // Add terms also to content to make terms findable by probabilistic search
4062
-                        $file_content = $all_specific_terms . ' ' . $file_content;
4062
+                        $file_content = $all_specific_terms.' '.$file_content;
4063 4063
 
4064 4064
                         if (!$simulation) {
4065 4065
                             $ic_slide->addValue('content', $file_content);
@@ -4085,7 +4085,7 @@  discard block
 block discarded – undo
4085 4085
                         } else { //if the specific field is not defined, force an empty one
4086 4086
                             $sterms = '';
4087 4087
                         }
4088
-                        $all_specific_terms .= ' ' . $sterms;
4088
+                        $all_specific_terms .= ' '.$sterms;
4089 4089
                         if (!empty($sterms)) {
4090 4090
                             $sterms = explode(',', $sterms);
4091 4091
                             foreach ($sterms as $sterm) {
@@ -4097,7 +4097,7 @@  discard block
 block discarded – undo
4097 4097
                         }
4098 4098
                     }
4099 4099
                     // Add terms also to content to make terms findable by probabilistic search
4100
-                    $file_content = $all_specific_terms . ' ' . $file_content;
4100
+                    $file_content = $all_specific_terms.' '.$file_content;
4101 4101
                     if (!$simulation) {
4102 4102
                         $ic_slide->addValue('content', $file_content);
4103 4103
                         $di->addChunk($ic_slide);
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
         $defaultVisibility = 'visible';
4381 4381
 
4382 4382
         if (isset($settings['documents'])) {
4383
-            $portalDefaultVisibility =  'invisible';
4383
+            $portalDefaultVisibility = 'invisible';
4384 4384
             if ($settings['documents'] == 'true') {
4385 4385
                 $portalDefaultVisibility = 'visible';
4386 4386
             }
@@ -4620,7 +4620,7 @@  discard block
 block discarded – undo
4620 4620
         //make htaccess with allow from all, and file index.html into temp/audio
4621 4621
         $htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
4622 4622
         if (!file_exists($htaccess)) {
4623
-            $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
4623
+            $htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
4624 4624
             $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
4625 4625
             if ($fp) {
4626 4626
                 fwrite($fp, $htaccess_content);
@@ -4629,9 +4629,9 @@  discard block
 block discarded – undo
4629 4629
         }
4630 4630
 
4631 4631
         //encript temp name file
4632
-        $name_crip = sha1(uniqid());//encript
4633
-        $findext= explode(".", $file);
4634
-        $extension = $findext[count($findext)-1];
4632
+        $name_crip = sha1(uniqid()); //encript
4633
+        $findext = explode(".", $file);
4634
+        $extension = $findext[count($findext) - 1];
4635 4635
         $file_crip = $name_crip.'.'.$extension;
4636 4636
 
4637 4637
         //copy file to temp/audio directory
@@ -4735,7 +4735,7 @@  discard block
 block discarded – undo
4735 4735
         $comment = null;
4736 4736
 
4737 4737
         $fileName = api_replace_dangerous_char($title);
4738
-        $filePath = api_get_path(SYS_COURSE_PATH) . "{$courseData['path']}/document{$dir}";
4738
+        $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['path']}/document{$dir}";
4739 4739
         $fileFullPath = "{$filePath}/{$fileName}.html";
4740 4740
         $fileSize = 0;
4741 4741
         $fileType = 'file';
@@ -4787,7 +4787,7 @@  discard block
 block discarded – undo
4787 4787
             $fileSize,
4788 4788
             $title,
4789 4789
             $comment,
4790
-            0,//$readonly = 0,
4790
+            0, //$readonly = 0,
4791 4791
             true, //$save_visibility = true,
4792 4792
             null, //$group_id = null,
4793 4793
             $sessionId
@@ -5073,8 +5073,8 @@  discard block
 block discarded – undo
5073 5073
             $sessionId,
5074 5074
             $groupId
5075 5075
         )) {
5076
-            $uniqueName = self::addSuffixToFileName($name, '_' . $counter);
5077
-            $filePath = $path . $uniqueName;
5076
+            $uniqueName = self::addSuffixToFileName($name, '_'.$counter);
5077
+            $filePath = $path.$uniqueName;
5078 5078
             $counter++;
5079 5079
         }
5080 5080
 
@@ -5115,7 +5115,7 @@  discard block
 block discarded – undo
5115 5115
                     WHERE 
5116 5116
                         filetype = 'folder' AND 
5117 5117
                         c_id = $course_id AND 
5118
-                        path IN ('" . $folder_sql . "')";
5118
+                        path IN ('".$folder_sql."')";
5119 5119
             $res = Database::query($sql);
5120 5120
             $folder_titles = array();
5121 5121
             while ($obj = Database::fetch_object($res)) {
@@ -5152,9 +5152,9 @@  discard block
 block discarded – undo
5152 5152
                     $folder_titles[$folder] = cut($folder_titles[$folder], 80);
5153 5153
                     $counter = count($path_parts) - 2;
5154 5154
                     if ($counter > 0) {
5155
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter) . ' &mdash; ' . $folder_titles[$folder];
5155
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter).' &mdash; '.$folder_titles[$folder];
5156 5156
                     } else {
5157
-                        $label = ' &mdash; ' . $folder_titles[$folder];
5157
+                        $label = ' &mdash; '.$folder_titles[$folder];
5158 5158
                     }
5159 5159
                     $parent_select->addOption($label, $folder_id);
5160 5160
                     if ($selected != '') {
@@ -5172,7 +5172,7 @@  discard block
 block discarded – undo
5172 5172
                     } else {
5173 5173
                         $path_parts = explode('/', str_replace($group_dir, '', $folder));
5174 5174
                         $label = cut($label, 80);
5175
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
5175
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
5176 5176
                     }
5177 5177
                     $parent_select->addOption($label, $folder_id);
5178 5178
                     if ($selected != '') {
@@ -5205,7 +5205,7 @@  discard block
 block discarded – undo
5205 5205
     ) {
5206 5206
         global $dbl_click_id;
5207 5207
         $course_info = api_get_course_info();
5208
-        $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
5208
+        $www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document';
5209 5209
         $webOdflist = DocumentManager::get_web_odf_extension_list();
5210 5210
 
5211 5211
         // Get the title or the basename depending on what we're using
@@ -5229,11 +5229,11 @@  discard block
 block discarded – undo
5229 5229
 
5230 5230
         if (!$show_as_icon) {
5231 5231
             // Build download link (icon)
5232
-            $forcedownload_link = ($filetype == 'folder') ? api_get_self() . '?' . api_get_cidreq() . '&action=downloadfolder&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5232
+            $forcedownload_link = ($filetype == 'folder') ? api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5233 5233
             // Folder download or file download?
5234 5234
             $forcedownload_icon = ($filetype == 'folder') ? 'save_pack.png' : 'save.png';
5235 5235
             // Prevent multiple clicks on zipped folder download
5236
-            $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_" . ($dbl_click_id++) . "=false;',10000); } else { return false; }\"" : '';
5236
+            $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"" : '';
5237 5237
         }
5238 5238
 
5239 5239
         $target = '_self';
@@ -5249,17 +5249,17 @@  discard block
 block discarded – undo
5249 5249
 
5250 5250
             if ($is_browser_viewable_file) {
5251 5251
                 if ($ext == 'pdf' || in_array($ext, $webOdflist)) {
5252
-                    $url = api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5252
+                    $url = api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5253 5253
                 } else {
5254
-                    $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5254
+                    $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5255 5255
                 }
5256 5256
             } else {
5257 5257
                 // url-encode for problematic characters (we may not call them dangerous characters...)
5258
-                $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
5259
-                $url = $www . $path;
5258
+                $path = str_replace('%2F', '/', $url_path).'?'.api_get_cidreq();
5259
+                $url = $www.$path;
5260 5260
             }
5261 5261
         } else {
5262
-            $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
5262
+            $url = api_get_self().'?'.api_get_cidreq().'&id='.$document_data['id'];
5263 5263
         }
5264 5264
 
5265 5265
         // The little download icon
@@ -5269,10 +5269,10 @@  discard block
 block discarded – undo
5269 5269
         if ($path == '/shared_folder') {
5270 5270
             $tooltip_title_alt = get_lang('UserFolders');
5271 5271
         } elseif (strstr($path, 'shared_folder_session_')) {
5272
-            $tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')';
5272
+            $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name(api_get_session_id()).')';
5273 5273
         } elseif (strstr($tooltip_title, 'sf_user_')) {
5274 5274
             $userinfo = api_get_user_info(substr($tooltip_title, 8));
5275
-            $tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5275
+            $tooltip_title_alt = get_lang('UserFolder').' '.$userinfo['complete_name'];
5276 5276
         } elseif ($path == '/chat_files') {
5277 5277
             $tooltip_title_alt = get_lang('ChatFiles');
5278 5278
         } elseif ($path == '/learning_path') {
@@ -5304,35 +5304,35 @@  discard block
 block discarded – undo
5304 5304
                 ) {
5305 5305
                     //filter when I am into shared folder, I can show for donwload only my shared folder
5306 5306
                     if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) {
5307
-                        if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5308
-                            preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5307
+                        if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5308
+                            preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5309 5309
                             api_is_allowed_to_edit() || api_is_platform_admin()
5310 5310
                         ) {
5311
-                            $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5312
-                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5311
+                            $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5312
+                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5313 5313
                         }
5314 5314
                     } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) ||
5315 5315
                         api_is_allowed_to_edit() ||
5316 5316
                         api_is_platform_admin()
5317 5317
                     ) {
5318
-                        $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5319
-                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5318
+                        $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5319
+                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5320 5320
                     }
5321 5321
                 }
5322 5322
             } else {
5323
-                $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5324
-                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5323
+                $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5324
+                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5325 5325
             }
5326 5326
 
5327 5327
             // Copy files to users myfiles
5328 5328
             if (api_get_setting('allow_my_files') === 'true' &&
5329 5329
                 api_get_setting('users_copy_files') === 'true'
5330 5330
             ) {
5331
-                $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
5331
+                $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq();
5332 5332
                 if ($filetype == 'file') {
5333 5333
 
5334
-                    $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5335
-                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5334
+                    $copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5335
+                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5336 5336
 
5337 5337
                     if (api_get_setting('allow_my_files') === 'false') {
5338 5338
                         $copy_to_myfiles = '';
@@ -5351,13 +5351,13 @@  discard block
 block discarded – undo
5351 5351
                 $filetype == 'file' &&
5352 5352
                 in_array($extension, array('html', 'htm'))
5353 5353
             ) {
5354
-                $pdf_icon = ' <a style="float:right".' . $prevent_multiple_click . ' href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $document_data['id'] . '">' .
5355
-                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a> ';
5354
+                $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$document_data['id'].'">'.
5355
+                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> ';
5356 5356
             }
5357 5357
 
5358 5358
             if ($is_browser_viewable_file) {
5359
-                $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' .
5360
-                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5359
+                $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'.
5360
+                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5361 5361
             }
5362 5362
 
5363 5363
             if ($filetype == 'file') {
@@ -5366,9 +5366,9 @@  discard block
 block discarded – undo
5366 5366
                     (preg_match('/wav$/i', urldecode($checkExtension))) ||
5367 5367
                     preg_match('/ogg$/i', urldecode($checkExtension))
5368 5368
                 ) {
5369
-                    return '<span style="float:left" ' . $visibility_class . '>' .
5370
-                    $title .
5371
-                    '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5369
+                    return '<span style="float:left" '.$visibility_class.'>'.
5370
+                    $title.
5371
+                    '</span>'.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5372 5372
                 } elseif (
5373 5373
 
5374 5374
                     // Show preview
@@ -5381,7 +5381,7 @@  discard block
 block discarded – undo
5381 5381
                     preg_match('/svg$/i', urldecode($checkExtension))
5382 5382
                 ) {
5383 5383
                     // Simpler version of showinframesmin.php with no headers
5384
-                    $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5384
+                    $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id'];
5385 5385
                     $class = 'ajax';
5386 5386
                     if ($visibility == false) {
5387 5387
                         $class = "ajax text-muted";
@@ -5396,34 +5396,34 @@  discard block
 block discarded – undo
5396 5396
                             'style' => 'float: left;'
5397 5397
                         ]
5398 5398
                     )
5399
-                    . $force_download_html . $send_to . $copy_to_myfiles
5400
-                    . $open_in_new_window_link . $pdf_icon;
5399
+                    . $force_download_html.$send_to.$copy_to_myfiles
5400
+                    . $open_in_new_window_link.$pdf_icon;
5401 5401
                 } else {
5402 5402
                     // For PDF Download the file.
5403 5403
                     $pdfPreview = null;
5404 5404
                     if ($ext != 'pdf' && !in_array($ext, $webOdflist)) {
5405
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5405
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5406 5406
                     } else {
5407 5407
                         $pdfPreview = Display::url(
5408 5408
                             Display::return_icon('preview.gif', get_lang('Preview')),
5409
-                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'],
5409
+                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'],
5410 5410
                             array('style' => 'float:right')
5411 5411
                         );
5412 5412
                     }
5413 5413
                     // No plugin just the old and good showinframes.php page
5414
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' .
5415
-                    $pdfPreview.$force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5414
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" style="float:left" '.$visibility_class.' >'.$title.'</a>'.
5415
+                    $pdfPreview.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5416 5416
                 }
5417 5417
             } else {
5418
-                return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . $title . '</a>' .
5419
-                $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5418
+                return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.$title.'</a>'.
5419
+                $force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5420 5420
             }
5421 5421
             // end copy files to users myfiles
5422 5422
         } else {
5423 5423
             // Icon column
5424 5424
             if (preg_match('/shared_folder/', urldecode($checkExtension)) &&
5425 5425
                 preg_match('/shared_folder$/', urldecode($checkExtension)) == false &&
5426
-                preg_match('/shared_folder_session_' . $current_session_id . '$/', urldecode($url)) == false
5426
+                preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url)) == false
5427 5427
             ) {
5428 5428
                 if ($filetype == 'file') {
5429 5429
                     //Sound preview with jplayer
@@ -5443,19 +5443,19 @@  discard block
 block discarded – undo
5443 5443
                         preg_match('/bmp$/i', urldecode($checkExtension)) ||
5444 5444
                         preg_match('/svg$/i', urldecode($checkExtension))
5445 5445
                     ) {
5446
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5447
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5448
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5449
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5446
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5447
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5448
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5449
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5450 5450
                     } else {
5451
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5452
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5453
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5451
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5452
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5453
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5454 5454
                     }
5455 5455
                 } else {
5456
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5457
-                    DocumentManager::build_document_icon_tag($filetype, $path) .
5458
-                    Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5456
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5457
+                    DocumentManager::build_document_icon_tag($filetype, $path).
5458
+                    Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5459 5459
                 }
5460 5460
             } else {
5461 5461
                 if ($filetype == 'file') {
@@ -5478,16 +5478,16 @@  discard block
 block discarded – undo
5478 5478
                         preg_match('/bmp$/i', urldecode($checkExtension)) ||
5479 5479
                         preg_match('/svg$/i', urldecode($checkExtension))
5480 5480
                     ) {
5481
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview
5482
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5483
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5481
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; //without preview
5482
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5483
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5484 5484
                     } else {
5485
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5486
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5485
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5486
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5487 5487
                     }
5488 5488
                 } else {
5489
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5490
-                    DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5489
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5490
+                    DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5491 5491
                 }
5492 5492
             }
5493 5493
         }
@@ -5522,13 +5522,13 @@  discard block
 block discarded – undo
5522 5522
                 $userinfo = api_get_user_info(substr($basename, 8));
5523 5523
                 $icon = $userinfo['avatar_small'];
5524 5524
 
5525
-                $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5525
+                $basename = get_lang('UserFolder').' '.$userinfo['complete_name'];
5526 5526
                 $user_image = true;
5527 5527
             } elseif (strstr($path, 'shared_folder_session_')) {
5528 5528
                 if ($is_allowed_to_edit) {
5529
-                    $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
5529
+                    $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder');
5530 5530
                 } else {
5531
-                    $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
5531
+                    $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')';
5532 5532
                 }
5533 5533
                 $icon = 'folder_users.png';
5534 5534
             } else {
@@ -5637,16 +5637,16 @@  discard block
 block discarded – undo
5637 5637
         // Build URL-parameters for table-sorting
5638 5638
         $sort_params = array();
5639 5639
         if (isset($_GET['column'])) {
5640
-            $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']);
5640
+            $sort_params[] = 'column='.Security::remove_XSS($_GET['column']);
5641 5641
         }
5642 5642
         if (isset($_GET['page_nr'])) {
5643
-            $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']);
5643
+            $sort_params[] = 'page_nr='.Security::remove_XSS($_GET['page_nr']);
5644 5644
         }
5645 5645
         if (isset($_GET['per_page'])) {
5646
-            $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']);
5646
+            $sort_params[] = 'per_page='.Security::remove_XSS($_GET['per_page']);
5647 5647
         }
5648 5648
         if (isset($_GET['direction'])) {
5649
-            $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']);
5649
+            $sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']);
5650 5650
         }
5651 5651
         $sort_params = implode('&amp;', $sort_params);
5652 5652
         $visibility_icon = ($visibility == 0) ? 'invisible' : 'visible';
@@ -5659,89 +5659,89 @@  discard block
 block discarded – undo
5659 5659
         if ($is_read_only /* or ($session_id!=api_get_session_id()) */) {
5660 5660
             if (api_is_course_admin() || api_is_platform_admin()) {
5661 5661
                 if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5662
-                    $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5663
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5664
-                } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5665
-                    $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5666
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5662
+                    $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5663
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5664
+                } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5665
+                    $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5666
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5667 5667
                 } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5668
-                    $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5669
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5668
+                    $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5669
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5670 5670
                 } else {
5671
-                    $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' .
5672
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5671
+                    $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5672
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5673 5673
                 }
5674 5674
             } else {
5675 5675
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5676 5676
             }
5677
-            $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5677
+            $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5678 5678
             if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5679
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5679
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5680 5680
             }
5681
-            $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5681
+            $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5682 5682
         } else {
5683 5683
             //Edit button
5684 5684
             if (in_array($path, DocumentManager::get_system_folders())) {
5685 5685
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5686
-            } elseif ($is_certificate_mode ) {
5686
+            } elseif ($is_certificate_mode) {
5687 5687
                 // gradebook category doesn't seem to be taken into account
5688
-                $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5688
+                $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'&curdirpath=/certificates">'.Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5689 5689
             } else {
5690 5690
                 if (api_get_session_id()) {
5691 5691
                     if ($document_data['session_id'] == api_get_session_id()) {
5692 5692
                         if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5693
-                            $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5694
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5695
-                        } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5696
-                            $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5697
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5693
+                            $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5694
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5695
+                        } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5696
+                            $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5697
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5698 5698
                         } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5699
-                            $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5700
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5699
+                            $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5700
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5701 5701
                         } else {
5702
-                            $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5703
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5702
+                            $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5703
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5704 5704
                         }
5705 5705
                     } else {
5706
-                        $modify_icons .= '&nbsp;' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
5706
+                        $modify_icons .= '&nbsp;'.Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
5707 5707
                     }
5708 5708
                 } else {
5709 5709
                     if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5710
-                        $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5711
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5712
-                    } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5713
-                        $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5714
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5710
+                        $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5711
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5712
+                    } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5713
+                        $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5714
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5715 5715
                     } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5716
-                        $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
5717
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5716
+                        $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5717
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5718 5718
                     } else {
5719
-                        $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5720
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5719
+                        $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5720
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5721 5721
                     }
5722 5722
                 }
5723 5723
             }
5724 5724
 
5725 5725
             // Move button.
5726 5726
             if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) {
5727
-                $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5727
+                $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5728 5728
             } else {
5729 5729
                 if (api_get_session_id()) {
5730 5730
                     if ($document_data['session_id'] == api_get_session_id()) {
5731
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5732
-                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5731
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5732
+                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5733 5733
                     } else {
5734
-                        $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5734
+                        $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5735 5735
                     }
5736 5736
                 } else {
5737
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5738
-                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5737
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5738
+                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5739 5739
                 }
5740 5740
             }
5741 5741
 
5742 5742
             //Visibility button
5743 5743
             if ($is_certificate_mode) {
5744
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL) . '</a>';
5744
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL).'</a>';
5745 5745
             } else {
5746 5746
                 if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5747 5747
                     if ($visibility_icon == 'invisible') {
@@ -5749,14 +5749,14 @@  discard block
 block discarded – undo
5749 5749
                     } else {
5750 5750
                         $tip_visibility = get_lang('Hide');
5751 5751
                     }
5752
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;' . $visibility_command . '=' . $id . '&amp;' . $sort_params . '">' .
5753
-                        Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>';
5752
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;'.$visibility_command.'='.$id.'&amp;'.$sort_params.'">'.
5753
+                        Display::return_icon($visibility_icon.'.png', $tip_visibility, '', ICON_SIZE_SMALL).'</a>';
5754 5754
                 }
5755 5755
             }
5756 5756
 
5757 5757
             // Delete button
5758 5758
             if (in_array($path, DocumentManager::get_system_folders())) {
5759
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5759
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5760 5760
             } else {
5761 5761
                 $titleToShow = addslashes(basename($document_data['title']));
5762 5762
 
@@ -5764,23 +5764,23 @@  discard block
 block discarded – undo
5764 5764
                     $_GET['curdirpath'] == '/certificates' &&
5765 5765
                     DocumentManager::get_default_certificate_id(api_get_course_int_id()) == $id
5766 5766
                 ) {
5767
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
5768
-                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5767
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'delete_certificate_id='.$id.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5768
+                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5769 5769
                 } else {
5770 5770
                     if ($is_certificate_mode) {
5771
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id  . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
5772
-                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5771
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5772
+                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5773 5773
                     } else {
5774 5774
                         if (api_get_session_id()) {
5775 5775
                             if ($document_data['session_id'] == api_get_session_id()) {
5776
-                                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id  . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'.
5777
-                                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5776
+                                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5777
+                                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5778 5778
                             } else {
5779
-                                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5779
+                                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5780 5780
                             }
5781 5781
                         } else {
5782
-                            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' .
5783
-                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5782
+                            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5783
+                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5784 5784
                         }
5785 5785
                     }
5786 5786
                 }
@@ -5792,15 +5792,15 @@  discard block
 block discarded – undo
5792 5792
                 // nothing to do
5793 5793
             } else {
5794 5794
                 if ($usePpt2lp && $formatType) {
5795
-                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" ' .
5796
-                        'data-documentId = ' . $document_id .
5797
-                        ' data-formatType = ' . $formatType . '>' .
5795
+                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" '.
5796
+                        'data-documentId = '.$document_id.
5797
+                        ' data-formatType = '.$formatType.'>'.
5798 5798
                         Display::return_icon(
5799 5799
                             'convert.png',
5800 5800
                             get_lang('Convert'),
5801 5801
                             array(),
5802 5802
                             ICON_SIZE_SMALL
5803
-                        ) . '</a>';
5803
+                        ).'</a>';
5804 5804
                 }
5805 5805
             }
5806 5806
         }
@@ -5808,8 +5808,8 @@  discard block
 block discarded – undo
5808 5808
         if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) {
5809 5809
             if ($is_template == 0) {
5810 5810
                 if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) {
5811
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;add_as_template=' . $id .  '&amp;' . $sort_params . '">' .
5812
-                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>';
5811
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;add_as_template='.$id.'&amp;'.$sort_params.'">'.
5812
+                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL).'</a>';
5813 5813
                 }
5814 5814
                 if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course
5815 5815
                     $visibility_icon_certificate = 'nocertificate';
@@ -5823,21 +5823,21 @@  discard block
 block discarded – undo
5823 5823
                         $certificate = get_lang('NoDefaultCertificate');
5824 5824
                     }
5825 5825
                     if (isset($_GET['selectcat'])) {
5826
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;selectcat=' . intval($_GET['selectcat']) . '&amp;set_certificate=' . $id . '&amp;' . $sort_params . '">';
5826
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;selectcat='.intval($_GET['selectcat']).'&amp;set_certificate='.$id.'&amp;'.$sort_params.'">';
5827 5827
                         $modify_icons .= Display::return_icon($visibility_icon_certificate.'.png', $certificate);
5828 5828
                         $modify_icons .= '</a>';
5829 5829
                         if ($is_preview) {
5830
-                            $modify_icons .= '&nbsp;<a target="_blank"  href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;set_preview=' . $id . '&amp;' . $sort_params . '" >' .
5831
-                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>';
5830
+                            $modify_icons .= '&nbsp;<a target="_blank"  href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;set_preview='.$id.'&amp;'.$sort_params.'" >'.
5831
+                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL).'</a>';
5832 5832
                         }
5833 5833
                     }
5834 5834
                 }
5835 5835
             } else {
5836
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&amp;remove_as_template=' . $id. '&amp;' . $sort_params . '">' .
5837
-                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>';
5836
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;remove_as_template='.$id.'&amp;'.$sort_params.'">'.
5837
+                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL).'</a>';
5838 5838
             }
5839
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' .
5840
-                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>';
5839
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$id.'">'.
5840
+                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a>';
5841 5841
         }
5842 5842
 
5843 5843
         return $modify_icons;
@@ -5909,7 +5909,7 @@  discard block
 block discarded – undo
5909 5909
                     // 3. inside a subfolder of the folder you want to move
5910 5910
                     if (($curdirpath != $folder) &&
5911 5911
                         ($folder != $move_file) &&
5912
-                        (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5912
+                        (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5913 5913
                     ) {
5914 5914
                         $path_displayed = $folder;
5915 5915
                         // If document title is used, we have to display titles instead of real paths...
@@ -5926,7 +5926,7 @@  discard block
 block discarded – undo
5926 5926
             foreach ($folders as $folder) {
5927 5927
                 if (($curdirpath != $folder) &&
5928 5928
                     ($folder != $move_file) &&
5929
-                    (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5929
+                    (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5930 5930
                 ) {
5931 5931
                     // Cannot copy dir into his own subdir
5932 5932
                     $path_displayed = DocumentManager::get_titles_of_path($folder);
@@ -5969,10 +5969,10 @@  discard block
 block discarded – undo
5969 5969
                 // If this path has soon been stored here we don't need a new query
5970 5970
                 $path_displayed .= $tmp_folders_titles[$tmp_path];
5971 5971
             } else {
5972
-                $sql = 'SELECT title FROM ' . Database::get_course_table(TABLE_DOCUMENT) . '
5973
-                    WHERE c_id = ' . $course_id . ' AND path LIKE BINARY "' . $tmp_path . '"';
5972
+                $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).'
5973
+                    WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"';
5974 5974
                 $rs = Database::query($sql);
5975
-                $tmp_title = '/' . Database::result($rs, 0, 0);
5975
+                $tmp_title = '/'.Database::result($rs, 0, 0);
5976 5976
                 $path_displayed .= $tmp_title;
5977 5977
                 $tmp_folders_titles[$tmp_path] = $tmp_title;
5978 5978
             }
@@ -6009,7 +6009,7 @@  discard block
 block discarded – undo
6009 6009
         $clean_curdirpath = Security::remove_XSS($curdirpath);
6010 6010
         if ($clean_curdirpath == '/shared_folder') {
6011 6011
             return true;
6012
-        } elseif ($clean_curdirpath == '/shared_folder_session_' . $current_session_id) {
6012
+        } elseif ($clean_curdirpath == '/shared_folder_session_'.$current_session_id) {
6013 6013
             return true;
6014 6014
         } else {
6015 6015
             return false;
@@ -6025,7 +6025,7 @@  discard block
 block discarded – undo
6025 6025
         $clean_path = Security::remove_XSS($path);
6026 6026
         if (strpos($clean_path, 'shared_folder/sf_user_')) {
6027 6027
             return true;
6028
-        } elseif (strpos($clean_path, 'shared_folder_session_' . $current_session_id . '/sf_user_')) {
6028
+        } elseif (strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')) {
6029 6029
             return true;
6030 6030
         } else {
6031 6031
             return false;
@@ -6038,11 +6038,11 @@  discard block
 block discarded – undo
6038 6038
      */
6039 6039
     public static function is_my_shared_folder($user_id, $path, $current_session_id)
6040 6040
     {
6041
-        $clean_path = Security::remove_XSS($path) . '/';
6041
+        $clean_path = Security::remove_XSS($path).'/';
6042 6042
         //for security does not remove the last slash
6043
-        $main_user_shared_folder = '/shared_folder\/sf_user_' . $user_id . '\//';
6043
+        $main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//';
6044 6044
         //for security does not remove the last slash
6045
-        $main_user_shared_folder_session = '/shared_folder_session_' . $current_session_id . '\/sf_user_' . $user_id . '\//';
6045
+        $main_user_shared_folder_session = '/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//';
6046 6046
 
6047 6047
         if (preg_match($main_user_shared_folder, $clean_path)) {
6048 6048
             return true;
@@ -6315,7 +6315,7 @@  discard block
 block discarded – undo
6315 6315
                 ON (i.c_id = d.c_id)
6316 6316
                 WHERE
6317 6317
                     d.id = i.ref AND
6318
-                    i.tool = '" . TOOL_DOCUMENT . "'
6318
+                    i.tool = '".TOOL_DOCUMENT."'
6319 6319
                     $conditionSession AND
6320 6320
                     i.c_id = $courseId AND
6321 6321
                     d.c_id = $courseId ";
@@ -6323,9 +6323,9 @@  discard block
 block discarded – undo
6323 6323
         $result = Database::query($sql);
6324 6324
         $documents = Database::store_result($result, 'ASSOC');
6325 6325
         if ($documents) {
6326
-            $course_dir = $courseInfo['directory'] . '/document';
6326
+            $course_dir = $courseInfo['directory'].'/document';
6327 6327
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
6328
-            $base_work_dir = $sys_course_path . $course_dir;
6328
+            $base_work_dir = $sys_course_path.$course_dir;
6329 6329
 
6330 6330
             foreach ($documents as $document) {
6331 6331
                 $documentId = $document['id'];
Please login to merge, or discard this patch.
main/gradebook/lib/be/category.class.php 1 patch
Indentation   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
         Database::query($sql);
748 748
     }
749 749
 
750
-     /**
751
-     * Delete this category from the database
752
-     * @param int $courseId
753
-     */
750
+        /**
751
+         * Delete this category from the database
752
+         * @param int $courseId
753
+         */
754 754
     public static function deleteCategoryFromCourse($courseId)
755 755
     {
756 756
         $table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
@@ -1617,7 +1617,6 @@  discard block
 block discarded – undo
1617 1617
      * @param string $course_code Course code (optional)
1618 1618
      * @param int    $session_id Session ID (optional)
1619 1619
      * @param bool   $order
1620
-
1621 1620
      * @return array Array of subcategories
1622 1621
      */
1623 1622
     public function get_subcategories($stud_id = null, $course_code = null, $session_id = null, $order = null)
@@ -1896,7 +1895,6 @@  discard block
 block discarded – undo
1896 1895
      * This function, locks a category , only one who can unlock it is
1897 1896
      * the platform administrator.
1898 1897
      * @param int locked 1 or unlocked 0
1899
-
1900 1898
      * @return boolean|null
1901 1899
      * */
1902 1900
     public function lock($locked)
Please login to merge, or discard this patch.