'index.php',"name" => get_lang('PlatformAdmin')); $interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang("SessionList")); $interbreadcrumb[]=array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview')); $interbreadcrumb[]=array('url' => "session_course_list.php?id_session=$id_session","name" =>api_htmlentities($session_name,ENT_QUOTES,$charset)); $arr_infos = array(); if (isset($_POST['formSent']) && $_POST['formSent']) { $formSent=1; // get all tutor by course_code in the session $sql = "SELECT id_user FROM $tbl_session_rel_course_rel_user WHERE id_session = '$id_session' AND course_code = '".Database::escape_string($course_code)."' AND status = 2"; $rs_coachs = Database::query($sql); $coachs_course_session = array(); if (Database::num_rows($rs_coachs) > 0){ while ($row_coachs = Database::fetch_row($rs_coachs)) { $coachs_course_session[] = $row_coachs[0]; } } $id_coachs= $_POST['id_coach']; if (is_array($id_coachs) && count($id_coachs) > 0) { foreach ($id_coachs as $id_coach) { $id_coach = intval($id_coach); $rs1 = SessionManager::set_coach_to_course_session($id_coach, $id_session, $course_code); } // set status to 0 other tutors from multiple list $array_intersect = array_diff($coachs_course_session,$id_coachs); foreach ($array_intersect as $nocoach_user_id) { $rs2 = SessionManager::set_coach_to_course_session( $nocoach_user_id, $id_session, $course_code, true ); } header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session); exit(); } } else { $sql = "SELECT id_user FROM $tbl_session_rel_course_rel_user WHERE id_session = '$id_session' AND course_code = '".Database::escape_string($course_code)."' AND status = 2 "; $rs = Database::query($sql); if (Database::num_rows($rs) > 0) { while ($infos = Database::fetch_array($rs)) { $arr_infos[] = $infos['id_user']; } } } $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; global $_configuration; if ($_configuration['multiple_access_urls']) { $tbl_access_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_id = api_get_current_access_url_id(); $sql="SELECT u.user_id,lastname,firstname,username FROM $tbl_user u LEFT JOIN $tbl_access_rel_user a ON(u.user_id= a.user_id) WHERE status='1' AND active = 1 AND access_url_id = $access_url_id ".$order_clause; } else { $sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1' AND active = 1 ".$order_clause; } $result = Database::query($sql); $coaches = Database::store_result($result); Display::display_header($tool_name); $tool_name = get_lang('ModifySessionCourse'); api_display_tool_title($tool_name); ?>