exit;
            break;
        case 'create_virtual_groups':
            $ids = GroupManager::create_groups_from_virtual_courses();
            $msg = urlencode(count($ids) . ' ' . get_lang('GroupsAdded'));
            header('Location: group.php?action=show_msg&msg=' . $msg);
            exit;
            break;
        case 'create_subgroups':
            GroupManager::create_subgroups($_POST['base_group'], $_POST['number_of_groups']);
            $msg = urlencode($_POST['number_of_groups'] . ' ' . get_lang('GroupsAdded'));
            header('Location: group.php?action=show_msg&msg=' . $msg);
            exit;
            break;
        case 'create_class_groups':
            $ids = GroupManager::create_class_groups($_POST['group_category']);
            $msg = urlencode(count($ids) . ' ' . get_lang('GroupsAdded'));
            header('Location: group.php?action=show_msg&msg=' . $msg);
            exit;
            break;
    }
}
$nameTools = get_lang('GroupCreation');
$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups'));
Display::display_header($nameTools, 'Group');
if (!api_is_allowed_to_edit(false, true)) {
    api_not_allowed();
} elseif (isset($_POST['number_of_groups'])) {
    if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) {
        Display::display_error_message(get_lang('PleaseEnterValidNumber') . '<br /><br /><a href="group_creation.php?' . api_get_cidreq() . '">&laquo; ' . get_lang('Back') . '</a>', false);
    } else {