CoursesAndSessionsCatalog.class.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. global $_configuration;
  18. if (isset($_configuration['catalog_show_courses_sessions'])) {
  19. if ($_configuration['catalog_show_courses_sessions'] == $value) {
  20. return true;
  21. }
  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. global $_configuration;
  34. $catalogShow = CATALOG_COURSES;
  35. if (isset($_configuration['catalog_show_courses_sessions'])) {
  36. $catalogShow = $_configuration['catalog_show_courses_sessions'];
  37. }
  38. if ($catalogShow == CATALOG_SESSIONS || $catalogShow == CATALOG_COURSES_SESSIONS) {
  39. return true;
  40. }
  41. return false;
  42. }
  43. /**
  44. * Check whether to display the courses list
  45. * @global array $_configuration Configuration
  46. *
  47. * @return boolean whether to display
  48. */
  49. public static function showCourses()
  50. {
  51. global $_configuration;
  52. $catalogShow = CATALOG_COURSES;
  53. if (isset($_configuration['catalog_show_courses_sessions'])) {
  54. $catalogShow = $_configuration['catalog_show_courses_sessions'];
  55. }
  56. if ($catalogShow == CATALOG_COURSES || $catalogShow == CATALOG_COURSES_SESSIONS) {
  57. return true;
  58. }
  59. return false;
  60. }
  61. }