| @@ 534-553 (lines=20) @@ | ||
| 531 | $courseCategoryCondition = " INNER JOIN $table a ON (t1.id = a.course_category_id)"; |
|
| 532 | ||
| 533 | $url_access_id = api_get_current_access_url_id(); |
|
| 534 | if ($url_access_id != -1) { |
|
| 535 | $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
| 536 | $sqlGetSubCatList = " |
|
| 537 | SELECT t1.name, |
|
| 538 | t1.code, |
|
| 539 | t1.parent_id, |
|
| 540 | t1.children_count, |
|
| 541 | COUNT(DISTINCT t3.code) AS nbCourse |
|
| 542 | FROM $main_category_table t1 |
|
| 543 | $courseCategoryCondition |
|
| 544 | LEFT JOIN $main_category_table t2 ON t1.code = t2.parent_id |
|
| 545 | LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses) |
|
| 546 | INNER JOIN $tbl_url_rel_course as url_rel_course |
|
| 547 | ON (url_rel_course.c_id = t3.id) |
|
| 548 | WHERE |
|
| 549 | url_rel_course.access_url_id = $url_access_id AND |
|
| 550 | t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")." |
|
| 551 | GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count |
|
| 552 | ORDER BY t1.tree_pos, t1.name"; |
|
| 553 | } |
|
| 554 | } |
|
| 555 | ||
| 556 | $resCats = Database::query($sqlGetSubCatList); |
|
| @@ 659-670 (lines=12) @@ | ||
| 656 | // Showing only the category of courses of the current access_url_id |
|
| 657 | if (api_is_multiple_url_enabled()) { |
|
| 658 | $url_access_id = api_get_current_access_url_id(); |
|
| 659 | if ($url_access_id != -1) { |
|
| 660 | $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
| 661 | $sqlGetSubCatList = " |
|
| 662 | SELECT t1.name,t1.code,t1.parent_id,t1.children_count,COUNT(DISTINCT t3.code) AS nbCourse |
|
| 663 | FROM $main_category_table t1 |
|
| 664 | LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id |
|
| 665 | LEFT JOIN $main_course_table t3 ON (t3.category_code=t1.code $platform_visible_courses) |
|
| 666 | INNER JOIN $tbl_url_rel_course as url_rel_course |
|
| 667 | ON (url_rel_course.c_id = t3.id) |
|
| 668 | WHERE access_url_id = $url_access_id AND t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")." |
|
| 669 | GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name"; |
|
| 670 | } |
|
| 671 | } |
|
| 672 | ||
| 673 | $resCats = Database::query($sqlGetSubCatList); |
|