@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $pageLength = isset($pageLength) ? $pageLength : isset($_GET['pageLength']) ? intval($_GET['pageLength']) : 12; |
| 20 | 20 | $pageTotal = intval(ceil(intval($countCoursesInCategory) / $pageLength)); |
| 21 | 21 | $cataloguePagination = $pageTotal > 1 ? getCataloguePagination($pageCurrent, $pageLength, $pageTotal) : ''; |
| 22 | -$search_term = isset($search_term) ? $search_term :null; |
|
| 22 | +$search_term = isset($search_term) ? $search_term : null; |
|
| 23 | 23 | |
| 24 | 24 | if ($showSessions && isset($_POST['date'])) { |
| 25 | 25 | $date = $_POST['date']; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $el.prepend('<?php echo Display::display_icon('nolines_minus.gif'); ?>'); |
| 61 | 61 | |
| 62 | 62 | $.ajax({ |
| 63 | - url: '<?php echo api_get_path(WEB_AJAX_PATH) . 'course.ajax.php' ?>', |
|
| 63 | + url: '<?php echo api_get_path(WEB_AJAX_PATH).'course.ajax.php' ?>', |
|
| 64 | 64 | type: 'GET', |
| 65 | 65 | dataType: 'json', |
| 66 | 66 | data: { |
@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | <?php |
| 125 | 125 | |
| 126 | 126 | $webAction = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
| 127 | - $action = (!empty($_REQUEST['action'])?Security::remove_XSS($_REQUEST['action']):'display_courses'); |
|
| 128 | - $pageLength = (!empty($_REQUEST['pageLength'])?intval($_REQUEST['pageLength']):10); |
|
| 129 | - $pageCurrent = (!empty($_REQUEST['pageCurrent'])?intval($_REQUEST['pageCurrent']):1); |
|
| 127 | + $action = (!empty($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : 'display_courses'); |
|
| 128 | + $pageLength = (!empty($_REQUEST['pageLength']) ? intval($_REQUEST['pageLength']) : 10); |
|
| 129 | + $pageCurrent = (!empty($_REQUEST['pageCurrent']) ? intval($_REQUEST['pageCurrent']) : 1); |
|
| 130 | 130 | $form = '<form action="'.$webAction.'" method="GET" class="form-horizontal">'; |
| 131 | - $form .= '<input type="hidden" name="action" value="' . $action . '">'; |
|
| 132 | - $form .= '<input type="hidden" name="pageCurrent" value="' . $pageCurrent . '">'; |
|
| 133 | - $form .= '<input type="hidden" name="pageLength" value="' . $pageLength . '">'; |
|
| 131 | + $form .= '<input type="hidden" name="action" value="'.$action.'">'; |
|
| 132 | + $form .= '<input type="hidden" name="pageCurrent" value="'.$pageCurrent.'">'; |
|
| 133 | + $form .= '<input type="hidden" name="pageLength" value="'.$pageLength.'">'; |
|
| 134 | 134 | $form .= '<div class="form-group">'; |
| 135 | 135 | $form .= '<div class="col-sm-12">'; |
| 136 | 136 | $form .= '<select name="category_code" onchange="submit();" class="selectpicker show-tick form-control">'; |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $categoryCode = $category['code']; |
| 140 | 140 | $countCourse = $category['count_courses']; |
| 141 | 141 | |
| 142 | - $form .= '<option '. ($categoryCode == $codeType? 'selected="selected" ':'') .' value="' . $category['code'] . '">' . $category['name'] . ' ( '. $countCourse .' ) </option>'; |
|
| 142 | + $form .= '<option '.($categoryCode == $codeType ? 'selected="selected" ' : '').' value="'.$category['code'].'">'.$category['name'].' ( '.$countCourse.' ) </option>'; |
|
| 143 | 143 | if (!empty($browse_course_categories[$categoryCode])) { |
| 144 | - foreach ($browse_course_categories[$categoryCode] as $subCategory){ |
|
| 144 | + foreach ($browse_course_categories[$categoryCode] as $subCategory) { |
|
| 145 | 145 | $subCategoryCode = $subCategory['code']; |
| 146 | - $form .= '<option '. ($subCategoryCode == $codeType ? 'selected="selected" ':'') .' value="' . $subCategory['code'] . '"> ---' . $subCategory['name'] . ' ( '. $subCategory['count_courses'] .' ) </option>'; |
|
| 146 | + $form .= '<option '.($subCategoryCode == $codeType ? 'selected="selected" ' : '').' value="'.$subCategory['code'].'"> ---'.$subCategory['name'].' ( '.$subCategory['count_courses'].' ) </option>'; |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $course_subscribe_allowed = ($course['subscribe'] == 1); |
| 207 | 207 | $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); |
| 208 | 208 | $count_connections = $course['count_connections']; |
| 209 | - $creation_date = substr($course['creation_date'],0,10); |
|
| 209 | + $creation_date = substr($course['creation_date'], 0, 10); |
|
| 210 | 210 | |
| 211 | 211 | $icon_title = null; |
| 212 | 212 | $html = null; |
@@ -323,9 +323,9 @@ discard block |
||
| 323 | 323 | $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; |
| 324 | 324 | $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']); |
| 325 | 325 | $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']); |
| 326 | - $html .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>'; |
|
| 326 | + $html .= '<h4 class="title"><a href="'.$linkCourse.'">'.cut($title, 60).'</a></h4>'; |
|
| 327 | 327 | $html .= '<div class="teachers">'.$teachers.'</div>'; |
| 328 | - $html .= '<div class="ranking">'. $rating . '</div>'; |
|
| 328 | + $html .= '<div class="ranking">'.$rating.'</div>'; |
|
| 329 | 329 | |
| 330 | 330 | return $html; |
| 331 | 331 | } |
@@ -340,8 +340,8 @@ discard block |
||
| 340 | 340 | $title = $course['title']; |
| 341 | 341 | $html = ''; |
| 342 | 342 | if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { |
| 343 | - $html = '<a data-title="' . $title . '" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="' . get_lang('Description') . '">' . |
|
| 344 | - Display::returnFontAwesomeIcon('info-circle') . '</a>'; |
|
| 343 | + $html = '<a data-title="'.$title.'" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.get_lang('Description').'">'. |
|
| 344 | + Display::returnFontAwesomeIcon('info-circle').'</a>'; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | return $html; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | function return_goto_button($course) |
| 355 | 355 | { |
| 356 | - $html = ' <a class="btn btn-default btn-sm" title="' . get_lang('GoToCourse') . '" href="'.api_get_course_url($course['code']).'">'. |
|
| 356 | + $html = ' <a class="btn btn-default btn-sm" title="'.get_lang('GoToCourse').'" href="'.api_get_course_url($course['code']).'">'. |
|
| 357 | 357 | Display::returnFontAwesomeIcon('share').'</a>'; |
| 358 | 358 | |
| 359 | 359 | return $html; |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | function return_register_button($course, $stok, $code, $search_term) |
| 389 | 389 | { |
| 390 | - $html = ' <a class="btn btn-success btn-sm" title="' . get_lang('Subscribe') . '" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' . |
|
| 391 | - Display::returnFontAwesomeIcon('sign-in') . '</a>'; |
|
| 390 | + $html = ' <a class="btn btn-success btn-sm" title="'.get_lang('Subscribe').'" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'. |
|
| 391 | + Display::returnFontAwesomeIcon('sign-in').'</a>'; |
|
| 392 | 392 | return $html; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | function return_unregister_button($course, $stok, $search_term, $code) |
| 403 | 403 | { |
| 404 | - $html = ' <a class="btn btn-danger btn-sm" title="' . get_lang('Unsubscribe') . '" href="'. api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' . |
|
| 405 | - Display::returnFontAwesomeIcon('sign-out') . '</a>'; |
|
| 404 | + $html = ' <a class="btn btn-danger btn-sm" title="'.get_lang('Unsubscribe').'" href="'.api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'. |
|
| 405 | + Display::returnFontAwesomeIcon('sign-out').'</a>'; |
|
| 406 | 406 | return $html; |
| 407 | 407 | } |
@@ -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; |
@@ -423,12 +423,12 @@ discard block |
||
| 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 |
||
| 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, |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | * @param string $searchTerm |
| 583 | 583 | * @return int |
| 584 | 584 | */ |
| 585 | -function countCoursesInCategory($category_code="", $searchTerm = '') |
|
| 585 | +function countCoursesInCategory($category_code = "", $searchTerm = '') |
|
| 586 | 586 | { |
| 587 | 587 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
| 588 | 588 | $categoryCode = Database::escape_string($category_code); |
@@ -594,7 +594,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $without_special_courses = ''; |
| 669 | 669 | if (!empty($specialCourseList)) { |
| 670 | - $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $specialCourseList) . '")'; |
|
| 670 | + $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")'; |
|
| 671 | 671 | } |
| 672 | 672 | $visibilityCondition = null; |
| 673 | 673 | $hidePrivate = api_get_setting('course_catalog_hide_private'); |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | $id_in = null; |
| 716 | 716 | while (list($id) = Database::fetch_row($result)) { |
| 717 | 717 | if ($id_in) { |
| 718 | - $id_in.=",$id"; |
|
| 718 | + $id_in .= ",$id"; |
|
| 719 | 719 | } else { |
| 720 | 720 | $id_in = "$id"; |
| 721 | 721 | } |
@@ -936,11 +936,9 @@ discard block |
||
| 936 | 936 | function getLimitArray() |
| 937 | 937 | { |
| 938 | 938 | $pageCurrent = isset($_REQUEST['pageCurrent']) ? |
| 939 | - intval($_GET['pageCurrent']) : |
|
| 940 | - 1; |
|
| 939 | + intval($_GET['pageCurrent']) : 1; |
|
| 941 | 940 | $pageLength = isset($_REQUEST['pageLength']) ? |
| 942 | - intval($_GET['pageLength']) : |
|
| 943 | - 12; |
|
| 941 | + intval($_GET['pageLength']) : 12; |
|
| 944 | 942 | return array( |
| 945 | 943 | 'start' => ($pageCurrent - 1) * $pageLength, |
| 946 | 944 | 'current' => $pageCurrent, |
@@ -959,7 +957,7 @@ discard block |
||
| 959 | 957 | if (!empty($limit) && is_array($limit)) { |
| 960 | 958 | $limitStart = isset($limit['start']) ? $limit['start'] : 0; |
| 961 | 959 | $limitLength = isset($limit['length']) ? $limit['length'] : 10; |
| 962 | - $limitFilter = 'LIMIT ' . $limitStart . ', ' . $limitLength; |
|
| 960 | + $limitFilter = 'LIMIT '.$limitStart.', '.$limitLength; |
|
| 963 | 961 | } |
| 964 | 962 | |
| 965 | 963 | return $limitFilter; |
@@ -976,7 +974,7 @@ discard block |
||
| 976 | 974 | { |
| 977 | 975 | // Start empty html |
| 978 | 976 | $pageDiv = ''; |
| 979 | - $html=''; |
|
| 977 | + $html = ''; |
|
| 980 | 978 | $pageBottom = max(1, $pageCurrent - 3); |
| 981 | 979 | $pageTop = min($pageTotal, $pageCurrent + 3); |
| 982 | 980 | |
@@ -1051,21 +1049,21 @@ discard block |
||
| 1051 | 1049 | $hiddenLinks = isset($hiddenLinks) ? Security::remove_XSS($hiddenLinksRequest) : $categoryCodeRequest; |
| 1052 | 1050 | |
| 1053 | 1051 | // Start URL with params |
| 1054 | - $pageUrl = api_get_self() . |
|
| 1055 | - '?action=' . $action . |
|
| 1056 | - '&category_code=' .$categoryCode. |
|
| 1057 | - '&hidden_links=' .$hiddenLinks. |
|
| 1058 | - '&pageCurrent=' . $pageCurrent . |
|
| 1059 | - '&pageLength=' . $pageLength |
|
| 1052 | + $pageUrl = api_get_self(). |
|
| 1053 | + '?action='.$action. |
|
| 1054 | + '&category_code='.$categoryCode. |
|
| 1055 | + '&hidden_links='.$hiddenLinks. |
|
| 1056 | + '&pageCurrent='.$pageCurrent. |
|
| 1057 | + '&pageLength='.$pageLength |
|
| 1060 | 1058 | ; |
| 1061 | 1059 | |
| 1062 | 1060 | switch ($action) { |
| 1063 | 1061 | case 'subscribe' : |
| 1064 | 1062 | // for search |
| 1065 | 1063 | $pageUrl .= |
| 1066 | - '&search_term=' . $searchTerm . |
|
| 1067 | - '&search_course=1' . |
|
| 1068 | - '&sec_token=' . $_SESSION['sec_token']; |
|
| 1064 | + '&search_term='.$searchTerm. |
|
| 1065 | + '&search_course=1'. |
|
| 1066 | + '&sec_token='.$_SESSION['sec_token']; |
|
| 1069 | 1067 | break; |
| 1070 | 1068 | case 'display_courses' : |
| 1071 | 1069 | // No break |