{{ moduleHeader('user', 'Members'|trans, true, true) }}
<h3>
    <span class="fas fa-door-open"></span>
    {% trans with {'%s%': getModVar('ZikulaProfileModule', 'recentmembersitemsperpage')} %}Last %s% registered users{% endtrans %}
</h3>
<table class="table table-bordered table-striped table-sm">
    <colgroup>
        <col id="cUserName" />
        <col id="cRegistrationDate" />
        {% if messageModule|default %}
            <col id="cMessages" />
        {% endif %}
        {% if 'url' in activeProperties %}
            <col id="cSite" />
        {% endif %}
        <col id="cActions" />
    </colgroup>
    <thead>
        <tr>
            <th id="hUserName" scope="col">{% trans %}User name{% endtrans %}</th>
            <th id="hRegistrationDate" scope="col">{% trans %}Registration date{% endtrans %}</th>
            {% if messageModule|default %}
                <th id="hMessages" scope="col">{% trans %}Messages{% endtrans %}</th>
            {% endif %}
            {% if 'url' in activeProperties %}
                <th id="hSite" scope="col">{% trans %}Site{% endtrans %}</th>
            {% endif %}
            <th id="hActions" scope="col">{% trans %}Actions{% endtrans %}</th>
        </tr>
    </thead>
    <tbody>
        {% for user in paginator.results|filter(u => u.uid != constant('Zikula\\UsersModule\\Constant::USER_ID_ANONYMOUS')) %}
        <tr>
            <td headers="hUserName"><strong>{{ user.uname|profileLinkByUserName() }}</strong>&nbsp;({{ user.uname }})&nbsp;
                {% set online = user|onlineSince(getModVar('ZikulaProfileModule', 'activeminutes', 10)) %}
                {% if online is same as(true) %}
                    <a href="{{ path('zikulaprofilemodule_members_online') }}" title="{% trans %}View users online{% endtrans %}"><span class="badge badge-success">{% trans %}online{% endtrans %}</span></a>
                {% elseif online is same as(false) %}
                    <span class="badge badge-danger">{% trans %}offline{% endtrans %}</span>
                {% endif %}
            </td>
            <td headers="hRegistrationDate">{{ user.registrationDate|format_date('medium')|default('') }}</td>
            {% if messageModule|default %}
                <td headers="hMessages"><a href="{{ user.uid|messageSendLink(true) }}"><i class="fas fa-envelope fa-lg"></i></a></td>
            {% endif %}
            {% if 'url' in activeProperties %}
                <td headers="hSite">
                    {% set url = user.attributes[prefix ~ ':url']|default %}
                    {% if url and url != 'http://' %}
                        <a href="{{ url|e('html_attr') }}"><i class="fas fa-globe fa-lg" title="{{ url|e('html_attr') }}"></i></a>
                    {% endif %}
                </td>
            {% endif %}
            {% set rowActions = knp_menu_get('zikulaProfileAdminMenu', [], {user: user}) %}
            <td headers="hActions" class="actions">
                {{ knp_menu_render(rowActions, {template: '@ZikulaMenuModule/Override/actions.html.twig'}) }}
            </td>
        </tr>
        {% else %}
            <tr class="table-info"><td colspan="5" class="text-center">{% trans %}No recently registered users found.{% endtrans %}</td></tr>
        {% endfor %}
    </tbody>
</table>
{{ include(paginator.template) }}
