CoursesAndSessionsCatalog.class.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Class CoursesAndSessionsCatalog
  5. */
  6. class CoursesAndSessionsCatalog
  7. {
  8. /**
  9. * Check the configuration for the courses and sessions catalog
  10. * @global array $_configuration Configuration
  11. * @param int $value The value to check
  12. *
  13. * @return boolean Whether the configuration is $value
  14. */
  15. public static function is($value = CATALOG_COURSES)
  16. {
  17. $showCoursesSessions = intval(
  18. api_get_setting('platform.catalog_show_courses_sessions')
  19. );
  20. if ($showCoursesSessions == $value) {
  21. return true;
  22. }
  23. return false;
  24. }
  25. /**
  26. * Check whether to display the sessions list
  27. * @global array $_configuration Configuration
  28. *
  29. * @return boolean whether to display
  30. */
  31. public static function showSessions()
  32. {
  33. $catalogShow = intval(
  34. api_get_setting('platform.catalog_show_courses_sessions')
  35. );
  36. if ($catalogShow == CATALOG_SESSIONS || $catalogShow == CATALOG_COURSES_SESSIONS) {
  37. return true;
  38. }
  39. return false;
  40. }
  41. /**
  42. * Check whether to display the courses list
  43. * @global array $_configuration Configuration
  44. *
  45. * @return boolean whether to display
  46. */
  47. public static function showCourses()
  48. {
  49. $catalogShow = intval(
  50. api_get_setting('platform.catalog_show_courses_sessions')
  51. );
  52. if ($catalogShow == CATALOG_COURSES || $catalogShow == CATALOG_COURSES_SESSIONS) {
  53. return true;
  54. }
  55. return false;
  56. }
  57. }