From: skodak Date: Mon, 20 Aug 2007 14:18:55 +0000 (+0000) Subject: MDL-10383 - some more disabling of groupingid's when $CFG->enablegroupings empty... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c0d4238d01c4aa6113871942e99a8d903fcd4e3d;p=moodle.git MDL-10383 - some more disabling of groupingid's when $CFG->enablegroupings empty; this should allow using of $cm->groupingid in modules without extra checks for $CFG->enablegroupings --- diff --git a/lib/grouplib.php b/lib/grouplib.php index bf106b5679..34c50f90e5 100644 --- a/lib/grouplib.php +++ b/lib/grouplib.php @@ -83,6 +83,10 @@ function groups_get_group($groupid) { function groups_get_all_groups($courseid, $userid=0, $groupingid=0) { global $CFG; + if (empty($CFG->enablegroupings)) { + $groupingid = 0; + } + if (!empty($userid)) { $userfrom = ", {$CFG->prefix}groups_members gm"; $userwhere = "AND g.id = gm.groupid AND gm.userid = '$userid'"; @@ -132,6 +136,10 @@ function groups_is_member($groupid, $userid=null) { function groups_has_membership($cm, $userid=null) { global $CFG, $USER; + if (empty($CFG->enablegroupings)) { + $cm->groupingid = 0; + } + if (empty($userid)) { $userid = $USER->id; } @@ -196,7 +204,11 @@ function groups_get_activity_groupmode($cm) { * @return mixed void or string depending on $return param */ function groups_print_activity_menu($cm, $urlroot, $return=false) { - global $USER; + global $CFG, $USER; + + if (empty($CFG->enablegroupings)) { + $cm->groupingid = 0; + } if (!$groupmode = groups_get_activity_groupmode($cm)) { if ($return) { @@ -256,7 +268,11 @@ function groups_print_activity_menu($cm, $urlroot, $return=false) { * @return mixed false if groups not used, int if groups used, 0 means all groups (access must be verified in SEPARATE mode) */ function groups_get_activity_group($cm, $update=false) { - global $USER, $SESSION; + global $CFG, $USER, $SESSION; + + if (empty($CFG->enablegroupings)) { + $cm->groupingid = 0; + } if (!$groupmode = groups_get_activity_groupmode($cm)) { // NOGROUPS used