@@ -68,7 +68,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -424,12 +424,12 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $editIcon = Display::return_icon('edit.png', get_lang('EditNode'), null, ICON_SIZE_SMALL); |
| 426 | 426 | $deleteIcon = Display::return_icon('delete.png', get_lang('DeleteNode'), null, ICON_SIZE_SMALL); |
| 427 | - $moveIcon = Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL); |
|
| 427 | + $moveIcon = Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL); |
|
| 428 | 428 | |
| 429 | 429 | foreach ($categories as $category) { |
| 430 | 430 | |
| 431 | 431 | $editUrl = $mainUrl.'&id='.$category['code'].'&action=edit'; |
| 432 | - $moveUrl = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos']; |
|
| 432 | + $moveUrl = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos']; |
|
| 433 | 433 | $deleteUrl = $mainUrl.'&id='.$category['code'].'&action=delete'; |
| 434 | 434 | |
| 435 | 435 | $actions = Display::url($editIcon, $editUrl).Display::url($moveIcon, $moveUrl).Display::url($deleteIcon, $deleteUrl); |
@@ -563,12 +563,12 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | $count_courses = countCoursesInCategory(); |
| 565 | 565 | |
| 566 | - $categories[0][count($categories[0])+1] = array( |
|
| 566 | + $categories[0][count($categories[0]) + 1] = array( |
|
| 567 | 567 | 'id' =>0, |
| 568 | 568 | 'name' => get_lang('None'), |
| 569 | 569 | 'code' => 'NONE', |
| 570 | 570 | 'parent_id' => null, |
| 571 | - 'tree_pos' => $row['tree_pos']+1, |
|
| 571 | + 'tree_pos' => $row['tree_pos'] + 1, |
|
| 572 | 572 | 'children_count' => 0, |
| 573 | 573 | 'auth_course_child' => true, |
| 574 | 574 | 'auth_cat_child' => true, |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | * @param string $searchTerm |
| 584 | 584 | * @return int |
| 585 | 585 | */ |
| 586 | -function countCoursesInCategory($category_code="", $searchTerm = '') |
|
| 586 | +function countCoursesInCategory($category_code = "", $searchTerm = '') |
|
| 587 | 587 | { |
| 588 | 588 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
| 589 | 589 | $categoryCode = Database::escape_string($category_code); |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | $without_special_courses = ''; |
| 597 | 597 | if (!empty($specialCourseList)) { |
| 598 | - $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $specialCourseList) . '")'; |
|
| 598 | + $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")'; |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | $visibilityCondition = null; |
@@ -609,15 +609,15 @@ discard block |
||
| 609 | 609 | if ($categoryCode == 'ALL') { |
| 610 | 610 | // Nothing to do |
| 611 | 611 | } elseif ($categoryCode == 'NONE') { |
| 612 | - $categoryFilter = ' AND category_code = "" '; |
|
| 612 | + $categoryFilter = ' AND category_code = "" '; |
|
| 613 | 613 | } else { |
| 614 | - $categoryFilter = ' AND category_code = "' . $categoryCode . '" '; |
|
| 614 | + $categoryFilter = ' AND category_code = "'.$categoryCode.'" '; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | if (!empty($searchTerm)) { |
| 618 | - $searchFilter = ' AND (code LIKE "%' . $searchTerm . '%" |
|
| 619 | - OR title LIKE "%' . $searchTerm . '%" |
|
| 620 | - OR tutor_name LIKE "%' . $searchTerm . '%") '; |
|
| 618 | + $searchFilter = ' AND (code LIKE "%'.$searchTerm.'%" |
|
| 619 | + OR title LIKE "%' . $searchTerm.'%" |
|
| 620 | + OR tutor_name LIKE "%' . $searchTerm.'%") '; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | $sql = "SELECT * FROM $tbl_course |
@@ -668,7 +668,7 @@ discard block |
||
| 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'); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $id_in = null; |
| 717 | 717 | while (list($id) = Database::fetch_row($result)) { |
| 718 | 718 | if ($id_in) { |
| 719 | - $id_in.=",$id"; |
|
| 719 | + $id_in .= ",$id"; |
|
| 720 | 720 | } else { |
| 721 | 721 | $id_in = "$id"; |
| 722 | 722 | } |
@@ -937,11 +937,9 @@ discard block |
||
| 937 | 937 | function getLimitArray() |
| 938 | 938 | { |
| 939 | 939 | $pageCurrent = isset($_REQUEST['pageCurrent']) ? |
| 940 | - intval($_GET['pageCurrent']) : |
|
| 941 | - 1; |
|
| 940 | + intval($_GET['pageCurrent']) : 1; |
|
| 942 | 941 | $pageLength = isset($_REQUEST['pageLength']) ? |
| 943 | - intval($_GET['pageLength']) : |
|
| 944 | - 10; |
|
| 942 | + intval($_GET['pageLength']) : 10; |
|
| 945 | 943 | return array( |
| 946 | 944 | 'start' => ($pageCurrent - 1) * $pageLength, |
| 947 | 945 | 'current' => $pageCurrent, |
@@ -960,7 +958,7 @@ discard block |
||
| 960 | 958 | if (!empty($limit) && is_array($limit)) { |
| 961 | 959 | $limitStart = isset($limit['start']) ? $limit['start'] : 0; |
| 962 | 960 | $limitLength = isset($limit['length']) ? $limit['length'] : 10; |
| 963 | - $limitFilter = 'LIMIT ' . $limitStart . ', ' . $limitLength; |
|
| 961 | + $limitFilter = 'LIMIT '.$limitStart.', '.$limitLength; |
|
| 964 | 962 | } |
| 965 | 963 | |
| 966 | 964 | return $limitFilter; |
@@ -977,7 +975,7 @@ discard block |
||
| 977 | 975 | { |
| 978 | 976 | // Start empty html |
| 979 | 977 | $pageDiv = ''; |
| 980 | - $html=''; |
|
| 978 | + $html = ''; |
|
| 981 | 979 | $pageBottom = max(1, $pageCurrent - 3); |
| 982 | 980 | $pageTop = min($pageTotal, $pageCurrent + 3); |
| 983 | 981 | |
@@ -1052,21 +1050,21 @@ discard block |
||
| 1052 | 1050 | $hiddenLinks = isset($hiddenLinks) ? Security::remove_XSS($hiddenLinksRequest) : $categoryCodeRequest; |
| 1053 | 1051 | |
| 1054 | 1052 | // Start URL with params |
| 1055 | - $pageUrl = api_get_self() . |
|
| 1056 | - '?action=' . $action . |
|
| 1057 | - '&category_code=' .$categoryCode. |
|
| 1058 | - '&hidden_links=' .$hiddenLinks. |
|
| 1059 | - '&pageCurrent=' . $pageCurrent . |
|
| 1060 | - '&pageLength=' . $pageLength |
|
| 1053 | + $pageUrl = api_get_self(). |
|
| 1054 | + '?action='.$action. |
|
| 1055 | + '&category_code='.$categoryCode. |
|
| 1056 | + '&hidden_links='.$hiddenLinks. |
|
| 1057 | + '&pageCurrent='.$pageCurrent. |
|
| 1058 | + '&pageLength='.$pageLength |
|
| 1061 | 1059 | ; |
| 1062 | 1060 | |
| 1063 | 1061 | switch ($action) { |
| 1064 | 1062 | case 'subscribe' : |
| 1065 | 1063 | // for search |
| 1066 | 1064 | $pageUrl .= |
| 1067 | - '&search_term=' . $searchTerm . |
|
| 1068 | - '&search_course=1' . |
|
| 1069 | - '&sec_token=' . $_SESSION['sec_token']; |
|
| 1065 | + '&search_term='.$searchTerm. |
|
| 1066 | + '&search_course=1'. |
|
| 1067 | + '&sec_token='.$_SESSION['sec_token']; |
|
| 1070 | 1068 | break; |
| 1071 | 1069 | case 'display_courses' : |
| 1072 | 1070 | // No break |