'; echo ''; require_login($courseid); groups_seed_random_number_generator(); $courseid = required_param('courseid', PARAM_INT); $noofstudents = required_param('noofstudents', PARAM_INT); $noofgroups = required_param('noofgroups', PARAM_INT); $distribevenly = required_param('distribevenly', PARAM_INT); //TODO: PARAM_BOOL ? $alphabetical = required_param('alphabetical', PARAM_INT); $generationtype = required_param('generationtype', PARAM_ALPHA); $groupingsettings->name = required_param('name', PARAM_ALPHANUM); $groupingsettings->description = required_param('description', PARAM_ALPHANUM); $groupingsettings->prefix = required_param('prefix'); $groupingsettings->defaultgroupdescription = required_param('defaultgroupdescription'); if (confirm_sesskey() and isteacheredit($courseid)) { if ($generationtype == 'nogroups') { $noofstudents = false; } $groupingid = groups_create_automatic_grouping($courseid, $noofstudents, $noofgroups, $distribevenly, $groupingsettings, false, $alphabetical); if (!$groupingid) { echo 'Failed to create grouping'; } else { echo ''.$groupingid.''; } } echo ''; ?>