Completed
Pull Request — 1.11.x (#1628)
by José
97:30 queued 69:06
created
main/course_home/vertical_activity.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     // Show message to confirm that a tool it to be hidden from available tools
38 38
     // visibility 0,1->2
39 39
     if (!empty($_GET['askDelete'])) {
40
-        $content .='<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
40
+        $content .= '<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
41 41
             <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
42 42
             <a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a>
43 43
         </div>';
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 
56 56
 // Start of tools for CourseAdmins (teachers/tutors)
57 57
 if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
58
-    $content .=  '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px;">
58
+    $content .= '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px;">
59 59
     <div class="normal-message" id="id_normal_message" style="display:none">';
60
-        $content .=  '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
61
-        $content .=  get_lang('PleaseStandBy');
60
+        $content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
61
+        $content .= get_lang('PleaseStandBy');
62 62
 
63
-    $content .=  '</div>
63
+    $content .= '</div>
64 64
         <div class="confirmation-message" id="id_confirmation_message" style="display:none"></div></div>';
65
-    $content .=  '<div id="activity-3col">';
65
+    $content .= '<div id="activity-3col">';
66 66
 
67 67
     if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
68 68
         $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span>
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
         $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span>
91 91
             <table width="100%">';
92 92
                 $content .= CourseHome::show_session_data($session_id);
93
-             $content .=  '</table></div>';
93
+             $content .= '</table></div>';
94 94
     }
95 95
 
96
-    $content .=  '<div class="Authoringview">';
96
+    $content .= '<div class="Authoringview">';
97 97
                 $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
98 98
                 $content .= CourseHome::show_tools_category($my_list);
99 99
     $content .= '</div>';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $order_tool_list = array();
107 107
         foreach ($my_list as $key => $new_tool) {
108 108
             $tool_name = CourseHome::translate_tool_name($new_tool);
109
-            $order_tool_list [$key]= $tool_name;
109
+            $order_tool_list [$key] = $tool_name;
110 110
         }
111 111
         natsort($order_tool_list);
112 112
         $my_temp_tool_array = array();
Please login to merge, or discard this patch.
main/course_description/listing.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@  discard block
 block discarded – undo
11 11
 api_protect_course_script(true);
12 12
 
13 13
 // display actions menu
14
-if (api_is_allowed_to_edit(null,true)) {
14
+if (api_is_allowed_to_edit(null, true)) {
15 15
     $categories = array();
16 16
     foreach ($default_description_titles as $id => $title) {
17 17
         $categories[$id] = $title;
18 18
     }
19 19
     $categories[ADD_BLOCK] = get_lang('NewBloc');
20 20
 
21
-	$i=1;
21
+	$i = 1;
22 22
 	echo '<div class="actions" style="margin-bottom:30px">';
23 23
 	ksort($categories);
24 24
 	foreach ($categories as $id => $title) {
25
-		if ($i==ADD_BLOCK) {
25
+		if ($i == ADD_BLOCK) {
26 26
 			echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
27 27
                 Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
28 28
 			break;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             <tr>
44 44
                 <td><h3>'.get_lang('ThematicAdvanceHistory').'</h3></td>
45 45
                 <td align="right"><a href="index.php?action=listing">'.
46
-                Display::return_icon('info.png',get_lang('BackToCourseDesriptionList'), array('style'=>'vertical-align:middle;'),ICON_SIZE_SMALL).' '.get_lang('BackToCourseDesriptionList').'</a></td></tr></table></div>';
46
+                Display::return_icon('info.png', get_lang('BackToCourseDesriptionList'), array('style'=>'vertical-align:middle;'), ICON_SIZE_SMALL).' '.get_lang('BackToCourseDesriptionList').'</a></td></tr></table></div>';
47 47
 }
48 48
 
49 49
 $user_info = api_get_user_info();
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 	foreach ($descriptions as $id => $description) {
53 53
         if (!empty($description)) {
54 54
             $actions = '';
55
-            if (api_is_allowed_to_edit(null,true) && !$history) {
55
+            if (api_is_allowed_to_edit(null, true) && !$history) {
56 56
                 if (api_get_session_id() == $description['session_id']) {
57 57
                     $description['title'] = $description['title'].' '.api_get_session_image(api_get_session_id(), $user_info['status']);
58 58
 
59 59
                     // delete
60
-                    $actions .= '<a href="'.api_get_self().'?id='.$description['id'].'&'.api_get_cidreq_params(api_get_course_id(), $description['session_id']).'&action=delete&description_type='.$description['description_type'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,api_get_system_encoding())).'\')) return false;">';
61
-                    $actions .= Display::return_icon('delete.png', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'),ICON_SIZE_SMALL);
60
+                    $actions .= '<a href="'.api_get_self().'?id='.$description['id'].'&'.api_get_cidreq_params(api_get_course_id(), $description['session_id']).'&action=delete&description_type='.$description['description_type'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, api_get_system_encoding())).'\')) return false;">';
61
+                    $actions .= Display::return_icon('delete.png', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'), ICON_SIZE_SMALL);
62 62
                     $actions .= '</a> ';
63 63
 
64 64
                     // edit
65 65
                     $actions .= '<a href="'.api_get_self().'?id='.$description['id'].'&'.api_get_cidreq_params(api_get_course_id(), $description['session_id']).'&action=edit&description_type='.$description['description_type'].'">';
66
-                    $actions .= Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align:middle;float:right; padding-right:4px;'),ICON_SIZE_SMALL);
66
+                    $actions .= Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align:middle;float:right; padding-right:4px;'), ICON_SIZE_SMALL);
67 67
                     $actions .= '</a> ';
68 68
                 } else {
69
-                    $actions .= Display::return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array('style' => 'vertical-align:middle;float:right;'),ICON_SIZE_SMALL);
69
+                    $actions .= Display::return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array('style' => 'vertical-align:middle;float:right;'), ICON_SIZE_SMALL);
70 70
                 }
71 71
             }
72 72
             echo Display::panel(
Please login to merge, or discard this patch.
main/course_description/edit.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
 }
35 35
 $categories[ADD_BLOCK] = get_lang('NewBloc');
36 36
 
37
-$i=1;
37
+$i = 1;
38 38
 echo '<div class="actions" style="margin-bottom:30px">';
39 39
 echo '<a href="index.php?'.api_get_cidreq().'">'.
40
-		Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
40
+		Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ToolCourseDescription'), '', ICON_SIZE_MEDIUM).
41 41
 	'</a>';
42 42
 
43 43
 ksort($categories);
44 44
 foreach ($categories as $id => $title) {
45
-	if ($i==ADD_BLOCK) {
45
+	if ($i == ADD_BLOCK) {
46 46
 		echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
47
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
47
+			Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
48 48
 		break;
49 49
 	} else {
50 50
 		echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
51
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
51
+			Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
52 52
 		$i++;
53 53
 	}
54 54
 }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 // error messages
58 58
 if (isset($error) && intval($error) == 1) {
59
-	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
59
+	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
60 60
 }
61 61
 
62 62
 // default header title form
Please login to merge, or discard this patch.
main/inc/lib/attendance.lib.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             $course_id = intval($course_id);
74 74
         }
75 75
 
76
-        $session_id = isset($session_id)?intval($session_id):api_get_session_id();
76
+        $session_id = isset($session_id) ? intval($session_id) : api_get_session_id();
77 77
         $condition_session = api_get_session_condition($session_id);
78 78
 
79 79
         // Get attendance data
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $from = intval($from);
109 109
         $number_of_items = intval($number_of_items);
110 110
 
111
-        if (!in_array($direction, array('ASC','DESC'))) {
111
+        if (!in_array($direction, array('ASC', 'DESC'))) {
112 112
             $direction = 'ASC';
113 113
         }
114 114
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 LIMIT $from,$number_of_items ";
136 136
 
137 137
         $res = Database::query($sql);
138
-        $attendances = array ();
138
+        $attendances = array();
139 139
         $user_info = api_get_user_info();
140 140
         $allowDelete = api_get_setting('allow_delete_attendance');
141 141
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
                         $attendance[2] = '<span class="muted">'.$attendance[2].'</span>';
191 191
                     }
192 192
                     if ($allowDelete === 'true') {
193
-                        $actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0]. '">' .
194
-                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
193
+                        $actions .= '<a href="index.php?'.api_get_cidreq().'&action=attendance_delete&attendance_id='.$attendance[0].'">'.
194
+                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
195 195
                     }
196 196
                 } else {
197 197
                     $is_locked_attendance = self::is_locked_attendance($attendance[0]);
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
                             $attendance[2] = '<span class="muted">'.$attendance[2].'</span>';
212 212
                         }
213 213
                         if ($allowDelete === 'true') {
214
-                            $actions .= ' <a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0].'">' .
215
-                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
214
+                            $actions .= ' <a href="index.php?'.api_get_cidreq().'&action=attendance_delete&attendance_id='.$attendance[0].'">'.
215
+                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
216 216
                         }
217 217
                     }
218 218
                 }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                 $is_done_all_calendar = self::is_all_attendance_calendar_done($attendance[0]);
222 222
 
223 223
                 if ($is_done_all_calendar) {
224
-                    $locked   = $attendance[4];
224
+                    $locked = $attendance[4];
225 225
                     if ($locked == 0) {
226 226
                         if (api_is_platform_admin()) {
227 227
                             $message_alert = get_lang('AreYouSureToLockTheAttendance');
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 }
242 242
                 $actions .= '</center>';
243 243
 
244
-                $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3],$actions);
244
+                $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3], $actions);
245 245
             } else {
246 246
                 $attendance[0] = '&nbsp;';
247 247
                 $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3]);
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
     public function attendance_add($link_to_gradebook = false)
283 283
     {
284 284
         $_course = api_get_course_info();
285
-        $tbl_attendance	= Database :: get_course_table(TABLE_ATTENDANCE);
285
+        $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
286 286
         $table_link = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
287 287
         $session_id = api_get_session_id();
288 288
         $user_id = api_get_user_id();
289 289
         $course_code = $_course['code'];
290 290
         $course_id = $_course['real_id'];
291
-        $title_gradebook= $this->attendance_qualify_title;
291
+        $title_gradebook = $this->attendance_qualify_title;
292 292
         $value_calification = 0;
293 293
         $weight_calification = floatval($this->attendance_weight);
294 294
 
@@ -434,12 +434,12 @@  discard block
 block discarded – undo
434 434
     public function attendance_restore($attendance_id)
435 435
     {
436 436
         $_course = api_get_course_info();
437
-        $tbl_attendance	= Database :: get_course_table(TABLE_ATTENDANCE);
437
+        $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
438 438
         $user_id = api_get_user_id();
439 439
         $course_id = $_course['real_id'];
440 440
         if (is_array($attendance_id)) {
441 441
             foreach ($attendance_id as $id) {
442
-                $id	= intval($id);
442
+                $id = intval($id);
443 443
                 $sql = "UPDATE $tbl_attendance SET active = 1
444 444
                         WHERE c_id = $course_id AND id = '$id'";
445 445
                 $result = Database::query($sql);
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
                     );
456 456
                 }
457 457
             }
458
-        } else  {
459
-            $attendance_id	= intval($attendance_id);
458
+        } else {
459
+            $attendance_id = intval($attendance_id);
460 460
             $sql = "UPDATE $tbl_attendance SET active = 1
461 461
                     WHERE c_id = $course_id AND id = '$attendance_id'";
462 462
             $result = Database::query($sql);
@@ -484,13 +484,13 @@  discard block
 block discarded – undo
484 484
     public function attendance_delete($attendance_id)
485 485
     {
486 486
         $_course = api_get_course_info();
487
-        $tbl_attendance	= Database :: get_course_table(TABLE_ATTENDANCE);
487
+        $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
488 488
         $user_id = api_get_user_id();
489 489
         $course_id = $_course['real_id'];
490 490
 
491 491
         if (is_array($attendance_id)) {
492 492
             foreach ($attendance_id as $id) {
493
-                $id	= intval($id);
493
+                $id = intval($id);
494 494
                 $sql = "UPDATE $tbl_attendance SET active = 2
495 495
                         WHERE c_id = $course_id AND id = '$id'";
496 496
                 $result = Database::query($sql);
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
                     );
507 507
                 }
508 508
             }
509
-        } else  {
510
-            $attendance_id= intval($attendance_id);
509
+        } else {
510
+            $attendance_id = intval($attendance_id);
511 511
             $sql = "UPDATE $tbl_attendance SET active = 2
512 512
                     WHERE c_id = $course_id AND id = '$attendance_id'";
513 513
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     public function changeVisibility($attendanceId, $status = 1)
539 539
     {
540 540
         $_course = api_get_course_info();
541
-        $tbl_attendance	= Database :: get_course_table(TABLE_ATTENDANCE);
541
+        $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
542 542
         $user_id = api_get_user_id();
543 543
         $course_id = $_course['real_id'];
544 544
         $status = intval($status);
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 
551 551
         if (is_array($attendanceId)) {
552 552
             foreach ($attendanceId as $id) {
553
-                $id	= intval($id);
553
+                $id = intval($id);
554 554
                 $sql = "UPDATE $tbl_attendance SET active = $status
555 555
                         WHERE c_id = $course_id AND id = '$id'";
556 556
                 $result = Database::query($sql);
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
                     api_item_property_update($_course, TOOL_ATTENDANCE, $id, $action, $user_id);
561 561
                 }
562 562
             }
563
-        } else  {
564
-            $attendanceId	= intval($attendanceId);
563
+        } else {
564
+            $attendanceId = intval($attendanceId);
565 565
             $sql = "UPDATE $tbl_attendance SET active = $status
566 566
                     WHERE c_id = $course_id AND id = '$attendanceId'";
567 567
             $result = Database::query($sql);
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
         $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
592 592
         $course_id = api_get_course_int_id();
593 593
         $attendance_id = intval($attendance_id);
594
-        $locked = ($lock)?1:0;
594
+        $locked = ($lock) ? 1 : 0;
595 595
         $upd = "UPDATE $tbl_attendance SET locked = $locked
596 596
                 WHERE c_id = $course_id AND id = $attendance_id";
597 597
         $result = Database::query($upd);
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
      */
721 721
     public function attendance_sheet_add($calendar_id, $users_present, $attendance_id)
722 722
     {
723
-        $tbl_attendance_sheet 	= Database::get_course_table(TABLE_ATTENDANCE_SHEET);
724
-        $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
723
+        $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
724
+        $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
725 725
 
726 726
         $calendar_id = intval($calendar_id);
727 727
         $attendance_id = intval($attendance_id);
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
         $course_id = api_get_course_int_id();
730 730
 
731 731
         $user_ids = array_keys($users);
732
-        $users_absent = array_diff($user_ids,$users_present);
732
+        $users_absent = array_diff($user_ids, $users_present);
733 733
         $affected_rows = 0;
734 734
 
735 735
         // get last edit type
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
         }
1013 1013
 
1014 1014
         $faults = $faults > 0 ? $faults : 0;
1015
-        $faults_porcent = $calendar_count > 0 ?round(($faults*100)/$calendar_count,0):0;
1015
+        $faults_porcent = $calendar_count > 0 ? round(($faults * 100) / $calendar_count, 0) : 0;
1016 1016
         $results['faults'] = $faults;
1017 1017
         $results['total'] = $calendar_count;
1018 1018
         $results['faults_porcent'] = $faults_porcent;
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
             //$course_code = $course['code'];
1047 1047
             //$course_info = api_get_course_info($course_code);
1048 1048
             $course_id = $course['real_id'];
1049
-            $tbl_attendance_result 	= Database::get_course_table(TABLE_ATTENDANCE_RESULT);
1049
+            $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
1050 1050
 
1051 1051
             $attendances_by_course = $this->get_attendances_list($course_id);
1052 1052
 
1053 1053
             foreach ($attendances_by_course as $attendance) {
1054 1054
                 // get total faults and total weight
1055
-                $total_done_attendance 	= $attendance['attendance_qualify_max'];
1055
+                $total_done_attendance = $attendance['attendance_qualify_max'];
1056 1056
                 $sql = "SELECT score
1057 1057
                         FROM $tbl_attendance_result
1058 1058
                         WHERE
@@ -1065,16 +1065,16 @@  discard block
 block discarded – undo
1065 1065
                     $row = Database::fetch_array($rs);
1066 1066
                     $score = $row['score'];
1067 1067
                 }
1068
-                $faults = $total_done_attendance-$score;
1069
-                $faults = $faults > 0 ? $faults:0;
1068
+                $faults = $total_done_attendance - $score;
1069
+                $faults = $faults > 0 ? $faults : 0;
1070 1070
                 $total_faults += $faults;
1071 1071
                 $total_weight += $total_done_attendance;
1072 1072
             }
1073 1073
         }
1074 1074
 
1075
-        $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0;
1075
+        $porcent = $total_weight > 0 ? round(($total_faults * 100) / $total_weight, 0) : 0;
1076 1076
         $results['faults'] 	= $total_faults;
1077
-        $results['total']	= $total_weight;
1077
+        $results['total'] = $total_weight;
1078 1078
         $results['porcent'] = $porcent;
1079 1079
 
1080 1080
         return $results;
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
     {
1093 1093
         // Database tables and variables
1094 1094
         $course_info = api_get_course_info($course_code);
1095
-        $tbl_attendance_result 	= Database::get_course_table(TABLE_ATTENDANCE_RESULT);
1095
+        $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
1096 1096
         $user_id = intval($user_id);
1097 1097
         $results = array();
1098 1098
         $total_faults = $total_weight = $porcent = 0;
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
         foreach ($attendances_by_course as $attendance) {
1102 1102
             // Get total faults and total weight
1103
-            $total_done_attendance 	= $attendance['attendance_qualify_max'];
1103
+            $total_done_attendance = $attendance['attendance_qualify_max'];
1104 1104
             $sql = "SELECT score FROM $tbl_attendance_result
1105 1105
                     WHERE
1106 1106
                         c_id = {$course_info['real_id']} AND
@@ -1112,15 +1112,15 @@  discard block
 block discarded – undo
1112 1112
                 $row = Database::fetch_array($rs);
1113 1113
                 $score = $row['score'];
1114 1114
             }
1115
-            $faults = $total_done_attendance-$score;
1116
-            $faults = $faults > 0 ? $faults:0;
1115
+            $faults = $total_done_attendance - $score;
1116
+            $faults = $faults > 0 ? $faults : 0;
1117 1117
             $total_faults += $faults;
1118 1118
             $total_weight += $total_done_attendance;
1119 1119
         }
1120 1120
 
1121
-        $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0;
1121
+        $porcent = $total_weight > 0 ? round(($total_faults * 100) / $total_weight, 0) : 0;
1122 1122
         $results['faults'] 	= $total_faults;
1123
-        $results['total']	= $total_weight;
1123
+        $results['total'] = $total_weight;
1124 1124
         $results['porcent'] = $porcent;
1125 1125
 
1126 1126
         return $results;
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
      */
1135 1135
     public function get_users_attendance_sheet($attendance_id, $user_id = 0, $groupId = null)
1136 1136
     {
1137
-        $tbl_attendance_sheet 	= Database::get_course_table(TABLE_ATTENDANCE_SHEET);
1138
-        $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
1137
+        $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
1138
+        $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
1139 1139
 
1140 1140
         $attendance_calendar = $this->get_attendance_calendar($attendance_id, 'all', null, $groupId);
1141 1141
         $calendar_ids = array();
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
                             WHERE
1158 1158
                                 c_id = $course_id AND
1159 1159
                                 user_id = '$uid' AND
1160
-                                attendance_calendar_id IN(".implode(',',$calendar_ids).")
1160
+                                attendance_calendar_id IN(".implode(',', $calendar_ids).")
1161 1161
                             ";
1162 1162
                     $res = Database::query($sql);
1163 1163
                     if (Database::num_rows($res) > 0) {
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
                             att.c_id = $course_id AND
1180 1180
                             cal.c_id =  $course_id AND
1181 1181
                             att.user_id = '$user_id' AND
1182
-                            att.attendance_calendar_id IN (".implode(',',$calendar_ids).")
1182
+                            att.attendance_calendar_id IN (".implode(',', $calendar_ids).")
1183 1183
                         ORDER BY date_time";
1184 1184
                 $res = Database::query($sql);
1185 1185
                 if (Database::num_rows($res) > 0) {
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
      */
1258 1258
     public function get_user_score($user_id, $attendance_id, $groupId = null)
1259 1259
     {
1260
-        $tbl_attendance_result 	= Database::get_course_table(TABLE_ATTENDANCE_RESULT);
1260
+        $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
1261 1261
         $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
1262 1262
         $tbl_attendance_cal_rel_group = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR_REL_GROUP);
1263 1263
         $tbl_attendance_cal = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
                    ";
1371 1371
         }
1372 1372
 
1373
-        if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done','calendar_id'))) {
1373
+        if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done', 'calendar_id'))) {
1374 1374
             $type = 'all';
1375 1375
         }
1376 1376
 
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
             case 'calendar_id':
1379 1379
                 $calendar_id = intval($calendar_id);
1380 1380
                 if (!empty($calendar_id)) {
1381
-                    $sql.= " AND c.id = $calendar_id";
1381
+                    $sql .= " AND c.id = $calendar_id";
1382 1382
                 }
1383 1383
                 break;
1384 1384
             case 'today':
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
         $rs = Database::query($sql);
1400 1400
         $data = array();
1401 1401
         if (Database::num_rows($rs) > 0) {
1402
-            while ($row = Database::fetch_array($rs,'ASSOC')) {
1402
+            while ($row = Database::fetch_array($rs, 'ASSOC')) {
1403 1403
                 $row['db_date_time'] = $row['date_time'];
1404 1404
                 $row['date_time'] = api_get_local_time($row['date_time']);
1405 1405
                 $row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT);
@@ -1764,14 +1764,14 @@  discard block
 block discarded – undo
1764 1764
      * @param   int     The number of years to add
1765 1765
      * @return  int     The new timestamp
1766 1766
      */
1767
-    private function add_month($timestamp, $num=1)
1767
+    private function add_month($timestamp, $num = 1)
1768 1768
     {
1769 1769
         $values = api_get_utc_datetime($timestamp);
1770
-        $values = str_replace(array(':','-',' '), '/', $values);
1771
-        list($y, $m, $d, $h, $n, $s) = split('/',$values);
1772
-        if($m+$num>12) {
1773
-            $y += floor($num/12);
1774
-            $m += $num%12;
1770
+        $values = str_replace(array(':', '-', ' '), '/', $values);
1771
+        list($y, $m, $d, $h, $n, $s) = split('/', $values);
1772
+        if ($m + $num > 12) {
1773
+            $y += floor($num / 12);
1774
+            $m += $num % 12;
1775 1775
         } else {
1776 1776
             $m += $num;
1777 1777
         }
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
      * @param	bool	true for removing all calendar inside current attendance, false for removing by calendar id
1830 1830
      * @return	int affected rows
1831 1831
      */
1832
-    public function attendance_calendar_delete($calendar_id, $attendance_id , $all_delete = false)
1832
+    public function attendance_calendar_delete($calendar_id, $attendance_id, $all_delete = false)
1833 1833
     {
1834 1834
         $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
1835 1835
         $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 
1987 1987
         $dateTimeStartOriginal = new DateTime($startDate);
1988 1988
         $dateTimeStart = new DateTime($startDate);
1989
-        $dateTimeEnd= new DateTime($endDate);
1989
+        $dateTimeEnd = new DateTime($endDate);
1990 1990
         $interval = $dateTimeStart->diff($dateTimeEnd);
1991 1991
         $days = intval($interval->format('%a'));
1992 1992
 
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
                 0,
2060 2060
                 $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')'
2061 2061
             );
2062
-            $row ++;
2062
+            $row++;
2063 2063
         }
2064 2064
 
2065 2065
         $column = 1;
@@ -2136,7 +2136,7 @@  discard block
 block discarded – undo
2136 2136
         $tableToString = $table->toHtml();
2137 2137
 
2138 2138
         $params = array(
2139
-            'filename' => get_lang('Attendance') . '_' . api_get_utc_datetime(),
2139
+            'filename' => get_lang('Attendance').'_'.api_get_utc_datetime(),
2140 2140
             'pdf_title' => get_lang('Attendance'),
2141 2141
             'course_code' => api_get_course_id(),
2142 2142
             'show_real_course_teachers' => true
Please login to merge, or discard this patch.
main/inc/lib/app_view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      * @param string  tool name (optional)
17 17
      * @param string $template_path
18 18
      */
19
-    public function __construct($toolname = '', $template_path=null)
19
+    public function __construct($toolname = '', $template_path = null)
20 20
     {
21 21
         if (!empty($toolname)) {
22 22
             if (isset($template_path)) {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             if (is_dir($path)) {
28 28
                 $this->tool_path = $path;
29 29
             } else {
30
-                throw new Exception('View::__construct() $path directory does not exist ' . $path);
30
+                throw new Exception('View::__construct() $path directory does not exist '.$path);
31 31
             }
32 32
         }
33 33
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function set_data($data)
40 40
     {
41 41
         if (!is_array($data)) {
42
-            throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data ));
42
+            throw new Exception('View::set_data() $data must to be an array, you have sent a'.gettype($data));
43 43
         }
44 44
         $this->data = $data;
45 45
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param string layout view
50 50
      * @param string $layout
51 51
      */
52
-    public function set_layout( $layout )
52
+    public function set_layout($layout)
53 53
     {
54 54
         $this->layout = $layout;
55 55
     }
Please login to merge, or discard this patch.
main/course_progress/thematic_plan.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 // actions menu
11 11
 $new_thematic_plan_data = array();
12 12
 if (!empty($thematic_plan_data))
13
-foreach($thematic_plan_data as $thematic_item) {
13
+foreach ($thematic_plan_data as $thematic_item) {
14 14
     $thematic_simple_list[] = $thematic_item['description_type'];
15 15
     $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
16 16
 }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     }
26 26
 }
27 27
 
28
-$i=1;
28
+$i = 1;
29 29
 
30 30
 echo Display::tag('h2', $thematic_data['title']);
31 31
 echo $thematic_data['content'];
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
             $thematic_plan = null;
68 68
         } else {
69 69
             $thematic_plan = null;
70
-            $default['title['.$id.']']       = $title;
71
-            $default['description['.$id.']']= '';
70
+            $default['title['.$id.']'] = $title;
71
+            $default['description['.$id.']'] = '';
72 72
         }
73 73
         $form->setDefaults($default);
74 74
     }
Please login to merge, or discard this patch.
main/chat/chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 ];
18 18
 
19 19
 foreach ($externalCSS as $css) {
20
-    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . $css);
20
+    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css);
21 21
 }
22 22
 
23
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css');
24
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'markdown.css');
23
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
24
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css');
25 25
 
26 26
 $externalJS = [
27 27
     'highlight/highlight.pack.js',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         continue;
42 42
     }
43 43
 
44
-    $iconList[$key] = strtoupper($icon) . '.png';
44
+    $iconList[$key] = strtoupper($icon).'.png';
45 45
 }
46 46
 
47 47
 $view = new Template(get_lang('Chat'), false, false, false, true, false);
Please login to merge, or discard this patch.
main/inc/lib/extra_field_option.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
                         foreach ($sub_options as $sub_option) {
218 218
                             if (!empty($sub_option)) {
219
-                                $new_params  = array(
219
+                                $new_params = array(
220 220
                                     'field_id' => $field_id,
221 221
                                     'option_value' => $sub_id,
222 222
                                     'display_text' => $sub_option,
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $form->addElement('hidden', 'field_id', $this->field_id);
661 661
 
662 662
         if ($action == 'edit') {
663
-            $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
663
+            $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([
664 664
                 'extra_field_option' => $id
665 665
             ]);
666 666
             $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');
Please login to merge, or discard this patch.
main/exercise/question.class.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public $type;
23 23
     public $level;
24 24
     public $picture;
25
-    public $exerciseList;  // array with the list of exercises which this question is in
25
+    public $exerciseList; // array with the list of exercises which this question is in
26 26
     public $category_list;
27 27
     public $parent_id;
28 28
     public $category;
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
             'multiple_answer_combination_true_false.class.php',
48 48
             'MultipleAnswerCombinationTrueFalse'
49 49
         ),
50
-        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'),
51
-        CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'),
50
+        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'),
51
+        CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'),
52 52
         UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
53 53
         DRAGGABLE => ['Draggable.php', 'Draggable'],
54 54
         MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable']
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
         $id = intval($id);
108 108
 
109 109
         if (!empty($course_id)) {
110
-            $course_info =  api_get_course_info_by_id($course_id);
110
+            $course_info = api_get_course_info_by_id($course_id);
111 111
         } else {
112 112
             $course_info = api_get_course_info();
113 113
         }
114 114
 
115 115
         $course_id = $course_info['real_id'];
116 116
 
117
-        if (empty($course_id) || $course_id == -1 ) {
117
+        if (empty($course_id) || $course_id == -1) {
118 118
 
119 119
             return false;
120 120
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     public function selectPicturePath()
270 270
     {
271 271
         if (!empty($this->picture)) {
272
-            return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture;
272
+            return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture;
273 273
         }
274 274
 
275 275
         return '';
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      */
307 307
     public function updateTitle($title)
308 308
     {
309
-        $this->question=$title;
309
+        $this->question = $title;
310 310
     }
311 311
 
312 312
     /**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                     // DO nothing
406 406
                 } else {
407 407
                     $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id)
408
-                            VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)";
408
+                            VALUES (".api_get_course_int_id().", $question_id, $category_id)";
409 409
                     Database::query($sql);
410 410
                 }
411 411
             }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             $sql = "SELECT count(*) AS nb FROM $table
433 433
                     WHERE
434 434
                         question_id = $question_id AND
435
-                        c_id=" . api_get_course_int_id();
435
+                        c_id=".api_get_course_int_id();
436 436
             $res = Database::query($sql);
437 437
             $row = Database::fetch_array($res);
438 438
             if ($row['nb'] > 0) {
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
                         SET category_id = $category_id
441 441
                         WHERE
442 442
                             question_id = $question_id AND
443
-                            c_id = " . api_get_course_int_id();
443
+                            c_id = ".api_get_course_int_id();
444 444
                 Database::query($sql);
445 445
             } else {
446 446
                 $sql = "INSERT INTO $table (c_id, question_id, category_id)
447
-                        VALUES (" . api_get_course_int_id().", $question_id, $category_id)";
447
+                        VALUES (".api_get_course_int_id().", $question_id, $category_id)";
448 448
                 Database::query($sql);
449 449
             }
450 450
         }
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         $sql = "DELETE FROM $table
463 463
                 WHERE
464 464
                     question_id = $question_id AND
465
-                    c_id = " . api_get_course_int_id();
465
+                    c_id = ".api_get_course_int_id();
466 466
         Database::query($sql);
467 467
     }
468 468
 
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
             ) {
516 516
                 // removes old answers
517 517
                 $sql = "DELETE FROM $TBL_REPONSES
518
-                        WHERE c_id = $course_id AND question_id = " . intval($this->id);
518
+                        WHERE c_id = $course_id AND question_id = ".intval($this->id);
519 519
                 Database::query($sql);
520 520
             }
521 521
 
522
-            $this->type=$type;
522
+            $this->type = $type;
523 523
         }
524 524
     }
525 525
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
         if (!file_exists($picturePath)) {
544 544
             if (mkdir($picturePath, api_get_permissions_for_new_directories())) {
545 545
                 // document path
546
-                $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document";
546
+                $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path']."/document";
547 547
                 $path = str_replace($documentPath, '', $picturePath);
548 548
                 $title_path = basename($picturePath);
549 549
                 $doc_id = add_document($this->course, $path, 'folder', 0, $title_path);
@@ -559,14 +559,14 @@  discard block
 block discarded – undo
559 559
 
560 560
         // if the question has got an ID
561 561
         if ($this->id) {
562
-            $this->picture = 'quiz-' . $this->id . '.jpg';
562
+            $this->picture = 'quiz-'.$this->id.'.jpg';
563 563
             $o_img = new Image($Picture);
564
-            $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg');
564
+            $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg');
565 565
             $document_id = add_document(
566 566
                 $this->course,
567
-                '/images/' . $this->picture,
567
+                '/images/'.$this->picture,
568 568
                 'file',
569
-                filesize($picturePath . '/' . $this->picture),
569
+                filesize($picturePath.'/'.$this->picture),
570 570
                 $this->picture
571 571
             );
572 572
             if ($document_id) {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         // if the question has an ID
601 601
         if ($this->id) {
602 602
             // Get dimensions from current image.
603
-            $my_image = new Image($picturePath . '/' . $this->picture);
603
+            $my_image = new Image($picturePath.'/'.$this->picture);
604 604
 
605 605
             $current_image_size = $my_image->get_image_size();
606 606
             $current_width = $current_image_size['width'];
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             }
641 641
 
642 642
             $my_image->resize($new_width, $new_height);
643
-            $result = $my_image->send_image($picturePath . '/' . $this->picture);
643
+            $result = $my_image->send_image($picturePath.'/'.$this->picture);
644 644
 
645 645
             if ($result) {
646 646
                 return true;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
             $picture = $this->picture;
666 666
             $this->picture = '';
667 667
 
668
-            return @unlink($picturePath . '/' . $picture) ? true : false;
668
+            return @unlink($picturePath.'/'.$picture) ? true : false;
669 669
         }
670 670
 
671 671
         return false;
@@ -682,27 +682,27 @@  discard block
 block discarded – undo
682 682
     {
683 683
         $course_id = $course_info['real_id'];
684 684
         $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
685
-        $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images';
686
-        $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images';
685
+        $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images';
686
+        $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images';
687 687
 
688 688
         // if the question has got an ID and if the picture exists
689 689
         if ($this->id && !empty($this->picture)) {
690 690
             $picture = explode('.', $this->picture);
691 691
             $extension = $picture[sizeof($picture) - 1];
692
-            $picture = 'quiz-' . $questionId . '.' . $extension;
693
-            $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false;
692
+            $picture = 'quiz-'.$questionId.'.'.$extension;
693
+            $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false;
694 694
             // If copy was correct then add to the database
695 695
             if ($result) {
696 696
                 $sql = "UPDATE $TBL_QUESTIONS SET
697
-                        picture = '" . Database::escape_string($picture) . "'
698
-                        WHERE c_id = $course_id AND id='" . intval($questionId) . "'";
697
+                        picture = '".Database::escape_string($picture)."'
698
+                        WHERE c_id = $course_id AND id='".intval($questionId)."'";
699 699
                 Database::query($sql);
700 700
 
701 701
                 $document_id = add_document(
702 702
                     $course_info,
703
-                    '/images/' . $picture,
703
+                    '/images/'.$picture,
704 704
                     'file',
705
-                    filesize($destination_path . '/' . $picture),
705
+                    filesize($destination_path.'/'.$picture),
706 706
                     $picture
707 707
                 );
708 708
                 if ($document_id) {
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         $Extension = $PictureName[sizeof($PictureName) - 1];
738 738
 
739 739
         // saves the picture into a temporary file
740
-        @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension);
740
+        @move_uploaded_file($Picture, $picturePath.'/tmp.'.$Extension);
741 741
     }
742 742
 
743 743
     /**
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 
772 772
         // if the question has got an ID and if the picture exists
773 773
         if ($this->id) {
774
-            if (file_exists($picturePath . '/tmp.jpg')) {
774
+            if (file_exists($picturePath.'/tmp.jpg')) {
775 775
                 $Extension = 'jpg';
776
-            } elseif (file_exists($picturePath . '/tmp.gif')) {
776
+            } elseif (file_exists($picturePath.'/tmp.gif')) {
777 777
                 $Extension = 'gif';
778
-            } elseif (file_exists($picturePath . '/tmp.png')) {
778
+            } elseif (file_exists($picturePath.'/tmp.png')) {
779 779
                 $Extension = 'png';
780 780
             }
781
-            $this->picture = 'quiz-' . $this->id . '.' . $Extension;
782
-            return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false;
781
+            $this->picture = 'quiz-'.$this->id.'.'.$Extension;
782
+            return @rename($picturePath.'/tmp.'.$Extension, $picturePath.'/'.$this->picture) ? true : false;
783 783
         }
784 784
         return false;
785 785
     }
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $category = $this->category;
810 810
 
811 811
         // question already exists
812
-        if(!empty($id)) {
812
+        if (!empty($id)) {
813 813
 
814 814
             $params = [
815 815
                 'question' => $question,
@@ -855,12 +855,12 @@  discard block
 block discarded – undo
855 855
                     $TBL_EXERCISE_QUESTION as test_question
856 856
                     WHERE
857 857
                         question.id = test_question.question_id AND
858
-                        test_question.exercice_id = " . intval($exerciseId) . " AND
858
+                        test_question.exercice_id = ".intval($exerciseId)." AND
859 859
                         question.c_id = $c_id AND
860 860
                         test_question.c_id = $c_id ";
861
-            $result	= Database::query($sql);
862
-            $current_position = Database::result($result,0,0);
863
-            $this->updatePosition($current_position+1);
861
+            $result = Database::query($sql);
862
+            $current_position = Database::result($result, 0, 0);
863
+            $this->updatePosition($current_position + 1);
864 864
             $position = $this->position;
865 865
 
866 866
             $params = [
@@ -956,10 +956,10 @@  discard block
 block discarded – undo
956 956
         }
957 957
     }
958 958
 
959
-    public function search_engine_edit($exerciseId, $addQs=false, $rmQs=false)
959
+    public function search_engine_edit($exerciseId, $addQs = false, $rmQs = false)
960 960
     {
961 961
         // update search engine and its values table if enabled
962
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
962
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
963 963
             $course_id = api_get_course_id();
964 964
             // get search_did
965 965
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@@ -977,8 +977,8 @@  discard block
 block discarded – undo
977 977
             $res = Database::query($sql);
978 978
 
979 979
             if (Database::num_rows($res) > 0 || $addQs) {
980
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
981
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
980
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
981
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
982 982
 
983 983
                 $di = new ChamiloIndexer();
984 984
                 if ($addQs) {
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 
992 992
                 // retrieve others exercise ids
993 993
                 $se_ref = Database::fetch_array($res);
994
-                $se_doc = $di->get_document((int)$se_ref['search_did']);
994
+                $se_doc = $di->get_document((int) $se_ref['search_did']);
995 995
                 if ($se_doc !== FALSE) {
996 996
                     if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) {
997 997
                         $se_doc_data = unserialize($se_doc_data);
@@ -1029,16 +1029,16 @@  discard block
 block discarded – undo
1029 1029
                     SE_DATA => array(
1030 1030
                         'type' => SE_DOCTYPE_EXERCISE_QUESTION,
1031 1031
                         'exercise_ids' => $question_exercises,
1032
-                        'question_id' => (int)$this->id
1032
+                        'question_id' => (int) $this->id
1033 1033
                     ),
1034
-                    SE_USER => (int)api_get_user_id(),
1034
+                    SE_USER => (int) api_get_user_id(),
1035 1035
                 );
1036 1036
                 $ic_slide->xapian_data = serialize($xapian_data);
1037 1037
                 $ic_slide->addValue("content", $this->description);
1038 1038
 
1039 1039
                 //TODO: index answers, see also form validation on question_admin.inc.php
1040 1040
 
1041
-                $di->remove_document((int)$se_ref['search_did']);
1041
+                $di->remove_document((int) $se_ref['search_did']);
1042 1042
                 $di->addChunk($ic_slide);
1043 1043
 
1044 1044
                 //index and return search engine document id
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
             $count = $new_exercise->selectNbrQuestions();
1118 1118
             $count++;
1119 1119
             $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order)
1120
-                    VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')";
1120
+                    VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')";
1121 1121
             Database::query($sql);
1122 1122
 
1123 1123
             // we do not want to reindex if we had just saved adnd indexed the question
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         $course_id = api_get_course_int_id();
1147 1147
 
1148 1148
         // exercise not found
1149
-        if($pos === false) {
1149
+        if ($pos === false) {
1150 1150
             return false;
1151 1151
         } else {
1152 1152
             // deletes the position in the array containing the wanted exercise ID
@@ -1156,17 +1156,17 @@  discard block
 block discarded – undo
1156 1156
                     FROM $TBL_EXERCISE_QUESTION
1157 1157
                     WHERE
1158 1158
                         c_id = $course_id
1159
-                        AND question_id = " . intval($id) . "
1159
+                        AND question_id = ".intval($id)."
1160 1160
                         AND exercice_id = " . intval($exerciseId);
1161 1161
             $res = Database::query($sql);
1162
-            if (Database::num_rows($res)>0) {
1162
+            if (Database::num_rows($res) > 0) {
1163 1163
                 $row = Database::fetch_array($res);
1164 1164
                 if (!empty($row['question_order'])) {
1165 1165
                     $sql = "UPDATE $TBL_EXERCISE_QUESTION
1166 1166
                         SET question_order = question_order-1
1167 1167
                         WHERE
1168 1168
                             c_id = $course_id
1169
-                            AND exercice_id = " . intval($exerciseId) . "
1169
+                            AND exercice_id = ".intval($exerciseId)."
1170 1170
                             AND question_order > " . $row['question_order'];
1171 1171
                     Database::query($sql);
1172 1172
                 }
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
1176 1176
                     WHERE
1177 1177
                         c_id = $course_id
1178
-                        AND question_id = " . intval($id) . "
1178
+                        AND question_id = ".intval($id)."
1179 1179
                         AND exercice_id = " . intval($exerciseId);
1180 1180
             Database::query($sql);
1181 1181
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
                                 SET question_order = question_order-1
1217 1217
                                 WHERE
1218 1218
                                     c_id= $course_id
1219
-                                    AND exercice_id = " . intval($row['exercice_id']) . "
1219
+                                    AND exercice_id = ".intval($row['exercice_id'])."
1220 1220
                                     AND question_order > " . $row['question_order'];
1221 1221
                         Database::query($sql);
1222 1222
                     }
@@ -1224,22 +1224,22 @@  discard block
 block discarded – undo
1224 1224
             }
1225 1225
 
1226 1226
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
1227
-                    WHERE c_id = $course_id AND question_id = " . $id;
1227
+                    WHERE c_id = $course_id AND question_id = ".$id;
1228 1228
             Database::query($sql);
1229 1229
 
1230 1230
             $sql = "DELETE FROM $TBL_QUESTIONS
1231
-                    WHERE c_id = $course_id AND id = " . $id;
1231
+                    WHERE c_id = $course_id AND id = ".$id;
1232 1232
             Database::query($sql);
1233 1233
 
1234 1234
             $sql = "DELETE FROM $TBL_REPONSES
1235
-                    WHERE c_id = $course_id AND question_id = " . $id;
1235
+                    WHERE c_id = $course_id AND question_id = ".$id;
1236 1236
             Database::query($sql);
1237 1237
 
1238 1238
             // remove the category of this question in the question_rel_category table
1239 1239
             $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY
1240 1240
                     WHERE 
1241 1241
                         c_id = $course_id AND 
1242
-                        question_id = " . $id;
1242
+                        question_id = ".$id;
1243 1243
             Database::query($sql);
1244 1244
 
1245 1245
             api_item_property_update(
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
                 if (class_exists($class_name)) {
1409 1409
                     return new $class_name();
1410 1410
                 } else {
1411
-                    echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type;
1411
+                    echo 'Can\'t instanciate class '.$class_name.' of type '.$type;
1412 1412
                 }
1413 1413
             }
1414 1414
         }
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
         // Question type
1452 1452
         $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
1453
-        $form->addElement('hidden','answerType', $answerType);
1453
+        $form->addElement('hidden', 'answerType', $answerType);
1454 1454
 
1455 1455
         // html editor
1456 1456
         $editorConfig = array(
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
             'Height' => '150'
1459 1459
         );
1460 1460
 
1461
-        if (!api_is_allowed_to_edit(null,true)) {
1461
+        if (!api_is_allowed_to_edit(null, true)) {
1462 1462
             $editorConfig['UserStatus'] = 'student';
1463 1463
         }
1464 1464
 
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
         if ($feedback_type == 1) {
1597 1597
             //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
1598
-            $question_type_custom_list = array (
1598
+            $question_type_custom_list = array(
1599 1599
                 UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER],
1600 1600
                 HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION]
1601 1601
             );
@@ -1611,14 +1611,14 @@  discard block
 block discarded – undo
1611 1611
             require_once $a_type[0];
1612 1612
             // get the picture of the type and the langvar which describes it
1613 1613
             $img = $explanation = '';
1614
-            eval('$img = ' . $a_type[1] . '::$typePicture;');
1615
-            eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);');
1614
+            eval('$img = '.$a_type[1].'::$typePicture;');
1615
+            eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
1616 1616
             echo '<li>';
1617 1617
             echo '<div class="icon-image">';
1618 1618
 
1619 1619
 
1620
-            $icon = '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' .
1621
-                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>';
1620
+            $icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.
1621
+                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
1622 1622
 
1623 1623
             if ($objExercise->force_edit_exercise_in_lp === false) {
1624 1624
                 if ($objExercise->exercise_was_added_in_lp == true) {
@@ -1639,9 +1639,9 @@  discard block
 block discarded – undo
1639 1639
             echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
1640 1640
         } else {
1641 1641
             if ($feedback_type == 1) {
1642
-                echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">";
1642
+                echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">";
1643 1643
             } else {
1644
-                echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">';
1644
+                echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">';
1645 1645
             }
1646 1646
             echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
1647 1647
         }
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
             $header .= $this->show_media_content();
1779 1779
         }
1780 1780
 
1781
-        $header .= Display::page_subheader2($counter_label . ". " . $question_title);
1781
+        $header .= Display::page_subheader2($counter_label.". ".$question_title);
1782 1782
         $header .= Display::div(
1783 1783
             "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>",
1784 1784
             array('class' => 'ribbon')
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
     public function create_question(
1801 1801
         $quiz_id,
1802 1802
         $question_name,
1803
-        $question_description = "" ,
1803
+        $question_description = "",
1804 1804
         $max_score = 0,
1805 1805
         $type = 1,
1806 1806
         $level = 1
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
         require_once $tabQuestionList[$type][0];
1871 1871
 
1872 1872
         $img = $explanation = null;
1873
-        eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
1874
-        eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
1873
+        eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;');
1874
+        eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);');
1875 1875
         return array($img, $explanation);
1876 1876
     }
1877 1877
 
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
         $media_list[0] = get_lang('NoMedia');
1937 1937
 
1938 1938
         if (!empty($medias)) {
1939
-            foreach($medias as $media) {
1939
+            foreach ($medias as $media) {
1940 1940
                 $media_list[$media['id']] = empty($media['question']) ? get_lang('Untitled') : $media['question'];
1941 1941
             }
1942 1942
         }
Please login to merge, or discard this patch.