"index.php", "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array ("url" => "class_list.php?filtreCours=".urlencode($course), "name" => get_lang('AdminClasses')); if ($_POST['formSent']) { $form_sent = $_POST['formSent']; $first_letter_left = $_POST['firstLetterLeft']; $first_letter_right = $_POST['firstLetterRight']; $left_user_list = is_array($_POST['LeftUserList']) ? $_POST['LeftUserList'] : array(); $right_user_list = is_array($_POST['RightUserList']) ? $_POST['RightUserList'] : array(); $add_to_class = empty ($_POST['addToClass']) ? 0 : 1; $remove_from_class = empty ($_POST['removeFromClass']) ? 0 : 1; if ($form_sent == 1) { if ($add_to_class) { if (count($left_user_list) == 0) { $error_message = get_lang('AtLeastOneUser'); } else { foreach ($left_user_list as $user_id) { ClassManager :: add_user($user_id, $class_id); } header('Location: class_list.php?filtreCours='.urlencode($course)); exit (); } } elseif ($remove_from_class) { if (count($right_user_list) == 0) $error_message = get_lang('AtLeastOneUser'); else { foreach ($right_user_list as $index => $user_id) { ClassManager :: unsubscribe_user($user_id, $class_id); } header('Location: class_list.php?filtreCours='.urlencode($course)); exit (); } } } } Display :: display_header($tool_name); //api_display_tool_title($tool_name); $sql = "SELECT u.user_id,lastname,firstname,username FROM $tbl_user u LEFT JOIN $tbl_class_user cu ON u.user_id=cu.user_id AND class_id='$class_id' WHERE lastname LIKE '".$first_letter_left."%' AND class_id IS NULL ORDER BY ". (count($left_user_list) > 0 ? "(user_id IN(".implode(',', $left_user_list).")) DESC," : "")." lastname"; $result = api_sql_query($sql, __FILE__, __LINE__); $left_users = api_store_result($result); $sql = "SELECT u.user_id,lastname,firstname,username FROM $tbl_user u,$tbl_class_user cu WHERE cu.user_id=u.user_id AND class_id='$class_id' AND lastname LIKE '".$first_letter_right."%' ORDER BY ". (count($right_user_list) > 0 ? "(user_id IN(".implode(',', $right_user_list).")) DESC," : "")." lastname"; $result = api_sql_query($sql, __FILE__, __LINE__); $right_users = api_store_result($result); if (!empty ($error_message)) { Display :: display_normal_message($error_message); } ?>