registerFunction('search_courses'); // setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; // setting breadcrumbs $interbreadcrumb[] = ['url' => 'session_list.php', 'name' => get_lang('Session list')]; // Database Table Definitions $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); // setting the name of the tool $tool_name = get_lang('Subscription sessions in the category'); $add_type = 'multiple'; if (isset($_GET['add_type']) && $_GET['add_type'] != '') { $add_type = Security::remove_XSS($_REQUEST['add_type']); } if (!api_is_platform_admin() && !api_is_session_admin()) { api_not_allowed(true); } $xajax->processRequests(); $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); $htmlHeadXtra[] = ' '; $formSent = 0; $errorMsg = $firstLetterCourse = $firstLetterSession = ''; $CourseList = $SessionList = []; $courses = $sessions = []; $categoryId = isset($_POST['CategorySessionId']) ? intval($_POST['CategorySessionId']) : null; if (isset($_POST['formSent']) && $_POST['formSent']) { $formSent = $_POST['formSent']; $sessionCategoryList = $_POST['SessionCategoryList']; if ($categoryId != 0 && count($sessionCategoryList) > 0) { // Removing all $sql = "UPDATE $tbl_session SET session_category_id = NULL WHERE session_category_id = $categoryId"; Database::query($sql); // Adding new $sessionCategoryList = array_map('intval', $sessionCategoryList); $session_id = join(',', $sessionCategoryList); $sql = "UPDATE $tbl_session SET session_category_id = $categoryId WHERE id in ($session_id) "; Database::query($sql); header('Location: add_many_session_to_category.php?id_category='.$categoryId.'&msg=ok'); exit; } else { header('Location: add_many_session_to_category.php?msg=error'); exit; } } if (isset($_GET['id_category'])) { $categoryId = intval($_GET['id_category']); } if (isset($_GET['msg']) && $_GET['msg'] == 'error') { $errorMsg = get_lang('Select category and sessions'); } if (isset($_GET['msg']) && $_GET['msg'] == 'ok') { $OkMsg = get_lang('Category update'); } $page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null; Display::display_header($tool_name); $where = ''; $rows_category_session = []; if ((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category'])) { $where = 'WHERE session_category_id != '.$categoryId.' OR session_category_id IS NULL'; $sql = 'SELECT id, name FROM '.$tbl_session.' WHERE session_category_id ='.$categoryId.' ORDER BY name'; $result = Database::query($sql); $rows_category_session = Database::store_result($result); } $rows_session_category = SessionManager::get_all_session_category(); if (empty($rows_session_category)) { echo Display::return_message(get_lang('You need to add a session category first'), 'warning'); Display::display_footer(); exit; } if (api_get_multiple_access_url()) { $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $access_url_id = api_get_current_access_url_id(); $sql = "SELECT s.id, s.name FROM $tbl_session s INNER JOIN $table_access_url_rel_session u ON s.id = u.session_id $where AND u.access_url_id = $access_url_id ORDER BY name"; } else { $sql = "SELECT id, name FROM $tbl_session $where ORDER BY name"; } $result = Database::query($sql); $rows_session = Database::store_result($result); ?>
'.$tool_name.''; ?> : */ ?>
:
:   :
 








'.get_lang('Subscription sessions in the category').''; ?>