Who is currently logged in?

@param string $type "list" or "nolist"

@return string
13062
private function usersLoggedInQuery($type = 'nolist'): string
    {
        $content   = '';
        $anonymous = 0;
        $logged_in = [];

        foreach ($this->user_service->allLoggedIn() as $user) {
            if (Auth::isAdmin() || $user->getPreference('visibleonline')) {
                $logged_in[] = $user;
            } else {
                $anonymous++;
            }
        }

        $count_logged_in = count($logged_in);

        if ($count_logged_in === 0 && $anonymous === 0) {
            $content .= I18N::translate('No signed-in and no anonymous users');
        }

        if ($anonymous > 0) {
            $content .= '<b>' . I18N::plural('%s anonymous signed-in user', '%s anonymous signed-in users', $anonymous, I18N::number($anonymous)) . '</b>';
        }

        if ($count_logged_in > 0) {
            if ($anonymous) {
                if ($type === 'list') {
                    $content .= '<br><br>';
                } else {
                    $content .= ' ' . I18N::translate('and') . ' ';
                }
            }
            $content .= '<b>' . I18N::plural('%s signed-in user', '%s signed-in users', $count_logged_in, I18N::number($count_logged_in)) . '</b>';
            if ($type === 'list') {
                $content .= '<ul>';
            } else {
                $content .= ': ';
            }
        }

        if (Auth::check()) {
            foreach ($logged_in as $user) {
                if ($type === 'list') {
                    $content .= '<li>';
                }

                $individual = Individual::getInstance($this->tree->getUserPreference($user, 'gedcomid'), $this->tree);

                if ($individual instanceof Individual && $individual->canShow()) {
                    $content .= '<a href="' . e($individual->url()) . '">' . e($user->realName()) . '</a>';
                } else {
                    $content .= e($user->realName());
                }

                $content .= ' - ' . e($user->userName());

                if (($user->getPreference('contactmethod') !== 'none')
                    && (Auth::id() !== $user->id())
                ) {
                    if ($type === 'list') {
                        $content .= '<br>';
                    }
                    $content .= '<a href="' . e(route('message', ['to' => $user->userName(), 'ged' => $this->tree->name()])) . '" class="btn btn-link" title="' . I18N::translate('Send a message') . '">' . view('icons/email') . '</a>';
                }

                if ($type === 'list') {
                    $content .= '</li>';
                }
            }
        }

        if ($type === 'list') {
            $content .= '</ul>';
        }

        return $content;
    }
67097
static function currentUser()
    {
        $user = self::instance();
        if ( $user->isAnonymous() || $user->isEnabled() )
        {
            return $user;
        }
        self::logoutCurrent();
        return self::instance();
    }
260654
public function getHeader($type = 'content_type')
    {
        return (array_key_exists($type, $this->result)) ? $this->result[$type] : null;
    }
1029683
public function getNextOfType($type)
    {
        for (; $this->idx < $this->count; ++$this->idx) {
            if ($this->tokens[$this->idx]->type === $type) {
                return $this->tokens[$this->idx++];
            }
        }

        return null;
    }
958050
public function getAllPrivilegesByType($type)
    {
        $this->initialize();
        $privileges = [];
        foreach ($this->roles as $role) {
            $privileges = array_merge($privileges, $role->getPrivilegesByType($type));
        }
        return $privileges;
    }
651001
private function getBiodata($type)
    {
        if ($type == 'Website') {
            preg_match('/('.$type.":<\/span> <a)[^<]*/", $this->_biodata, $biodata);
            if ($biodata) {
                preg_match('/".+"/', $biodata[0], $biodata);
                if ($biodata[0] != '"http://"') {
                    return str_replace('"', '', $biodata[0]);
                }
            }
        }

        preg_match('/('.$type.":<\/span>)[^<]*/", $this->_biodata, $biodata);

        if ($biodata) {
            $biodata = strip_tags($biodata[0]);
            $biodata = explode(': ', $biodata);
            $biodata = trim($biodata[1]);

            if ($type == 'Alternate names') {
                return explode(', ', $biodata);
            }

            if ($type == 'Member Favorites') {
                return str_replace(',', '', $biodata);
            }

            return $biodata;
        }
    }
166547
public function listContents($type)
    {
        $names = [];
        $files = $this->listFiles($type);

        foreach ($files as $file) {
            $names[] = static::getName($file);
        }

        return $names;
    }
742221
public function getTypeName($type = null)
	{
		$group = $this->getGroup();
		$type  = $type === null ? $this->getType() : $type;

		return $GLOBALS['BOOTSTRAP']['wrappers'][$group][$type]['name'];
	}
688353
public function display($type = null)
    {
        $result = '';

        if ( ! is_null($type) && ! in_array($type, $this->types)) {
            return $result;
        }

        if (in_array($type, $this->types)) {
            $result .= $this->buildMessages($_SESSION[$this->key][$type], $type);
        } elseif (is_null($type)) {
            foreach ($_SESSION[$this->key] as $messageType => $messages) {
                $result .= $this->buildMessages($messages, $messageType);
            }
        }

        $this->clear($type);

        return $result;
    }
700277
public function get_type( $type ) {
		$tokens = [];

		foreach ( $this->text as $index => $token ) {
			if ( $token->type === $type ) {
				$tokens[ $index ] = $token;
			}
		}

		return $tokens;
	}
658943
public function getChatClassString($type) {
        /** @var EntityManager $em */
        $em = $this->container->get('doctrine')->getManager();

        $chatClass = "Sopinet\ChatBundle\Entity\Chat";

        $cmf = $em->getMetadataFactory();
        $meta = $cmf->getMetadataFor($chatClass);

        $config = $this->container->getParameter('sopinet_chat.config');
        foreach($meta->discriminatorMap as $typeString => $typeClass) {
            if ($typeString == $type) {
                return $typeClass;
            }
        }

        // Type unknow
        return null;
    }
250460
private function getTypeSuffix($type)
    {
        self::$TYP_MAPPING = array_merge(self::$TYP_COMPLEX_MAPPING, self::$TYP_SIMPLE_MAPPING);

        if ($type == '') {
            return '';
        }

        if (!isset(self::$TYP_MAPPING[$this->type])) {
            return '';
        }

        return self::$TYP_MAPPING[$this->type];
    }
684783
public static function getName(int $type) : string
    {
        $names = [self::UNKNOWN => 'unknown', self::STANDARD => 'standard', self::FULL => 'full', self::LITE => 'lite'];
        return $names[$type] ?? 'invalid';
    }
886923
private function getReferenceType($type)
    {
        switch ($type) {
            case 'absolute':
                return UrlGeneratorInterface::ABSOLUTE_PATH;
            case 'url':
                return UrlGeneratorInterface::ABSOLUTE_URL;
            case 'relative':
                return UrlGeneratorInterface::RELATIVE_PATH;
            case 'network':
                return UrlGeneratorInterface::NETWORK_PATH;
            default:
                return UrlGeneratorInterface::ABSOLUTE_PATH;
        }
    }
325824
public function next($type = false)
    {
        if ($type === false || $type === true) {
            $this->_current++;
            return $this->current($type);
        }
        $content = '';
        $start = $this->_current++;
        $count = $this->count();

        $list = array_fill_keys((array) $type, true);

        while ($this->_current < $count) {
            $content .= $this->_data[$this->_current][1];
            if (isset($list[$this->_data[$this->_current][0]])) {
                return $content;
            }
            $this->_current++;
        }
        $this->_current = $start;
    }
240495
private function getFromMemory($type)
    {
        if (isset($this->loaded[$type])) {
            return $this->loaded[$type];
        }
        return null;
    }
750580
public function count($type = 'admin.web')
    {

        return $this->calendar
            ->scopeQuery(function ($query) use ($type) {
                return $query->where('status', '<>', 'Draft')
                    ->whereUserId(user_id($type))
                    ->whereUserType(user_type($type));
            })->count();
    }