Create library for courses and sessions catalog - refs #7275

1.9.x
Angel Fernando Quiroz Campos 10 years ago
parent 27ac91324f
commit 86c53f0d10
  1. 69
      main/inc/lib/CoursesAndSessionsCatalog.class.php
  2. 1
      main/inc/lib/autoload.class.php

@ -0,0 +1,69 @@
<?php
class CoursesAndSessionsCatalog
{
/**
* Check the configuration for the courses and sessions catalog
* @global array $_configuration Configuration
* @param int $value The value to check
* @return boolean Whether the configuration is $value
*/
public static function is($value = CATALOG_COURSES)
{
global $_configuration;
if (isset($_configuration['catalog_show_courses_sessions'])) {
if ($_configuration['catalog_show_courses_sessions'] == $value) {
return true;
}
}
return false;
}
/**
* Check whether to display the sessions list
* @global array $_configuration Configuration
* @return boolean whether to display
*/
public static function showSessions()
{
global $_configuration;
$catalogShow = CATALOG_COURSES;
if (isset($_configuration['catalog_show_courses_sessions'])) {
$catalogShow = $_configuration['catalog_show_courses_sessions'];
}
if ($catalogShow == CATALOG_SESSIONS || $catalogShow == CATALOG_COURSES_SESSIONS) {
return true;
}
return false;
}
/**
* Check whether to display the courses list
* @global array $_configuration Configuration
* @return boolean whether to display
*/
public static function showCourses()
{
global $_configuration;
$catalogShow = CATALOG_COURSES;
if (isset($_configuration['catalog_show_courses_sessions'])) {
$catalogShow = $_configuration['catalog_show_courses_sessions'];
}
if ($catalogShow == CATALOG_COURSES || $catalogShow == CATALOG_COURSES_SESSIONS) {
return true;
}
return false;
}
}

@ -115,6 +115,7 @@ class Autoload
$result['Controller'] = '/main/inc/lib/controller.class.php';
$result['Converter'] = '/main/inc/lib/system/text/converter.class.php';
$result['Course'] = '/main/coursecopy/classes/Course.class.php';
$result['CoursesAndSessionsCatalog'] = '/main/inc/lib/CoursesAndSessionsCatalog.class.php';
$result['CourseArchiver'] = '/main/coursecopy/classes/CourseArchiver.class.php';
$result['CourseBuilder'] = '/main/coursecopy/classes/CourseBuilder.class.php';
$result['CourseCopyLearnpath'] = '/main/coursecopy/classes/CourseCopyLearnpath.class.php';

Loading…
Cancel
Save