case 2: $timestart = $course->startdate; break; case 3: default: $timestart = $today; break; } if ($extendperiod <= 0) { $timeend = 0; } else { $timeend = $timestart + $extendperiod; } $enrol_manual->enrol_user($instance, $adduser->id, $roleid, $timestart, $timeend); } $potentialuserselector->invalidate_selected_users(); $currentuserselector->invalidate_selected_users(); //TODO: log } } // Process incoming role unassignments. if ($canunenrol && optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) { $userstounassign = $currentuserselector->get_selected_users(); if (!empty($userstounassign)) { foreach ($userstounassign as $removeuser) { $enrol_manual->unenrol_user($instance, $removeuser->id); } $potentialuserselector->invalidate_selected_users(); $currentuserselector->invalidate_selected_users(); //TODO: log }