|
|
|
@ -202,123 +202,6 @@ class CoursesController |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get the html block for courses categories. |
|
|
|
|
* |
|
|
|
|
* @param string $code Current category code |
|
|
|
|
* @param bool $hiddenLinks Whether hidden links |
|
|
|
|
* @param array $limit |
|
|
|
|
* |
|
|
|
|
* @return string The HTML block |
|
|
|
|
*/ |
|
|
|
|
public function getCoursesCategoriesBlock( |
|
|
|
|
$code = null, |
|
|
|
|
$hiddenLinks = false, |
|
|
|
|
$limit = null |
|
|
|
|
) { |
|
|
|
|
$categories = CoursesAndSessionsCatalog::getCourseCategories(); |
|
|
|
|
$html = ''; |
|
|
|
|
if (!empty($categories)) { |
|
|
|
|
$action = 'display_courses'; |
|
|
|
|
foreach ($categories[0] as $category) { |
|
|
|
|
$categoryName = $category['name']; |
|
|
|
|
$categoryCode = $category['code']; |
|
|
|
|
$categoryCourses = $category['count_courses']; |
|
|
|
|
|
|
|
|
|
$html .= '<li>'; |
|
|
|
|
|
|
|
|
|
$categoryLink = CourseCategory::getCourseCategoryUrl( |
|
|
|
|
1, |
|
|
|
|
$limit['length'], |
|
|
|
|
$categoryCode, |
|
|
|
|
$hiddenLinks, |
|
|
|
|
$action |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($code == $categoryCode) { |
|
|
|
|
$html .= '<strong>'; |
|
|
|
|
$html .= "$categoryName ($categoryCourses)"; |
|
|
|
|
$html .= '</strong>'; |
|
|
|
|
} else { |
|
|
|
|
if (!empty($categoryCourses)) { |
|
|
|
|
$html .= '<a href="'.$categoryLink.'">'; |
|
|
|
|
$html .= "$categoryName ($categoryCourses)"; |
|
|
|
|
$html .= '</a>'; |
|
|
|
|
} else { |
|
|
|
|
$html .= "$categoryName ($categoryCourses)"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($categories[$categoryCode])) { |
|
|
|
|
$html .= '<ul class="nav nav-list">'; |
|
|
|
|
|
|
|
|
|
foreach ($categories[$categoryCode] as $subCategory1) { |
|
|
|
|
$subCategory1Name = $subCategory1['name']; |
|
|
|
|
$subCategory1Code = $subCategory1['code']; |
|
|
|
|
$subCategory1Courses = $subCategory1['count_courses']; |
|
|
|
|
$html .= '<li>'; |
|
|
|
|
if ($code == $subCategory1Code) { |
|
|
|
|
$html .= "<strong>$subCategory1Name ($subCategory1Courses)</strong>"; |
|
|
|
|
} else { |
|
|
|
|
$html .= '<a href="'.$categoryLink.'">'; |
|
|
|
|
$html .= "$subCategory1Name ($subCategory1Courses)"; |
|
|
|
|
$html .= '</a>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($categories[$subCategory1Code])) { |
|
|
|
|
$html .= '<ul class="nav nav-list">'; |
|
|
|
|
|
|
|
|
|
foreach ($categories[$subCategory1Code] as $subCategory2) { |
|
|
|
|
$subCategory2Name = $subCategory2['name']; |
|
|
|
|
$subCategory2Code = $subCategory2['code']; |
|
|
|
|
$subCategory2Courses = $subCategory2['count_courses']; |
|
|
|
|
|
|
|
|
|
$html .= '<li>'; |
|
|
|
|
|
|
|
|
|
if ($code == $subCategory2Code) { |
|
|
|
|
$html .= "<strong>$subCategory2Name ($subCategory2Courses)</strong>"; |
|
|
|
|
} else { |
|
|
|
|
$html .= '<a href="'.$categoryLink.'">'; |
|
|
|
|
$html .= "$subCategory2Name ($subCategory2Courses)"; |
|
|
|
|
$html .= '</a>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($categories[$subCategory2Code])) { |
|
|
|
|
$html .= '<ul class="nav nav-list">'; |
|
|
|
|
|
|
|
|
|
foreach ($categories[$subCategory2Code] as $subCategory3) { |
|
|
|
|
$subCategory3Name = $subCategory3['name']; |
|
|
|
|
$subCategory3Code = $subCategory3['code']; |
|
|
|
|
$subCategory3Courses = $subCategory3['count_courses']; |
|
|
|
|
|
|
|
|
|
$html .= '<li>'; |
|
|
|
|
|
|
|
|
|
if ($code == $subCategory3Code) { |
|
|
|
|
$html .= "<strong>$subCategory3Name ($subCategory3Courses)</strong>"; |
|
|
|
|
} else { |
|
|
|
|
$html .= '<a href="'.$categoryLink.'">'; |
|
|
|
|
$html .= "$subCategory3Name ($subCategory3Courses)"; |
|
|
|
|
$html .= '</a>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</li>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</ul>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</li>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</ul>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</li>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</ul>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</li>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $html; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get a HTML button for subscribe to session. |
|
|
|
|
* |
|
|
|
|