Completed
Push — 1.10.x ( 71f40f...60fa62 )
by Julito
153:02 queued 109:23
created
main/inc/lib/course_category.lib.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     $parentIdCondition = " AND (t1.parent_id IS NULL OR t1.parent_id = '' )";
70 70
     if (!empty($category)) {
71
-        $parentIdCondition =  " AND t1.parent_id  = '$category' ";
71
+        $parentIdCondition = " AND t1.parent_id  = '$category' ";
72 72
     }
73 73
 
74 74
     $sql = "SELECT
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
     $categories = Database::store_result($result);
101 101
     foreach ($categories as $category) {
102
-        $category['nbr_courses'] =  1;
102
+        $category['nbr_courses'] = 1;
103 103
     }
104 104
 
105 105
     return $categories;
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
     if ($row = Database::fetch_array($result)) {
197 197
         if (!empty($row['parent_id'])) {
198 198
             Database::query("UPDATE $tbl_course SET category_code = '".$row['parent_id']."' WHERE category_code='$node'");
199
-            Database::query("UPDATE $tbl_category SET parent_id='" . $row['parent_id'] . "' WHERE parent_id='$node'");
199
+            Database::query("UPDATE $tbl_category SET parent_id='".$row['parent_id']."' WHERE parent_id='$node'");
200 200
         } else {
201 201
             Database::query("UPDATE $tbl_course SET category_code='' WHERE category_code='$node'");
202 202
             Database::query("UPDATE $tbl_category SET parent_id=NULL WHERE parent_id='$node'");
203 203
         }
204 204
 
205
-        Database::query("UPDATE $tbl_category SET tree_pos=tree_pos-1 WHERE tree_pos > '" . $row['tree_pos'] . "'");
205
+        Database::query("UPDATE $tbl_category SET tree_pos=tree_pos-1 WHERE tree_pos > '".$row['tree_pos']."'");
206 206
         Database::query("DELETE FROM $tbl_category WHERE code='$node'");
207 207
 
208 208
         if (!empty($row['parent_id'])) {
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
     }
292 292
 
293 293
     $sql = "UPDATE $tbl_category
294
-            SET tree_pos ='" . $row['tree_pos'] . "'
294
+            SET tree_pos ='".$row['tree_pos']."'
295 295
             WHERE code='$code'";
296 296
     Database::query($sql);
297 297
 
298 298
     $sql = "UPDATE $tbl_category
299 299
             SET tree_pos = '$tree_pos'
300
-            WHERE code= '" . $row['code'] . "'";
300
+            WHERE code= '".$row['code']."'";
301 301
     Database::query($sql);
302 302
 
303 303
     return true;
@@ -423,12 +423,12 @@  discard block
 block discarded – undo
423 423
 
424 424
         $editIcon = Display::return_icon('edit.png', get_lang('EditNode'), null, ICON_SIZE_SMALL);
425 425
         $deleteIcon = Display::return_icon('delete.png', get_lang('DeleteNode'), null, ICON_SIZE_SMALL);
426
-        $moveIcon =  Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL);
426
+        $moveIcon = Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL);
427 427
 
428 428
         foreach ($categories as $category) {
429 429
 
430 430
             $editUrl = $mainUrl.'&id='.$category['code'].'&action=edit';
431
-            $moveUrl  = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos'];
431
+            $moveUrl = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos'];
432 432
             $deleteUrl = $mainUrl.'&id='.$category['code'].'&action=delete';
433 433
 
434 434
             $actions = Display::url($editIcon, $editUrl).Display::url($moveIcon, $moveUrl).Display::url($deleteIcon, $deleteUrl);
@@ -562,12 +562,12 @@  discard block
 block discarded – undo
562 562
 
563 563
     $count_courses = countCoursesInCategory();
564 564
 
565
-    $categories[0][count($categories[0])+1] = array(
565
+    $categories[0][count($categories[0]) + 1] = array(
566 566
         'id' =>0,
567 567
         'name' => get_lang('None'),
568 568
         'code' => 'NONE',
569 569
         'parent_id' => null,
570
-        'tree_pos' => $row['tree_pos']+1,
570
+        'tree_pos' => $row['tree_pos'] + 1,
571 571
         'children_count' => 0,
572 572
         'auth_course_child' => true,
573 573
         'auth_cat_child' => true,
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 
595 595
     $without_special_courses = '';
596 596
     if (!empty($specialCourseList)) {
597
-        $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $specialCourseList) . '")';
597
+        $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")';
598 598
     }
599 599
 
600 600
     $visibilityCondition = null;
@@ -608,15 +608,15 @@  discard block
 block discarded – undo
608 608
     if ($categoryCode == 'ALL') {
609 609
         // Nothing to do
610 610
     } elseif ($categoryCode == 'NONE') {
611
-        $categoryFilter =  ' AND category_code = "" ';
611
+        $categoryFilter = ' AND category_code = "" ';
612 612
     } else {
613
-        $categoryFilter =  ' AND category_code = "' . $categoryCode . '" ';
613
+        $categoryFilter = ' AND category_code = "'.$categoryCode.'" ';
614 614
     }
615 615
 
616 616
     if (!empty($searchTerm)) {
617
-        $searchFilter = ' AND (code LIKE "%' . $searchTerm . '%"
618
-            OR title LIKE "%' . $searchTerm . '%"
619
-            OR tutor_name LIKE "%' . $searchTerm . '%") ';
617
+        $searchFilter = ' AND (code LIKE "%'.$searchTerm.'%"
618
+            OR title LIKE "%' . $searchTerm.'%"
619
+            OR tutor_name LIKE "%' . $searchTerm.'%") ';
620 620
     }
621 621
 
622 622
     $sql = "SELECT * FROM $tbl_course
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 
669 669
     $without_special_courses = '';
670 670
     if (!empty($specialCourseList)) {
671
-        $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $specialCourseList) . '")';
671
+        $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")';
672 672
     }
673 673
     $visibilityCondition = null;
674 674
     $hidePrivate = api_get_setting('course_catalog_hide_private');
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
         $id_in = null;
720 720
         while (list($id) = Database::fetch_row($result)) {
721 721
             if ($id_in) {
722
-                $id_in.=",$id";
722
+                $id_in .= ",$id";
723 723
             } else {
724 724
                 $id_in = "$id";
725 725
             }
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
     if (!empty($limit) && is_array($limit)) {
960 960
         $limitStart = isset($limit['start']) ? $limit['start'] : 0;
961 961
         $limitLength = isset($limit['length']) ? $limit['length'] : 10;
962
-        $limitFilter = 'LIMIT ' . $limitStart . ', ' . $limitLength;
962
+        $limitFilter = 'LIMIT '.$limitStart.', '.$limitLength;
963 963
     }
964 964
 
965 965
     return $limitFilter;
@@ -1045,21 +1045,21 @@  discard block
 block discarded – undo
1045 1045
     $hiddenLinks = isset($hiddenLinks) ? Security::remove_XSS($hiddenLinksRequest) : $categoryCodeRequest;
1046 1046
 
1047 1047
         // Start URL with params
1048
-    $pageUrl = api_get_self() .
1049
-        '?action=' . $action .
1050
-        '&category_code=' .$categoryCode.
1051
-        '&hidden_links=' .$hiddenLinks.
1052
-        '&pageCurrent=' . $pageCurrent .
1053
-        '&pageLength=' . $pageLength
1048
+    $pageUrl = api_get_self().
1049
+        '?action='.$action.
1050
+        '&category_code='.$categoryCode.
1051
+        '&hidden_links='.$hiddenLinks.
1052
+        '&pageCurrent='.$pageCurrent.
1053
+        '&pageLength='.$pageLength
1054 1054
     ;
1055 1055
 
1056 1056
     switch ($action) {
1057 1057
         case 'subscribe':
1058 1058
             // for search
1059 1059
             $pageUrl .=
1060
-                '&search_term=' . $searchTerm .
1061
-                '&search_course=1' .
1062
-                '&sec_token=' . $_SESSION['sec_token'];
1060
+                '&search_term='.$searchTerm.
1061
+                '&search_course=1'.
1062
+                '&sec_token='.$_SESSION['sec_token'];
1063 1063
             break;
1064 1064
         case 'display_courses':
1065 1065
             // No break
Please login to merge, or discard this patch.