{extends "../@listView.xml"}
{var iterator = $user->getClubs($page, $admin)}
{var count    = $user->getClubCount($admin)}

{block title}{_"groups"}{/block} 

{block header}
    <a href="{$user->getURL()}">{$user->getCanonicalName()}</a> » {_"groups"}
    
    <div n:if="!is_null($thisUser) && $user->getId() === $thisUser->getId()" style="float:right;">
        <span>
            <b>
                <a href="/groups_create">
                    {_"create_group"}
                </a>
            </b>
        </span>
    </div>
{/block}

{* BEGIN ELEMENTS DESCRIPTION *}

{block tabs}
	{if !is_null($thisUser) && $user->getId() === $thisUser->getId()}
		<div {if !$admin}id="activetabs"{/if} class="tab">
			<a {if !$admin}id="act_tab_a"{/if} href="/groups{$user->getId()}">
				{_groups}
			</a>
		</div>
		<div {if $admin}id="activetabs"{/if} class="tab">
			<a {if $admin}id="act_tab_a"{/if} href="/groups{$user->getId()}?act=managed">
				{_managed}
			</a>
		</div>
	{/if}
{/block}

{block link|strip|stripHtml}
    {$x->getURL()}
{/block}

{block preview}
    <img src="{$x->getAvatarUrl()}" width="75" alt="Фотография группы" />
{/block}

{block name}
    {$x->getName()}
{/block}

{block description}
    {$x->getDescription()}
{/block}

{var clubPinned = $thisUser->isClubPinned($x)}
{if $x->canBeModifiedBy($thisUser ?? NULL) || $clubPinned || $thisUser->getPinnedClubCount() <= 10}
    {block actions}
        <a class="profile_link" href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" id="_pinGroup" data-group-name="{$x->getName()}" data-group-url="{$x->getUrl()}">
            {if $clubPinned}
                {_remove_from_left_menu}
            {else}
                {_add_to_left_menu}
            {/if}
        </a>
    {/block}
{/if}