openvk/Web/Presenters/templates/User/Friends.xml

186 lines
7.5 KiB
XML
Raw Normal View History

2020-06-07 19:04:43 +03:00
{extends "../@listView.xml"}
2022-04-24 08:06:45 +03:00
{var $perPage = 6} {* Why 6? Check User::_abstractRelationGenerator *}
2020-06-07 19:04:43 +03:00
2022-04-24 08:06:45 +03:00
{var $act = $_GET["act"] ?? "friends"}
2020-06-07 19:04:43 +03:00
{if $act == "incoming"}
2024-09-16 02:11:00 +03:00
{var $iterator = iterator_to_array($user->getRequests($page))}
{var $count = $user->getRequestsCount()}
2020-06-07 19:04:43 +03:00
{elseif $act == "outcoming"}
2022-04-24 08:06:45 +03:00
{var $iterator = iterator_to_array($user->getSubscriptions($page))}
{var $count = $user->getSubscriptionsCount()}
2024-09-16 02:11:00 +03:00
{elseif $act == "followers"}
{var $iterator = iterator_to_array($user->getFollowers($page))}
{var $count = $user->getFollowersCount()}
2022-07-31 14:33:23 +03:00
{elseif $act == "online"}
{var $iterator = iterator_to_array($user->getFriendsOnline($page))}
{var $count = $user->getFriendsOnlineCount()}
2020-06-07 19:04:43 +03:00
{else}
2022-04-24 08:06:45 +03:00
{var $iterator = iterator_to_array($user->getFriends($page))}
{var $count = $user->getFriendsCount()}
2020-06-07 19:04:43 +03:00
{/if}
{block title}
{if $act == "incoming"}
2022-08-09 09:37:08 +03:00
{_incoming_req}
2020-06-07 19:04:43 +03:00
{elseif $act == "outcoming"}
2022-08-09 09:37:08 +03:00
{_outcoming_req}
2024-09-16 02:11:00 +03:00
{elseif $act == "followers"}
{_followers}
2022-07-31 14:33:23 +03:00
{elseif $act == "online"}
2022-08-09 09:37:08 +03:00
{_friends_online}
2020-06-07 19:04:43 +03:00
{else}
2022-08-09 09:37:08 +03:00
{_friends}
2020-06-07 19:04:43 +03:00
{/if}
{/block}
{block header}
{if isset($thisUser) && $thisUser->getId() == $user->getId()}
{_my_friends}
2020-06-07 19:04:43 +03:00
{else}
<a href="{$user->getURL()}">{$user->getCanonicalName()}</a> »
{if $act == "incoming"}
2022-08-09 09:37:08 +03:00
{_incoming_req}
{elseif $act == "outcoming"}
2022-08-09 09:37:08 +03:00
{_outcoming_req}
2024-09-16 02:11:00 +03:00
{elseif $act == "followers"}
{_followers}
2022-07-31 14:33:23 +03:00
{elseif $act == "online"}
2022-08-09 09:37:08 +03:00
{_friends_online}
{else}
2022-08-09 09:37:08 +03:00
{_friends}
{/if}
2020-06-07 19:04:43 +03:00
{/if}
{/block}
{block tabs}
<div n:attr="id => ($act === 'friends' ? 'activetabs' : 'ki')" class="tab">
2022-07-31 14:33:23 +03:00
<a n:attr="id => ($act === 'friends' ? 'act_tab_a' : 'ki')" href="?">{_all_friends}</a>
</div>
<div n:attr="id => ($act === 'online' ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($act === 'online' ? 'act_tab_a' : 'ki')" href="?act=online">{_online}</a>
2020-06-07 19:04:43 +03:00
</div>
2024-09-16 02:11:00 +03:00
<div n:if="!is_null($thisUser) && $user->getId() === $thisUser->getId()" n:attr="id => ($act === 'incoming' || $act === 'followers' || $act === 'outcoming' ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($act === 'incoming' || $act === 'followers' || $act === 'outcoming' ? 'act_tab_a' : 'ki')" href="?act=incoming">{_req}</a>
2020-06-07 19:04:43 +03:00
</div>
{/block}
{block size}
2024-09-16 02:11:00 +03:00
<div n:if="$act === 'incoming' || $act === 'followers' || $act === 'outcoming'" class="mb_tabs">
<div n:attr="id => ($act === 'incoming' ? 'active' : 'ki')" class="mb_tab">
<div>
<a href="?act=incoming">{_incoming_req}</a>
</div>
</div>
2024-09-16 02:11:00 +03:00
<div n:attr="id => ($act === 'followers' ? 'active' : 'ki')" class="mb_tab">
<div>
<a href="?act=followers">{_followers}</a>
</div>
</div>
<div n:attr="id => ($act === 'outcoming' ? 'active' : 'ki')" class="mb_tab">
<div>
<a href="?act=outcoming">{_outcoming_req}</a>
</div>
</div>
</div>
<div style="padding-bottom: 0px;" class="summaryBar">
<div class="summary">
{if !is_null($thisUser) && $user->getId() === $thisUser->getId()}
{if $act == "incoming"}
{tr("req", $count)}
{elseif $act == "outcoming"}
{tr("req", $count)}
2024-09-16 02:11:00 +03:00
{elseif $act == "followers"}
{tr("followers", $count)}
2022-07-31 14:33:23 +03:00
{elseif $act == "online"}
{tr("friends_list_online", $count)}
{else}
{tr("friends_list", $count)}
{/if}
{else}
{tr("friends", $count)}
{/if}
</div>
2020-06-07 19:04:43 +03:00
</div>
{/block}
{* BEGIN ELEMENTS DESCRIPTION *}
{block link|strip|stripHtml}
{$x->getURL()}
{/block}
{block preview}
2024-01-06 21:30:59 +03:00
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография пользователя" loading=lazy />
2020-06-07 19:04:43 +03:00
{/block}
{block name}
{$x->getCanonicalName()}
<img n:if="$x->isVerified()"
class="name-checkmark"
src="/assets/packages/static/openvk/img/checkmark.png"
/>
2020-06-07 19:04:43 +03:00
{/block}
{block description}
<table>
<tbody>
<tr>
<td width="120" valign="top"><span class="nobold">{_pronouns}: </span></td>
<td>{$x->isFemale() ? tr("female") : ($x->isNeutral() ? tr("neutral") : tr("male"))}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr>
2022-08-09 09:37:08 +03:00
<td width="120" valign="top"><span class="nobold">{_relationship}:</span></td>
<td>{$x->getLocalizedMaritalStatus()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr>
2022-08-09 09:37:08 +03:00
<td width="120" valign="top"><span class="nobold">{_registration_date}: </span></td>
2020-06-07 19:04:43 +03:00
<td>{$x->getRegistrationTime()}</td>
</tr>
</tbody>
</table>
{/block}
{block actions}
{if ($x->getId() !== $thisUser->getId()) && ($thisUser->getId() === $user->getId())}
2022-04-24 08:06:45 +03:00
{var $subStatus = $x->getSubscriptionStatus($thisUser)}
{if $subStatus === 0}
2024-09-18 01:02:56 +03:00
<form action="/setSub/user" method="post" class="profile_link_form" id="_submitUserSubscriptionAction">
<input type="hidden" name="act" value="add" />
<input type="hidden" name="id" value="{$x->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
2022-08-09 09:37:08 +03:00
<input type="submit" class="profile_link" value="{_friends_add}" />
</form>
{elseif $subStatus === 1}
2024-09-18 01:02:56 +03:00
<form action="/setSub/user" method="post" class="profile_link_form" id="_submitUserSubscriptionAction">
<input type="hidden" name="act" value="add" />
<input type="hidden" name="id" value="{$x->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
2022-08-09 09:37:08 +03:00
<input type="submit" class="profile_link" value="{_friends_accept}" />
</form>
2024-09-16 02:11:00 +03:00
{if $act !== 'followers'}
2024-09-18 01:02:56 +03:00
<form action="/setSub/user" method="post" class="profile_link_form" id="_submitUserSubscriptionAction">
2024-09-16 02:11:00 +03:00
<input type="hidden" name="act" value="rej" />
<input type="hidden" name="id" value="{$x->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" class="profile_link" value="{_friends_leave_in_flw}" />
</form>
{/if}
{elseif $subStatus === 2}
2024-09-18 01:02:56 +03:00
<form action="/setSub/user" method="post" class="profile_link_form" id="_submitUserSubscriptionAction">
<input type="hidden" name="act" value="rem" />
<input type="hidden" name="id" value="{$x->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
2022-08-09 09:37:08 +03:00
<input type="submit" class="profile_link" value="{_friends_reject}" />
</form>
{elseif $subStatus === 3}
2024-12-08 16:45:35 +03:00
<a href="/im?sel={$x->getId()}" class="profile_link" rel="nofollow">{_send_message}</a>
2024-09-18 01:02:56 +03:00
<form action="/setSub/user" method="post" class="profile_link_form" id="_submitUserSubscriptionAction">
<input type="hidden" name="act" value="rem" />
<input type="hidden" name="id" value="{$x->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
2022-08-09 09:37:08 +03:00
<input type="submit" class="profile_link" value="{_friends_delete}" />
</form>
{/if}
{/if}
2024-01-06 21:30:59 +03:00
{/block}