Completed
Push — 1.11.x ( 69878b...1da93a )
by José
64:32 queued 39:16
created
main/gradebook/lib/flatview_data_generator.class.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
             isset($this->params['only_subcat']) &&
115 115
             $this->params['only_subcat'] == $this->category->get_id()
116 116
         ) {
117
-            $main_weight  = $this->category->get_weight();
117
+            $main_weight = $this->category->get_weight();
118 118
             $grade_model_id = $this->category->get_grade_model_id();
119 119
         } else {
120
-            $main_cat  = Category::load($parent_id, null, null);
120
+            $main_cat = Category::load($parent_id, null, null);
121 121
             $main_weight = $main_cat[0]->get_weight();
122 122
             $grade_model_id = $main_cat[0]->get_grade_model_id();
123 123
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                     $list = [];
199 199
                     $list['items'] = $finalList;
200 200
                     $list['header'] = '<center>'.$mainHeader.'</center>';
201
-                    $headers[]= $list;
201
+                    $headers[] = $list;
202 202
                 } else {
203 203
                     $headers[] = '<center>'.$mainHeader.'</center>';
204 204
                 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                     !in_array($item->get_id(), $evaluationsAdded)
227 227
                 ) {
228 228
                     $weight = round(100 * $item->get_weight() / $main_weight, 1);
229
-                    $headers[] = $item->get_name() . ' ' . $weight . ' % ';
229
+                    $headers[] = $item->get_name().' '.$weight.' % ';
230 230
                 }
231 231
             }
232 232
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         if (!isset($items_count)) {
266 266
             $items_count = count($this->evals_links) - $items_start;
267 267
         }
268
-        for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
268
+        for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
269 269
             $item = $this->evals_links [$count + $items_start];
270 270
             $headers[] = $item->get_name();
271 271
         }
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
     ) {
295 295
         // Do some checks on users/items counts, redefine if invalid values
296 296
         if (!isset($users_count)) {
297
-            $users_count = count ($this->users) - $users_start;
297
+            $users_count = count($this->users) - $users_start;
298 298
         }
299 299
         if ($users_count < 0) {
300 300
             $users_count = 0;
301 301
         }
302 302
         if (!isset($items_count)) {
303
-            $items_count = count ($this->evals) + count ($this->links) - $items_start;
303
+            $items_count = count($this->evals) + count($this->links) - $items_start;
304 304
         }
305 305
         if ($items_count < 0) {
306 306
             $items_count = 0;
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 
314 314
         // sort users array
315 315
         if ($users_sorting & self :: FVDG_SORT_LASTNAME) {
316
-            usort($userTable, array('FlatViewDataGenerator','sort_by_last_name'));
316
+            usort($userTable, array('FlatViewDataGenerator', 'sort_by_last_name'));
317 317
 
318 318
         } elseif ($users_sorting & self :: FVDG_SORT_FIRSTNAME) {
319
-            usort($userTable, array('FlatViewDataGenerator','sort_by_first_name'));
319
+            usort($userTable, array('FlatViewDataGenerator', 'sort_by_first_name'));
320 320
         }
321 321
 
322 322
         if ($users_sorting & self :: FVDG_SORT_DESC) {
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
             $parent_id == 0 ||
361 361
             (isset($this->params['only_subcat']) && $this->params['only_subcat'] == $this->category->get_id())
362 362
         ) {
363
-            $main_weight  = $this->category->get_weight();
363
+            $main_weight = $this->category->get_weight();
364 364
             $grade_model_id = $this->category->get_grade_model_id();
365 365
         } else {
366
-            $main_cat  = Category::load($parent_id, null, null);
366
+            $main_cat = Category::load($parent_id, null, null);
367 367
             $main_weight = $main_cat[0]->get_weight();
368 368
             $grade_model_id = $main_cat[0]->get_grade_model_id();
369 369
         }
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
                     $divide = $score[1] == 0 ? 1 : $score[1];
476 476
 
477 477
                     $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
478
-                    $item_value  = $score[0]/$divide*$main_weight;
478
+                    $item_value = $score[0] / $divide * $main_weight;
479 479
 
480 480
                     // Fixing total when using one or multiple gradebooks
481
-                    $percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight();
482
-                    $item_value = $percentage*$item_value;
481
+                    $percentage = $sub_cat->get_weight() / ($sub_cat_percentage) * $sub_cat_percentage / $this->category->get_weight();
482
+                    $item_value = $percentage * $item_value;
483 483
                     $item_total += $sub_cat->get_weight();
484 484
                     /*
485 485
                         if ($convert_using_the_global_weight) {
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 if ($convert_using_the_global_weight) {
527 527
                     //$item_total = $main_weight;
528 528
                 }
529
-            } else  {
529
+            } else {
530 530
                 // All evaluations
531 531
                 $result = $this->parseEvaluations(
532 532
                     $user_id,
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
             // Sub cat weight
634 634
             //$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
635 635
 
636
-            $item_value = isset($score[0]) ? $score[0]/$divide : 0;
636
+            $item_value = isset($score[0]) ? $score[0] / $divide : 0;
637 637
 
638 638
             // Fixing total when using one or multiple gradebooks.
639 639
             if (empty($parentCategoryIdFilter)) {
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
         $data = array();
716 716
 
717 717
         foreach ($selected_users as $user) {
718
-            $row = array ();
718
+            $row = array();
719 719
             for ($count = 0; $count < count($this->evals_links); $count++) {
720 720
                 $item = $this->evals_links [$count];
721 721
                 $score = $item->calc_score($user[0]);
722
-                $porcent_score = isset($score[1]) &&  $score[1] > 0 ? ($score[0]*100)/$score[1] :0;
722
+                $porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0] * 100) / $score[1] : 0;
723 723
                 $row[$item->get_name()] = $porcent_score;
724 724
             }
725 725
             $data[$user[0]] = $row;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
         */
743 743
         $result = array();
744 744
         foreach ($data_by_item as $k => $v) {
745
-            $average = round(array_sum($v)/count($v));
745
+            $average = round(array_sum($v) / count($v));
746 746
             arsort($v);
747 747
             $maximum = array_shift($v);
748 748
             $minimum = array_pop($v);
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
                 $minimum = 0;
752 752
             }
753 753
 
754
-            $summary= array(
754
+            $summary = array(
755 755
                 'max' => $maximum,
756 756
                 'min' => $minimum,
757 757
                 'avg' => $average
@@ -768,19 +768,19 @@  discard block
 block discarded – undo
768 768
     public function get_data_to_graph()
769 769
     {
770 770
         // do some checks on users/items counts, redefine if invalid values
771
-        $usertable = array ();
771
+        $usertable = array();
772 772
         foreach ($this->users as $user) {
773 773
             $usertable[] = $user;
774 774
         }
775 775
         // sort users array
776
-        usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
776
+        usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
777 777
 
778
-        $data = array ();
778
+        $data = array();
779 779
 
780 780
         $selected_users = $usertable;
781 781
         foreach ($selected_users as $user) {
782
-            $row = array ();
783
-            $row[] = $user[0];    // user id
782
+            $row = array();
783
+            $row[] = $user[0]; // user id
784 784
             $item_value = 0;
785 785
             $item_total = 0;
786 786
 
@@ -788,12 +788,12 @@  discard block
 block discarded – undo
788 788
                 $item = $this->evals_links[$count];
789 789
                 $score = $item->calc_score($user[0]);
790 790
 
791
-                $divide =( ($score[1])==0 ) ? 1 : $score[1];
792
-                $item_value += $score[0]/$divide*$item->get_weight();
791
+                $divide = (($score[1]) == 0) ? 1 : $score[1];
792
+                $item_value += $score[0] / $divide * $item->get_weight();
793 793
                 $item_total += $item->get_weight();
794 794
 
795 795
 
796
-                $score_denom = ($score[1]==0) ? 1 : $score[1];
796
+                $score_denom = ($score[1] == 0) ? 1 : $score[1];
797 797
                 $score_final = ($score[0] / $score_denom) * 100;
798 798
                 $row[] = $score_final;
799 799
             }
@@ -820,15 +820,15 @@  discard block
 block discarded – undo
820 820
             $usertable[] = $user;
821 821
         }
822 822
         // sort users array
823
-        usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
823
+        usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
824 824
 
825 825
         // generate actual data array
826 826
         $scoredisplay = ScoreDisplay :: instance();
827 827
         $data = array();
828 828
         $selected_users = $usertable;
829 829
         foreach ($selected_users as $user) {
830
-            $row = array ();
831
-            $row[] = $user[0];    // user id
830
+            $row = array();
831
+            $row[] = $user[0]; // user id
832 832
             $item_value = 0;
833 833
             $item_total = 0;
834 834
             $final_score = 0;
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
                     $divide = $score[1] == 0 ? 1 : $score[1];
849 849
 
850 850
                     //$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
851
-                    $item_value     = $score[0]/$divide*$main_weight;
852
-                    $item_total        += $sub_cat->get_weight();
851
+                    $item_value = $score[0] / $divide * $main_weight;
852
+                    $item_total += $sub_cat->get_weight();
853 853
 
854 854
                     $row[] = array(
855 855
                         $item_value,
@@ -871,13 +871,13 @@  discard block
 block discarded – undo
871 871
                     $score = $item->calc_score($user[0]);
872 872
                     $divide = ($score[1]) == 0 ? 1 : $score[1];
873 873
                     $item_value += $score[0] / $divide * $item->get_weight();
874
-                    $item_total+=$item->get_weight();
875
-                    $score_denom=($score[1]==0) ? 1 : $score[1];
874
+                    $item_total += $item->get_weight();
875
+                    $score_denom = ($score[1] == 0) ? 1 : $score[1];
876 876
                     $score_final = ($score[0] / $score_denom) * 100;
877
-                    $row[] = array ($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM,null, true)));
877
+                    $row[] = array($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM, null, true)));
878 878
 
879 879
                 }
880
-                $total_score=array($item_value,$item_total);
880
+                $total_score = array($item_value, $item_total);
881 881
                 $score_final = ($item_value / $item_total) * 100;
882 882
                 if ($displayWarning) {
883 883
                     Display::display_warning_message($total_score[1]);
Please login to merge, or discard this patch.
main/gradebook/gradebook_view_result.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $resultedit[0],
63 63
         'edit_result_form',
64 64
         null,
65
-        api_get_self() . '?editres=' . $resultedit[0]->get_id() . '&selecteval=' . $select_eval.'&'.api_get_cidreq()
65
+        api_get_self().'?editres='.$resultedit[0]->get_id().'&selecteval='.$select_eval.'&'.api_get_cidreq()
66 66
     );
67 67
 
68 68
     if ($edit_res_form->validate()) {
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
         unset($result);
82 82
 
83 83
         Display::addFlash(Display::return_message(get_lang('ResultEdited'), 'normal', false));
84
-        header('Location: gradebook_view_result.php?selecteval=' . $select_eval . '&editresmessage=&'.api_get_cidreq());
84
+        header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&editresmessage=&'.api_get_cidreq());
85 85
         exit;
86 86
     }
87 87
 }
88 88
 $file_type = null;
89 89
 if (isset($_GET['import'])) {
90 90
     $interbreadcrumb[] = array(
91
-        'url' => api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?selecteval=' . $select_eval.'&'.api_get_cidreq(),
91
+        'url' => api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(),
92 92
         'name' => get_lang('ViewResult')
93 93
     );
94 94
     $import_result_form = new DataForm(
95 95
         DataForm :: TYPE_IMPORT,
96 96
         'import_result_form',
97 97
         null,
98
-        api_get_self() . '?import=&selecteval=' . $select_eval,
98
+        api_get_self().'?import=&selecteval='.$select_eval,
99 99
         '_blank',
100 100
         ''
101 101
     );
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                     if (($importedresult['user_id'] == $allresult->get_user_id())) {
124 124
                         if ($importedresult['score'] != $allresult->get_score()) {
125 125
                             if (!isset($values['overwrite'])) {
126
-                                header('Location: '.api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?selecteval=' . $select_eval . '&import_score_error=' . $importedresult['user_id']);
126
+                                header('Location: '.api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?selecteval='.$select_eval.'&import_score_error='.$importedresult['user_id']);
127 127
                                 exit;
128 128
                                 break;
129 129
                             } else {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                     }
142 142
                 }
143 143
                 if ($importedresult['user_id'] == null) {
144
-                    header('Location: gradebook_view_result.php?selecteval=' . $select_eval . '&incorrectdata=');
144
+                    header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&incorrectdata=');
145 145
                     exit;
146 146
                 }
147 147
                 $userinfo = api_get_user_info($importedresult['user_id']);
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
                     $userinfo['official_code'] != $importedresult['official_code']
151 151
                 ) {
152 152
                     if (!isset($values['ignoreerrors'])) {
153
-                        header('Location: gradebook_view_result.php?selecteval=' . $select_eval . '&import_user_error=' . $importedresult['user_id']);
153
+                        header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&import_user_error='.$importedresult['user_id']);
154 154
                         exit;
155 155
                     }
156 156
                 }
157 157
                 if ($added != '1') {
158 158
                     if ($importedresult['score'] > $eval[0]->get_max()) {
159
-                        header('Location: gradebook_view_result.php?selecteval=' . $select_eval . '&overwritemax=');
159
+                        header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&overwritemax=');
160 160
                         exit;
161 161
                     }
162 162
                     $result = new Result();
@@ -175,23 +175,23 @@  discard block
 block discarded – undo
175 175
                 }
176 176
             }
177 177
         } else {
178
-            header('Location: ' . api_get_self() . '?import=&selecteval=' . $select_eval . '&importnofile=');
178
+            header('Location: '.api_get_self().'?import=&selecteval='.$select_eval.'&importnofile=');
179 179
             Display::addFlash(Display::return_message(get_lang('ImportNoFile'), 'warning', false));
180 180
 
181 181
             exit;
182 182
         }
183 183
         if ($overwritescore != 0) {
184
-            header('Location: ' . api_get_self() . '?selecteval=' . $select_eval. '&importoverwritescore=' . $overwritescore);
185
-            Display::addFlash(Display::return_message(get_lang('ImportOverWriteScore') . ' ' . $overwritescore));
184
+            header('Location: '.api_get_self().'?selecteval='.$select_eval.'&importoverwritescore='.$overwritescore);
185
+            Display::addFlash(Display::return_message(get_lang('ImportOverWriteScore').' '.$overwritescore));
186 186
             exit;
187 187
         }
188 188
         if ($nr_results_added == 0) {
189 189
             Display::addFlash(Display::return_message(get_lang('ProblemUploadingFile'), 'warning', false));
190
-            header('Location: ' . api_get_self() . '?selecteval=' . $select_eval. '&nothingadded=');
190
+            header('Location: '.api_get_self().'?selecteval='.$select_eval.'&nothingadded=');
191 191
             exit;
192 192
         }
193 193
         Display::addFlash(Display::return_message(get_lang('FileUploadComplete'), 'success', false));
194
-        header('Location: ' . api_get_self() . '?selecteval=' . $select_eval . '&importok=');
194
+        header('Location: '.api_get_self().'?selecteval='.$select_eval.'&importok=');
195 195
         exit;
196 196
     }
197 197
 }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         DataForm :: TYPE_EXPORT,
207 207
         'export_result_form',
208 208
         null,
209
-        api_get_self() . '?export=&selecteval=' . $select_eval,
209
+        api_get_self().'?export=&selecteval='.$select_eval,
210 210
         '_blank',
211 211
         $locked_status
212 212
     );
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     if ($export_result_form->validate()) {
218 218
         $export = $export_result_form->exportValues();
219 219
         $file_type = $export['file_type'];
220
-        $filename = 'export_results_' . gmdate('Y-m-d_H-i-s');
220
+        $filename = 'export_results_'.gmdate('Y-m-d_H-i-s');
221 221
         $results = Result :: load(null, null, $select_eval);
222 222
         $data = array(); //when file type is csv, add a header to the output file
223 223
         if ($file_type == 'csv') {
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
             $datagen = new ResultsDataGenerator($eval[0], $allresults);
238 238
 
239 239
             // set headers pdf
240
-            !empty($_user['official_code']) ? $officialcode = $_user['official_code'] . ' - ' : '';
240
+            !empty($_user['official_code']) ? $officialcode = $_user['official_code'].' - ' : '';
241 241
 
242
-            $h1 = array(get_lang('Teacher'), $officialcode . $_user['firstName'] . ', ' . $_user['lastName']);
242
+            $h1 = array(get_lang('Teacher'), $officialcode.$_user['firstName'].', '.$_user['lastName']);
243 243
             $h2 = array(get_lang('Score'), $eval[0]->get_max());
244 244
             $h3 = array(get_lang('Course'), $_course['name']);
245 245
             $h4 = array(get_lang('Weight'), $eval[0]->get_weight());
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
             $header_pdf = array($h1, $h2, $h3, $h4, $h5, $h6);
250 250
 
251 251
             // set footer pdf
252
-            $f1 = '<hr />' . get_lang('Drh');
253
-            $f2 = '<hr />' . get_lang('Teacher');
254
-            $f3 = '<hr />' . get_lang('Date');
252
+            $f1 = '<hr />'.get_lang('Drh');
253
+            $f2 = '<hr />'.get_lang('Teacher');
254
+            $f3 = '<hr />'.get_lang('Date');
255 255
             $footer_pdf = array($f1, $f2, $f3);
256 256
 
257 257
             // set title pdf
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
             // set headers data table
261 261
             $head_ape_name = '';
262 262
             if (api_is_western_name_order()) {
263
-                $head_ape_name = get_lang('FirstName') . ', ' . get_lang('LastName');
263
+                $head_ape_name = get_lang('FirstName').', '.get_lang('LastName');
264 264
             } else {
265
-                $head_ape_name = get_lang('LastName') . ', ' . get_lang('FirstName');
265
+                $head_ape_name = get_lang('LastName').', '.get_lang('FirstName');
266 266
             }
267 267
 
268 268
             $head_table = array(
@@ -297,15 +297,15 @@  discard block
 block discarded – undo
297 297
                 $result[] = $user_info['username'];
298 298
 
299 299
                 if (api_is_western_name_order()) {
300
-                    $result[] = $user_info['firstname'] . ', ' . $user_info['lastname'];
300
+                    $result[] = $user_info['firstname'].', '.$user_info['lastname'];
301 301
                 } else {
302
-                    $result[] = $user_info['lastname'] . ', ' . $user_info['firstname'];
302
+                    $result[] = $user_info['lastname'].', '.$user_info['firstname'];
303 303
                 }
304 304
                 if ($number_decimals == null) {
305 305
                     if (empty($data['scoreletter']) && !is_numeric($data['score'])) {
306 306
                         $result[] = get_lang('DidNotTakeTheExam');
307 307
                     } else {
308
-                        $result[] = api_strtoupper(get_lang('Literal' . $data['scoreletter']));
308
+                        $result[] = api_strtoupper(get_lang('Literal'.$data['scoreletter']));
309 309
                     }
310 310
                 } else {
311 311
                     if (empty($data['score']) && !is_numeric($data['score'])) {
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 if (isset($_GET['resultdelete'])) {
357 357
     $result = Result :: load($_GET['resultdelete']);
358 358
     $result[0]->delete();
359
-    header('Location: gradebook_view_result.php?deleteresult=&selecteval=' . $select_eval);
359
+    header('Location: gradebook_view_result.php?deleteresult=&selecteval='.$select_eval);
360 360
     exit;
361 361
 }
362 362
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                     $result[0]->delete();
374 374
                     $number_of_deleted_results++;
375 375
                 }
376
-                header('Location: gradebook_view_result.php?massdelete=&selecteval=' . $select_eval);
376
+                header('Location: gradebook_view_result.php?massdelete=&selecteval='.$select_eval);
377 377
                 exit;
378 378
                 break;
379 379
         }
@@ -414,14 +414,14 @@  discard block
 block discarded – undo
414 414
 
415 415
 $htmlHeadXtra[] = '<script>
416 416
 function confirmationuser() {
417
-    if (confirm("' . get_lang('DeleteUser') . '?"))
417
+    if (confirm("' . get_lang('DeleteUser').'?"))
418 418
     	{return true;}
419 419
     else
420 420
     	{return false;}
421 421
 }
422 422
 
423 423
 function confirmationall () {
424
-    if (confirm("' . get_lang('DeleteAll') . '?"))
424
+    if (confirm("' . get_lang('DeleteAll').'?"))
425 425
     	{return true;}
426 426
     else
427 427
     	{return false;}
@@ -430,13 +430,13 @@  discard block
 block discarded – undo
430 430
 if (isset($_GET['deleteall'])) {
431 431
     $eval[0]->delete_results();
432 432
     Display::addFlash(Display::return_message(get_lang('AllResultDeleted')));
433
-    header('Location: '.api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?allresdeleted=&selecteval=' . $select_eval.'&'.api_get_cidreq());
433
+    header('Location: '.api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?allresdeleted=&selecteval='.$select_eval.'&'.api_get_cidreq());
434 434
     exit;
435 435
 }
436 436
 if (!isset($_GET['export']) && (!isset($_GET['import']))) {
437 437
     if (!isset($_GET['selectcat'])) {
438 438
         $interbreadcrumb[] = array(
439
-            'url' => $_SESSION['gradebook_dest'] . '?selectcat=' . $currentcat[0]->get_id().'&'.api_get_cidreq(),
439
+            'url' => $_SESSION['gradebook_dest'].'?selectcat='.$currentcat[0]->get_id().'&'.api_get_cidreq(),
440 440
             'name' => get_lang('Details')
441 441
         );
442 442
     }
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 }
488 488
 if (isset($_GET['import_score_error'])) {
489 489
     $userinfo = api_get_user_info($_GET['import_score_error']);
490
-    Display :: display_warning_message(get_lang('ScoreDoesNotMatch') . ' ' . api_get_person_name($userinfo['firstname'], $userinfo['lastname']));
490
+    Display :: display_warning_message(get_lang('ScoreDoesNotMatch').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']));
491 491
 }
492 492
 if ($file_type == null) {
493 493
     //show the result header
Please login to merge, or discard this patch.
main/gradebook/gradebook_showlog_eval.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 
12 12
 $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
13 13
 
14
-$interbreadcrumb[] = array (
14
+$interbreadcrumb[] = array(
15 15
     'url' => $_SESSION['gradebook_dest'].'?',
16 16
     'name' => get_lang('Gradebook'
17 17
 ));
18
-$interbreadcrumb[] = array (
18
+$interbreadcrumb[] = array(
19 19
     'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat,
20 20
     'name' => get_lang('Details'
21 21
 ));
22
-$interbreadcrumb[] = array (
22
+$interbreadcrumb[] = array(
23 23
     'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.$selectCat,
24 24
     'name' => get_lang('GradebookQualifyLog')
25 25
 );
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 $t_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
32 32
 $t_user = Database :: get_main_table(TABLE_MAIN_USER);
33
-$visible_log=Security::remove_XSS($_GET['visiblelog']);
33
+$visible_log = Security::remove_XSS($_GET['visiblelog']);
34 34
 
35 35
 $evaledit = Evaluation :: load($visible_log);
36 36
 $sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 foreach ($list_info as $key => $info_log) {
48
-    $list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
49
-    $list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
48
+    $list_info[$key][5] = ($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
49
+    $list_info[$key][3] = ($info_log[3] == 1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
50 50
 }
51 51
 
52 52
 $parameters = array(
Please login to merge, or discard this patch.
main/gradebook/gradebook_statistics.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 
10 10
 api_block_anonymous_users();
11 11
 
12
-$eval= Evaluation :: load($_GET['selecteval']);
12
+$eval = Evaluation :: load($_GET['selecteval']);
13 13
 if ($eval[0]->get_category_id() < 0) {
14 14
     // if category id is negative, then the evaluation's origin is a link
15
-    $link= LinkFactory :: get_evaluation_link($eval[0]->get_id());
15
+    $link = LinkFactory :: get_evaluation_link($eval[0]->get_id());
16 16
     $currentcat = Category :: load($link->get_category_id());
17 17
 } else {
18 18
     $currentcat = Category :: load($eval[0]->get_category_id());
19 19
 }
20 20
 
21
-$interbreadcrumb[]= array (
22
-    'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
21
+$interbreadcrumb[] = array(
22
+    'url' => $_SESSION['gradebook_dest'].'?selectcat='.$currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
23 23
 
24 24
 if (api_is_allowed_to_edit()) {
25
-    $interbreadcrumb[]= array (
26
-        'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
25
+    $interbreadcrumb[] = array(
26
+        'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
27 27
         'name' => get_lang('ViewResult')
28 28
     );
29 29
 }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         Display :: display_error_message(get_lang('PleaseEnableScoringSystem'), false);
46 46
     }
47 47
 } else {
48
-    $allresults = Result::load(null,null,$eval[0]->get_id());
48
+    $allresults = Result::load(null, null, $eval[0]->get_id());
49 49
     $nr_items = array();
50 50
     foreach ($displays as $itemsdisplay) {
51 51
         $nr_items[$itemsdisplay['display']] = 0;
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
     }
79 79
 
80 80
     // Generate table
81
-    $stattable= '<table class="data_table" cellspacing="0" cellpadding="3">';
82
-    $stattable .= '<tr><th>' . get_lang('ScoringSystem') . '</th>';
83
-    $stattable .= '<th>' . get_lang('Percentage') . '</th>';
84
-    $stattable .= '<th>' . get_lang('CountUsers') . '</th>';
81
+    $stattable = '<table class="data_table" cellspacing="0" cellpadding="3">';
82
+    $stattable .= '<tr><th>'.get_lang('ScoringSystem').'</th>';
83
+    $stattable .= '<th>'.get_lang('Percentage').'</th>';
84
+    $stattable .= '<th>'.get_lang('CountUsers').'</th>';
85 85
     //$stattable .= '<th>' . get_lang('Statistics') . '</th></tr>';
86
-    $counter=0;
86
+    $counter = 0;
87 87
     foreach ($keys as $key) {
88
-        $bar = ($highest_ratio > 0?($nr_items[$key] / $highest_ratio) * 100:0);
89
-        $stattable .= '<tr class="row_' . ($counter % 2 == 0 ? 'odd' : 'even') . '">';
90
-        $stattable .= '<td width="150">' . $key . '</td>';
88
+        $bar = ($highest_ratio > 0 ? ($nr_items[$key] / $highest_ratio) * 100 : 0);
89
+        $stattable .= '<tr class="row_'.($counter % 2 == 0 ? 'odd' : 'even').'">';
90
+        $stattable .= '<td width="150">'.$key.'</td>';
91 91
 
92 92
         $stattable .= '<td width="550">'.Display::bar_progress($bar).'</td>';
93
-        $stattable .= '<td align="right">' . $nr_items[$key] . '</td>';
93
+        $stattable .= '<td align="right">'.$nr_items[$key].'</td>';
94 94
         $counter++;
95 95
     }
96 96
     $stattable .= '</tr></table>';
Please login to merge, or discard this patch.
main/lp/lp_build.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 $isStudentView  = (int) $_REQUEST['isStudentView'];
28 28
 $learnpath_id   = (int) $_REQUEST['lp_id'];
29
-$submit			= $_POST['submit_button'];
29
+$submit = $_POST['submit_button'];
30 30
 
31 31
 /* MAIN CODE */
32 32
 if ((!$is_allowed_to_edit) || ($isStudentView)) {
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 if (!empty($gradebook) && $gradebook == 'view') {
68
-    $interbreadcrumb[] = array (
69
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
68
+    $interbreadcrumb[] = array(
69
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
70 70
         'name' => get_lang('ToolGradebook')
71 71
     );
72 72
 }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 $interbreadcrumb[] = array('url' => '#', "name" => $therow['name']);
75 75
 
76 76
 // Theme calls.
77
-$lp_theme_css=$_SESSION['oLP']->get_theme();
77
+$lp_theme_css = $_SESSION['oLP']->get_theme();
78 78
 $show_learn_path = true;
79 79
 Display::display_header('', 'Path');
80 80
 $suredel = trim(get_lang('AreYouSureToDeleteJS'));
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 
144 144
 function show_block($link, $title, $subtitle, $icon) {
145 145
     $html = '<li class="col-md-4">';
146
-    $html .=  '<div class="thumbnail">';
147
-    $html .=  '<a href="'.$link.'" title="'.$title.'">';
148
-    $html .=  Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
149
-    $html .=  '</a>';
150
-    $html .=  '<div class="caption">';
151
-    $html .=  '<strong>'.$title.'</strong></a> '.$subtitle;
152
-    $html .=  '</div>';
153
-    $html .=  '</div>';
154
-    $html .=  '</li>';
146
+    $html .= '<div class="thumbnail">';
147
+    $html .= '<a href="'.$link.'" title="'.$title.'">';
148
+    $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
149
+    $html .= '</a>';
150
+    $html .= '<div class="caption">';
151
+    $html .= '<strong>'.$title.'</strong></a> '.$subtitle;
152
+    $html .= '</div>';
153
+    $html .= '</div>';
154
+    $html .= '</li>';
155 155
     return $html;
156 156
 }
157 157
 
Please login to merge, or discard this patch.
main/group/group_creation.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 if (isset($_POST['number_of_groups'])) {
80 80
     if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) {
81 81
         Display :: display_error_message(
82
-			get_lang('PleaseEnterValidNumber').'<br /><br />
82
+            get_lang('PleaseEnterValidNumber').'<br /><br />
83 83
 			<a href="group_creation.php?'.api_get_cidreq().'">&laquo; '.get_lang('Back').'</a>',
84
-			false
85
-		);
84
+            false
85
+        );
86 86
     } else {
87 87
         $number_of_groups = intval($_POST['number_of_groups']);
88 88
         if ($number_of_groups > 1) {
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
     }
121 121
     </script>
122 122
     <?php
123
-		}
124
-		$group_categories = GroupManager::get_categories();
125
-		$group_id = GroupManager :: get_number_of_groups() + 1;
126
-		$cat_options = [];
127
-		foreach ($group_categories as $index => $category) {
128
-			$cat_options[$category['id']] = $category['title'];
129
-		}
123
+        }
124
+        $group_categories = GroupManager::get_categories();
125
+        $group_id = GroupManager :: get_number_of_groups() + 1;
126
+        $cat_options = [];
127
+        foreach ($group_categories as $index => $category) {
128
+            $cat_options[$category['id']] = $category['title'];
129
+        }
130 130
         $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq());
131 131
 
132
-		// Modify the default templates
133
-		$renderer = $form->defaultRenderer();
134
-		$form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>";
135
-		$renderer->setFormTemplate($form_template);
136
-		$element_template = <<<EOT
132
+        // Modify the default templates
133
+        $renderer = $form->defaultRenderer();
134
+        $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>";
135
+        $renderer->setFormTemplate($form_template);
136
+        $element_template = <<<EOT
137 137
         <tr class="separate">
138 138
 		<td>
139 139
 			<!-- BEGIN required -->
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $form->setDefaults($defaults);
226 226
         $form->addButtonCreate(get_lang('CreateGroup'), 'submit');
227 227
         $form->display();
228
-	}
228
+    }
229 229
 } else {
230 230
     /*
231 231
      * Show form to generate new groups
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         case 'create_groups':
25 25
             $groups = array();
26 26
 
27
-            for ($i = 0; $i < $_POST['number_of_groups']; $i ++) {
27
+            for ($i = 0; $i < $_POST['number_of_groups']; $i++) {
28 28
                 $group1['name'] = empty($_POST['group_'.$i.'_name']) ? get_lang('Group').' '.$i : $_POST['group_'.$i.'_name'];
29 29
                 $group1['category'] = isset($_POST['group_'.$i.'_category']) ? $_POST['group_'.$i.'_category'] : null;
30 30
                 $group1['tutor'] = isset($_POST['group_'.$i.'_tutor']) ? $_POST['group_'.$i.'_tutor'] : null;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $form->addGroup($group_el, 'groups', null, "</td><td>", false);
163 163
         // Checkboxes
164 164
         if ($_POST['number_of_groups'] > 1) {
165
-            $group_el = array ();
165
+            $group_el = array();
166 166
             $group_el[] = $form->createElement('static', null, null, ' ');
167 167
             if (api_get_setting('allow_group_categories') === 'true') {
168 168
                 $group_el[] = $form->createElement(
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             $form->addGroup($group_el, 'groups', null, '</td><td>', false);
184 184
         }
185 185
         // Properties for all groups
186
-        for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) {
186
+        for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number++) {
187 187
             $group_el = array();
188 188
             $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name');
189 189
             if (api_get_setting('allow_group_categories') === 'true') {
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
                     $prev = '000';
211 211
                 } elseif ($group_id < 100) {
212 212
                     $prev = '00';
213
-                } elseif ($group_id<1000) {
213
+                } elseif ($group_id < 1000) {
214 214
                     $prev = '0';
215 215
                 } else {
216 216
                     $prev = '';
217 217
                 }
218 218
             }
219 219
 
220
-            $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++;
220
+            $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id++;
221 221
             $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false);
222 222
         }
223 223
         $defaults['action'] = 'create_groups';
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
      */
233 233
     $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq());
234 234
     $create_groups_form->addElement('header', $nameTools);
235
-    $create_groups_form->addText('number_of_groups',get_lang('NumberOfGroupsToCreate'),null,array('value'=>'1'));
236
-    $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'),'plus','primary');
235
+    $create_groups_form->addText('number_of_groups', get_lang('NumberOfGroupsToCreate'), null, array('value'=>'1'));
236
+    $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'), 'plus', 'primary');
237 237
     $defaults = array();
238 238
     $defaults['number_of_groups'] = 1;
239 239
     $create_groups_form->setDefaults($defaults);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * Show form to generate subgroups
244 244
      */
245 245
     if (api_get_setting('allow_group_categories') === 'true' && count(GroupManager :: get_group_list()) > 0) {
246
-        $base_group_options = array ();
246
+        $base_group_options = array();
247 247
         $groups = GroupManager :: get_group_list();
248 248
         foreach ($groups as $index => $group) {
249 249
             $number_of_students = GroupManager :: number_of_students($group['id']);
Please login to merge, or discard this patch.
main/group/group_overview.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  */
16 16
 require_once '../inc/global.inc.php';
17 17
 $this_section = SECTION_COURSES;
18
-$current_course_tool  = TOOL_GROUP;
18
+$current_course_tool = TOOL_GROUP;
19 19
 
20 20
 // Notice for unauthorized people.
21 21
 api_protect_course_script(true);
@@ -85,29 +85,29 @@  discard block
 block discarded – undo
85 85
         Display::return_icon('add.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>';
86 86
 
87 87
 if (api_get_setting('allow_group_categories') === 'true') {
88
-    $actions.= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
88
+    $actions .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
89 89
         Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'</a>';
90 90
 } else {
91
-    $actions.= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.
91
+    $actions .= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.
92 92
         Display::return_icon('settings.png', get_lang('PropModify'), '', ICON_SIZE_MEDIUM).'</a>';
93 93
 }
94
-$actions.= '<a href="import.php?'.api_get_cidreq().'&action=import">'.
94
+$actions .= '<a href="import.php?'.api_get_cidreq().'&action=import">'.
95 95
     Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM).'</a>';
96 96
 
97
-$actions.= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'.
97
+$actions .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'.
98 98
     Display::return_icon('export_csv.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';
99 99
 
100
-$actions.= '<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'.
100
+$actions .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'.
101 101
 Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
102 102
 
103
-$actions.= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'.
103
+$actions .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'.
104 104
     Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
105 105
 
106
-$actions.= '<a href="group.php?'.api_get_cidreq().'">'.
107
-    Display::return_icon('group.png', get_lang('Groups'),'',ICON_SIZE_MEDIUM).'</a>';
106
+$actions .= '<a href="group.php?'.api_get_cidreq().'">'.
107
+    Display::return_icon('group.png', get_lang('Groups'), '', ICON_SIZE_MEDIUM).'</a>';
108 108
 
109 109
 
110
-$actions.= '<a href="../user/user.php?'.api_get_cidreq().'">'.
110
+$actions .= '<a href="../user/user.php?'.api_get_cidreq().'">'.
111 111
 Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICON_SIZE_MEDIUM).'</a>';
112 112
 
113 113
 // Action links
Please login to merge, or discard this patch.
main/inc/lib/gradebook.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         }
58 58
 
59 59
         $c_id = $c_id ? intval($c_id) : api_get_course_int_id();
60
-        $table  = Database::get_course_table(TABLE_TOOL_LIST);
60
+        $table = Database::get_course_table(TABLE_TOOL_LIST);
61 61
         $sql = "SELECT * from $table
62 62
                 WHERE c_id = $c_id and name='$name'
63 63
                 LIMIT 1";
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $selected_skills = self::get_skills_by_gradebook($gradebook_id);
195 195
         $clean_selected_skills = array();
196 196
         if (!empty($selected_skills)) {
197
-            foreach($selected_skills as $skill) {
197
+            foreach ($selected_skills as $skill) {
198 198
                 $clean_selected_skills[] = $skill['id'];
199 199
             }
200 200
         }
Please login to merge, or discard this patch.
main/inc/ajax/lp.ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             foreach ($tab_parents_id as $parent_id) {
85 85
                 $Same_parent_LP_item_list = $LP_item_list->get_item_with_same_parent($parent_id);
86 86
                 $previous_item_id = 0;
87
-                for ($i=0; $i < count($Same_parent_LP_item_list->list); $i++) {
87
+                for ($i = 0; $i < count($Same_parent_LP_item_list->list); $i++) {
88 88
                     $item_id = $Same_parent_LP_item_list->list[$i]->id;
89 89
                     // display_order
90 90
                     $display_order = $i + 1;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                     // next_item_id
96 96
                     $next_item_id = 0;
97 97
                     if ($i < count($Same_parent_LP_item_list->list) - 1) {
98
-                        $next_item_id = $Same_parent_LP_item_list->list[$i+1]->id;
98
+                        $next_item_id = $Same_parent_LP_item_list->list[$i + 1]->id;
99 99
                     }
100 100
                     $LP_item_list->set_parameters_for_id($item_id, $next_item_id, "next_item_id");
101 101
                 }
Please login to merge, or discard this patch.