123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?php
- $language_file = array ('courses', 'registration');
- $cidReset = true;
- require_once '../inc/global.inc.php';
- require_once api_get_path(LIBRARY_PATH).'auth.lib.php';
- require_once api_get_path(LIBRARY_PATH).'app_view.php';
- require_once 'courses_controller.php';
- require_once api_get_path(LIBRARY_PATH).'course.lib.php';
- require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
- if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
-
- $htmlHeadXtra[] = '<script type="text/javascript">' .
- 'var GB_ROOT_DIR = "'.api_get_path(WEB_LIBRARY_PATH).'javascript/greybox/"' .
- '</script>';
- $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/greybox/AJS.js" type="text/javascript" language="javascript"></script>';
- $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/greybox/AJS_fx.js" type="text/javascript" language="javascript"></script>';
- $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/greybox/gb_scripts.js" type="text/javascript" language="javascript"></script>';
- $htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/greybox/gb_styles.css" rel="stylesheet" type="text/css" />';
- }
- $this_section = SECTION_COURSES;
- api_block_anonymous_users();
- if (!(api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_create_course())) {
- if (api_get_setting('allow_students_to_browse_courses') == 'false') {
- api_not_allowed();
- }
- }
- $actions = array('sortmycourses', 'createcoursecategory', 'subscribe', 'deletecoursecategory', 'unsubscribe', 'display_courses');
- $action = 'subscribe';
- $nameTools = get_lang('SortMyCourses');
- if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
- $action = $_GET['action'];
- }
- if ($action == 'createcoursecategory') {
- $nameTools = get_lang('CreateCourseCategory');
- }
- if ($action == 'subscribe') {
- $nameTools = get_lang('SubscribeToCourse');
- }
- $interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'user_portal.php', 'name' => get_lang('MyCourses'));
- if (empty($nameTools)) {
- $nameTools = get_lang('CourseManagement');
- } else {
- $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'auth/courses.php', 'name' => get_lang('CourseManagement'));
- $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools);
- }
- $courses_controller = new CoursesController();
- $ctok = $_SESSION['sec_token'];
- if (isset($_GET['move'])) {
- if (isset($_GET['course'])) {
- if ($ctok == $_GET['sec_token']) {
- $courses_controller->move_course($_GET['move'], $_GET['course'], $_GET['category']);
- }
- }
- if (isset($_GET['category']) && !$_GET['course']) {
- if ($ctok == $_GET['sec_token']) {
- $courses_controller->move_category($_GET['move'], $_GET['category']);
- }
- }
- }
- if (isset($_POST['submit_change_course_category'])) {
- if ($ctok == $_POST['sec_token']) {
- $courses_controller->change_course_category($_POST['course_2_edit_category'], $_POST['course_categories']);
- }
- }
- if (isset($_POST['submit_edit_course_category']) && isset($_POST['title_course_category']) && strlen(trim($_POST['title_course_category'])) > 0) {
- if ($ctok == $_POST['sec_token']) {
- $courses_controller->edit_course_category($_POST['title_course_category'], $_POST['edit_course_category']);
- }
- }
- if ($action == 'deletecoursecategory' && isset($_GET['id'])) {
- if ($ctok == $_GET['sec_token']) {
- $get_id_cat = intval($_GET['id']);
- $courses_controller->delete_course_category($get_id_cat);
- }
- }
- if (isset($_POST['unsubscribe'])) {
- if ($ctok == $_POST['sec_token']) {
- $courses_controller->unsubscribe_user_from_course($_POST['unsubscribe']);
-
- }
- }
- if (isset($_POST['create_course_category']) && isset($_POST['title_course_category']) && strlen(trim($_POST['title_course_category'])) > 0) {
- if ($ctok == $_POST['sec_token']) {
- $courses_controller->add_course_category($_POST['title_course_category']);
- }
- }
- if (isset($_REQUEST['search_course'])) {
-
- if ($ctok == $_REQUEST['sec_token']) {
- $courses_controller->search_courses($_REQUEST['search_term']);
- }
- }
- if (isset($_GET['subscribe_course'])) {
-
- $courses_controller->subscribe_user($_GET['subscribe_course'], $_GET['search_term'], $_GET['category_code']);
-
- }
- switch ($action) {
- case 'createcoursecategory' :
- $courses_controller->categories_list($action);
- break;
- case 'deletecoursecategory' :
- case 'sortmycourses' :
- $courses_controller->courses_list($action);
- break;
- case 'subscribe' :
- $courses_controller->courses_categories($action);
- break;
- case 'display_courses' :
- $courses_controller->courses_categories($action, $_GET['category_code']);
- break;
- }
|