Completed
Push — 1.11.x ( d84d27...922b6f )
by José
30:17
created
main/inc/lib/myspace.lib.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2097,7 +2097,9 @@
 block discarded – undo
2097 2097
                 FROM $tbl_course course
2098 2098
                 WHERE course.code IN (".implode(',',$courses_code).")";
2099 2099
 
2100
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2100
+        if (!in_array($direction, array('ASC','DESC'))) {
2101
+            $direction = 'ASC';
2102
+        }
2101 2103
 
2102 2104
         $column = intval($column);
2103 2105
         $from = intval($from);
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $session_id  = intval($session_id);
135 135
 
136 136
         $sql = 'SELECT login_course_date, logout_course_date
137
-                FROM ' . $tbl_track_course . '
137
+                FROM ' . $tbl_track_course.'
138 138
                 WHERE
139 139
                     user_id = '.$user_id.' AND
140 140
                     c_id = '.$courseId.' AND
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         foreach ($course_list as $course_item) {
174 174
             $courseInfo = api_get_course_info($course_item['code']);
175 175
             $courseId = $courseInfo['real_id'];
176
-            $new_course_list[] =  '"'.$courseId.'"';
176
+            $new_course_list[] = '"'.$courseId.'"';
177 177
         }
178 178
         $course_list = implode(', ', $new_course_list);
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             return false;
182 182
         }
183 183
         $sql = 'SELECT login_course_date, logout_course_date, c_id
184
-                FROM ' . $tbl_track_course . '
184
+                FROM ' . $tbl_track_course.'
185 185
                 WHERE
186 186
                     user_id = '.$user_id.' AND
187 187
                     c_id IN ('.$course_list.') AND
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             // student score
260 260
             $avg_score = Tracking :: get_avg_student_score($user_id, $courseCode);
261 261
             if (is_numeric($avg_score)) {
262
-                $avg_score = round($avg_score,2);
262
+                $avg_score = round($avg_score, 2);
263 263
             } else {
264 264
                 $$avg_score = '-';
265 265
             }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
297 297
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
298
-        $t_head .=      '<tr>';
298
+        $t_head .= '<tr>';
299 299
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
300 300
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
301 301
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         $addparams = array('view' => 'admin', 'display' => 'user');
315 315
 
316
-        $table = new SortableTable('tracking_user_overview', array('MySpace','get_number_of_users_tracking_overview'), array('MySpace','get_user_data_tracking_overview'), 0);
316
+        $table = new SortableTable('tracking_user_overview', array('MySpace', 'get_number_of_users_tracking_overview'), array('MySpace', 'get_user_data_tracking_overview'), 0);
317 317
         $table->additional_parameters = $addparams;
318 318
 
319 319
         $table->set_header(0, get_lang('OfficialCode'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         }
327 327
         $table->set_header(3, get_lang('LoginName'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
328 328
         $table->set_header(4, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
329
-        $table->set_column_filter(4, array('MySpace','course_info_tracking_filter'));
329
+        $table->set_column_filter(4, array('MySpace', 'course_info_tracking_filter'));
330 330
         $table->display();
331 331
     }
332 332
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         $table -> set_header(7, get_lang('Sessions'), false);
387 387
 
388 388
         if ($is_western_name_order) {
389
-            $csv_header[] = array (
389
+            $csv_header[] = array(
390 390
                 get_lang('FirstName'),
391 391
                 get_lang('LastName'),
392 392
                 get_lang('TimeSpentOnThePlatform'),
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                 get_lang('NumberOfSessions')
397 397
             );
398 398
         } else {
399
-            $csv_header[] = array (
399
+            $csv_header[] = array(
400 400
                 get_lang('LastName'),
401 401
                 get_lang('FirstName'),
402 402
                 get_lang('TimeSpentOnThePlatform'),
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 
537 537
         if ($tracking_column != 3) {
538 538
             if ($tracking_direction == 'DESC') {
539
-                usort($all_datas, array('MySpace','rsort_users'));
539
+                usort($all_datas, array('MySpace', 'rsort_users'));
540 540
             } else {
541
-                usort($all_datas, array('MySpace','sort_users'));
541
+                usort($all_datas, array('MySpace', 'sort_users'));
542 542
             }
543 543
         }
544 544
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
         /**
598 598
          * Column config
599 599
          */
600
-        $column_model   = array(
600
+        $column_model = array(
601 601
             array(
602 602
                 'name' => 'username',
603 603
                 'index' => 'username',
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 
639 639
         $action_links = '';
640 640
         // jqgrid will use this URL to do the selects
641
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
641
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
642 642
 
643 643
         //Table Id
644 644
         $tableId = 'lpProgress';
@@ -660,11 +660,11 @@  discard block
 block discarded – undo
660 660
             true
661 661
         );
662 662
 
663
-        $return = '<script>$(function() {'. $table .
663
+        $return = '<script>$(function() {'.$table.
664 664
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
665 665
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
666 666
                        caption:"",
667
-                       title:"' . get_lang('ExportExcel') . '",
667
+                       title:"' . get_lang('ExportExcel').'",
668 668
                        onClickButton : function () {
669 669
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
670 670
                        }
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         /**
715 715
          * Column config
716 716
          */
717
-        $column_model   = array(
717
+        $column_model = array(
718 718
             array('name'=>'session', 'index'=>'session', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
719 719
             array('name'=>'exercise_id', 'index'=>'exercise_id', 'align'=>'left', 'search' => 'true'),
720 720
             array('name'=>'quiz_title', 'index'=>'quiz_title', 'align'=>'left', 'search' => 'true'),
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
         //get dynamic column names
732 732
 
733 733
         // jqgrid will use this URL to do the selects
734
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . $sessionId . '&course_id=' . $courseId  . '&exercise_id=' . $exerciseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
734
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id='.$sessionId.'&course_id='.$courseId.'&exercise_id='.$exerciseId.'&date_to='.$date_to.'&date_from='.$date_from;
735 735
 
736 736
         // Autowidth
737 737
         $extra_params['autowidth'] = 'true';
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
         $tableId = 'exerciseProgressOverview';
743 743
         $table = Display::grid_js($tableId, $url, $columns, $column_model, $extra_params, array(), '', true);
744 744
 
745
-        $return = '<script>$(function() {'. $table .
745
+        $return = '<script>$(function() {'.$table.
746 746
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
747 747
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
748 748
                        caption:"",
749
-                       title:"' . get_lang('ExportExcel') . '",
749
+                       title:"' . get_lang('ExportExcel').'",
750 750
                        onClickButton : function () {
751 751
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
752 752
                        }
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
                 // adding the fields that are checked to the session
807 807
                 $message = '';
808 808
                 foreach ($values as $field_ids => $value) {
809
-                    if ($value == 1 && strstr($field_ids,'extra_export_field')) {
809
+                    if ($value == 1 && strstr($field_ids, 'extra_export_field')) {
810 810
                         $_SESSION['additional_export_fields'][] = str_replace('extra_export_field', '', $field_ids);
811 811
                     }
812 812
                 }
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                 // Displaying a feedback message
822 822
                 if (!empty($_SESSION['additional_export_fields'])) {
823 823
                     Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>', false);
824
-                } else  {
824
+                } else {
825 825
                     Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'), false);
826 826
                 }
827 827
             } else {
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
     {
850 850
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
851 851
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
852
-        $t_head .=      '<tr>';
852
+        $t_head .= '<tr>';
853 853
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
854 854
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
855 855
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgCourseScore'), 6, true).'</span></th>';
@@ -866,13 +866,13 @@  discard block
 block discarded – undo
866 866
 
867 867
         $addparams = array('view' => 'admin', 'display' => 'courseoverview');
868 868
 
869
-        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace','get_course_data_tracking_overview'), 1);
869
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace', 'get_course_data_tracking_overview'), 1);
870 870
         $table->additional_parameters = $addparams;
871 871
 
872 872
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
873 873
         $table->set_header(1, get_lang('Course'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
874 874
         $table->set_header(2, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
875
-        $table->set_column_filter(2, array('MySpace','course_tracking_filter'));
875
+        $table->set_column_filter(2, array('MySpace', 'course_tracking_filter'));
876 876
         $table->display();
877 877
     }
878 878
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
         $sql .= " ORDER BY col$column $direction ";
909 909
         $sql .= " LIMIT $from,$number_of_items";
910 910
         $result = Database::query($sql);
911
-        $return = array ();
911
+        $return = array();
912 912
         while ($course = Database::fetch_row($result)) {
913 913
             $return[] = $course;
914 914
         }
@@ -961,18 +961,18 @@  discard block
 block discarded – undo
961 961
             $progress += $progress_tmp[0];
962 962
             $nb_progress_lp += $progress_tmp[1];
963 963
             $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
964
-            if(is_array($score_tmp)) {
964
+            if (is_array($score_tmp)) {
965 965
                 $score += $score_tmp[0];
966 966
                 $nb_score_lp += $score_tmp[1];
967 967
             }
968 968
             $nb_messages += Tracking::count_student_messages($row->user_id, $course_code);
969 969
             $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
970 970
             $last_login_date_tmp = Tracking :: get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
971
-            if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
971
+            if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
972 972
                 $last_login_date = $last_login_date_tmp;
973
-            } else if($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
973
+            } else if ($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
974 974
                 // Find the max and assign it to first_login_date
975
-                if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
975
+                if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
976 976
                     $last_login_date = $last_login_date_tmp;
977 977
                 }
978 978
             }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
                 $progress += $progress_tmp[0];
1111 1111
                 $nb_progress_lp += $progress_tmp[1];
1112 1112
                 $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1113
-                if(is_array($score_tmp)) {
1113
+                if (is_array($score_tmp)) {
1114 1114
                     $score += $score_tmp[0];
1115 1115
                     $nb_score_lp += $score_tmp[1];
1116 1116
                 }
@@ -1118,11 +1118,11 @@  discard block
 block discarded – undo
1118 1118
                 $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1119 1119
 
1120 1120
                 $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1121
-                if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1121
+                if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1122 1122
                     $last_login_date = $last_login_date_tmp;
1123
-                } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1123
+                } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1124 1124
                     // Find the max and assign it to first_login_date
1125
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1125
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1126 1126
                         $last_login_date = $last_login_date_tmp;
1127 1127
                     }
1128 1128
                 }
@@ -1132,22 +1132,22 @@  discard block
 block discarded – undo
1132 1132
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1133 1133
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1134 1134
             }
1135
-            if($nb_progress_lp > 0) {
1135
+            if ($nb_progress_lp > 0) {
1136 1136
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1137 1137
             } else {
1138 1138
                 $avg_progress = 0;
1139 1139
             }
1140
-            if($nb_score_lp > 0) {
1140
+            if ($nb_score_lp > 0) {
1141 1141
                 $avg_score = round($score / $nb_score_lp, 2);
1142 1142
             } else {
1143 1143
                 $avg_score = '-';
1144 1144
             }
1145
-            if($last_login_date) {
1145
+            if ($last_login_date) {
1146 1146
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1147 1147
             } else {
1148 1148
                 $last_login_date = '-';
1149 1149
             }
1150
-            if($total_score_possible > 0) {
1150
+            if ($total_score_possible > 0) {
1151 1151
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1152 1152
             } else {
1153 1153
                 $total_score_percentage = 0;
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
     {
1184 1184
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1185 1185
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1186
-        $t_head .=      '<tr>';
1186
+        $t_head .= '<tr>';
1187 1187
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
1188 1188
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1189 1189
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
         $addparams = array('view' => 'admin', 'display' => 'sessionoverview');
1203 1203
 
1204
-        $table = new SortableTable('tracking_session_overview', array('MySpace','get_total_number_sessions'), array('MySpace','get_session_data_tracking_overview'), 1);
1204
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_sessions'), array('MySpace', 'get_session_data_tracking_overview'), 1);
1205 1205
         $table->additional_parameters = $addparams;
1206 1206
 
1207 1207
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
         $sql .= " ORDER BY col$column $direction ";
1241 1241
         $sql .= " LIMIT $from,$number_of_items";
1242 1242
         $result = Database::query($sql);
1243
-        $return = array ();
1243
+        $return = array();
1244 1244
         while ($session = Database::fetch_row($result)) {
1245 1245
             $return[] = $session;
1246 1246
         }
@@ -1329,10 +1329,10 @@  discard block
 block discarded – undo
1329 1329
                 if ($last_login_date_tmp != false && $last_login_date == false) {
1330 1330
                     // TODO: To be cleaned.
1331 1331
                     $last_login_date = $last_login_date_tmp;
1332
-                } else if($last_login_date_tmp != false && $last_login_date != false) {
1332
+                } else if ($last_login_date_tmp != false && $last_login_date != false) {
1333 1333
                     // TODO: Repeated previous condition! To be cleaned.
1334 1334
                     // Find the max and assign it to first_login_date
1335
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1335
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1336 1336
                         $last_login_date = $last_login_date_tmp;
1337 1337
                     }
1338 1338
                 }
@@ -1342,27 +1342,27 @@  discard block
 block discarded – undo
1342 1342
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1343 1343
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1344 1344
             }
1345
-            if($nb_progress_lp > 0) {
1345
+            if ($nb_progress_lp > 0) {
1346 1346
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1347 1347
             } else {
1348 1348
                 $avg_progress = 0;
1349 1349
             }
1350
-            if($nb_score_lp > 0) {
1350
+            if ($nb_score_lp > 0) {
1351 1351
                 $avg_score = round($score / $nb_score_lp, 2);
1352 1352
             } else {
1353 1353
                 $avg_score = '-';
1354 1354
             }
1355
-            if($last_login_date) {
1355
+            if ($last_login_date) {
1356 1356
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1357 1357
             } else {
1358 1358
                 $last_login_date = '-';
1359 1359
             }
1360
-            if($total_score_possible > 0) {
1360
+            if ($total_score_possible > 0) {
1361 1361
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1362 1362
             } else {
1363 1363
                 $total_score_percentage = 0;
1364 1364
             }
1365
-            if($total_score_percentage > 0) {
1365
+            if ($total_score_percentage > 0) {
1366 1366
                 $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1367 1367
             } else {
1368 1368
                 $total_score = '-';
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
                 $total_score_obtained = 0;
1474 1474
                 $total_score_possible = 0;
1475 1475
                 $total_questions_answered = 0;
1476
-                while($row_user = Database::fetch_object($result_users)) {
1476
+                while ($row_user = Database::fetch_object($result_users)) {
1477 1477
                     // get time spent in the course and session
1478 1478
                     $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id);
1479 1479
                     $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true);
@@ -1502,11 +1502,11 @@  discard block
 block discarded – undo
1502 1502
                         $session_id,
1503 1503
                         false
1504 1504
                     );
1505
-                    if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1505
+                    if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1506 1506
                         $last_login_date = $last_login_date_tmp;
1507
-                    } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1507
+                    } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1508 1508
                         // Find the max and assign it to first_login_date
1509
-                        if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1509
+                        if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1510 1510
                             $last_login_date = $last_login_date_tmp;
1511 1511
                         }
1512 1512
                     }
@@ -1516,27 +1516,27 @@  discard block
 block discarded – undo
1516 1516
                     $total_score_possible += $exercise_results_tmp['score_possible'];
1517 1517
                     $total_questions_answered += $exercise_results_tmp['questions_answered'];
1518 1518
                 }
1519
-                if($nb_progress_lp > 0) {
1519
+                if ($nb_progress_lp > 0) {
1520 1520
                     $avg_progress = round($progress / $nb_progress_lp, 2);
1521 1521
                 } else {
1522 1522
                     $avg_progress = 0;
1523 1523
                 }
1524
-                if($nb_score_lp > 0) {
1524
+                if ($nb_score_lp > 0) {
1525 1525
                     $avg_score = round($score / $nb_score_lp, 2);
1526 1526
                 } else {
1527 1527
                     $avg_score = '-';
1528 1528
                 }
1529
-                if($last_login_date) {
1529
+                if ($last_login_date) {
1530 1530
                     $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1531 1531
                 } else {
1532 1532
                     $last_login_date = '-';
1533 1533
                 }
1534
-                if($total_score_possible > 0) {
1534
+                if ($total_score_possible > 0) {
1535 1535
                     $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1536 1536
                 } else {
1537 1537
                     $total_score_percentage = 0;
1538 1538
                 }
1539
-                if($total_score_percentage > 0) {
1539
+                if ($total_score_percentage > 0) {
1540 1540
                     $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1541 1541
                 } else {
1542 1542
                     $total_score = '-';
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
         while ($row = Database::fetch_array($result)) {
1597 1597
             $score_obtained += $row['exe_result'];
1598 1598
             $score_possible += $row['exe_weighting'];
1599
-            $questions_answered ++;
1599
+            $questions_answered++;
1600 1600
         }
1601 1601
 
1602 1602
         if ($score_possible != 0) {
@@ -1716,9 +1716,9 @@  discard block
 block discarded – undo
1716 1716
                     }
1717 1717
                 }
1718 1718
                 // time spent in the course
1719
-                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course ($user[4], $courseId));
1719
+                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId));
1720 1720
                 // student progress in course
1721
-                $csv_row[] = round(Tracking::get_avg_student_progress ($user[4], $row[0]), 2);
1721
+                $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
1722 1722
                 // student score
1723 1723
                 $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
1724 1724
                 // student tes score
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
                 // student messages
1727 1727
                 $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
1728 1728
                 // student assignments
1729
-                $csv_row[] = Tracking::count_student_assignments ($user[4], $row[0]);
1729
+                $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
1730 1730
                 // student exercises results
1731 1731
                 $exercises_results = MySpace::exercises_results($user[4], $row[0]);
1732 1732
                 $csv_row[] = $exercises_results['score_obtained'];
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
                 $csv_row[] = $exercises_results['questions_answered'];
1735 1735
                 $csv_row[] = $exercises_results['percentage'];
1736 1736
                 // first connection
1737
-                $csv_row[] = Tracking::get_first_connection_date_on_the_course ($user[4], $courseId);
1737
+                $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId);
1738 1738
                 // last connection
1739 1739
                 $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo));
1740 1740
 
@@ -1768,9 +1768,9 @@  discard block
 block discarded – undo
1768 1768
         // get all courses with limit
1769 1769
         $sql = "SELECT course.code as col1, course.title as col2
1770 1770
                 FROM $tbl_course course
1771
-                WHERE course.code IN (".implode(',',$courses_code).")";
1771
+                WHERE course.code IN (".implode(',', $courses_code).")";
1772 1772
 
1773
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
1773
+        if (!in_array($direction, array('ASC', 'DESC'))) $direction = 'ASC';
1774 1774
 
1775 1775
         $column = intval($column);
1776 1776
         $from = intval($from);
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
             $table_row[] = $avg_assignments_in_course;
1840 1840
 
1841 1841
             //set the "from" value to know if I access the Reporting by the chamilo tab or the course link
1842
-            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq=' .$course_code.'&from=myspace&id_session='.$session_id.'">
1842
+            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'">
1843 1843
                              '.Display::return_icon('2rightarrow.png').'
1844 1844
                              </a>
1845 1845
                             </center>';
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
                 $nb_students_in_course,
1849 1849
                 $avg_time_spent_in_course,
1850 1850
                 is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%',
1851
-                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course ,
1851
+                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course,
1852 1852
                 is_null($avg_score_in_exercise) ? null : $avg_score_in_exercise.'%',
1853 1853
                 $avg_messages_in_course,
1854 1854
                 $avg_assignments_in_course,
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
         $sql .= " ORDER BY col$column $direction ";
1917 1917
         $sql .= " LIMIT $from,$number_of_items";
1918 1918
         $result = Database::query($sql);
1919
-        $return = array ();
1919
+        $return = array();
1920 1920
         while ($user = Database::fetch_row($result)) {
1921 1921
             $return[] = $user;
1922 1922
         }
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
                     $i++;
1972 1972
                 }
1973 1973
             }
1974
-            $username_array = array('username' => $desired_username , 'sufix' => $sufix);
1974
+            $username_array = array('username' => $desired_username, 'sufix' => $sufix);
1975 1975
             return $username_array;
1976 1976
         } else {
1977 1977
             $username_array = array('username' => $username, 'sufix' => '');
@@ -2246,7 +2246,7 @@  discard block
 block discarded – undo
2246 2246
         foreach ($users as $index => $user) {
2247 2247
             $userid = $user['id'];
2248 2248
             $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
2249
-                           VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')";
2249
+                           VALUES ('$id_session','$userid', '".api_get_utc_datetime()."')";
2250 2250
             Database::query($sql_insert);
2251 2251
             $user['added_at_session'] = 1;
2252 2252
             $new_users[] = $user;
@@ -2280,10 +2280,10 @@  discard block
 block discarded – undo
2280 2280
                 );
2281 2281
                 $userInfo = api_get_user_info($user['id']);
2282 2282
 
2283
-                if (($user['added_at_platform'] == 1  && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2283
+                if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2284 2284
                     if ($user['added_at_platform'] == 1) {
2285 2285
                         $addedto = get_lang('UserCreatedPlatform');
2286
-                    } else  {
2286
+                    } else {
2287 2287
                         $addedto = '          ';
2288 2288
                     }
2289 2289
 
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
         global $current_tag;
2347 2347
         switch ($data) {
2348 2348
             case 'Contact' :
2349
-                $user = array ();
2349
+                $user = array();
2350 2350
                 break;
2351 2351
             default :
2352 2352
                 $current_tag = $data;
@@ -2393,9 +2393,9 @@  discard block
 block discarded – undo
2393 2393
         global $current_value;
2394 2394
         global $user;
2395 2395
         global $users;
2396
-        $users = array ();
2396
+        $users = array();
2397 2397
         $parser = xml_parser_create('UTF-8');
2398
-        xml_set_element_handler($parser, array('MySpace','element_start'), array('MySpace','element_end'));
2398
+        xml_set_element_handler($parser, array('MySpace', 'element_start'), array('MySpace', 'element_end'));
2399 2399
         xml_set_character_data_handler($parser, "character_data");
2400 2400
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
2401 2401
         xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
@@ -2441,7 +2441,7 @@  discard block
 block discarded – undo
2441 2441
             get_lang('SearchCourse'),
2442 2442
             $courseList,
2443 2443
             [
2444
-                'url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query([
2444
+                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?'.http_build_query([
2445 2445
                     'a' => 'search_course_by_session_all',
2446 2446
                     'session_id' => $sessionId
2447 2447
                 ])
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
                             course_id: $('#course_id').val() || 0
2461 2461
                         });
2462 2462
 
2463
-                        return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;
2463
+                        return '" . api_get_path(WEB_AJAX_PATH)."session.ajax.php?' + params;
2464 2464
                     }
2465 2465
                 "
2466 2466
             ]
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
                             course_id: $('#course_id').val()
2492 2492
                         });
2493 2493
 
2494
-                        return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;
2494
+                        return '" . api_get_path(WEB_AJAX_PATH)."course.ajax.php?' + params;
2495 2495
                     }
2496 2496
                 "
2497 2497
             ]
@@ -2579,7 +2579,7 @@  discard block
 block discarded – undo
2579 2579
                     " : "
2580 2580
                         u.lastname AS col2,
2581 2581
                         u.firstname AS col3,
2582
-                " ) . "
2582
+                " )."
2583 2583
                 a.logout_course_date,
2584 2584
                 c.title,
2585 2585
                 c.code,
@@ -2590,7 +2590,7 @@  discard block
 block discarded – undo
2590 2590
 
2591 2591
         if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
2592 2592
             $sessionId = intval($_GET['session_id']);
2593
-            $sql .= " WHERE a.session_id = " . $sessionId;
2593
+            $sql .= " WHERE a.session_id = ".$sessionId;
2594 2594
         }
2595 2595
 
2596 2596
         $sql .= " ORDER BY col$column $orderDirection ";
@@ -2696,13 +2696,13 @@  discard block
 block discarded – undo
2696 2696
 function get_stats($user_id, $courseId, $start_date = null, $end_date = null)
2697 2697
 {
2698 2698
     // Database table definitions
2699
-    $tbl_track_course   = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2699
+    $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2700 2700
 
2701 2701
     $course_info = api_get_course_info_by_id($courseId);
2702 2702
     if (!empty($course_info)) {
2703 2703
         $strg_sd = '';
2704 2704
         $strg_ed = '';
2705
-        if ($start_date != null && $end_date != null){
2705
+        if ($start_date != null && $end_date != null) {
2706 2706
             $end_date = add_day_to($end_date);
2707 2707
             $strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
2708 2708
             $strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
@@ -2711,10 +2711,10 @@  discard block
 block discarded – undo
2711 2711
                 SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
2712 2712
                 SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
2713 2713
                 count(user_id) as times
2714
-                FROM ' . $tbl_track_course . '
2714
+                FROM ' . $tbl_track_course.'
2715 2715
                 WHERE
2716
-                    user_id = ' . intval($user_id) . ' AND
2717
-                    c_id = ' . intval($courseId) . ' '.$strg_sd.' '.$strg_ed.' '.'
2716
+                    user_id = ' . intval($user_id).' AND
2717
+                    c_id = ' . intval($courseId).' '.$strg_sd.' '.$strg_ed.' '.'
2718 2718
                 ORDER BY login_course_date ASC';
2719 2719
 
2720 2720
         $rs = Database::query($sql);
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
 }
2733 2733
 
2734 2734
 function add_day_to($end_date) {
2735
-    $foo_date = strtotime( $end_date );
2735
+    $foo_date = strtotime($end_date);
2736 2736
     $foo_date = strtotime(" +1 day", $foo_date);
2737 2737
     $foo_date = date("Y-m-d", $foo_date);
2738 2738
     return $foo_date;
@@ -2746,7 +2746,7 @@  discard block
 block discarded – undo
2746 2746
  * @version OCT-22- 2010
2747 2747
  * @return array
2748 2748
  */
2749
-function convert_to_array($sql_result){
2749
+function convert_to_array($sql_result) {
2750 2750
     $result_to_print = '<table>';
2751 2751
     foreach ($sql_result as $key => $data) {
2752 2752
         $result_to_print .= '<tr><td>'.date('d-m-Y (H:i:s)', $data['login']).'</td><td>'.api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n";
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
  * @version OCT-22- 2010
2766 2766
  * @return string
2767 2767
  */
2768
-function convert_to_string($sql_result){
2768
+function convert_to_string($sql_result) {
2769 2769
     $result_to_print = '<table>';
2770 2770
     if (!empty($sql_result)) {
2771 2771
         foreach ($sql_result as $key => $data) {
@@ -2790,18 +2790,18 @@  discard block
 block discarded – undo
2790 2790
  */
2791 2791
 function grapher($sql_result, $start_date, $end_date, $type = "")
2792 2792
 {
2793
-    if (empty($start_date)) { $start_date =""; }
2794
-    if (empty($end_date)) { $end_date =""; }
2795
-    if ($type == ""){ $type = 'day'; }
2796
-    $main_year  = $main_month_year = $main_day = array();
2793
+    if (empty($start_date)) { $start_date = ""; }
2794
+    if (empty($end_date)) { $end_date = ""; }
2795
+    if ($type == "") { $type = 'day'; }
2796
+    $main_year = $main_month_year = $main_day = array();
2797 2797
     // get last 8 days/months
2798 2798
     $last_days      = 5;
2799 2799
     $last_months    = 3;
2800 2800
     for ($i = $last_days; $i >= 0; $i--) {
2801
-        $main_day[date ('d-m-Y', time () - $i * 3600 * 24)] = 0;
2801
+        $main_day[date('d-m-Y', time() - $i * 3600 * 24)] = 0;
2802 2802
     }
2803 2803
     for ($i = $last_months; $i >= 0; $i--) {
2804
-        $main_month_year[date ('m-Y', time () - $i * 30 * 3600 * 24)] = 0;
2804
+        $main_month_year[date('m-Y', time() - $i * 30 * 3600 * 24)] = 0;
2805 2805
     }
2806 2806
 
2807 2807
     $i = 0;
@@ -2837,7 +2837,7 @@  discard block
 block discarded – undo
2837 2837
         /* Create and populate the pData object */
2838 2838
         $myData = new pData();
2839 2839
         $myData->addPoints($main_date, 'Serie1');
2840
-        if (count($main_date)!= 1) {
2840
+        if (count($main_date) != 1) {
2841 2841
             $myData->addPoints($labels, 'Labels');
2842 2842
             $myData->setSerieDescription('Labels', 'Months');
2843 2843
             $myData->setAbscissa('Labels');
@@ -2845,7 +2845,7 @@  discard block
 block discarded – undo
2845 2845
         $myData->setSerieWeight('Serie1', 1);
2846 2846
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
2847 2847
         $myData->setAxisName(0, get_lang('Minutes'));
2848
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
2848
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
2849 2849
 
2850 2850
         // Cache definition
2851 2851
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -2854,9 +2854,9 @@  discard block
 block discarded – undo
2854 2854
 
2855 2855
         if ($myCache->isInCache($chartHash)) {
2856 2856
             //if we already created the img
2857
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
2857
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
2858 2858
             $myCache->saveFromCache($chartHash, $imgPath);
2859
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
2859
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
2860 2860
         } else {
2861 2861
             /* Define width, height and angle */
2862 2862
             $mainWidth = 760;
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
             /* Set the default font */
2886 2886
             $myPicture->setFontProperties(
2887 2887
                 array(
2888
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
2888
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
2889 2889
                     "FontSize" => 10)
2890 2890
             );
2891 2891
             /* Write the chart title */
@@ -2902,7 +2902,7 @@  discard block
 block discarded – undo
2902 2902
             /* Set the default font */
2903 2903
             $myPicture->setFontProperties(
2904 2904
                 array(
2905
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
2905
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
2906 2906
                     "FontSize" => 8
2907 2907
                 )
2908 2908
             );
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
             /* Draw the line chart */
2945 2945
             $myPicture->setFontProperties(
2946 2946
                 array(
2947
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
2947
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
2948 2948
                     "FontSize" => 10
2949 2949
                 )
2950 2950
             );
@@ -2963,15 +2963,15 @@  discard block
 block discarded – undo
2963 2963
 
2964 2964
             /* Write and save into cache */
2965 2965
             $myCache->writeToCache($chartHash, $myPicture);
2966
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
2966
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
2967 2967
             $myCache->saveFromCache($chartHash, $imgPath);
2968
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
2968
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
2969 2969
         }
2970
-        $html = '<img src="' . $imgPath . '">';
2970
+        $html = '<img src="'.$imgPath.'">';
2971 2971
 
2972 2972
         return $html;
2973 2973
     } else {
2974
-        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8');
2974
+        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>', 'UTF-8');
2975 2975
 
2976 2976
         return $foo_img;
2977 2977
     }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -679,7 +679,6 @@  discard block
 block discarded – undo
679 679
      * @param   int $sessionId  The session ID
680 680
      * @param   int $courseId   The course ID
681 681
      * @param   int $exerciseId The quiz ID
682
-     * @param   int $answer Answer status (0 = incorrect, 1 = correct, 2 = both)
683 682
      * @return  string  HTML array of results formatted for gridJS
684 683
      * @author César Perales <[email protected]>, Beeznest Team
685 684
      */
@@ -898,6 +897,7 @@  discard block
 block discarded – undo
898 897
      * @param int Number of items to select
899 898
      * @param string Column to order on
900 899
      * @param string Order direction
900
+     * @param integer $number_of_items
901 901
      * @return array Results
902 902
      */
903 903
     public static function get_course_data_tracking_overview($from, $number_of_items, $column, $direction)
@@ -1235,6 +1235,7 @@  discard block
 block discarded – undo
1235 1235
      * @param int Number of items to select
1236 1236
      * @param string Column to order on
1237 1237
      * @param string Order direction
1238
+     * @param integer $number_of_items
1238 1239
      * @return array Results
1239 1240
      */
1240 1241
     public static function get_session_data_tracking_overview($from, $number_of_items, $column, $direction)
@@ -1255,7 +1256,6 @@  discard block
 block discarded – undo
1255 1256
     /**
1256 1257
      * Fills in session reporting data
1257 1258
      *
1258
-     * @param integer $user_id the id of the user
1259 1259
      * @param array $url_params additonal url parameters
1260 1260
      * @param array $row the row information (the other columns)
1261 1261
      * @return string html code
@@ -1888,6 +1888,7 @@  discard block
 block discarded – undo
1888 1888
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
1889 1889
      * @version Dokeos 1.8.6
1890 1890
      * @since October 2008
1891
+     * @param integer $number_of_items
1891 1892
      */
1892 1893
     public static function get_user_data_tracking_overview($from, $number_of_items, $column, $direction)
1893 1894
     {
@@ -1990,7 +1991,6 @@  discard block
 block discarded – undo
1990 1991
     /**
1991 1992
      * Checks if there are repeted users in a given array
1992 1993
      * @param  array $usernames list of the usernames in the uploaded file
1993
-     * @param  array $user_array['username'] and $user_array['sufix'] where sufix is the number part in a login i.e -> jmontoya2
1994 1994
      * @return array with the $usernames array and the $user_array array
1995 1995
      * @author Julio Montoya
1996 1996
      */
@@ -2165,6 +2165,7 @@  discard block
 block discarded – undo
2165 2165
 
2166 2166
     /**
2167 2167
      * Adds missing user-information (which isn't required, like password, etc).
2168
+     * @return integer
2168 2169
      */
2169 2170
     function complete_missing_data($user) {
2170 2171
         // 1. Generate a password if it is necessary.
Please login to merge, or discard this patch.
main/inc/lib/security.lib.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $rel_path = '/'.$rel_path;
92 92
         }
93 93
         $abs_path = $current_path.$rel_path;
94
-        $true_path=str_replace("\\", '/', realpath($abs_path));
94
+        $true_path = str_replace("\\", '/', realpath($abs_path));
95 95
         $found = strpos($true_path.'/', $checker_path);
96 96
         if ($found === 0) {
97 97
             return true;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         }
322 322
 
323 323
         if ($user_status == COURSEMANAGERLOWSECURITY) {
324
-            return $var;  // No filtering.
324
+            return $var; // No filtering.
325 325
         }
326 326
 
327 327
         static $purifier = array();
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             }
345 345
 
346 346
             // Shows _target attribute in anchors
347
-            $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent'));
347
+            $config->set('Attr.AllowedFrameTargets', array('_blank', '_top', '_self', '_parent'));
348 348
 
349 349
             if ($user_status == STUDENT) {
350 350
                 global $allowed_html_student;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,6 +46,8 @@  discard block
 block discarded – undo
46 46
      * @param	string	Absolute path to be checked (with trailing slash)
47 47
      * @param	string	Checker path under which the path
48 48
      * should be (absolute path, with trailing slash, get it from api_get_path(SYS_COURSE_PATH))
49
+     * @param string $abs_path
50
+     * @param string $checker_path
49 51
      * @return	bool	True if the path is under the checker, false otherwise
50 52
      */
51 53
     public static function check_abs_path($abs_path, $checker_path)
@@ -257,6 +259,7 @@  discard block
 block discarded – undo
257 259
      * @param string	The variable to filter for XSS, this params can be a string or an array (example : array(x,y))
258 260
      * @param int The user status,constant allowed (STUDENT, COURSEMANAGER, ANONYMOUS, COURSEMANAGERLOWSECURITY)
259 261
      * @param bool $filter_terms
262
+     * @param integer $user_status
260 263
      * @return	mixed	Filtered string or array
261 264
      */
262 265
     public static function remove_XSS($var, $user_status = null, $filter_terms = false)
@@ -393,7 +396,7 @@  discard block
 block discarded – undo
393 396
      * This method provides specific protection (against XSS and other kinds of attacks) for static images (icons) used by the system.
394 397
      * Image paths are supposed to be given by programmers - people who know what they do, anyway, this method encourages
395 398
      * a safe practice for generating icon paths, without using heavy solutions based on HTMLPurifier for example.
396
-     * @param string $img_path          The input path of the image, it could be relative or absolute URL.
399
+     * @param string $image_path          The input path of the image, it could be relative or absolute URL.
397 400
      * @return string                   Returns sanitized image path or an empty string when the image path is not secure.
398 401
      * @author Ivan Tcholakov, March 2011
399 402
      */
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
      */
262 262
     public static function remove_XSS($var, $user_status = null, $filter_terms = false)
263 263
     {
264
-    	if ($filter_terms) {
265
-    		$var = self::filter_terms($var);
266
-    	}
264
+        if ($filter_terms) {
265
+            $var = self::filter_terms($var);
266
+        }
267 267
 
268 268
         if (empty($user_status)) {
269 269
             if (api_is_anonymous()) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
      */
359 359
     public static function filter_terms($text)
360 360
     {
361
-    	static $bad_terms = array();
361
+        static $bad_terms = array();
362 362
 
363 363
         if (empty($bad_terms)) {
364 364
             $list = api_get_setting('filter_terms');
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
             }
380 380
         }
381 381
 
382
-    	$replace = '***';
383
-    	if (!empty($bad_terms)) {
384
-    		// Fast way
385
-    		$new_text = str_ireplace($bad_terms, $replace, $text, $count);
386
-    		$text = $new_text;
387
-    	}
382
+        $replace = '***';
383
+        if (!empty($bad_terms)) {
384
+            // Fast way
385
+            $new_text = str_ireplace($bad_terms, $replace, $text, $count);
386
+            $text = $new_text;
387
+        }
388 388
 
389
-		return $text;
389
+        return $text;
390 390
     }
391 391
 
392 392
     /**
Please login to merge, or discard this patch.
main/inc/lib/access_url_edit_users_to_url_functions.lib.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,22 +43,22 @@
 block discarded – undo
43 43
                    ' WHERE (username LIKE "'.$needle.'%" '.
44 44
                    ' OR firstname LIKE "'.$needle.'%" '.
45 45
                    ' OR lastname LIKE "'.$needle.'%") '.
46
-                    $order_clause .
46
+                    $order_clause.
47 47
                    ' LIMIT 11';
48 48
 
49 49
             $rs = Database::query($sql);
50
-            $i=0;
50
+            $i = 0;
51 51
 
52 52
             while ($user = Database :: fetch_array($rs)) {
53 53
                 $i++;
54
-                if ($i<=10) {
54
+                if ($i <= 10) {
55 55
                     $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($user['user_id']).'\',\''.api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])).' ('.addslashes($user['username']).')'.'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
56 56
                 } else {
57 57
                     $return .= '...<br />';
58 58
                 }
59 59
             }
60 60
         }
61
-        $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return));
61
+        $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
62 62
         return $xajax_response;
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
             // search users where username or firstname or lastname begins likes $needle
41 41
             $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
42 42
             $sql = 'SELECT u.user_id, username, lastname, firstname FROM '.$tbl_user.' u '.
43
-                   ' WHERE (username LIKE "'.$needle.'%" '.
44
-                   ' OR firstname LIKE "'.$needle.'%" '.
45
-                   ' OR lastname LIKE "'.$needle.'%") '.
43
+                    ' WHERE (username LIKE "'.$needle.'%" '.
44
+                    ' OR firstname LIKE "'.$needle.'%" '.
45
+                    ' OR lastname LIKE "'.$needle.'%") '.
46 46
                     $order_clause .
47
-                   ' LIMIT 11';
47
+                    ' LIMIT 11';
48 48
 
49 49
             $rs = Database::query($sql);
50 50
             $i=0;
Please login to merge, or discard this patch.
main/inc/lib/statistics.lib.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -666,7 +666,7 @@
 block discarded – undo
666 666
         $res = Database::query($sql);
667 667
         $count1 = Database::fetch_object($res);
668 668
         $sql = "SELECT COUNT(*) AS n FROM $user_table as u $table ".
669
-               "WHERE LENGTH(picture_uri) > 0 $url_condition2";
669
+                "WHERE LENGTH(picture_uri) > 0 $url_condition2";
670 670
         $res = Database::query($sql);
671 671
         $count2 = Database::fetch_object($res);
672 672
         // #users without picture
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
105 105
         $course_table = Database:: get_main_table(TABLE_MAIN_COURSE);
106 106
         $user_table = Database:: get_main_table(TABLE_MAIN_USER);
107
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
107
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
108 108
         $current_url_id = api_get_current_access_url_id();
109
-        $active_filter = $onlyActive?' AND active=1':'';
110
-        $status_filter = isset($status)?' AND status = '.intval($status):'';
109
+        $active_filter = $onlyActive ? ' AND active=1' : '';
110
+        $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
111 111
 
112 112
         if (api_is_multiple_url_enabled()) {
113 113
             $sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                     FROM $user_table
132 132
                     WHERE 1=1 $status_filter $active_filter";
133 133
             if (isset($categoryCode)) {
134
-                $status_filter = isset($status)?' AND status = '.intval($status):'';
134
+                $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
135 135
                 $sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number
136 136
                         FROM $course_user_table cu, $course_table c
137 137
                         WHERE
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public static function countSessions()
157 157
     {
158 158
         $session_table = Database :: get_main_table(TABLE_MAIN_SESSION);
159
-        $access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
159
+        $access_url_rel_session_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
160 160
         if (api_is_multiple_url_enabled()) {
161 161
             $current_url_id = api_get_current_access_url_id();
162 162
             $sql = "SELECT COUNT(id) AS number
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     public static function getNumberOfActivities()
180 180
     {
181 181
         // Database table definitions
182
-        $track_e_default  = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
182
+        $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
183 183
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
184
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
184
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
185 185
         $current_url_id = api_get_current_access_url_id();
186 186
         if (api_is_multiple_url_enabled()) {
187 187
             $sql = "SELECT count(default_id) AS total_number_of_items
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         $from = intval($from);
230 230
         $numberOfItems = intval($numberOfItems);
231 231
 
232
-        if (!in_array($direction, array('ASC','DESC'))) {
232
+        if (!in_array($direction, array('ASC', 'DESC'))) {
233 233
             $direction = 'DESC';
234 234
         }
235 235
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         $sql .= " LIMIT $from,$numberOfItems ";
281 281
 
282 282
         $res = Database::query($sql);
283
-        $activities = array ();
283
+        $activities = array();
284 284
         while ($row = Database::fetch_row($res)) {
285 285
             if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) {
286 286
                 $row[2] = $row[2];
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         $sql = "SELECT code, name FROM $categoryTable
350 350
                 ORDER BY tree_pos";
351 351
         $res = Database::query($sql);
352
-        $categories = array ();
352
+        $categories = array();
353 353
         while ($category = Database::fetch_object($res)) {
354 354
             $categories[$category->code] = $category->name;
355 355
         }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
             $data_max = ($data_max < $value ? $value : $data_max);
371 371
         }
372 372
         reset($data);
373
-        $result = array ();
373
+        $result = array();
374 374
         $delta = $max / $data_max;
375 375
         foreach ($data as $index => $value) {
376 376
             $result[$index] = (int) round($value * $delta);
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
             } else {
405 405
                 $number_label = Statistics::makeSizeString($number);
406 406
             }
407
-            $percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0');
407
+            $percentage = ($total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0');
408 408
 
409
-            echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'">
409
+            echo '<tr class="row_'.($i % 2 == 0 ? 'odd' : 'even').'">
410 410
                     <td width="150">'.$subtitle.'</td>
411 411
                     <td width="550">'.Display::bar_progress($percentage, false).'</td>
412 412
                     <td align="right">'.$number_label.'</td>';
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                 echo '<td align="right"> '.$percentage.'%</td>';
415 415
             }
416 416
             echo '</tr>';
417
-            $i ++;
417
+            $i++;
418 418
         }
419 419
         if ($showTotal) {
420 420
             if (!$isFileSize) {
@@ -434,17 +434,17 @@  discard block
 block discarded – undo
434 434
     public static function printLoginStats($type)
435 435
     {
436 436
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
437
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
437
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
438 438
         $current_url_id = api_get_current_access_url_id();
439 439
 
440 440
         $table_url = null;
441 441
         $where_url = null;
442 442
         $now = api_get_utc_datetime();
443
-        $where_url_last = ' WHERE login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
443
+        $where_url_last = ' WHERE login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
444 444
         if (api_is_multiple_url_enabled()) {
445 445
             $table_url = ", $access_url_rel_user_table";
446 446
             $where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'";
447
-            $where_url_last = ' AND login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
447
+            $where_url_last = ' AND login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
448 448
         }
449 449
 
450 450
         $period = get_lang('PeriodMonth');
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
                         GROUP BY stat_date 
464 464
                         ORDER BY stat_date ";
465 465
                 $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins 
466
-                               FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." 
466
+                               FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'DAY')." 
467 467
                                GROUP BY stat_date 
468 468
                                ORDER BY stat_date ";
469 469
                 break;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                         GROUP BY stat_date 
476 476
                         ORDER BY DATE_FORMAT( login_date, '%w' ) ";
477 477
                 $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date, count( login_id ) AS number_of_logins 
478
-                               FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." 
478
+                               FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'WEEK')." 
479 479
                                GROUP BY stat_date 
480 480
                                ORDER BY DATE_FORMAT( login_date, '%w' ) ";
481 481
                 break;
@@ -519,14 +519,14 @@  discard block
 block discarded – undo
519 519
     {
520 520
         $totalLogin = array();
521 521
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
522
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
522
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
523 523
         $current_url_id = api_get_current_access_url_id();
524 524
         if (api_is_multiple_url_enabled()) {
525 525
             $table_url = ", $access_url_rel_user_table";
526 526
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
527 527
         } else {
528 528
             $table_url = '';
529
-            $where_url='';
529
+            $where_url = '';
530 530
         }
531 531
         $now = api_get_utc_datetime();
532 532
         $field = 'login_user_id';
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
     {
559 559
         $totalLogin = [];
560 560
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
561
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
561
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
562 562
         $current_url_id = api_get_current_access_url_id();
563 563
         if (api_is_multiple_url_enabled()) {
564 564
             $table_url = ", $access_url_rel_user_table";
565 565
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
566 566
         } else {
567 567
             $table_url = '';
568
-            $where_url='';
568
+            $where_url = '';
569 569
         }
570 570
         $now = api_get_utc_datetime();
571 571
         $field = 'login_user_id';
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
                 GROUP BY date(login_date)";
579 579
 
580 580
         $res = Database::query($sql);
581
-        while ($row = Database::fetch_array($res,'ASSOC')){
581
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
582 582
             $totalLogin[$row['login_date']] = $row['number'];
583 583
         }
584 584
 
@@ -672,13 +672,13 @@  discard block
 block discarded – undo
672 672
     public static function printUserPicturesStats()
673 673
     {
674 674
         $user_table = Database :: get_main_table(TABLE_MAIN_USER);
675
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
675
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
676 676
         $current_url_id = api_get_current_access_url_id();
677 677
         $url_condition = null;
678 678
         $url_condition2 = null;
679 679
         $table = null;
680 680
         if (api_is_multiple_url_enabled()) {
681
-            $url_condition =  ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
681
+            $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
682 682
             $url_condition2 = " AND url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
683 683
             $table = ", $access_url_rel_user_table as url ";
684 684
         }
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
             'width=200px',
711 711
             false
712 712
         );
713
-        $renderer =& $form->defaultRenderer();
713
+        $renderer = & $form->defaultRenderer();
714 714
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
715 715
         $form->addElement('hidden', 'report', 'activities');
716 716
         $form->addElement('hidden', 'activities_direction', 'DESC');
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
         $columns[1] = 'access_date';
761 761
         $sql_order[SORT_ASC] = 'ASC';
762 762
         $sql_order[SORT_DESC] = 'DESC';
763
-        $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10;
764
-        $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
765
-        $column = isset($_GET['column'])?intval($_GET['column']) : 0;
766
-        $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
763
+        $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10;
764
+        $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1;
765
+        $column = isset($_GET['column']) ? intval($_GET['column']) : 0;
766
+        $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60;
767 767
         $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
768 768
 
769 769
         if (!in_array($direction, array(SORT_ASC, SORT_DESC))) {
@@ -791,25 +791,25 @@  discard block
 block discarded – undo
791 791
                         access_url_id='".$current_url_id."'
792 792
                    GROUP BY t.c_id
793 793
                    HAVING t.c_id <> ''
794
-                   AND DATEDIFF( '".api_get_utc_datetime()."' , access_date ) <= ". $date_diff;
794
+                   AND DATEDIFF( '".api_get_utc_datetime()."' , access_date ) <= ".$date_diff;
795 795
         } else {
796 796
             $sql = "SELECT * FROM $table t
797 797
                    GROUP BY t.c_id
798 798
                    HAVING t.c_id <> ''
799
-                   AND DATEDIFF( '".api_get_utc_datetime()."' , access_date ) <= ". $date_diff;
799
+                   AND DATEDIFF( '".api_get_utc_datetime()."' , access_date ) <= ".$date_diff;
800 800
         }
801 801
         $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction];
802
-        $from = ($page_nr -1) * $per_page;
802
+        $from = ($page_nr - 1) * $per_page;
803 803
         $sql .= ' LIMIT '.$from.','.$per_page;
804 804
 
805 805
         echo '<p>'.get_lang('LastAccess').' &gt;= '.$date_diff.' '.get_lang('Days').'</p>';
806 806
         $res = Database::query($sql);
807 807
         if (Database::num_rows($res) > 0) {
808
-            $courses = array ();
808
+            $courses = array();
809 809
             while ($obj = Database::fetch_object($res)) {
810 810
                 $courseInfo = api_get_course_info_by_id($obj->c_id);
811
-                $course = array ();
812
-                $course[]= '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
811
+                $course = array();
812
+                $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
813 813
                 // Allow sort by date hiding the numerical date
814 814
                 $course[] = '<span style="display:none;">'.$obj->access_date.'</span>'.api_convert_and_format_date($obj->access_date);
815 815
                 $courses[] = $course;
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
     {
888 888
         $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
889 889
         $user_table = Database::get_main_table(TABLE_MAIN_USER);
890
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
890
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
891 891
         $current_url_id = api_get_current_access_url_id();
892 892
 
893 893
         if (api_is_multiple_url_enabled()) {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
     {
927 927
         $totalLogin = array();
928 928
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
929
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
929
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
930 930
         $current_url_id = api_get_current_access_url_id();
931 931
         $total = self::countUsers();
932 932
         if (api_is_multiple_url_enabled()) {
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
935 935
         } else {
936 936
             $table_url = '';
937
-            $where_url='';
937
+            $where_url = '';
938 938
         }
939 939
         $now = api_get_utc_datetime();
940 940
         $sql[get_lang('ThisDay')] =
Please login to merge, or discard this patch.
main/inc/lib/opengraph/OpenGraph.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 
19 19
 class OpenGraph implements Iterator
20 20
 {
21
-  /**
22
-   * There are base schema's based on type, this is just
23
-   * a map so that the schema can be obtained
24
-   *
25
-   */
21
+    /**
22
+     * There are base schema's based on type, this is just
23
+     * a map so that the schema can be obtained
24
+     *
25
+     */
26 26
     public static $TYPES = array(
27 27
         'activity' => array('activity', 'sport'),
28 28
         'business' => array('bar', 'company', 'cafe', 'hotel', 'restaurant'),
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
         'website' => array('blog', 'website'),
35 35
     );
36 36
 
37
-  /**
38
-   * Holds all the Open Graph values we've parsed from a page
39
-   *
40
-   */
37
+    /**
38
+     * Holds all the Open Graph values we've parsed from a page
39
+     *
40
+     */
41 41
     private $_values = array();
42 42
 
43
-  /**
44
-   * Fetches a URI and parses it for Open Graph data, returns
45
-   * false on error.
46
-   *
47
-   * @param $URI    URI to page to parse for Open Graph data
48
-   * @return OpenGraph
49
-   */
43
+    /**
44
+     * Fetches a URI and parses it for Open Graph data, returns
45
+     * false on error.
46
+     *
47
+     * @param $URI    URI to page to parse for Open Graph data
48
+     * @return OpenGraph
49
+     */
50 50
     static public function fetch($URI) {
51 51
         $curl = curl_init($URI);
52 52
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         }
70 70
     }
71 71
 
72
-  /**
73
-   * Parses HTML and extracts Open Graph data, this assumes
74
-   * the document is at least well formed.
75
-   *
76
-   * @param $HTML    HTML to parse
77
-   * @return OpenGraph
78
-   */
72
+    /**
73
+     * Parses HTML and extracts Open Graph data, this assumes
74
+     * the document is at least well formed.
75
+     *
76
+     * @param $HTML    HTML to parse
77
+     * @return OpenGraph
78
+     */
79 79
     static private function _parse($HTML) {
80 80
         $old_libxml_error = libxml_use_internal_errors(true);
81 81
 
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
         return $page;
141 141
     }
142 142
 
143
-  /**
144
-   * Helper method to access attributes directly
145
-   * Example:
146
-   * $graph->title
147
-   *
148
-   * @param $key    Key to fetch from the lookup
149
-   */
143
+    /**
144
+     * Helper method to access attributes directly
145
+     * Example:
146
+     * $graph->title
147
+     *
148
+     * @param $key    Key to fetch from the lookup
149
+     */
150 150
     public function __get($key) {
151 151
         if (array_key_exists($key, $this->_values)) {
152 152
             return $this->_values[$key];
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
         }
162 162
     }
163 163
 
164
-  /**
165
-   * Return all the keys found on the page
166
-   *
167
-   * @return array
168
-   */
164
+    /**
165
+     * Return all the keys found on the page
166
+     *
167
+     * @return array
168
+     */
169 169
     public function keys() {
170 170
         return array_keys($this->_values);
171 171
     }
172 172
 
173
-  /**
174
-   * Helper method to check an attribute exists
175
-   *
176
-   * @param $key
177
-   */
173
+    /**
174
+     * Helper method to check an attribute exists
175
+     *
176
+     * @param $key
177
+     */
178 178
     public function __isset($key) {
179 179
         return array_key_exists($key, $this->_values);
180 180
     }
181 181
 
182
-  /**
183
-   * Will return true if the page has location data embedded
184
-   *
185
-   * @return boolean Check if the page has location data
186
-   */
182
+    /**
183
+     * Will return true if the page has location data embedded
184
+     *
185
+     * @return boolean Check if the page has location data
186
+     */
187 187
     public function hasLocation() {
188 188
         if (array_key_exists('latitude', $this->_values) && array_key_exists('longitude', $this->_values)) {
189 189
             return true;
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
         return $valid_address;
198 198
     }
199 199
 
200
-  /**
201
-   * Iterator code
202
-   */
200
+    /**
201
+     * Iterator code
202
+     */
203 203
     private $_position = 0;
204 204
     public function rewind() { reset($this->_values); $this->_position = 0; }
205 205
     public function current() { return current($this->_values); }
Please login to merge, or discard this patch.
main/inc/lib/events_dispatcher.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,9 +18,11 @@
 block discarded – undo
18 18
 
19 19
         foreach ($event_config[$event_name]["actions"] as $func) {
20 20
             $execute = true;
21
-            if (!function_exists($func)) // if the function doesn't exist, we log
21
+            if (!function_exists($func)) {
22
+                // if the function doesn't exist, we log
22 23
             {
23 24
                 error_log("EventsDispatcher warning : ".$func." does not exist.");
25
+            }
24 26
                 $execute = false;
25 27
             }
26 28
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     /**
14 14
      * @param string $event_name
15 15
      * @param array $event_data
16
-     * @return bool
16
+     * @return false|null
17 17
      */
18 18
     public static function events($event_name, $event_data = array())
19 19
     {
Please login to merge, or discard this patch.
main/inc/lib/internationalization.lib.php 4 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1710,8 +1710,7 @@
 block discarded – undo
1710 1710
             }
1711 1711
         }
1712 1712
         return false;
1713
-    }
1714
-    elseif (is_array($encoding2)) {
1713
+    } elseif (is_array($encoding2)) {
1715 1714
         foreach ($encoding2 as $encoding) {
1716 1715
             if (api_equal_encodings($encoding1, $encoding, $strict)) {
1717 1716
                 return true;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
         $date_format = str_replace(
634 634
             array('%A', '%a', '%B', '%b'),
635 635
             array(
636
-                $translated['days_long'][(int)strftime('%w', $time)],
637
-                $translated['days_short'][(int)strftime('%w', $time)],
638
-                $translated['months_long'][(int)strftime('%m', $time) - 1],
639
-                $translated['months_short'][(int)strftime('%m', $time) - 1],
636
+                $translated['days_long'][(int) strftime('%w', $time)],
637
+                $translated['days_short'][(int) strftime('%w', $time)],
638
+                $translated['months_long'][(int) strftime('%m', $time) - 1],
639
+                $translated['months_short'][(int) strftime('%m', $time) - 1],
640 640
             ),
641 641
             $date_format
642 642
         );
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
  * @return string					Returns the encoding identificator modified in suitable for comparison way.
1584 1584
  */
1585 1585
 function api_refine_encoding_id($encoding) {
1586
-    if (is_array($encoding)){
1586
+    if (is_array($encoding)) {
1587 1587
         return array_map('api_refine_encoding_id', $encoding);
1588 1588
     }
1589 1589
     return strtoupper(str_replace('_', '-', $encoding));
Please login to merge, or discard this patch.
Doc Comments   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -433,6 +433,7 @@  discard block
 block discarded – undo
433 433
  * If null, the timezone will be determined based on user preference,
434 434
  * or timezone chosen by the admin for the platform.
435 435
  * @param string The timezone to be converted from. If null, UTC will be assumed.
436
+ * @param string $to_timezone
436 437
  * @return string The converted time formatted as Y-m-d H:i:s
437 438
  *
438 439
  * @author Guillaume Viguier <[email protected]>
@@ -691,6 +692,8 @@  discard block
 block discarded – undo
691 692
  * @param mixed The time to be converted
692 693
  * @param mixed Format to be used (TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG)
693 694
  * @param string Timezone to be converted from. If null, UTC will be assumed.
695
+ * @param integer $format
696
+ * @param string $from_timezone
694 697
  * @return string Converted and localized date
695 698
  *
696 699
  * @author Guillaume Viguier <[email protected]>
@@ -760,7 +763,7 @@  discard block
 block discarded – undo
760 763
  * @param int|string $format (optional)	The person name format. It may be a pattern-string (for example '%t %l, %f' or '%T %F %L', ...) or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
761 764
  * @param string $language (optional)	The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
762 765
  * @param string $encoding (optional)	The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
763
- * @return bool							The result is sort of full name of the person.
766
+ * @return string							The result is sort of full name of the person.
764 767
  * Sample results:
765 768
  * Peter Ustinoff or Dr. Peter Ustinoff     - the Western order
766 769
  * Ustinoff Peter or Dr. Ustinoff Peter     - the Eastern order
@@ -1081,8 +1084,8 @@  discard block
 block discarded – undo
1081 1084
 
1082 1085
 /**
1083 1086
  * This function returns a string or an array with all occurrences of search in subject (ignoring case) replaced with the given replace value.
1084
- * @param mixed $search					String or array of strings to be found.
1085
- * @param mixed $replace				String or array of strings used for replacement.
1087
+ * @param string $search					String or array of strings to be found.
1088
+ * @param string $replace				String or array of strings used for replacement.
1086 1089
  * @param mixed $subject				String or array of strings being searched.
1087 1090
  * @param int $count (optional)			The number of matched and replaced needles will be returned in count, which is passed by reference.
1088 1091
  * @param string $encoding (optional)	The used internally by this function character encoding.
@@ -1145,10 +1148,10 @@  discard block
 block discarded – undo
1145 1148
 /**
1146 1149
  * Finds first occurrence of a string within another, case insensitive.
1147 1150
  * @param string $haystack					The string from which to get the first occurrence.
1148
- * @param mixed $needle						The string to be found.
1151
+ * @param string $needle						The string to be found.
1149 1152
  * @param bool $before_needle (optional)	Determines which portion of $haystack this function returns. The default value is FALSE.
1150 1153
  * @param string $encoding (optional)		The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
1151
- * @return mixed							Returns the portion of $haystack, or FALSE if $needle is not found.
1154
+ * @return false|string							Returns the portion of $haystack, or FALSE if $needle is not found.
1152 1155
  * Notes:
1153 1156
  * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character.
1154 1157
  * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle.
@@ -1204,7 +1207,7 @@  discard block
 block discarded – undo
1204 1207
  * @param mixed $needle						The string which first character is to be found.
1205 1208
  * @param bool $before_needle (optional)	Determines which portion of $haystack this function returns. The default value is FALSE.
1206 1209
  * @param string $encoding (optional)		The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
1207
- * @return mixed							Returns the portion of $haystack, or FALSE if the first character from $needle is not found.
1210
+ * @return false|string							Returns the portion of $haystack, or FALSE if the first character from $needle is not found.
1208 1211
  * Notes:
1209 1212
  * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character.
1210 1213
  * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence.
@@ -1271,7 +1274,7 @@  discard block
 block discarded – undo
1271 1274
  * @param mixed $needle						The string to be found.
1272 1275
  * @param bool $before_needle (optional)	Determines which portion of $haystack this function returns. The default value is FALSE.
1273 1276
  * @param string $encoding (optional)		The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
1274
- * @return mixed							Returns the portion of $haystack, or FALSE if $needle is not found.
1277
+ * @return false|string							Returns the portion of $haystack, or FALSE if $needle is not found.
1275 1278
  * Notes:
1276 1279
  * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character.
1277 1280
  * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle.
@@ -1452,8 +1455,8 @@  discard block
 block discarded – undo
1452 1455
 
1453 1456
 /**
1454 1457
  * Performs a regular expression search and replace, UTF-8 aware when it is applicable.
1455
- * @param string|array $pattern			The pattern to search for. It can be either a string or an array with strings.
1456
- * @param string|array $replacement		The string or an array with strings to replace.
1458
+ * @param string $pattern			The pattern to search for. It can be either a string or an array with strings.
1459
+ * @param string $replacement		The string or an array with strings to replace.
1457 1460
  * @param string|array $subject			The string or an array with strings to search and replace.
1458 1461
  * @param int $limit					The maximum possible replacements for each pattern in each subject string. Defaults to -1 (no limit).
1459 1462
  * @param int &$count					If specified, this variable will be filled with the number of replacements done.
@@ -1601,7 +1604,7 @@  discard block
 block discarded – undo
1601 1604
 
1602 1605
 /**
1603 1606
  * This function checks whether two $encoding are equal (same, equvalent).
1604
- * @param string|array $encoding1		The first encoding
1607
+ * @param string $encoding1		The first encoding
1605 1608
  * @param string|array $encoding2		The second encoding
1606 1609
  * @param bool $strict					When this parameter is TRUE the comparison ignores aliases of encodings.
1607 1610
  * When the parameter is FALSE, aliases are taken into account.
@@ -1705,6 +1708,7 @@  discard block
 block discarded – undo
1705 1708
 /**
1706 1709
  * Checks a string for UTF-8 validity.
1707 1710
  *
1711
+ * @param string $string
1708 1712
  */
1709 1713
 function api_is_valid_utf8($string)
1710 1714
 {
@@ -1847,7 +1851,7 @@  discard block
 block discarded – undo
1847 1851
 /**
1848 1852
  * Replaces non-valid formats for person names with the default (English) format.
1849 1853
  * @param string $format	The input format to be verified.
1850
- * @return bool				Returns the same format if is is valid, otherwise returns a valid English format.
1854
+ * @return string				Returns the same format if is is valid, otherwise returns a valid English format.
1851 1855
  */
1852 1856
 function _api_validate_person_name_format($format) {
1853 1857
     if (empty($format) || stripos($format, '%f') === false || stripos($format, '%l') === false) {
@@ -1976,6 +1980,9 @@  discard block
 block discarded – undo
1976 1980
 
1977 1981
 // This function checks whether the function _api_convert_encoding() (the php-
1978 1982
 // implementation) is able to convert from/to a given encoding.
1983
+/**
1984
+ * @param string $encoding
1985
+ */
1979 1986
 function _api_convert_encoding_supports($encoding)
1980 1987
 {
1981 1988
     static $supports = array();
@@ -1987,7 +1994,7 @@  discard block
 block discarded – undo
1987 1994
 
1988 1995
 /**
1989 1996
  * Given a date object, return a human or ISO format, with or without h:m:s
1990
- * @param object $date The Date object
1997
+ * @param DateTime $date The Date object
1991 1998
  * @param bool $showTime Whether to show the time and date (true) or only the date (false)
1992 1999
  * @param bool $humanForm Whether to show day-month-year (true) or year-month-day (false)
1993 2000
  * @return string Formatted date
Please login to merge, or discard this patch.
Indentation   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     }
100 100
 
101 101
     if (!isset($used_lang_vars)) {
102
-    	$used_lang_vars = array();
102
+        $used_lang_vars = array();
103 103
     }
104 104
 
105 105
     // Caching results from some API functions, for speed.
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     static $text_direction = array();
301 301
 
302 302
     if (empty($language)) {
303
-    	$language = api_get_interface_language();
303
+        $language = api_get_interface_language();
304 304
     }
305 305
     if (!isset($text_direction[$language])) {
306 306
         $text_direction[$language] = in_array(
@@ -1723,7 +1723,6 @@  discard block
 block discarded – undo
1723 1723
 
1724 1724
 /**
1725 1725
  * Return true a date is valid
1726
-
1727 1726
  * @param string $date example: 2014-06-30 13:05:05
1728 1727
  * @param string $format example: "Y-m-d H:i:s"
1729 1728
  *
@@ -1996,15 +1995,15 @@  discard block
 block discarded – undo
1996 1995
 {
1997 1996
     if ($showTime) {
1998 1997
         if ($humanForm) {
1999
-           return $date->format('j M Y H:i:s');
1998
+            return $date->format('j M Y H:i:s');
2000 1999
         } else {
2001
-           return $date->format('Y-m-d H:i:s');
2000
+            return $date->format('Y-m-d H:i:s');
2002 2001
         }
2003 2002
     } else {
2004 2003
         if ($humanForm) {
2005
-           return $date->format('j M Y');
2004
+            return $date->format('j M Y');
2006 2005
         } else {
2007
-           return $date->format('Y-m-d');
2006
+            return $date->format('Y-m-d');
2008 2007
         }
2009 2008
     }
2010 2009
 }
Please login to merge, or discard this patch.
main/inc/lib/course_request.lib.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
         $exemplary_content
66 66
     ) {
67 67
         $wanted_code = trim($wanted_code);
68
-        $user_id = (int)$user_id;
69
-        $exemplary_content = (bool)$exemplary_content ? 1 : 0;
68
+        $user_id = (int) $user_id;
69
+        $exemplary_content = (bool) $exemplary_content ? 1 : 0;
70 70
 
71 71
         if ($wanted_code == '') {
72 72
             return false;
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
         $user_id,
255 255
         $exemplary_content
256 256
     ) {
257
-        $id = (int)$id;
257
+        $id = (int) $id;
258 258
         $wanted_code = trim($wanted_code);
259
-        $user_id = (int)$user_id;
260
-        $exemplary_content = (bool)$exemplary_content ? 1 : 0;
259
+        $user_id = (int) $user_id;
260
+        $exemplary_content = (bool) $exemplary_content ? 1 : 0;
261 261
 
262 262
         if ($wanted_code == '') {
263 263
             return false;
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public static function delete_course_request($id)
362 362
     {
363
-        $id = (int)$id;
363
+        $id = (int) $id;
364 364
         $sql = "DELETE FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)."
365 365
                 WHERE id = ".$id;
366 366
         $result = Database::query($sql);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         if (is_null($status)) {
378 378
             $sql = "SELECT COUNT(id) AS number FROM ".$course_table;
379 379
         } else {
380
-            $status = (int)$status;
380
+            $status = (int) $status;
381 381
             $sql = "SELECT COUNT(id) AS number FROM ".$course_table."
382 382
                     WHERE status = ".$status;
383 383
         }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
      */
396 396
     public static function get_course_request_info($id)
397 397
     {
398
-        $id = (int)$id;
398
+        $id = (int) $id;
399 399
         $sql = "SELECT *
400 400
                 FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)."
401 401
                 WHERE id = ".$id;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      */
414 414
     public static function get_course_request_code($id)
415 415
     {
416
-        $id = (int)$id;
416
+        $id = (int) $id;
417 417
         $sql = "SELECT code
418 418
                 FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)."
419 419
                 WHERE id = ".$id;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      */
435 435
     public static function accept_course_request($id)
436 436
     {
437
-        $id = (int)$id;
437
+        $id = (int) $id;
438 438
 
439 439
         // Retrieve request's data
440 440
         $course_request_info = self::get_course_request_info($id);
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             return false;
448 448
         }*/
449 449
 
450
-        $user_id = (int)$course_request_info['user_id'];
450
+        $user_id = (int) $course_request_info['user_id'];
451 451
         if ($user_id <= 0) {
452 452
             return false;
453 453
         }
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
      */
532 532
     public static function reject_course_request($id)
533 533
     {
534
-        $id = (int)$id;
534
+        $id = (int) $id;
535 535
         // Retrieve request's data
536 536
         $course_request_info = self::get_course_request_info($id);
537 537
         if (!is_array($course_request_info)) {
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      */
610 610
     public static function ask_for_additional_info($id)
611 611
     {
612
-        $id = (int)$id;
612
+        $id = (int) $id;
613 613
 
614 614
         // Retrieve request's data
615 615
         $course_request_info = self::get_course_request_info($id);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
      */
701 701
     public static function additional_info_asked($id)
702 702
     {
703
-        $id = (int)$id;
703
+        $id = (int) $id;
704 704
         $sql = "SELECT id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)."
705 705
                 WHERE (id = ".$id." AND info > 0)";
706 706
         $result = Database::num_rows(Database::query($sql));
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      * @param string $objetives
52 52
      * @param string $target_audience
53 53
      * @param int $user_id
54
-     * @return mixed The database id of the newly created course request or FALSE on failure.
54
+     * @return false|string The database id of the newly created course request or FALSE on failure.
55 55
      */
56 56
     public static function create_course_request(
57 57
         $wanted_code,
Please login to merge, or discard this patch.
main/inc/lib/access_url_edit_sessions_to_url_functions.lib.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@
 block discarded – undo
44 44
                     ORDER BY name, id
45 45
                     LIMIT 11';
46 46
             $rs = Database::query($sql);
47
-            $i=0;
47
+            $i = 0;
48 48
             while ($session = Database :: fetch_array($rs)) {
49 49
                 $i++;
50
-                if ($i<=10) {
50
+                if ($i <= 10) {
51 51
                      $return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />';
52 52
                 } else {
53 53
                     $return .= '...<br />';
54 54
                 }
55 55
             }
56 56
         }
57
-        $xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return));
57
+        $xajax_response -> addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
58 58
         return $xajax_response;
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             while ($session = Database :: fetch_array($rs)) {
49 49
                 $i++;
50 50
                 if ($i<=10) {
51
-                     $return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />';
51
+                        $return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />';
52 52
                 } else {
53 53
                     $return .= '...<br />';
54 54
                 }
Please login to merge, or discard this patch.