Load a count of valid teams for this assignment.

@param int $activitygroup Activity active group
@return int number of valid teams
14671
public function count_teams($activitygroup = 0) {

        $count = 0;

        $participants = $this->list_participants($activitygroup, true);

        // If a team submission grouping id is provided all good as all returned groups
        // are the submission teams, but if no team submission grouping was specified
        // $groups will contain all participants groups.
        if ($this->get_instance()->teamsubmissiongroupingid) {

            // We restrict the users to the selected group ones.
            $groups = groups_get_all_groups($this->get_course()->id,
                                            array_keys($participants),
                                            $this->get_instance()->teamsubmissiongroupingid,
                                            'DISTINCT g.id, g.name');

            $count = count($groups);

            // When a specific group is selected we don't count the default group users.
            if ($activitygroup == 0) {
                if (empty($this->get_instance()->preventsubmissionnotingroup)) {
                    // See if there are any users in the default group.
                    $defaultusers = $this->get_submission_group_members(0, true);
                    if (count($defaultusers) > 0) {
                        $count += 1;
                    }
                }
            } else if ($activitygroup != 0 && empty($groups)) {
                // Set count to 1 if $groups returns empty.
                // It means the group is not part of $this->get_instance()->teamsubmissiongroupingid.
                $count = 1;
            }
        } else {
            // It is faster to loop around participants if no grouping was specified.
            $groups = array();
            foreach ($participants as $participant) {
                if ($group = $this->get_submission_group($participant->id)) {
                    $groups[$group->id] = true;
                } else if (empty($this->get_instance()->preventsubmissionnotingroup)) {
                    $groups[0] = true;
                }
            }

            $count = count($groups);
        }

        return $count;
    }
535732
public function count()
    {
        $qb = $this->getLoadQuery()
            ->select('COUNT(' . $this->getAlias() . '.id) as count')
            ->resetQueryParts(['groupBy', 'join'])
        ;
        $result = $qb->execute()->fetchColumn(0);

        return (int) $result;
    }
492357
protected function executeActions($group)
    {
        $executedCount = 0;
        reset($this->actions[$group]);
        while (list($index, $action) = each($this->actions[$group])) {
            if ($this->isActionReadyToExecute($action[0], $action[2])) {
                $executedCount += $this->executeAction($index, $action);
                unset($this->actions[$group][$index]);
            }
        }

        return $executedCount;
    }
1009765
public function load($locale, $group, $namespace = null)
	{
		if (is_null($namespace) || $namespace == '*')
		{
			return $this->loadPath($this->path, $locale, $group);
		}
		else
		{
			return $this->loadNamespaced($locale, $group, $namespace);
		}
	}
356077
public static function getConversionGroupUnits($group = NULL) {
		$conversionGroups = array();
		foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
			if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
				$conversionGroups[$conversionGroup['Group']][] = $conversionUnit;
			}
		}
		return $conversionGroups;
	}
303209
public function count_users( $role ) {

		$count_users = count_users();

		$avail_roles = array();

		foreach ( $count_users['avail_roles'] as $count_role => $count ) {
			$avail_roles[ $count_role ] = $count;
		}

		if ( empty( $role ) ) {
			return $avail_roles;
		}

		if ( ! isset( $avail_roles[ $role ] ) ) {
			$avail_roles[ $role ] = 0;
		}

		return $avail_roles[ $role ];
	}
1345665
public function countChildren($path)
    {
        // load and return the category with the passed path
        $this->categoryCountChildrenStmt->execute(array(MemberNames::PATH => $path));
        return $this->categoryCountChildrenStmt->fetchColumn();
    }
482802
public function offsetGet($group)
    {
        if (!isset($this[$group])) {

            // Load builder from file or instantiate an empty one.
            if ($this->hasConfigFile($group)) {
                $this[$group] = $this->load($group);
            } else {
                $this[$group] = ServiceBuilder::factory(array());
            }

            // Initialize the "removed" flag.
            $this->removed[$group] = array();
        }
        return parent::offsetGet($group);
    }
1282801
public function assignGroup($group)
    {
        if (Group::count() === 0) {
            throw new \Exception('No groups have been created.');
        }

        return $this->groups()->save(
            Group::whereName($group)->firstOrFail()
        );
    }
276222
public static function fetchTeam($team = null)
    {
        if (is_null($team) || !Config::get('laratrust.use_teams')) {
            return null;
        }

        return static::getIdFor($team, 'team');
    }
579863
public function getSitesFromGroup($group)
    {
        $db = $this->getDb();
        $sites = $db->fetchAll("SELECT * FROM " . $this->table . "
                                WHERE `group` = ?", $group);

        return $sites;
    }
886262
public function countTypesInGroup($groupId)
    {
        try {
            return $this->innerGateway->countTypesInGroup($groupId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
35245
public function loadGroupByIdentifier($identifier)
    {
        $groups = $this->mapper->extractGroupsFromRows(
            $this->contentTypeGateway->loadGroupDataByIdentifier($identifier)
        );

        if (count($groups) !== 1) {
            throw new Exception\TypeGroupNotFound($identifier);
        }

        return $groups[0];
    }
1329744
protected function GetAdminGroups($group = "")
	{
		$keys = array_keys($this->GetAdminModulesList());
		if ($group != "")
		{
			if (in_array($group, $keys))
			{
				$keys = array($group);
			}
			else
			{
				$keys = array();
			}
		}
		
		$arr = new ArrayDataset($keys, "name");
		return $arr->getIterator();
	}
59370
private function getUsersByUserGroup(UserGroup $userGroup)
    {
        return 10;
        $em = $this->getDoctrine()->getEntityManager();

        $query = $em->createQuery('SELECT '
                . '                     u, g '
                . '                FROM Flowcode\UserBundle\Entity\User u'
                . '                     join u.groups g '
                . '                WHERE '
                . '                     g.name = '.$userGroup->getName().'');
        $users = $query->getResult();

        return $users;
    }
997273
public function hasMemberInvitationOnTeam($teamId)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $memberInvitationsOnTeam = $this->memberInvitations->filter(function ($memberInvitation) use ($teamId) {
            return ($memberInvitation->member->team_id === $teamId) && ($memberInvitation->member->status === "Invited");
        });
        /** @noinspection PhpUndefinedMethodInspection */
        return $memberInvitationsOnTeam->count() > 0;
    }
650835
public function update($group)
    {
        if (is_string($group)) {
            $group = $this->groupFactory->createForPlayer($group);
        } else {
            if (is_array($group)) {
                $group = $this->groupFactory->createForPlayers($group);
            }
        }

        $ml = $this->guiHandler->getManialink($group, $this);
        if ($ml) {
            $this->actionFactory->destroyNotPermanentActions($ml);
            if ($ml instanceof Window) {
                $ml->busyCounter += 1;

                if ($ml->isBusy && $ml->busyCounter > 1) {
                    $ml->setBusy(false);
                }
            }
            $this->updateContent($ml);
            $this->guiHandler->addToDisplay($ml, $this);
        }
    }