This commit is contained in:
Andrew Nicols
2022-04-07 15:25:36 +08:00
4 changed files with 85 additions and 30 deletions
+5 -4
View File
@@ -282,9 +282,9 @@ EOF;
/**
* Get the current groupid if set.
*
* @return null|int
* @return int
*/
public function get_group_id(): ?int {
public function get_group_id(): int {
return empty($this->groupid) ? 0 : $this->groupid;
}
@@ -294,7 +294,8 @@ EOF;
* @return bool
*/
public function uses_groups(): bool {
return $this->groupid !== null;
$groupmode = groups_get_activity_groupmode($this->get_cm());
return $groupmode != NOGROUPS;
}
/**
@@ -305,7 +306,7 @@ EOF;
public function get_group_name(): ?string {
$groupid = $this->get_group_id();
if ($groupid === null) {
if (!$this->uses_groups()) {
return null;
}