MDL-9628 Added title attributes to quickgrading and quickfeedback input elements...
[moodle-pu.git] / group / db / dbcleanup.php
blobe9bc08416460c4b6e00da2bcc635a938d20b6b68
1 <?php
3 // @@@ TO DO Need to write these functions because they are needed by parts of
4 // the current moodle code where courses are deleted etc.
6 /**
7 * @param int $courseid If false, removes the user from all groups for all
8 * course
9 */
10 function groups_remove_user_from_all_groups($userid, $courseid) {
11 // @@@ TO DO
14 function groups_remove_all_group_members($courseid, $showfeedback) {
15 // @@@ TO DO
18 function groups_remove_all_groups($courseid, $removemembers, $showfeedback) {
19 // @@@ TO DO
22 /**
23 * Cleans up all the groups and groupings in a course (it does this best-effort
24 * i.e. if one deletion fails, it still attempts further deletions).
25 * IMPORTANT: Note that if the groups and groupings are used by other courses
26 * somehow, they will still be deleted - it doesn't protect against this.
27 * @param int $courseid The id of the course
28 * @return boolean True if the clean up was successful, false otherwise.
30 function groups_cleanup_groups($courseid) {
31 $success = true;
33 // Delete all the groupings
34 $groupings = groups_get_groupings($courseid);
35 if ($groupings != false) {
36 foreach($groupings as $groupingid) {
37 $groupingdeleted = groups_delete_grouping($groupingid);
38 if (!$groupingdeleted) {
39 $success = false;
44 // Delete all the groups
45 $groupids = groups_get_groups($courseid);
46 if ($groupids != false) {
47 foreach($groupids as $groupid) {
48 $groupdeleted = groups_delete_group($groupid);
50 if (!$groupdeleted) {
51 $success = false;
56 return $success;