/** * Determines if a grouping belongs to a specified course * @param int $groupingid The id of the grouping * @param int $courseid The id of the course * @return boolean True if the grouping belongs to the course, false otherwise, * or if an error occurred. */ function groups_grouping_belongs_to_course($groupingid, $courseid) { return groups_db_grouping_belongs_to_course($groupingid, $courseid); }
if (!groups_group_belongs_to_course($group->id, $course->id)) { error('Group not from this course.'); } $groupings = groups_get_groupings_for_group($id); if (empty($groupings)) { $groupingid = -1; } else { if (!isset($groupings[$groupingid])) { $groupingid = $groupings[0]; } } } if ($groupingid != GROUP_NOT_IN_GROUPING and !groups_db_grouping_belongs_to_course($groupingid, $course->id)) { error('Grouping not from this course.'); } if ($newgrouping != GROUP_NOT_IN_GROUPING and !groups_db_grouping_belongs_to_course($newgrouping, $course->id)) { error('Grouping not from this course.'); } // Process delete action if ($delete and $group) { if (!$group) { /// Delete action should not be called without a group id error(get_string('errorinvalidgroup')); } else { if (!$confirm) { print_header(get_string('deleteselectedgroup', 'group'), get_string('deleteselectedgroup', 'group')); $optionsyes = array('id' => $group->id, 'delete' => 1, 'courseid' => $course->id, 'sesskey' => sesskey(), 'confirm' => 1); $optionsno = array('id' => $course->id); notice_yesno(get_string('deletegroupconfirm', 'group', $group->name), 'edit.php', 'index.php', $optionsyes, $optionsno, 'post', 'get'); print_footer(); die;