mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Friends: Add list with friends online
This commit is contained in:
parent
4ba7c5b982
commit
22e4e76b9f
6 changed files with 81 additions and 1 deletions
|
@ -500,6 +500,16 @@ class User extends RowModel
|
|||
return $this->_abstractRelationCount("get-friends");
|
||||
}
|
||||
|
||||
function getFriendsOnline(int $page = 1, int $limit = 6): \Traversable
|
||||
{
|
||||
return $this->_abstractRelationGenerator("get-online-friends", $page, $limit);
|
||||
}
|
||||
|
||||
function getFriendsOnlineCount(): int
|
||||
{
|
||||
return $this->_abstractRelationCount("get-online-friends");
|
||||
}
|
||||
|
||||
function getFollowers(int $page = 1, int $limit = 6): \Traversable
|
||||
{
|
||||
return $this->_abstractRelationGenerator("get-followers", $page, $limit);
|
||||
|
|
6
Web/Models/sql/get-online-friends.tsql
Executable file
6
Web/Models/sql/get-online-friends.tsql
Executable file
|
@ -0,0 +1,6 @@
|
|||
(SELECT follower AS __id FROM
|
||||
(SELECT follower FROM subscriptions WHERE target=? AND model="openvk\\Web\\Models\\Entities\\User") u0
|
||||
INNER JOIN
|
||||
(SELECT target FROM subscriptions WHERE follower=? AND model="openvk\\Web\\Models\\Entities\\User") u1
|
||||
ON u0.follower = u1.target) u2
|
||||
INNER JOIN profiles ON profiles.id = u2.__id WHERE online > (UNIX_TIMESTAMP() - 300)
|
|
@ -9,6 +9,9 @@
|
|||
{elseif $act == "outcoming"}
|
||||
{var $iterator = iterator_to_array($user->getSubscriptions($page))}
|
||||
{var $count = $user->getSubscriptionsCount()}
|
||||
{elseif $act == "online"}
|
||||
{var $iterator = iterator_to_array($user->getFriendsOnline($page))}
|
||||
{var $count = $user->getFriendsOnlineCount()}
|
||||
{else}
|
||||
{var $iterator = iterator_to_array($user->getFriends($page))}
|
||||
{var $count = $user->getFriendsCount()}
|
||||
|
@ -19,6 +22,8 @@
|
|||
{_"incoming_req"}
|
||||
{elseif $act == "outcoming"}
|
||||
{_"outcoming_req"}
|
||||
{elseif $act == "online"}
|
||||
{_"friends_online"}
|
||||
{else}
|
||||
{_"friends"}
|
||||
{/if}
|
||||
|
@ -33,6 +38,8 @@
|
|||
{_"incoming_req"}
|
||||
{elseif $act == "outcoming"}
|
||||
{_"outcoming_req"}
|
||||
{elseif $act == "online"}
|
||||
{_"friends_online"}
|
||||
{else}
|
||||
{_"friends"}
|
||||
{/if}
|
||||
|
@ -41,7 +48,10 @@
|
|||
|
||||
{block tabs}
|
||||
<div n:attr="id => ($act === 'friends' ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($act === 'friends' ? 'act_tab_a' : 'ki')" href="?">{_friends}</a>
|
||||
<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>
|
||||
</div>
|
||||
<div n:attr="id => ($act === 'incoming' || $act === 'outcoming' ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($act === 'incoming' || $act === 'outcoming' ? 'act_tab_a' : 'ki')" href="?act=incoming">{_req}</a>
|
||||
|
@ -68,6 +78,8 @@
|
|||
{tr("req", $count)}
|
||||
{elseif $act == "outcoming"}
|
||||
{tr("req", $count)}
|
||||
{elseif $act == "online"}
|
||||
{tr("friends_list_online", $count)}
|
||||
{else}
|
||||
{tr("friends_list", $count)}
|
||||
{/if}
|
||||
|
|
|
@ -201,6 +201,34 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div n:if="$thisUser->getId() == $user->getId() && $user->getFriendsOnlineCount() > 0">
|
||||
{var $friendOnlineCount = $user->getFriendsOnlineCount()}
|
||||
|
||||
<div class="content_title_expanded" onclick="hidePanel(this, {$friendOnlineCount});">
|
||||
{_"friends_online"}
|
||||
</div>
|
||||
<div>
|
||||
<div class="content_subtitle">
|
||||
{tr("friends_online", $friendOnlineCount)}
|
||||
<div style="float:right;">
|
||||
<a href="/friends{$user->getId()}">{_"all_title"}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content_list">
|
||||
<div class="cl_element" n:foreach="$user->getFriendsOnline(1) as $friend">
|
||||
<div class="cl_avatar">
|
||||
<a href="{$friend->getURL()}">
|
||||
<img class="ava" src="{$friend->getAvatarUrl('miniscule')}" />
|
||||
</a>
|
||||
</div>
|
||||
<a href="{$friend->getURL()}" class="cl_name">
|
||||
<text class="cl_fname">{$friend->getFirstName()}</text>
|
||||
<text class="cl_lname">{$friend->getLastName()}</text>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div n:if="$albumsCount > 0 && $user->getPrivacyPermission('photos.read', $thisUser ?? NULL)">
|
||||
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
|
||||
{_"albums"}
|
||||
|
|
|
@ -209,6 +209,8 @@
|
|||
"incoming_req" = "Pending";
|
||||
"outcoming_req" = "Outgoing";
|
||||
"req" = "Requests";
|
||||
"friends_online" = "Friends online";
|
||||
"all_friends" = "All friends";
|
||||
|
||||
"req_zero" = "No requests were found...";
|
||||
"req_one" = "Found $1 request";
|
||||
|
@ -218,10 +220,18 @@
|
|||
"friends_one" = "$1 friend";
|
||||
"friends_other" = "$1 friends";
|
||||
|
||||
"friends_online_zero" = "No friends online";
|
||||
"friends_online_one" = "$1 friend is online";
|
||||
"friends_online_other" = "$1 friends are online";
|
||||
|
||||
"friends_list_zero" = "You have no friends yet";
|
||||
"friends_list_one" = "You have $1 friend";
|
||||
"friends_list_other" = "You have $1 friends";
|
||||
|
||||
"friends_list_online_zero" = "You have no friends online";
|
||||
"friends_list_online_one" = "You have $1 friend online";
|
||||
"friends_list_online_other" = "You have $1 friends online";
|
||||
|
||||
"followers_zero" = "No followers";
|
||||
"followers_one" = "$1 follower";
|
||||
"followers_other" = "$1 followers";
|
||||
|
|
|
@ -216,6 +216,8 @@
|
|||
"incoming_req" = "Входящие";
|
||||
"outcoming_req" = "Исходящие";
|
||||
"req" = "Заявки";
|
||||
"friends_online" = "Друзья он-лайн";
|
||||
"all_friends" = "Все друзья";
|
||||
|
||||
"req_zero" = "Не найдено ни одной заявки...";
|
||||
"req_one" = "Найдена $1 заявка";
|
||||
|
@ -229,6 +231,12 @@
|
|||
"friends_many" = "$1 друзей";
|
||||
"friends_other" = "$1 друзей";
|
||||
|
||||
"friends_online_zero" = "Ни одного друга он-лайн";
|
||||
"friends_online_one" = "$1 друг он-лайн";
|
||||
"friends_online_few" = "$1 друга он-лайн";
|
||||
"friends_online_many" = "$1 друзей он-лайн";
|
||||
"friends_online_other" = "$1 друзей он-лайн";
|
||||
|
||||
"friends_list_zero" = "У Вас пока нет друзей";
|
||||
"friends_list_one" = "У Вас $1 друг";
|
||||
"friends_list_few" = "У Вас $1 друга";
|
||||
|
@ -247,6 +255,12 @@
|
|||
"subscriptions_many" = "$1 подписок";
|
||||
"subscriptions_other" = "$1 подписок";
|
||||
|
||||
"friends_list_online_zero" = "У Вас пока нет друзей он-лайн";
|
||||
"friends_list_online_one" = "У Вас $1 друг он-лайн";
|
||||
"friends_list_online_few" = "У Вас $1 друга он-лайн";
|
||||
"friends_list_online_many" = "У Вас $1 друзей он-лайн";
|
||||
"friends_list_online_other" = "У Вас $1 друзей он-лайн";
|
||||
|
||||
/* Group */
|
||||
|
||||
"name_group" = "Название";
|
||||
|
|
Loading…
Reference in a new issue