CoursesAndSessionsCatalog.class.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @todo change class name
  5. * Class CoursesAndSessionsCatalog
  6. */
  7. class CoursesAndSessionsCatalog
  8. {
  9. const PAGE_LENGTH = 12;
  10. /**
  11. * Check the configuration for the courses and sessions catalog
  12. * @global array $_configuration Configuration
  13. * @param int $value The value to check
  14. *
  15. * @return boolean Whether the configuration is $value
  16. */
  17. public static function is($value = CATALOG_COURSES)
  18. {
  19. $showCoursesSessions = intval(api_get_setting('catalog_show_courses_sessions'));
  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(api_get_setting('catalog_show_courses_sessions'));
  34. if ($catalogShow == CATALOG_SESSIONS || $catalogShow == CATALOG_COURSES_SESSIONS) {
  35. return true;
  36. }
  37. return false;
  38. }
  39. /**
  40. * Check whether to display the courses list
  41. * @global array $_configuration Configuration
  42. *
  43. * @return boolean whether to display
  44. */
  45. public static function showCourses()
  46. {
  47. $catalogShow = intval(api_get_setting('catalog_show_courses_sessions'));
  48. if ($catalogShow == CATALOG_COURSES || $catalogShow == CATALOG_COURSES_SESSIONS) {
  49. return true;
  50. }
  51. return false;
  52. }
  53. }