$group1['places'] = isset($_POST['group_' . $i . '_places']) ? $_POST['group_' . $i . '_places'] : null; $groups[] = $group1; } foreach ($groups as $index => $group) { if (!empty($_POST['same_tutor'])) { $group['tutor'] = $_POST['group_0_tutor']; } if (!empty($_POST['same_places'])) { $group['places'] = $_POST['group_0_places']; } if (api_get_setting('allow_group_categories') == 'false') { $group['category'] = GroupManager::DEFAULT_GROUP_CATEGORY; } elseif (isset($_POST['same_category']) && $_POST['same_category']) { $group['category'] = $_POST['group_0_category']; } GroupManager::create_group($group['name'], $group['category'], $group['tutor'], $group['places']); } $msg = urlencode(count($groups) . ' ' . get_lang('GroupsAdded')); header('Location: group.php?action=show_msg&msg=' . $msg); 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);