Completed
Pull Request — 1.11.x (#1262)
by José
41:21
created
main/gradebook/lib/be/category.class.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function set_session_id($session_id = 0)
201 201
     {
202
-        $this->session_id = (int)$session_id;
202
+        $this->session_id = (int) $session_id;
203 203
     }
204 204
 
205 205
     /**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $skills = $this->get_skills();
289 289
         $skill_select = array();
290 290
         if (!empty($skills)) {
291
-            foreach($skills as $skill) {
291
+            foreach ($skills as $skill) {
292 292
                 $skill_select[$skill['id']] = $skill['name'];
293 293
             }
294 294
         }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public static function load_session_categories($id = null, $session_id = null)
324 324
     {
325
-        if (isset($id) && (int)$id === 0) {
325
+        if (isset($id) && (int) $id === 0) {
326 326
             $cats = array();
327 327
             $cats[] = Category::create_root_category();
328 328
             return $cats;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         if (!empty($session_id)) {
336 336
             $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
337 337
             $sql = 'SELECT id, course_code
338
-                    FROM '.$tbl_grade_categories. '
338
+                    FROM '.$tbl_grade_categories.'
339 339
                     WHERE session_id = '.$session_id;
340 340
             $result_session = Database::query($sql);
341 341
             if (Database::num_rows($result_session) > 0) {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
     ) {
376 376
         //if the category given is explicitly 0 (not null), then create
377 377
         // a root category object (in memory)
378
-        if (isset($id) && (int)$id === 0) {
378
+        if (isset($id) && (int) $id === 0) {
379 379
             $cats = array();
380 380
             $cats[] = Category::create_root_category();
381 381
 
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
         $sql = 'SELECT * FROM '.$tbl_grade_categories;
387 387
         $paramcount = 0;
388 388
         if (isset($id)) {
389
-            $sql.= ' WHERE id = '.intval($id);
390
-            $paramcount ++;
389
+            $sql .= ' WHERE id = '.intval($id);
390
+            $paramcount++;
391 391
         }
392 392
 
393 393
         if (isset($user_id)) {
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
             if (empty($session_id)) {
424 424
                 $sql .= ' AND (session_id IS NULL OR session_id = 0) ';
425 425
             } else {
426
-                $sql .= ' AND session_id = '.(int)$session_id.' ';
426
+                $sql .= ' AND session_id = '.(int) $session_id.' ';
427 427
             }
428 428
             //}
429
-            $paramcount ++;
429
+            $paramcount++;
430 430
         }
431 431
 
432 432
         if (isset($parent_id)) {
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                             $default_weight = $default_weight_setting;
599 599
                         }
600 600
                         foreach ($components as $component) {
601
-                            $gradebook =  new Gradebook();
601
+                            $gradebook = new Gradebook();
602 602
                             $params = array();
603 603
 
604 604
                             $params['name'] = $component['acronym'];
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
                 }
616 616
             }
617 617
 
618
-            $gradebook= new Gradebook();
618
+            $gradebook = new Gradebook();
619 619
             $gradebook->update_skills_to_gradebook($this->id, $this->get_skills(false));
620 620
 
621 621
             return $id;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
                         $params['description']      = $component['title'];
681 681
                         $params['user_id']          = api_get_user_id();
682 682
                         $params['parent_id']        = $this->id;
683
-                        $params['weight']           = $component['percentage']/100*$default_weight;
683
+                        $params['weight']           = $component['percentage'] / 100 * $default_weight;
684 684
                         $params['session_id']       = api_get_session_id();
685 685
                         $params['course_code']      = $this->get_course_code();
686 686
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             }
691 691
         }
692 692
 
693
-        $gradebook= new Gradebook();
693
+        $gradebook = new Gradebook();
694 694
         $gradebook->update_skills_to_gradebook(
695 695
             $this->id,
696 696
             $this->get_skills(false),
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
         if (!empty($links)) {
711 711
             foreach ($links as $link_item) {
712 712
                 if (isset($link_item)) {
713
-                    $new_item_weight =  $new_weight * $link_item->get_weight() / $old_weight;
713
+                    $new_item_weight = $new_weight * $link_item->get_weight() / $old_weight;
714 714
                     $link_item->set_weight($new_item_weight);
715 715
                     $link_item->save();
716 716
                 }
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
                     visible=3';
752 752
         $res = Database::query($sql);
753 753
         $option = Database::fetch_array($res, 'ASSOC');
754
-        if ($option['num']>=1) {
754
+        if ($option['num'] >= 1) {
755 755
             return '&nbsp;&nbsp;<span class="resource-deleted">(&nbsp;'.get_lang('ResourceDeleted').'&nbsp;)</span>';
756 756
         } else {
757 757
             return false;
@@ -812,9 +812,9 @@  discard block
 block discarded – undo
812 812
             $sql .= ' AND user_id = '.api_get_user_id();
813 813
         }
814 814
         if (!isset ($parent)) {
815
-            $sql.= ' AND parent_id is null';
815
+            $sql .= ' AND parent_id is null';
816 816
         } else {
817
-            $sql.= ' AND parent_id = '.intval($parent);
817
+            $sql .= ' AND parent_id = '.intval($parent);
818 818
         }
819 819
 
820 820
         $result = Database::query($sql);
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
                     }
913 913
 
914 914
                     if (isset($score) && !empty($score[1]) && !empty($catweight)) {
915
-                        $ressum += $score[0]/$score[1] * $catweight;
915
+                        $ressum += $score[0] / $score[1] * $catweight;
916 916
                     }
917 917
                 }
918 918
             }
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
                     }
1002 1002
 
1003 1003
                     if (isset($score) && !empty($score[1]) && !empty($catweight)) {
1004
-                        $ressum += $score[0]/$score[1] * $catweight;
1004
+                        $ressum += $score[0] / $score[1] * $catweight;
1005 1005
 
1006 1006
                         if ($ressum > $bestResult) {
1007 1007
                             $bestResult = $ressum;
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
                 // session, we don't check his registration to these, but this
1141 1141
                 // could be an improvement
1142 1142
                 if (!empty($session_id)) {
1143
-                    $sql .= " AND course_code = '".Database::escape_string($course_code)."' AND session_id = ".(int)$session_id;
1143
+                    $sql .= " AND course_code = '".Database::escape_string($course_code)."' AND session_id = ".(int) $session_id;
1144 1144
                 } else {
1145 1145
                     $sql .= " AND course_code = '".Database::escape_string($course_code)."' AND session_id is null OR session_id=0";
1146 1146
                 }
@@ -1164,9 +1164,9 @@  discard block
 block discarded – undo
1164 1164
                 // could be an improvement
1165 1165
                 $sql .= " AND course_code  = '".Database::escape_string($course_code)."'";
1166 1166
                 if (!empty($session_id)) {
1167
-                    $sql .= " AND session_id = ".(int)$session_id;
1167
+                    $sql .= " AND session_id = ".(int) $session_id;
1168 1168
                 } else {
1169
-                    $sql .="AND session_id IS NULL OR session_id=0";
1169
+                    $sql .= "AND session_id IS NULL OR session_id=0";
1170 1170
                 }
1171 1171
             } else {
1172 1172
                 $sql .= ' AND course_code IN
@@ -1180,10 +1180,10 @@  discard block
 block discarded – undo
1180 1180
                     )';
1181 1181
             }
1182 1182
         }elseif (api_is_platform_admin()) {
1183
-            if (isset($session_id) && $session_id!=0) {
1184
-                $sql.=' AND session_id='.intval($session_id);
1183
+            if (isset($session_id) && $session_id != 0) {
1184
+                $sql .= ' AND session_id='.intval($session_id);
1185 1185
             } else {
1186
-                $sql.=' AND coalesce(session_id,0)=0';
1186
+                $sql .= ' AND coalesce(session_id,0)=0';
1187 1187
             }
1188 1188
         }
1189 1189
         $result = Database::query($sql);
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
         // course independent categories
1193 1193
         if (empty($course_code)) {
1194
-            $cats = Category::get_independent_categories_with_result_for_student (0, $stud_id, $cats);
1194
+            $cats = Category::get_independent_categories_with_result_for_student(0, $stud_id, $cats);
1195 1195
         }
1196 1196
 
1197 1197
         return $cats;
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
     public function get_root_categories_for_teacher($user_id, $course_code = null, $session_id = null)
1207 1207
     {
1208 1208
         if ($user_id == null) {
1209
-            return Category::load(null,null,$course_code,0,null,$session_id);
1209
+            return Category::load(null, null, $course_code, 0, null, $session_id);
1210 1210
         }
1211 1211
 
1212 1212
         $courseTable = Database :: get_main_table(TABLE_MAIN_COURSE);
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
         if (!empty($course_code)) {
1219 1219
             $sql .= " AND course_code = '".Database::escape_string($course_code)."' ";
1220 1220
             if (!empty($session_id)) {
1221
-                $sql .= " AND session_id = ".(int)$session_id;
1221
+                $sql .= " AND session_id = ".(int) $session_id;
1222 1222
             }
1223 1223
         } else {
1224 1224
             $sql .= ' AND course_code in
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
         $cats = Category::create_category_objects_from_sql_result($result);
1235 1235
         // course independent categories
1236 1236
         if (isset($course_code)) {
1237
-            $indcats = Category::load(null,$user_id,$course_code,0,null,$session_id);
1237
+            $indcats = Category::load(null, $user_id, $course_code, 0, null, $session_id);
1238 1238
             $cats = array_merge($cats, $indcats);
1239 1239
         }
1240 1240
 
@@ -1277,20 +1277,20 @@  discard block
 block discarded – undo
1277 1277
             $targets[] = $root;
1278 1278
 
1279 1279
             if (isset($this->course_code) && !empty($this->course_code)) {
1280
-                $crscats = Category::load(null,null,$this->course_code,0);
1280
+                $crscats = Category::load(null, null, $this->course_code, 0);
1281 1281
                 foreach ($crscats as $cat) {
1282 1282
                     if ($this->can_be_moved_to_cat($cat)) {
1283
-                        $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1284
-                        $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
1283
+                        $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
1284
+                        $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
1285 1285
                     }
1286 1286
                 }
1287 1287
             }
1288 1288
 
1289
-            $indcats = Category::load(null,$user,0,0);
1289
+            $indcats = Category::load(null, $user, 0, 0);
1290 1290
             foreach ($indcats as $cat) {
1291 1291
                 if ($this->can_be_moved_to_cat($cat)) {
1292
-                    $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1293
-                    $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
1292
+                    $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
1293
+                    $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
1294 1294
                 }
1295 1295
             }
1296 1296
 
@@ -1303,11 +1303,11 @@  discard block
 block discarded – undo
1303 1303
      */
1304 1304
     private function add_target_subcategories($targets, $level, $catid)
1305 1305
     {
1306
-        $subcats = Category::load(null,null,null,$catid);
1306
+        $subcats = Category::load(null, null, null, $catid);
1307 1307
         foreach ($subcats as $cat) {
1308 1308
             if ($this->can_be_moved_to_cat($cat)) {
1309
-                $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1310
-                $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
1309
+                $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
1310
+                $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
1311 1311
             }
1312 1312
         }
1313 1313
 
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
      * Impossible when origin and target are the same... children won't be processed
1321 1321
      * either. (a category can't be moved to one of its own children)
1322 1322
      */
1323
-    private function can_be_moved_to_cat ($cat)
1323
+    private function can_be_moved_to_cat($cat)
1324 1324
     {
1325 1325
         return $cat->get_id() != $this->get_id();
1326 1326
     }
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
     {
1350 1350
         $cats = Category::load(null, null, null, $this->id, null);
1351 1351
         $evals = Evaluation::load(null, null, null, $this->id, null);
1352
-        $links = LinkFactory::load(null,null,null,null,null,$this->id,null);
1352
+        $links = LinkFactory::load(null, null, null, null, null, $this->id, null);
1353 1353
 
1354 1354
         foreach ($cats as $cat) {
1355 1355
             $cat->set_course_code($this->get_course_code());
@@ -1382,15 +1382,15 @@  discard block
 block discarded – undo
1382 1382
             $user = (api_is_platform_admin() ? null : api_get_user_id());
1383 1383
             $cats = Category::get_root_categories_for_teacher($user);
1384 1384
             foreach ($cats as $cat) {
1385
-                $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1386
-                $targets = Category::add_subtree($targets, $level+1, $cat->get_id(),null);
1385
+                $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
1386
+                $targets = Category::add_subtree($targets, $level + 1, $cat->get_id(), null);
1387 1387
             }
1388 1388
         } else {
1389 1389
             // student
1390 1390
             $cats = Category::get_root_categories_for_student(api_get_user_id());
1391 1391
             foreach ($cats as $cat) {
1392
-                $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1393
-                $targets = Category::add_subtree($targets, $level+1, $cat->get_id(), 1);
1392
+                $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
1393
+                $targets = Category::add_subtree($targets, $level + 1, $cat->get_id(), 1);
1394 1394
             }
1395 1395
         }
1396 1396
 
@@ -1400,14 +1400,14 @@  discard block
 block discarded – undo
1400 1400
     /**
1401 1401
      * Internal function used by get_tree()
1402 1402
      */
1403
-    private function add_subtree ($targets, $level, $catid, $visible)
1403
+    private function add_subtree($targets, $level, $catid, $visible)
1404 1404
     {
1405
-        $subcats = Category::load(null,null,null,$catid,$visible);
1405
+        $subcats = Category::load(null, null, null, $catid, $visible);
1406 1406
 
1407 1407
         if (!empty($subcats)) {
1408 1408
             foreach ($subcats as $cat) {
1409
-                $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1410
-                $targets = Category::add_subtree($targets, $level+1, $cat->get_id(),$visible);
1409
+                $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
1410
+                $targets = Category::add_subtree($targets, $level + 1, $cat->get_id(), $visible);
1411 1411
             }
1412 1412
         }
1413 1413
 
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
      * Generate an array of courses that a teacher hasn't created a category for.
1419 1419
      * @return array 2-dimensional array - every element contains 2 subelements (code, title)
1420 1420
      */
1421
-    public function get_not_created_course_categories ($user_id)
1421
+    public function get_not_created_course_categories($user_id)
1422 1422
     {
1423 1423
         $tbl_main_courses = Database :: get_main_table(TABLE_MAIN_COURSE);
1424 1424
         $tbl_main_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@@ -1440,9 +1440,9 @@  discard block
 block discarded – undo
1440 1440
                 )';
1441 1441
         $result = Database::query($sql);
1442 1442
 
1443
-        $cats=array();
1444
-        while ($data=Database::fetch_array($result)) {
1445
-            $cats[] = array ($data['code'], $data['title']);
1443
+        $cats = array();
1444
+        while ($data = Database::fetch_array($result)) {
1445
+            $cats[] = array($data['code'], $data['title']);
1446 1446
         }
1447 1447
 
1448 1448
         return $cats;
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
      * Generate an array of all courses that a teacher is admin of.
1453 1453
      * @return array 2-dimensional array - every element contains 2 subelements (code, title)
1454 1454
      */
1455
-    public function get_all_courses ($user_id)
1455
+    public function get_all_courses($user_id)
1456 1456
     {
1457 1457
         $tbl_main_courses = Database :: get_main_table(TABLE_MAIN_COURSE);
1458 1458
         $tbl_main_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
         $result = Database::query($sql);
1467 1467
         $cats = array();
1468 1468
         while ($data = Database::fetch_array($result)) {
1469
-            $cats[] = array ($data['code'], $data['title']);
1469
+            $cats[] = array($data['code'], $data['title']);
1470 1470
         }
1471 1471
 
1472 1472
         return $cats;
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
     {
1480 1480
         $cats = Category::load(null, null, null, $this->id, null);
1481 1481
         $evals = Evaluation::load(null, null, null, $this->id, null);
1482
-        $links = LinkFactory::load(null,null,null,null,null,$this->id,null);
1482
+        $links = LinkFactory::load(null, null, null, null, null, $this->id, null);
1483 1483
         if (!empty($cats)) {
1484 1484
             foreach ($cats as $cat) {
1485 1485
                 $cat->set_visible($this->is_visible());
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
      * @param string $name_mask search string
1835 1835
      * @return array category objects matching the search criterium
1836 1836
      */
1837
-    public function find_category($name_mask,$allcat)
1837
+    public function find_category($name_mask, $allcat)
1838 1838
     {
1839 1839
         $foundcats = array();
1840 1840
         foreach ($allcat as $search_cat) {
@@ -1877,9 +1877,9 @@  discard block
 block discarded – undo
1877 1877
                 }
1878 1878
             }
1879 1879
 
1880
-            $link_to_lock= $this->get_links();
1880
+            $link_to_lock = $this->get_links();
1881 1881
             if (!empty($link_to_lock)) {
1882
-                foreach ($link_to_lock as $item ) {
1882
+                foreach ($link_to_lock as $item) {
1883 1883
                     $item->lock($locked);
1884 1884
                 }
1885 1885
             }
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
                 return [
1969 1969
                     'badge_link' => Display::url(
1970 1970
                         get_lang('DownloadBadges'),
1971
-                        api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user=$user_id",
1971
+                        api_get_path(WEB_CODE_PATH)."gradebook/get_badges.php?user=$user_id",
1972 1972
                         array(
1973 1973
                             'target' => '_blank',
1974 1974
                             'class' => 'btn btn-default'
@@ -2002,7 +2002,7 @@  discard block
 block discarded – undo
2002 2002
             $fileWasGenerated = $certificate_obj->html_file_is_generated();
2003 2003
 
2004 2004
             if (!empty($fileWasGenerated)) {
2005
-                $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $my_certificate['id'];
2005
+                $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$my_certificate['id'];
2006 2006
 
2007 2007
                 $certificates = Display::url(
2008 2008
                     Display::returnFontAwesomeIcon('download').' '.get_lang('DownloadCertificate'),
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
 
2026 2026
                 $hideExportLink = api_get_setting('hide_certificate_export_link');
2027 2027
                 $hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students');
2028
-                if ($hideExportLink === 'true' || (api_is_student() && $hideExportLinkStudent === 'true') ) {
2028
+                if ($hideExportLink === 'true' || (api_is_student() && $hideExportLinkStudent === 'true')) {
2029 2029
                     $exportToPDF = null;
2030 2030
                 }
2031 2031
 
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
                 if ($skillToolEnabled && $userHasSkills) {
2039 2039
                     $html['badge_link'] = Display::url(
2040 2040
                         get_lang('DownloadBadges'),
2041
-                        api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user=$user_id",
2041
+                        api_get_path(WEB_CODE_PATH)."gradebook/get_badges.php?user=$user_id",
2042 2042
                         array(
2043 2043
                             'target' => '_blank',
2044 2044
                             'class' => 'btn btn-default'
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
                     $certificate_obj = new Certificate($value_certificate['id']);
2099 2099
                     $certificate_obj->generate(array('hide_print_button' => true));
2100 2100
                     if ($certificate_obj->html_file_is_generated()) {
2101
-                        $certificate_path_list[]= $certificate_obj->html_file;
2101
+                        $certificate_path_list[] = $certificate_obj->html_file;
2102 2102
                     }
2103 2103
                 }
2104 2104
             }
Please login to merge, or discard this patch.
main/gradebook/lib/be/attendancelink.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             }
165 165
 		} else {
166 166
             // all students -> get average
167
-            $students = array();  // user list, needed to make sure we only
167
+            $students = array(); // user list, needed to make sure we only
168 168
             // take first attempts into account
169 169
             $rescount = 0;
170 170
             $sum = 0;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		$this->get_attendance_data();
240 240
 		$attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
241 241
 		$attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
242
-		if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') {
242
+		if (isset($attendance_qualify_title) && $attendance_qualify_title != '') {
243 243
 			return $this->attendance_data['attendance_qualify_title'];
244 244
 		} else {
245 245
 			return $attendance_title;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		$sql = 'SELECT * FROM '.$this->get_attendance_table().' att
280 280
     			WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
281 281
 		$result = Database::query($sql);
282
-		$row = Database::fetch_array($result,'ASSOC');
282
+		$row = Database::fetch_array($result, 'ASSOC');
283 283
 		$attendance_id = $row['id'];
284 284
 		$url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&session_id='.$session_id.'&cidReq='.$this->get_course_code();
285 285
 
Please login to merge, or discard this patch.
main/gradebook/lib/be/evallink.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
         $eval = $this->get_evaluation();
48 48
         // course/platform admin can go to the view_results page
49 49
         if (api_is_allowed_to_edit()) {
50
-            return 'gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $eval->get_id();
50
+            return 'gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$eval->get_id();
51 51
         } // students can go to the statistics page (if custom display enabled)
52 52
         elseif (ScoreDisplay :: instance()->is_custom()) {
53
-            return 'gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $eval->get_id();
53
+            return 'gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$eval->get_id();
54 54
         } else {
55 55
             return null;
56 56
         }
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
                 $eval = new Evaluation();
177 177
                 $eval->set_category_id(-1);
178 178
                 $eval->set_date(api_get_utc_datetime()); // these values will be changed
179
-                $eval->set_weight(0);    //   when the link setter
180
-                $eval->set_visible(0);   //     is called
179
+                $eval->set_weight(0); //   when the link setter
180
+                $eval->set_visible(0); //     is called
181 181
                 $eval->set_id(-1); // a 'real' id will be set when eval is added to db
182 182
                 $eval->set_user_id($this->get_user_id());
183 183
                 $eval->set_course_code($this->get_course_code());
Please login to merge, or discard this patch.
main/gradebook/lib/be/surveylink.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			$links[] = array(
76 76
 				$data['survey_id'],
77 77
 				api_trunc_str(
78
-					$data['code'] . ': ' . self::html_to_text($data['title']),
78
+					$data['code'].': '.self::html_to_text($data['title']),
79 79
 					80
80 80
 				)
81 81
 			);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	/**
122 122
 	 * Has anyone done this survey yet?
123 123
 	 */
124
-	public function has_results($stud_id=null)
124
+	public function has_results($stud_id = null)
125 125
 	{
126 126
 		$ref_id = intval($this->get_ref_id());
127 127
 		$session_id = api_get_session_id();
Please login to merge, or discard this patch.
main/gradebook/lib/be/linkfactory.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $name_mask search string
59 59
      * @return array link objects matching the search criterium
60 60
      */
61
-    public function find_links($name_mask,$selectcat)
61
+    public function find_links($name_mask, $selectcat)
62 62
     {
63 63
         return AbstractLink::find_links($name_mask, $selectcat);
64 64
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     public static function get_all_types()
99 99
     {
100 100
         //LINK_DROPBOX,
101
-        return array (
101
+        return array(
102 102
             LINK_EXERCISE,
103 103
             //LINK_DROPBOX,
104 104
             LINK_HOTPOTATOES,
Please login to merge, or discard this patch.
main/gradebook/lib/be/forumthreadlink.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 			die('Error in get_not_created_links() : course code not set');
85 85
 		}
86 86
 
87
-		$tbl_grade_links 	= Database :: get_course_table(TABLE_FORUM_THREAD);
88
-		$tbl_item_property	= Database :: get_course_table(TABLE_ITEM_PROPERTY);
87
+		$tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD);
88
+		$tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
89 89
 		$session_id = api_get_session_id();
90 90
 
91 91
 		if ($session_id) {
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 		$result = Database::query($sql);
109 109
 
110 110
 		while ($data = Database::fetch_array($result)) {
111
-			if ( isset($data['thread_title_qualify']) and $data['thread_title_qualify']!=""){
112
-				$cats[] = array ($data['thread_id'], $data['thread_title_qualify']);
111
+			if (isset($data['thread_title_qualify']) and $data['thread_title_qualify'] != "") {
112
+				$cats[] = array($data['thread_id'], $data['thread_title_qualify']);
113 113
 			} else {
114
-				$cats[] = array ($data['thread_id'], $data['thread_title']);
114
+				$cats[] = array($data['thread_id'], $data['thread_title']);
115 115
 			}
116 116
 		}
117 117
 		$my_cats = isset($cats) ? $cats : null;
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
                 if (empty($counter) || $counter <= 2) {
194 194
                     return array(0, $assignment['thread_qualify_max']);
195 195
                 }
196
-                return [$score/$counter, $assignment['thread_qualify_max']];
196
+                return [$score / $counter, $assignment['thread_qualify_max']];
197 197
             }
198 198
 		} else {
199 199
 			// All students -> get average
200
-			$students = array();  // user list, needed to make sure we only
200
+			$students = array(); // user list, needed to make sure we only
201 201
 			// take first attempts into account
202 202
 			$counter = 0;
203 203
 			$sum = 0;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 						return array($bestResult, $weight);
229 229
 						break;
230 230
 					case 'average':
231
-						return array($sumResult/$counter, $weight);
231
+						return array($sumResult / $counter, $weight);
232 232
 						break;
233 233
 					case 'ranking':
234 234
 						return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	public function get_name()
271 271
 	{
272 272
 		$this->get_exercise_data();
273
-		$thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : '';
274
-		$thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : '';
275
-		if ( isset($thread_title_qualify) && $thread_title_qualify!="") {
273
+		$thread_title = isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : '';
274
+		$thread_title_qualify = isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : '';
275
+		if (isset($thread_title_qualify) && $thread_title_qualify != "") {
276 276
 			return $this->exercise_data['thread_title_qualify'];
277 277
 		} else {
278 278
 			return $thread_title;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      */
285 285
 	public function get_description()
286 286
 	{
287
-		return '';//$this->exercise_data['description'];
287
+		return ''; //$this->exercise_data['description'];
288 288
 	}
289 289
 
290 290
 	/**
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 		$sql = 'SELECT * FROM '.$this->get_forum_thread_table()."
311 311
     			WHERE c_id = '.$this->course_id.' AND thread_id = '".$this->get_ref_id()."' AND session_id = ".api_get_session_id()."";
312 312
 		$result = Database::query($sql);
313
-		$row    = Database::fetch_array($result,'ASSOC');
314
-		$forum_id=$row['forum_id'];
313
+		$row    = Database::fetch_array($result, 'ASSOC');
314
+		$forum_id = $row['forum_id'];
315 315
 
316 316
 		$url = api_get_path(WEB_PATH).'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id;
317 317
 		return $url;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
 	function save_linked_data()
344 344
 	{
345
-		$weight = (float)$this->get_weight();
345
+		$weight = (float) $this->get_weight();
346 346
 		$ref_id = $this->get_ref_id();
347 347
 
348 348
 		if (!empty($ref_id)) {
Please login to merge, or discard this patch.
main/gradebook/lib/be/result.class.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -90,23 +90,23 @@  discard block
 block discarded – undo
90 90
         if (is_null($id) && is_null($user_id) && !is_null($evaluation_id)) {
91 91
             // Verified_if_exist_evaluation
92 92
             $sql = 'SELECT COUNT(*) AS count
93
-                    FROM ' . $tbl_grade_results . '
94
-                    WHERE evaluation_id="' . Database::escape_string($evaluation_id) . '";';
93
+                    FROM ' . $tbl_grade_results.'
94
+                    WHERE evaluation_id="' . Database::escape_string($evaluation_id).'";';
95 95
             $result = Database::query($sql);
96 96
             $existEvaluation = Database::result($result, 0, 0);
97 97
 
98 98
             if ($existEvaluation != 0) {
99 99
                 if ($sessionId) {
100 100
                     $sql = 'SELECT c_id, user_id as user_id, status
101
-                            FROM ' . $tbl_session_rel_course_user . '
101
+                            FROM ' . $tbl_session_rel_course_user.'
102 102
 							WHERE
103 103
 							    status= 0 AND
104
-							    c_id = "' . api_get_course_int_id() . '" AND
104
+							    c_id = "' . api_get_course_int_id().'" AND
105 105
 							    session_id = ' . $sessionId;
106 106
                 } else {
107 107
                     $sql = 'SELECT c_id, user_id, status
108
-                            FROM ' . $tbl_course_rel_course . '
109
-                            WHERE status ="' . STUDENT . '" AND c_id = "' . api_get_course_int_id() . '" ';
108
+                            FROM ' . $tbl_course_rel_course.'
109
+                            WHERE status ="' . STUDENT.'" AND c_id = "'.api_get_course_int_id().'" ';
110 110
                 }
111 111
 
112 112
                 $res_course_rel_user = Database::query($sql);
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
                 $current_date = api_get_utc_datetime();
117 117
                 for ($i = 0; $i < count($list_user_course_list); $i++) {
118 118
                     $sql_verified = 'SELECT COUNT(*) AS count
119
-                                    FROM ' . $tbl_grade_results . '
119
+                                    FROM ' . $tbl_grade_results.'
120 120
                                     WHERE
121
-                                        user_id="' . intval($list_user_course_list[$i]['user_id']) . '" AND
122
-                                        evaluation_id="' . intval($evaluation_id) . '";';
121
+                                        user_id="' . intval($list_user_course_list[$i]['user_id']).'" AND
122
+                                        evaluation_id="' . intval($evaluation_id).'";';
123 123
                     $res_verified = Database::query($sql_verified);
124 124
                     $info_verified = Database::result($res_verified, 0, 0);
125 125
                     if ($info_verified == 0) {
126
-                        $sql_insert = 'INSERT INTO ' . $tbl_grade_results . '(user_id,evaluation_id,created_at,score)
127
-									   VALUES ("' . intval($list_user_course_list[$i]['user_id']) . '","' . intval($evaluation_id) . '","' . $current_date . '",0);';
126
+                        $sql_insert = 'INSERT INTO '.$tbl_grade_results.'(user_id,evaluation_id,created_at,score)
127
+									   VALUES ("' . intval($list_user_course_list[$i]['user_id']).'","'.intval($evaluation_id).'","'.$current_date.'",0);';
128 128
                         Database::query($sql_insert);
129 129
                     }
130 130
                 }
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 
149 149
         $paramcount = 0;
150 150
         if (!empty($id)) {
151
-            $sql.= ' WHERE gr.id = ' . intval($id);
152
-            $paramcount ++;
151
+            $sql .= ' WHERE gr.id = '.intval($id);
152
+            $paramcount++;
153 153
         }
154 154
         if (!empty($user_id)) {
155 155
             if ($paramcount != 0)
156 156
                 $sql .= ' AND';
157 157
             else
158 158
                 $sql .= ' WHERE';
159
-            $sql .= ' gr.user_id = ' . intval($user_id);
160
-            $paramcount ++;
159
+            $sql .= ' gr.user_id = '.intval($user_id);
160
+            $paramcount++;
161 161
         }
162 162
         if (!empty($evaluation_id)) {
163 163
             if ($paramcount != 0) {
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
             } else {
166 166
                 $sql .= ' WHERE';
167 167
             }
168
-            $sql .= ' gr.evaluation_id = ' . intval($evaluation_id);
169
-            $paramcount ++;
168
+            $sql .= ' gr.evaluation_id = '.intval($evaluation_id);
169
+            $paramcount++;
170 170
         }
171 171
         $sql .= ' ORDER BY u.lastname, u.firstname';
172 172
         $result = Database::query($sql);
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
     {
192 192
         if (isset($this->user_id) && isset($this->evaluation)) {
193 193
             $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
194
-            $sql = "INSERT INTO " . $tbl_grade_results
194
+            $sql = "INSERT INTO ".$tbl_grade_results
195 195
                 . " (user_id, evaluation_id,
196 196
 					created_at";
197 197
             if (isset($this->score)) {
198 198
                 $sql .= ",score";
199 199
             }
200 200
             $sql .= ") VALUES
201
-					(" . (int) $this->get_user_id() . ", " . (int) $this->get_evaluation_id()
202
-                . ", '" . $this->get_date() . "' ";
201
+					(" . (int) $this->get_user_id().", ".(int) $this->get_evaluation_id()
202
+                . ", '".$this->get_date()."' ";
203 203
             if (isset($this->score)) {
204
-                $sql .= ", " . $this->get_score();
204
+                $sql .= ", ".$this->get_score();
205 205
             }
206 206
             $sql .= ")";
207 207
             Database::query($sql);
@@ -222,16 +222,16 @@  discard block
 block discarded – undo
222 222
             $arr_result = $result->load(null, $userid, $evaluationid);
223 223
             $arr = get_object_vars($arr_result[0]);
224 224
 
225
-            $sql = 'INSERT INTO ' . $tbl_grade_results_log
225
+            $sql = 'INSERT INTO '.$tbl_grade_results_log
226 226
                 . ' (id_result,user_id, evaluation_id,created_at';
227 227
             if (isset($arr['score'])) {
228 228
                 $sql .= ',score';
229 229
             }
230 230
             $sql .= ') VALUES
231
-					(' . (int) $arr['id'] . ',' . (int) $arr['user_id'] . ', ' . (int) $arr['evaluation']
232
-                . ", '" . api_get_utc_datetime() . "'";
231
+					(' . (int) $arr['id'].','.(int) $arr['user_id'].', '.(int) $arr['evaluation']
232
+                . ", '".api_get_utc_datetime()."'";
233 233
             if (isset($arr['score'])) {
234
-                $sql .= ', ' . $arr['score'];
234
+                $sql .= ', '.$arr['score'];
235 235
             }
236 236
             $sql .= ')';
237 237
 
@@ -247,16 +247,16 @@  discard block
 block discarded – undo
247 247
     public function save()
248 248
     {
249 249
         $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
250
-        $sql = 'UPDATE ' . $tbl_grade_results . '
250
+        $sql = 'UPDATE '.$tbl_grade_results.'
251 251
                 SET user_id = ' . $this->get_user_id()
252
-            . ', evaluation_id = ' . $this->get_evaluation_id()
252
+            . ', evaluation_id = '.$this->get_evaluation_id()
253 253
             . ', score = ';
254 254
         if (isset($this->score)) {
255 255
             $sql .= $this->get_score();
256 256
         } else {
257 257
             $sql .= 'null';
258 258
         }
259
-        $sql .= ' WHERE id = ' . $this->id;
259
+        $sql .= ' WHERE id = '.$this->id;
260 260
         // no need to update creation date
261 261
         Database::query($sql);
262 262
     }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     public function delete()
268 268
     {
269 269
         $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
270
-        $sql = 'DELETE FROM ' . $tbl_grade_results . ' WHERE id = ' . $this->id;
270
+        $sql = 'DELETE FROM '.$tbl_grade_results.' WHERE id = '.$this->id;
271 271
         Database::query($sql);
272 272
     }
273 273
 }
Please login to merge, or discard this patch.
main/gradebook/lib/be/studentpublicationlink.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 		$result = Database::query($sql);
86 86
 
87
-		$cats=array();
88
-		while ($data=Database::fetch_array($result)) {
89
-			$cats[] = array ($data['id'], $data['url']);
87
+		$cats = array();
88
+		while ($data = Database::fetch_array($result)) {
89
+			$cats[] = array($data['id'], $data['url']);
90 90
 		}
91 91
 		return $cats;
92 92
 	}
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			if (empty($work_name)) {
128 128
 				$work_name = basename($data['url']);
129 129
 			}
130
-			$cats[] = array ($data['id'], $work_name);
130
+			$cats[] = array($data['id'], $work_name);
131 131
 		}
132
-		$cats=isset($cats) ? $cats : array();
132
+		$cats = isset($cats) ? $cats : array();
133 133
 		return $cats;
134 134
 	}
135 135
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     				c_id = '.$this->course_id.' AND
179 179
     				active = 1 AND
180 180
     				parent_id = "'.$parentId.'" AND
181
-    				session_id = '.api_get_session_id() .' AND
181
+    				session_id = '.api_get_session_id().' AND
182 182
     				qualificator_id <> 0
183 183
 				';
184 184
 		if (!empty($stud_id)) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 				return '';
213 213
 			}
214 214
 		} else {
215
-			$students = array();  // user list, needed to make sure we only
215
+			$students = array(); // user list, needed to make sure we only
216 216
 			// take first attempts into account
217 217
 			$rescount = 0;
218 218
 			$sum = 0;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 						return array($bestResult, $weight);
246 246
 						break;
247 247
 					case 'average':
248
-						return array($sumResult/$rescount, $weight);
248
+						return array($sumResult / $rescount, $weight);
249 249
 						break;
250 250
 					case 'ranking':
251 251
 						return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	{
308 308
 		$tbl_name = $this->get_studpub_table();
309 309
 		$course_info = api_get_course_info($this->get_course_code());
310
-		if ($tbl_name=='') {
310
+		if ($tbl_name == '') {
311 311
 			return false;
312 312
 		} elseif (!isset($this->exercise_data)) {
313 313
 			$sql = 'SELECT * FROM '.$this->get_studpub_table()."
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 	public function save_linked_data()
348 348
 	{
349
-		$weight = (float)$this->get_weight();
349
+		$weight = (float) $this->get_weight();
350 350
 		$ref_id = $this->get_ref_id();
351 351
 
352 352
 		if (!empty($ref_id)) {
Please login to merge, or discard this patch.
main/gradebook/lib/be/evaluation.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -223,36 +223,36 @@  discard block
 block discarded – undo
223 223
 		$paramcount = 0;
224 224
 
225 225
 		if (isset ($id)) {
226
-			$sql.= ' WHERE id = '.intval($id);
227
-			$paramcount ++;
226
+			$sql .= ' WHERE id = '.intval($id);
227
+			$paramcount++;
228 228
 		}
229 229
 
230 230
 		if (isset ($user_id)) {
231 231
 			if ($paramcount != 0) $sql .= ' AND';
232 232
 			else $sql .= ' WHERE';
233 233
 			$sql .= ' user_id = '.intval($user_id);
234
-			$paramcount ++;
234
+			$paramcount++;
235 235
 		}
236 236
 
237 237
 		if (isset ($course_code) && $course_code <> '-1') {
238 238
 			if ($paramcount != 0) $sql .= ' AND';
239 239
 			else $sql .= ' WHERE';
240 240
 			$sql .= " course_code = '".Database::escape_string($course_code)."'";
241
-			$paramcount ++;
241
+			$paramcount++;
242 242
 		}
243 243
 
244 244
 		if (isset ($category_id)) {
245 245
 			if ($paramcount != 0) $sql .= ' AND';
246 246
 			else $sql .= ' WHERE';
247 247
 			$sql .= ' category_id = '.intval($category_id);
248
-			$paramcount ++;
248
+			$paramcount++;
249 249
 		}
250 250
 
251 251
 		if (isset ($visible)) {
252 252
 			if ($paramcount != 0) $sql .= ' AND';
253 253
 			else $sql .= ' WHERE';
254 254
 			$sql .= ' visible = '.intval($visible);
255
-			$paramcount ++;
255
+			$paramcount++;
256 256
 		}
257 257
 
258 258
 		if (isset ($locked)) {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		$alleval = array();
279 279
 		if (Database::num_rows($result)) {
280 280
 			while ($data = Database::fetch_array($result)) {
281
-				$eval= new Evaluation();
281
+				$eval = new Evaluation();
282 282
 				$eval->set_id($data['id']);
283 283
 				$eval->set_name($data['name']);
284 284
 				$eval->set_description($data['description']);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
364 364
 			$tbl_grade_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
365 365
 			$eval = new Evaluation();
366
-			$dateobject = $eval->load($idevaluation,null,null,null,null);
366
+			$dateobject = $eval->load($idevaluation, null, null, null, null);
367 367
 			$arreval = get_object_vars($dateobject[0]);
368 368
 			if (!empty($arreval['id'])) {
369 369
 				$sql = 'SELECT weight from '.$tbl_grade_evaluations.'
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			.', description = ';
398 398
 		if (isset($this->description)) {
399 399
 			$sql .= "'".Database::escape_string($this->get_description())."'";
400
-		}else {
400
+		} else {
401 401
 			$sql .= 'null';
402 402
 		}
403 403
 		$sql .= ', user_id = '.intval($this->get_user_id())
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
 				$sql .= ' AND user_id = '.api_get_user_id();
469 469
 			}
470 470
 
471
-		}else {
471
+		} else {
472 472
 			$sql .= ' AND user_id = '.api_get_user_id();
473 473
 		}
474 474
 
475 475
 		if (!isset ($parent)) {
476
-			$sql.= ' AND category_id is null';
476
+			$sql .= ' AND category_id is null';
477 477
 		} else {
478
-			$sql.= ' AND category_id = '.intval($parent);
478
+			$sql .= ' AND category_id = '.intval($parent);
479 479
 		}
480 480
 		$result = Database::query($sql);
481
-		$number=Database::fetch_row($result);
481
+		$number = Database::fetch_row($result);
482 482
 
483 483
 		return $number[0] != 0;
484 484
 	}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 				FROM '.$tbl_grade_results.'
495 495
 				WHERE evaluation_id = '.intval($this->id);
496 496
 		$result = Database::query($sql);
497
-		$number=Database::fetch_row($result);
497
+		$number = Database::fetch_row($result);
498 498
 
499 499
 		return ($number[0] != 0);
500 500
 	}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             $results = isset($data[$key]) ? $data[$key] : null;
545 545
 
546 546
             if ($useSession == false) {
547
-                $results  = null;
547
+                $results = null;
548 548
             }
549 549
 			if (empty($results)) {
550 550
 				$results = Result::load(null, $stud_id, $this->id);
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             $data = Session::read('calc_score');
571 571
             $allResults = isset($data[$key]) ? $data[$key] : null;
572 572
             if ($useSession == false) {
573
-                $allResults  = null;
573
+                $allResults = null;
574 574
             }
575 575
 			if (empty($allResults)) {
576 576
 				$allResults = Result::load(null, null, $this->id);
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 					return array($bestResult, $weight);
603 603
 					break;
604 604
 				case 'average':
605
-					return array($sumResult/$count, $weight);
605
+					return array($sumResult / $count, $weight);
606 606
 					break;
607 607
 				case 'ranking':
608 608
                     $students = array();
@@ -640,17 +640,17 @@  discard block
 block discarded – undo
640 640
 		$targets[] = $root;
641 641
 
642 642
 		if (isset($this->course_code) && !empty($this->course_code)) {
643
-			$crscats = Category::load(null,null,$this->course_code,0);
643
+			$crscats = Category::load(null, null, $this->course_code, 0);
644 644
 			foreach ($crscats as $cat) {
645
-				$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
646
-				$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
645
+				$targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
646
+				$targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
647 647
 			}
648 648
 		}
649 649
 
650
-		$indcats = Category::load(null,$user,0,0);
650
+		$indcats = Category::load(null, $user, 0, 0);
651 651
 		foreach ($indcats as $cat) {
652
-			$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
653
-			$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
652
+			$targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
653
+			$targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
654 654
 		}
655 655
 
656 656
 		return $targets;
@@ -661,10 +661,10 @@  discard block
 block discarded – undo
661 661
 	 */
662 662
 	private function add_target_subcategories($targets, $level, $catid)
663 663
 	{
664
-		$subcats = Category::load(null,null,null,$catid);
664
+		$subcats = Category::load(null, null, null, $catid);
665 665
 		foreach ($subcats as $cat) {
666
-			$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
667
-			$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
666
+			$targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
667
+			$targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
668 668
 		}
669 669
 		return $targets;
670 670
 	}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 	 * @return array evaluation objects matching the search criterium
744 744
 	 * @todo can be written more efficiently using a new (but very complex) sql query
745 745
 	 */
746
-	public function find_evaluations($name_mask,$selectcat)
746
+	public function find_evaluations($name_mask, $selectcat)
747 747
 	{
748 748
 		$rootcat = Category::load($selectcat);
749 749
 		$evals = $rootcat[0]->get_evaluations((api_is_allowed_to_create_course() ? null : api_get_user_id()), true);
Please login to merge, or discard this patch.