break; case "group_userList_add": $group_id = $_POST['group_id']; $group_name = ace_group_get_name_by_id($group_id); # if form has data if ($_POST['user_email_list'] != '') { $student_email_list = preg_split("/[\r\n]+/", $_POST['user_email_list'], -1, PREG_SPLIT_NO_EMPTY); $email_count = array(); $new_user_array = array(); $new_user_initial_password_text_block = ''; foreach ($student_email_list as $student_email) { $sanitized_email = filter_var($student_email, FILTER_VALIDATE_EMAIL); if (filter_var($sanitized_email, FILTER_VALIDATE_EMAIL)) { $email_count['good']++; if (!ace_user_exists($sanitized_email)) { $user_array = ace_user_create($sanitized_email, '', ''); $new_user_array[] = $user_array; if ($user_array['user_id'] !== FALSE) { $email_count['created']++; } ace_group_add_user($group_id, $user_array['user_id']); $email_count['added']++; } else { $user_id = ace_user_get_id_by_name($sanitized_email); if (!ace_group_user_is_member($group_id, $user_id)) { ace_group_add_user($group_id, $user_id); $email_count['added']++; } } } else { $email_count['bad']++;
$messages[] = create_message(FALSE, 'deleting course (' . $course_ref . '), sections exist for this course'); } else { $success = ace_course_delete($_POST['course_id']); $messages[] = create_message($success, 'deleting course (' . $course_ref . ')'); } break; case 'user_change_state': $user_id = $_POST['user_id']; $user_name = ace_user_get_name_by_id($user_id); $current_user_state = ace_user_get_state($user_id); $new_user_state = $current_user_state ? FALSE : TRUE; $success = ace_user_set_state($user_id, $new_user_state); $messages[] = create_message($success, ($new_user_state ? 'activating ' : 'deactivating ') . 'user (' . $user_name . ')'); break; case 'user_create': $user_id = ace_user_create($_POST['user_email'], $_POST['user_first'], $_POST['user_last']); $success = $user_id !== FALSE ? TRUE : FALSE; $messages[] = create_message($success, 'creating user (' . $_POST['user_email'] . ')'); break; case 'user_update': if ($_POST['user_id']) { $user_id = $_POST['user_id']; $user_email = $_POST['user_email']; $user_first = $_POST['user_first']; $user_last = $_POST['user_last']; $success = ace_user_update($user_id, $user_email, $user_first, $user_last); $messages[] = create_message($success, 'updating user (' . $user_email . ')'); } break; case 'user_delete': $user_id = $_POST['user_id'];