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

This commit is contained in:
skodak 2007-08-20 14:18:55 +00:00
parent 055f21850a
commit c0d4238d01

View file

@ -83,6 +83,10 @@ function groups_get_group($groupid) {
function groups_get_all_groups($courseid, $userid=0, $groupingid=0) { function groups_get_all_groups($courseid, $userid=0, $groupingid=0) {
global $CFG; global $CFG;
if (empty($CFG->enablegroupings)) {
$groupingid = 0;
}
if (!empty($userid)) { if (!empty($userid)) {
$userfrom = ", {$CFG->prefix}groups_members gm"; $userfrom = ", {$CFG->prefix}groups_members gm";
$userwhere = "AND g.id = gm.groupid AND gm.userid = '$userid'"; $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) { function groups_has_membership($cm, $userid=null) {
global $CFG, $USER; global $CFG, $USER;
if (empty($CFG->enablegroupings)) {
$cm->groupingid = 0;
}
if (empty($userid)) { if (empty($userid)) {
$userid = $USER->id; $userid = $USER->id;
} }
@ -196,7 +204,11 @@ function groups_get_activity_groupmode($cm) {
* @return mixed void or string depending on $return param * @return mixed void or string depending on $return param
*/ */
function groups_print_activity_menu($cm, $urlroot, $return=false) { 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 (!$groupmode = groups_get_activity_groupmode($cm)) {
if ($return) { 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) * @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) { 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)) { if (!$groupmode = groups_get_activity_groupmode($cm)) {
// NOGROUPS used // NOGROUPS used