1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-21 10:18:19 +03:00

Переработан механизм работы ленты активности. Теперь появилась возможность расширять типы событий в плагинах. Подсписки на типы событий у пользователей не сохранятся

This commit is contained in:
kirsan 2011-07-22 15:07:41 +00:00
parent ff31257981
commit 41860c3611
20 changed files with 700 additions and 679 deletions

View file

@ -122,7 +122,7 @@ class ActionAjax extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTopicCommentVote->getVoterId(), ModuleStream::EVENT_VOTE_COMMENT, $oComment->getId());
$this->Stream_write($oTopicCommentVote->getVoterId(), 'vote_comment', $oComment->getId());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('comment_vote_error'),$this->Lang_Get('error'));
return;
@ -193,7 +193,7 @@ class ActionAjax extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTopicVote->getVoterId(), ModuleStream::EVENT_VOTE_TOPIC, $oTopic->getId());
$this->Stream_write($oTopicVote->getVoterId(), 'vote_topic', $oTopic->getId());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -247,7 +247,7 @@ class ActionAjax extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oBlogVote->getVoterId(), ModuleStream::EVENT_VOTE_BLOG, $oBlog->getId());
$this->Stream_write($oBlogVote->getVoterId(), 'vote_blog', $oBlog->getId());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('attention'));
return;
@ -327,7 +327,7 @@ class ActionAjax extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oUserVote->getVoterId(), ModuleStream::EVENT_VOTE_USER, $oUser->getId());
$this->Stream_write($oUserVote->getVoterId(), 'vote_user', $oUser->getId());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;

View file

@ -218,7 +218,7 @@ class ActionBlog extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oBlog->getOwnerId(), ModuleStream::EVENT_ADD_BLOG, $oBlog->getId());
$this->Stream_write($oBlog->getOwnerId(), 'add_blog', $oBlog->getId());
Router::Location($oBlog->getUrlFull());
} else {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
@ -1031,7 +1031,7 @@ class ActionBlog extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oCommentNew->getUserId(), ModuleStream::EVENT_ADD_COMMENT, $oCommentNew->getId());
$this->Stream_write($oCommentNew->getUserId(), 'add_comment', $oCommentNew->getId());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
@ -1422,7 +1422,7 @@ class ActionBlog extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oBlogUser->getId(), ModuleStream::EVENT_JOIN_BLOG, $oBlog->getId());
$this->Stream_write($oBlogUser->getId(), 'join_blog', $oBlog->getId());
$this->Message_AddNotice($sMessage,$this->Lang_Get('attention'),true);
Router::Location(Router::GetPath('talk'));
@ -1577,7 +1577,7 @@ class ActionBlog extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($this->oUserCurrent->getId(), ModuleStream::EVENT_JOIN_BLOG, $oBlog->getId());
$this->Stream_write($this->oUserCurrent->getId(), 'join_blog', $oBlog->getId());
} else {
$sMsg=($oBlog->getType()=='close')
? $this->Lang_Get('blog_join_error_invite')

View file

@ -311,7 +311,11 @@ class ActionLink extends Action {
//Делаем рассылку спама всем, кто состоит в этом блоге
if ($oTopic->getPublish()==1 and $oBlog->getType()!='personal') {
$this->Topic_SendNotifyTopicNew($oBlog,$oTopic,$this->oUserCurrent);
}
}
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTopic->getUserId(), 'add_topic', $oTopic->getId());
Router::Location($oTopic->getUrl());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));

View file

@ -381,6 +381,10 @@ class ActionPhotoset extends Action {
}
}
setcookie('ls_photoset_target_tmp', null);
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTopic->getUserId(), 'add_topic', $oTopic->getId());
Router::Location($oTopic->getUrl());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));

View file

@ -479,7 +479,7 @@ class ActionProfile extends Action {
*/
$oFriend->setStatusByUserId(ModuleUser::USER_FRIEND_ACCEPT,$this->oUserCurrent->getId());
if($this->User_UpdateFriend($oFriend)) {
$this->Stream_write($oFriend->getUserFrom(), ModuleStream::EVENT_MAKE_FRIENDS, $oFriend->getUserTo());
$this->Stream_write($oFriend->getUserFrom(), 'make_friends', $oFriend->getUserTo());
$this->Message_AddNoticeSingle($this->Lang_Get('user_friend_add_ok'),$this->Lang_Get('attention'));
$oViewerLocal=$this->GetViewerLocal();

View file

@ -286,6 +286,10 @@ class ActionQuestion extends Action {
if ($oTopic->getPublish()==1 and $oBlog->getType()!='personal') {
$this->Topic_SendNotifyTopicNew($oBlog,$oTopic,$this->oUserCurrent);
}
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTopic->getUserId(), 'add_topic', $oTopic->getId());
Router::Location($oTopic->getUrl());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));

View file

@ -2,180 +2,137 @@
class ActionStream extends Action
{
protected $oUserCurrent;
protected $oUserCurrent;
public function Init()
{
$this->oUserCurrent = $this->User_getUserCurrent();
if (!$this->oUserCurrent) {
parent::EventNotFound();
}
$this->SetDefaultEvent('index');
$this->Viewer_Assign('STREAM_EVENT_TYPE', array ( 'ADD_TOPIC' => array('id' => ModuleStream::EVENT_ADD_TOPIC, 'name' => $this->Lang_Get('stream_event_type_add_topic')),
'ADD_COMMENT' => array('id' => ModuleStream::EVENT_ADD_COMMENT, 'name' => $this->Lang_Get('stream_event_type_add_comment')),
'ADD_BLOG' => array('id' => ModuleStream::EVENT_ADD_BLOG, 'name' => $this->Lang_Get('stream_event_type_add_blog')),
'VOTE_TOPIC' => array('id' => ModuleStream::EVENT_VOTE_TOPIC, 'name' => $this->Lang_Get('stream_event_type_vote_topic')),
'VOTE_COMMENT' => array('id' => ModuleStream::EVENT_VOTE_COMMENT, 'name' => $this->Lang_Get('stream_event_type_vote_comment')),
'VOTE_BLOG' => array('id' => ModuleStream::EVENT_VOTE_BLOG, 'name' => $this->Lang_Get('stream_event_type_vote_blog')),
'VOTE_USER' => array('id' => ModuleStream::EVENT_VOTE_USER, 'name' => $this->Lang_Get('stream_event_type_vote_user')),
'MAKE_FRIENDS' => array('id' => ModuleStream::EVENT_MAKE_FRIENDS, 'name' => $this->Lang_Get('stream_event_type_make_friends')),
'JOIN_BLOG' => array('id' => ModuleStream::EVENT_JOIN_BLOG, 'name' => $this->Lang_Get('stream_event_type_join_blog'))
));
$this->Viewer_Assign('sMenuItemSelect', 'stream');
}
public function Init()
{
$this->oUserCurrent = $this->User_getUserCurrent();
if (!$this->oUserCurrent) {
parent::EventNotFound();
}
$this->SetDefaultEvent('index');
$this->Viewer_Assign('aStreamEventTypes', $this->Stream_getEventTypes());
public function Shutdown()
{
$this->Viewer_Assign('sMenuItemSelect', 'stream');
}
}
public function Shutdown()
{
protected function RegisterEvent()
{
$this->AddEvent('index', 'EventIndex');
$this->AddEvent('update', 'EventUpdateSubscribes');
$this->AddEvent('subscribe', 'EventSubscribe');
$this->AddEvent('subscribeByLogin', 'EventSubscribeByLogin');
$this->AddEvent('unsubscribe', 'EventUnSubscribe');
$this->AddEvent('switchEventType', 'EventSwitchEventType');
$this->AddEvent('get_more', 'EventGetMore');
}
}
protected function EventIndex()
{
$aEvents = $this->Stream_read();
$this->Viewer_Assign('aStreamEvents', $aEvents['events']);
if (isset($aEvents['events']) && count($aEvents['events'])) {
$aLastEvent = end($aEvents['events']);
$this->Viewer_Assign('iStreamLastId', $aLastEvent['id']);
$this->Viewer_Assign('aStreamTopics', $aEvents['topics']);
$this->Viewer_Assign('aStreamBlogs', $aEvents['blogs']);
$this->Viewer_Assign('aStreamUsers', $aEvents['users']);
$this->Viewer_Assign('aStreamComments', $aEvents['comments']);
if (count($aEvents['events']) < Config::Get('module.stream.count_default')) {
$this->Viewer_Assign('bDisableGetMoreButton', true);
} else {
$this->Viewer_Assign('bDisableGetMoreButton', false);
}
}
$this->SetTemplateAction('list');
}
protected function RegisterEvent()
{
$this->AddEvent('index', 'EventIndex');
$this->AddEvent('subscribe', 'EventSubscribe');
$this->AddEvent('subscribeByLogin', 'EventSubscribeByLogin');
$this->AddEvent('unsubscribe', 'EventUnSubscribe');
$this->AddEvent('switchEventType', 'EventSwitchEventType');
$this->AddEvent('get_more', 'EventGetMore');
}
protected function EventSwitchEventType()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('type')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
$this->Stream_switchUserEventType($this->oUserCurrent->getId(), getRequest('type'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventIndex()
{
$aEvents = $this->Stream_read();
$this->Viewer_Assign('aStreamEvents', $aEvents['events']);
if (isset($aEvents['events']) && count($aEvents['events'])) {
$aLastEvent = end($aEvents['events']);
$this->Viewer_Assign('iStreamLastId', $aLastEvent['id']);
$this->Viewer_Assign('aStreamTopics', $aEvents['topics']);
$this->Viewer_Assign('aStreamBlogs', $aEvents['blogs']);
$this->Viewer_Assign('aStreamUsers', $aEvents['users']);
$this->Viewer_Assign('aStreamComments', $aEvents['comments']);
if (count($aEvents['events']) < Config::Get('module.stream.count_default')) {
$this->Viewer_Assign('bDisableGetMoreButton', true);
} else {
$this->Viewer_Assign('bDisableGetMoreButton', false);
}
}
$this->SetTemplateAction('list');
}
protected function EventGetMore()
{
$this->Viewer_SetResponseAjax('json');
$iFromId = getRequest('last_id');
if (!$iFromId) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$aEvents = $this->Stream_read(null, $iFromId);
protected function EventSwitchEventType()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('type')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
$this->Stream_switchUserEventType($this->oUserCurrent->getId(), getRequest('type'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
$oViewer=$this->Viewer_GetLocalViewer();
$oViewer->Assign('aStreamEvents', $aEvents['events']);
if (isset($aEvents['events']) && count($aEvents['events'])) {
$aLastEvent = end($aEvents['events']);
$oViewer->Assign('iStreamLastId', $aLastEvent['id']);
$this->Viewer_AssignAjax('iStreamLastId', $aLastEvent['id']);
$oViewer->Assign('aStreamTopics', $aEvents['topics']);
$oViewer->Assign('aStreamBlogs', $aEvents['blogs']);
$oViewer->Assign('aStreamUsers', $aEvents['users']);
$oViewer->Assign('aStreamComments', $aEvents['comments']);
$oViewer->Assign('STREAM_EVENT_TYPE', array ( 'ADD_TOPIC' => array('id' => ModuleStream::EVENT_ADD_TOPIC, 'name' => $this->Lang_Get('stream_event_type_add_topic')),
'ADD_COMMENT' => array('id' => ModuleStream::EVENT_ADD_COMMENT, 'name' => $this->Lang_Get('stream_event_type_add_comment')),
'ADD_BLOG' => array('id' => ModuleStream::EVENT_ADD_BLOG, 'name' => $this->Lang_Get('stream_event_type_add_blog')),
'VOTE_TOPIC' => array('id' => ModuleStream::EVENT_VOTE_TOPIC, 'name' => $this->Lang_Get('stream_event_type_vote_topic')),
'VOTE_COMMENT' => array('id' => ModuleStream::EVENT_VOTE_COMMENT, 'name' => $this->Lang_Get('stream_event_type_vote_comment')),
'VOTE_BLOG' => array('id' => ModuleStream::EVENT_VOTE_BLOG, 'name' => $this->Lang_Get('stream_event_type_vote_blog')),
'VOTE_USER' => array('id' => ModuleStream::EVENT_VOTE_USER, 'name' => $this->Lang_Get('stream_event_type_vote_user')),
'MAKE_FRIENDS' => array('id' => ModuleStream::EVENT_MAKE_FRIENDS, 'name' => $this->Lang_Get('stream_event_type_make_friends')),
'JOIN_BLOG' => array('id' => ModuleStream::EVENT_JOIN_BLOG, 'name' => $this->Lang_Get('stream_event_type_join_blog'))
));
}
protected function EventGetMore()
{
$this->Viewer_SetResponseAjax('json');
$iFromId = getRequest('last_id');
if (!$iFromId) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$aEvents = $this->Stream_read(null, $iFromId);
$oViewer=$this->Viewer_GetLocalViewer();
$oViewer->Assign('aStreamEvents', $aEvents['events']);
if (isset($aEvents['events']) && count($aEvents['events'])) {
$aLastEvent = end($aEvents['events']);
$oViewer->Assign('iStreamLastId', $aLastEvent['id']);
$this->Viewer_AssignAjax('iStreamLastId', $aLastEvent['id']);
$oViewer->Assign('aStreamTopics', $aEvents['topics']);
$oViewer->Assign('aStreamBlogs', $aEvents['blogs']);
$oViewer->Assign('aStreamUsers', $aEvents['users']);
$oViewer->Assign('aStreamComments', $aEvents['comments']);
}
$sFeed = $oViewer->Fetch('stream_list.tpl');
$this->Viewer_AssignAjax('result', $sFeed);
$this->Viewer_AssignAjax('events_count', count($aEvents['events']));
}
$this->Viewer_AssignAjax('result', $sFeed);
$this->Viewer_AssignAjax('events_count', count($aEvents['events']));
}
protected function EventSubscribe()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
if ($this->oUserCurrent->getId() == getRequest('id')) {
$this->Message_AddError($this->Lang_Get('stream_error_subscribe_to_yourself'),$this->Lang_Get('error'));
return;
}
$this->Stream_subscribeUser($this->oUserCurrent->getId(), getRequest('id'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventSubscribe()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
if ($this->oUserCurrent->getId() == getRequest('id')) {
$this->Message_AddError($this->Lang_Get('stream_error_subscribe_to_yourself'),$this->Lang_Get('error'));
return;
}
$this->Stream_subscribeUser($this->oUserCurrent->getId(), getRequest('id'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventSubscribeByLogin()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('login')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$oUser = $this->User_getUserByLogin(getRequest('login'));
if (!$oUser) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
if ($this->oUserCurrent->getId() == $oUser->getId()) {
$this->Message_AddError($this->Lang_Get('stream_error_subscribe_to_yourself'),$this->Lang_Get('error'));
return;
}
$this->Stream_subscribeUser($this->oUserCurrent->getId(), $oUser->getId());
$this->Viewer_AssignAjax('uid', $oUser->getId());
$this->Viewer_AssignAjax('user_login', $oUser->getLogin());
$this->Viewer_AssignAjax('user_web_path', $oUser->getuserWebPath());
$this->Viewer_AssignAjax('lang_error_msg', $this->Lang_Get('userfeed_subscribes_already_subscribed'));
$this->Viewer_AssignAjax('lang_error_title', $this->Lang_Get('error'));
$this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventSubscribeByLogin()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('login')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$oUser = $this->User_getUserByLogin(getRequest('login'));
if (!$oUser) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
if ($this->oUserCurrent->getId() == $oUser->getId()) {
$this->Message_AddError($this->Lang_Get('stream_error_subscribe_to_yourself'),$this->Lang_Get('error'));
return;
}
$this->Stream_subscribeUser($this->oUserCurrent->getId(), $oUser->getId());
$this->Viewer_AssignAjax('uid', $oUser->getId());
$this->Viewer_AssignAjax('user_login', $oUser->getLogin());
$this->Viewer_AssignAjax('user_web_path', $oUser->getuserWebPath());
$this->Viewer_AssignAjax('lang_error_msg', $this->Lang_Get('userfeed_subscribes_already_subscribed'));
$this->Viewer_AssignAjax('lang_error_title', $this->Lang_Get('error'));
$this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventUnsubscribe()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
$this->Stream_unsubscribeUser($this->oUserCurrent->getId(), getRequest('id'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventUpdateSubscribes()
{
$this->Viewer_SetResponseAjax('json');
$sType = getRequest('type');
$iType = null;
switch($sType) {
case 'blogs':
$iType = ModuleUserfeed::SUBSCRIBE_TYPE_BLOG;
break;
case 'users':
$iType = ModuleUserfeed::SUBSCRIBE_TYPE_USER;
break;
default:
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$aIds = explode(',', getRequest('ids'));
$aUserSubscribes = array('users' => array(), 'blogs' => array());
$aUserSubscribes[$sType] = $aIds;
$this->Userfeed_updateSubscribes($this->oUserCurrent->getId(), $aUserSubscribes, $iType);
$this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
}
protected function EventUnsubscribe()
{
$this->Viewer_SetResponseAjax('json');
if (!getRequest('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
$this->Stream_unsubscribeUser($this->oUserCurrent->getId(), getRequest('id'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
}

View file

@ -348,7 +348,7 @@ class ActionTopic extends Action {
/**
* Добавляем событие в ленту
*/
$this->Stream_write($oTopic->getUserId(), ModuleStream::EVENT_ADD_TOPIC, $oTopic->getId());
$this->Stream_write($oTopic->getUserId(), 'add_topic', $oTopic->getId());
Router::Location($oTopic->getUrl());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));

View file

@ -3,11 +3,11 @@
class BlockStreamConfig extends Block
{
public function Exec() {
$aStreamConfig = $this->Stream_getUserConfig($this->User_getUserCurrent()->getId());
$this->Viewer_Assign('aStreamConfig', $aStreamConfig);
$aTypesList = $this->Stream_getTypesList($this->User_getUserCurrent()->getId());
$this->Viewer_Assign('aStreamTypesList', $aTypesList);
$aUserSubscribes = $this->Stream_getUserSubscribes($this->User_getUserCurrent()->getId());
$aFriends = $this->User_getUsersFriend($this->User_getUserCurrent()->getId());
$this->Viewer_Assign('aStreamSubscribedUsers', $aUserSubscribes);
$this->Viewer_Assign('aStreamFriends', $aFriends);
}
}
}

View file

@ -1,189 +1,232 @@
<?php
class ModuleStream extends Module
{
const EVENT_ALL = 1023;
const EVENT_ADD_TOPIC = 2;
const EVENT_ADD_COMMENT = 4;
const EVENT_ADD_BLOG = 8;
const EVENT_VOTE_TOPIC = 16;
const EVENT_VOTE_COMMENT = 32;
const EVENT_VOTE_BLOG = 64;
const EVENT_VOTE_USER = 128;
const EVENT_MAKE_FRIENDS = 256;
const EVENT_JOIN_BLOG = 512;
const EVENT_ALL = 1023;
const EVENT_ADD_TOPIC = 2;
const EVENT_ADD_COMMENT = 4;
const EVENT_ADD_BLOG = 8;
const EVENT_VOTE_TOPIC = 16;
const EVENT_VOTE_COMMENT = 32;
const EVENT_VOTE_BLOG = 64;
const EVENT_VOTE_USER = 128;
const EVENT_MAKE_FRIENDS = 256;
const EVENT_JOIN_BLOG = 512;
protected $oMapper = null;
protected $oMapper = null;
protected $aEventTypes = array(
'add_topic' => array('related' => 'topics'),
'add_comment' => array('related' => 'comments'),
'add_blog' => array('related' => 'blogs'),
'vote_topic' => array('related' => 'topics'),
'vote_comment' => array('related' => 'comments'),
'vote_blog' => array('related' => 'blogs'),
'vote_user' => array('related' => 'users'),
'make_friends' => array('related' => 'users'),
'join_blog' => array('related' => 'blogs')
);
public function Init()
{
$this->oMapper=Engine::GetMapper(__CLASS__);
}
public function getEventTypes()
{
return $this->aEventTypes;
}
/**
* Подписать пользователя
* @param type $iUserId Id подписываемого пользователя
* @param type $iSubscribeType Тип подписки (см. константы класса)
* @param type $iTargetId Id цели подписки
*/
public function subscribeUser($iUserId, $iTargetUserId)
{
return $this->oMapper->subscribeUser($iUserId, $iTargetUserId);
}
public function Init()
{
$this->oMapper=Engine::GetMapper(__CLASS__);
}
/**
* Отписать пользователя
* @param type $iUserId Id подписываемого пользователя
* @param type $iSubscribeType Тип подписки (см. константы класса)
* @param type $iTargetId Id цели подписки
*/
public function unsubscribeUser($iUserId, $iTargetUserId)
{
return $this->oMapper->unsubscribeUser($iUserId, $iTargetUserId);
}
/**
* Подписать пользователя
* @param type $iUserId Id подписываемого пользователя
* @param type $iSubscribeType Тип подписки (см. константы класса)
* @param type $iTargetId Id цели подписки
*/
public function subscribeUser($iUserId, $iTargetUserId)
{
return $this->oMapper->subscribeUser($iUserId, $iTargetUserId);
}
/**
* Редактирвоание списка событий, на которые подписан юзер
* @param type $iUserId
* @param type $iType
* @return type
*/
public function switchUserEventType($iUserId, $sType)
{
return $this->oMapper->switchUserEventType($iUserId, $sType);
}
/**
* Отписать пользователя
* @param type $iUserId Id подписываемого пользователя
* @param type $iSubscribeType Тип подписки (см. константы класса)
* @param type $iTargetId Id цели подписки
*/
public function unsubscribeUser($iUserId, $iTargetUserId)
{
return $this->oMapper->unsubscribeUser($iUserId, $iTargetUserId);
}
/**
* Запись события в ленту
* @param type $oUser
* @param type $iEventType
* @param type $iTargetId
*/
public function write($oUser, $sEventType, $iTargetId)
{
$this->oMapper->addEvent($oUser, $sEventType, $iTargetId);
}
/**
* Редактирвоание списка событий, на которые подписан юзер
* @param type $iUserId
* @param type $iType
* @return type
*/
public function switchUserEventType($iUserId, $iType)
{
return $this->oMapper->switchUserEventType($iUserId, $iType);
}
/**
* Удалеине события из ленты
* @param type $oUser
* @param type $iEventType
* @param type $iTargetId
*/
public function delete($oUser, $sEventType, $iTargetId)
{
$this->oMapper->deleteEvent($oUser, $sEventType, $iTargetId);
}
/**
* Запись события в ленту
* @param type $oUser
* @param type $iEventType
* @param type $iTargetId
*/
public function write($oUser, $iEventType, $iTargetId)
{
$this->oMapper->addEvent($oUser, $iEventType, $iTargetId);
}
/**
* Чтение ленты событий
* @param type $iCount
* @param type $iFromId
* @return type
*/
public function read($iCount = null, $iFromId = null)
{
if (!$iCount) $iCount = Config::Get('module.stream.count_default');
/**
* Удалеине события из ленты
* @param type $oUser
* @param type $iEventType
* @param type $iTargetId
*/
public function delete($oUser, $iEventType, $iTargetId)
{
$this->oMapper->deleteEvent($oUser, $iEventType, $iTargetId);
}
$oUser = $this->User_getUserCurrent();
$aEventTypes = $this->getTypesList($oUser->getId());
if (!count($aEventTypes)) return array('events' => array());
$aUsersList = $this->getUsersList();
if (!count($aUsersList)) return array('events' => array());
/**
* Чтение ленты событий
* @param type $iCount
* @param type $iFromId
* @return type
*/
public function read($iCount = null, $iFromId = null)
{
if (!$iCount) $iCount = Config::Get('module.stream.count_default');
$aEvents = array();
$aEvents = $this->oMapper->read($aEventTypes, $aUsersList, $iCount, $iFromId);
/*
* Создание массива для загрузки дополнительных объектов. необходимых при отображении ленты
*/
$aNeededObjects = array();
$aResult = array('events' => $aEvents);
foreach ($this->aEventTypes as $aType) {
if (!isset($aNeededObjects[$aType['related']])) {
$aNeededObjects[$aType['related']] = array();
$aResult[$aType['related']] = array();
}
}
if (!count($aEvents)) array('events' => array());
foreach ($aEvents as $aEvent) {
if (!in_array($aEvent['initiator'], $aNeededObjects['users'])) {
$aNeededObjects['users'][] = $aEvent['initiator'];
}
$sRelatedType = $this->aEventTypes[$aEvent['event_type']]['related'];
if (isset($aNeededObjects[$sRelatedType])) {
$aNeededObjects[$sRelatedType][] = $aEvent['target_id'];
}
}
foreach ($aNeededObjects as $sType => $aList) {
if (count($aList)) {
$sFunction = 'loadRelated' . ucfirst($sType);
if (method_exists($this, $sFunction)) {
$this->$sFunction($aList, $aResult);
}
}
}
return$aResult;
}
$oUser = $this->User_getUserCurrent();
$aUserConfig = $this->getUserConfig($oUser->getId());
$aEventTypes = $aUserConfig['event_types'];
if (!count($aEventTypes)) return array('events' => array());
$aUsesrList = $this->getUsersList();
if (!$aUsesrList) return array('events' => array());
protected function loadRelatedTopics($aIds, &$aRelatedObjects)
{
$aTopicsUnsorted =$this->Topic_getTopicsAdditionalData($aIds);
foreach ($aTopicsUnsorted as $oTopic) {
if (!isset($aRelatedObjects['topics'][$oTopic->getId()] )) {
$aRelatedObjects['topics'][$oTopic->getId()] = $oTopic;
}
}
}
protected function loadRelatedBlogs($aIds, &$aRelatedObjects)
{
$aBlogsUnsorted =$this->Blog_getBlogsByArrayId($aIds);
foreach ($aBlogsUnsorted as $oBlog) {
if (!isset($aRelatedObjects['blogs'][$oBlog->getId()] )) {
$aRelatedObjects['blogs'][$oBlog->getId()] = $oBlog;
}
}
}
protected function loadRelatedComments($aIds, &$aRelatedObjects)
{
$aCommentsUnsorted =$this->Comment_getCommentsByArrayId($aIds);
foreach ($aCommentsUnsorted as $oComment) {
if (!isset($aRelatedObjects['comments'][$oComment->getId()] )) {
$aRelatedObjects['comments'][$oComment->getId()] = $oComment;
}
}
$aTopics = array();
foreach($aComments as $oComment) {
if (!isset($aRelatedObjects['topics'][$oComment->getTargetId()])) {
$aTopics[] = $oComment->getTargetId();
}
}
$this->loadRelatedTopics($aTopics, $aRelatedObjects);
}
protected function loadRelatedUsers($aIds, &$aRelatedObjects)
{
$aRelatedObjects['users'] = $this->User_getUsersByArrayId($aIds);
$aUsersUnsorted =$this->User_getUsersByArrayId($aIds);
foreach ($aUsersUnsorted as $oUser) {
if (!isset($aRelatedObjects['users'][$oUser->getId()] )) {
$aRelatedObjects['users'][$oUser->getId()] = $oUser;
}
}
}
/**
* Получение списка пользователей, на которых подписан пользователь
* @param type $iUserId
* @return type
*/
public function getUserSubscribes($iUserId)
{
$aIds = $this->oMapper->getUserSubscribes($iUserId);
$aResult = array();
if (count($aIds)) {
$aUsers = $this->User_getUsersByArrayId($aIds);
foreach ($aUsers as $oUser) {
$aResult[$oUser->getId()] = $oUser;
}
}
return $aResult;
}
$aEvents = array();
$aEvents = $this->oMapper->read($aEventTypes, $aUsesrList, $iCount, $iFromId);
/**
* Получение типов событий, на которые подписан пользователь
* @param type $iUserId
* @return type
*/
public function getTypesList($iUserId)
{
return $this->oMapper->getTypesList($iUserId);
}
$aNeededObjects = array('topics' => array(), 'blogs' => array(), 'users' => array(), 'comments' => array());
if (!count($aEvents)) array('events' => array());
foreach ($aEvents as $aEvent) {
if (!in_array($aEvent['initiator'], $aNeededObjects['users'])) {
$aNeededObjects['users'][] = $aEvent['initiator'];
}
switch ($aEvent['event_type']) {
case self::EVENT_ADD_TOPIC: case self::EVENT_VOTE_TOPIC:
if (!in_array($aEvent['target_id'], $aNeededObjects['topics'])) {
$aNeededObjects['topics'][] = $aEvent['target_id'];
}
break;
case self::EVENT_ADD_COMMENT: case self::EVENT_VOTE_COMMENT:
if (!in_array($aEvent['target_id'], $aNeededObjects['comments'])) {
$aNeededObjects['comments'][] = $aEvent['target_id'];
}
break;
case self::EVENT_ADD_BLOG: case self::EVENT_VOTE_BLOG: case self::EVENT_JOIN_BLOG:
if (!in_array($aEvent['target_id'], $aNeededObjects['blogs'])) {
$aNeededObjects['blogs'][] = $aEvent['target_id'];
}
break;
case self::EVENT_VOTE_USER: case self::EVENT_MAKE_FRIENDS:
if (!in_array($aEvent['target_id'], $aNeededObjects['users'])) {
$aNeededObjects['users'][] = $aEvent['target_id'];
}
break;
}
}
$aTopics = array();
if (count($aNeededObjects['topics'])) {
$aTopics = $this->Topic_getTopicsAdditionalData($aNeededObjects['topics']);
}
$aBlogs = array();
if (count($aNeededObjects['blogs'])) {
$aBlogs = $this->Blog_getBlogsByArrayId($aNeededObjects['blogs']);
}
$aUsers = array();
if (count($aNeededObjects['users'])) {
$aUsers = $this->User_getUsersByArrayId($aNeededObjects['users']);
}
$aComments = array();
if (count($aNeededObjects['comments'])) {
$aComments = $this->Comment_getCommentsByArrayId($aNeededObjects['comments']);
foreach($aComments as $oComment) {
if (!isset($aTopics[$oComment->getTargetId()])) {
$aTopics[$oComment->getTargetId()] = $this->Topic_getTopicById($oComment->getTargetId());
}
}
}
return array('events' => $aEvents, 'topics' => $aTopics, 'blogs' => $aBlogs, 'users' => $aUsers, 'comments' => $aComments);
}
/**
* Получение списка пользователей, на которых подписан пользователь
* @param type $iUserId
* @return type
*/
public function getUserSubscribes($iUserId)
{
$aIds = $this->oMapper->getUserSubscribes($iUserId);
$aResult = array();
if (count($aIds)) {
$aUsers = $this->User_getUsersByArrayId($aIds);
foreach ($aUsers as $oUser) {
$aResult[$oUser->getId()] = $oUser;
}
}
return $aResult;
}
/**
* Получение настроек ленты
* @param type $iUserId
* @return type
*/
public function getUserConfig($iUserId)
{
return $this->oMapper->getUserConfig($iUserId);
}
/**
* Получение списка id пользователей, на которых подписан пользователь
* @return type
*/
protected function getUsersList()
{
$iUserId = $this->User_getUserCurrent()->getId();
$aList = $this->oMapper->getUserSubscribes($iUserId);
return $aList;
}
/**
* Получение списка id пользователей, на которых подписан пользователь
* @return type
*/
protected function getUsersList()
{
$iUserId = $this->User_getUserCurrent()->getId();
$aList = $this->oMapper->getUserSubscribes($iUserId);
return $aList;
}
}

View file

@ -2,83 +2,76 @@
class ModuleStream_MapperStream extends Mapper
{
public function subscribeUser($iUserId, $iTargetUserId)
{
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_subscribe') . ' WHERE
user_id = ?d AND target_user_id = ?d';
if (!$this->oDb->select($sql, $iUserId, $iTargetUserId)) {
$sql = 'INSERT INTO ' . Config::Get('db.table.stream_subscribe') . ' SET
user_id = ?d, target_user_id = ?d';
$this->oDb->query($sql, $iUserId, $iTargetUserId);
}
}
public function subscribeUser($iUserId, $iTargetUserId)
{
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_subscribe') . ' WHERE
user_id = ?d AND target_user_id = ?d';
if (!$this->oDb->select($sql, $iUserId, $iTargetUserId)) {
$sql = 'INSERT INTO ' . Config::Get('db.table.stream_subscribe') . ' SET
user_id = ?d, target_user_id = ?d';
$this->oDb->query($sql, $iUserId, $iTargetUserId);
}
}
public function unsubscribeUser($iUserId, $iTargetUserId)
{
$sql = 'DELETE FROM ' . Config::Get('db.table.stream_subscribe') . ' WHERE
user_id = ?d AND target_user_id = ?d';
$this->oDb->query($sql, $iUserId, $iTargetUserId);
}
public function unsubscribeUser($iUserId, $iTargetUserId)
{
$sql = 'DELETE FROM ' . Config::Get('db.table.stream_subscribe') . ' WHERE
user_id = ?d AND target_user_id = ?d';
$this->oDb->query($sql, $iUserId, $iTargetUserId);
}
public function read($iEventTypes, $aUsesrList, $iCount, $iFromId)
{
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_event'). ' WHERE
event_type & ?d AND initiator IN (?a)';
$aParams = array($iEventTypes, $aUsesrList);
if ($iFromId) {
$sql .= ' AND id < ?d';
$aParams[] = $iFromId;
}
$sql .= ' ORDER BY id DESC';
if ($iCount) {
$sql .= ' LIMIT 0,?d';
$aParams[] = $iCount;
}
return call_user_func_array(array($this->oDb, 'select'), array_merge(array($sql), $aParams));
}
public function read($aEventTypes, $aUsesrList, $iCount, $iFromId)
{
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_event'). ' WHERE
event_type IN (?a) AND initiator IN (?a)';
$aParams = array($aEventTypes, $aUsesrList);
if ($iFromId) {
$sql .= ' AND id < ?d';
$aParams[] = $iFromId;
}
$sql .= ' ORDER BY id DESC';
if ($iCount) {
$sql .= ' LIMIT 0,?d';
$aParams[] = $iCount;
}
return call_user_func_array(array($this->oDb, 'select'), array_merge(array($sql), $aParams));
}
public function addEvent($oUserId, $iEventType, $iTargetId)
{
$sql = 'INSERT INTO ' . Config::Get('db.table.stream_event'). ' SET
event_type = ?d, target_id = ?d, initiator = ?d';
$this->oDb->query($sql, $iEventType, $iTargetId, $oUserId);
}
public function addEvent($oUserId, $sEventType, $iTargetId)
{
$sql = 'INSERT INTO ' . Config::Get('db.table.stream_event'). ' SET
event_type = ?, target_id = ?d, initiator = ?d';
$this->oDb->query($sql, $sEventType, $iTargetId, $oUserId);
}
public function deleteEvent($oUser, $iEventType, $iTargetId)
{
$sql = 'DELETE FROM' . Config::Get('db.table.stream_event'). ' WHERE
event_type = ?d AND target_id = ?d AND initiator = ?d';
$this->oDb->query($sql, $iEventType, $iTargetId, $oUser->getId());
}
public function deleteEvent($oUser, $sEventType, $iTargetId)
{
$sql = 'DELETE FROM' . Config::Get('db.table.stream_event'). ' WHERE
event_type = ? AND target_id = ?d AND initiator = ?d';
$this->oDb->query($sql, $sEventType, $iTargetId, $oUser->getId());
}
public function getUserSubscribes($iUserId)
{
$sql = 'SELECT target_user_id FROM ' . Config::Get('db.table.stream_subscribe') . ' WHERE user_id = ?d';
return $this->oDb->selectCol($sql, $iUserId);
}
public function getUserSubscribes($iUserId)
{
$sql = 'SELECT target_user_id FROM ' . Config::Get('db.table.stream_subscribe') . ' WHERE user_id = ?d';
return $this->oDb->selectCol($sql, $iUserId);
}
public function getUserConfig($iUserId)
{
$this->initUserConfig($iUserId);
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_config') . ' WHERE user_id = ?d';
$ret = $this->oDb->selectRow($sql, $iUserId);
return $ret;
}
public function getTypesList($iUserId)
{
$sql = 'SELECT event_type FROM ' . Config::Get('db.table.stream_user_type') . ' WHERE user_id = ?d';
$ret = $this->oDb->selectCol($sql, $iUserId);
return $ret;
}
public function switchUserEventType($iUserId, $iEventType)
{
$sql = 'UPDATE ' . Config::Get('db.table.stream_config') . ' SET
event_types = event_types ^ ?d
WHERE user_id = ?d';
$this->oDb->query($sql, $iEventType, $iUserId);
}
public function initUserConfig($iUserId)
{
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_config') . ' WHERE user_id = ?d';
if (!$this->oDb->select($sql, $iUserId)) {
$sql = 'INSERT INTO ' . Config::Get('db.table.stream_config') . ' SET user_id = ?d, event_types = ?d';
$this->oDb->query($sql, $iUserId, ModuleStream::EVENT_ALL);
}
}
public function switchUserEventType($iUserId, $sEventType)
{
$sql = 'SELECT * FROM ' . Config::Get('db.table.stream_user_type') . ' WHERE user_id = ?d AND event_type = ?';
if ($this->oDb->select($sql, $iUserId, $sEventType)) {
$sql = 'DELETE FROM ' . Config::Get('db.table.stream_user_type') . ' WHERE user_id = ?d AND event_type = ?';
} else {
$sql = 'INSERT INTO '. Config::Get('db.table.stream_user_type') . ' SET user_id = ?d , event_type = ?';
}
$this->oDb->query($sql, $iUserId, $sEventType);
}
}

View file

@ -272,7 +272,7 @@ $config['db']['table']['notify_task'] = '___db.table.prefix___notify_tas
$config['db']['table']['userfeed_subscribe'] = '___db.table.prefix___userfeed_subscribe';
$config['db']['table']['stream_subscribe'] = '___db.table.prefix___stream_subscribe';
$config['db']['table']['stream_event'] = '___db.table.prefix___stream_event';
$config['db']['table']['stream_config'] = '___db.table.prefix___stream_config';
$config['db']['table']['stream_user_type'] = '___db.table.prefix___stream_user_type';
$config['db']['table']['user_field'] = '___db.table.prefix___user_field';
$config['db']['table']['user_field_value'] = '___db.table.prefix___user_field_value';
$config['db']['table']['topic_photo'] = '___db.table.prefix___topic_photo';

View file

@ -24,7 +24,7 @@
$config['entity_prefix'] = '';
$config['sphinx']['host'] = 'localhost';
$config['sphinx']['port'] = '3312';
$config['sphinx']['port'] = '9312';
return $config;
?>

View file

@ -45,4 +45,13 @@ CREATE TABLE `prefix_topic_photo` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `prefix_topic` CHANGE topic_type topic_type ENUM('topic','link','question','photoset') NOT NULL DEFAULT 'topic';
DROP TABLE `prefix_stream_config`;
CREATE TABLE `prefix_stream_user_type` (
`user_id` int(11) NOT NULL,
`event_type` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
ALTER TABLE `prefix_topic` CHANGE topic_type topic_type ENUM('topic','link','question','photoset') NOT NULL DEFAULT 'topic';
ALTER TABLE `prefix_stream_event` CHANGE event_type event_type varchar(100) not null;

View file

@ -16,18 +16,21 @@
<p class="note">{$aLang.stream_settings_note_filter}</p>
<ul class="stream-settings-filter">
{foreach from=$STREAM_EVENT_TYPE item=aEventType}
<li><label><input class="streamEventTypeCheckbox input-checkbox"
type="checkbox"
id="strn_et_{$aEventType.id}"
{math equation="x & y" x=$aEventType.id y=$aStreamConfig.event_types assign=bStreamChecked}
{if $bStreamChecked}checked="checked"{/if}
onClick="if ($(this).get('checked')) { ls.stream.switchEventType( {$aEventType.id}) } else { ls.stream.switchEventType( {$aEventType.id}) } " />
{$aEventType.name}</label>
</li>
{/foreach}
</ul>
<ul class="stream-settings-filter">
{foreach from=$aStreamEventTypes key=sType item=aEventType}
<li>
<label>
<input class="streamEventTypeCheckbox input-checkbox"
type="checkbox"
id="strn_et_{$sType}"
{if in_array($sType, $aStreamTypesList)}checked="checked"{/if}
onClick="if ($(this).get('checked')) { ls.stream.switchEventType( '{$sType}') } else { ls.stream.switchEventType( '{$sType}') } " />
{assign var=langKey value="stream_event_type_`$sType`"}
{$aLang.$langKey}
</label>
</li>
{/foreach}
</ul>
<h3>{$aLang.stream_block_users_title}</h3>

View file

@ -1,55 +1,54 @@
{if count($aStreamEvents)}
<ul class="stream-list">
{foreach from=$aStreamEvents item=aEvent}
{assign var=initiatorId value=$aEvent.initiator}
{assign var=initiator value=$aStreamUsers.$initiatorId}
<li class="stream-item-type-{$aEvent.event_type}">
<ul class="stream-list">
{foreach from=$aStreamEvents item=aEvent}
{assign var=initiatorId value=$aEvent.initiator}
{assign var=initiator value=$aStreamUsers.$initiatorId}
<li class="stream-item-type-{$aEvent.event_type}">
<a href="{$initiator->getUserWebPath()}"><img src="{$initiator->getProfileAvatarPath(48)}" alt="avatar" class="avatar" /></a>
<span class="date">{date_format date=$aEvent.date_added}</span>
<a href="{$initiator->getUserWebPath()}"><strong>{$initiator->getLogin()}</strong></a>
{if $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_TOPIC.id}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_COMMENT.id}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_add_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_vote_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_TOPIC.id}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_COMMENT.id}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_USER.id}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$user}
{$aLang.stream_list_event_vote_user} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.JOIN_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_join_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.MAKE_FRIENDS.id}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$aLang.stream_list_event_make_friends} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{/if}
</li>
{/foreach}
</ul>
{if $aEvent.event_type == 'add_topic'}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'add_comment'}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'add_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_add_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_vote_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_topic'}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_comment'}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_user'}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$user}
{$aLang.stream_list_event_vote_user} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{elseif $aEvent.event_type == 'join_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_join_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'make_friends'}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$aLang.stream_list_event_make_friends} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{/if}
</li>
{/foreach}
</ul>
{/if}

View file

@ -22,18 +22,21 @@
<p class="sp-note">{$aLang.stream_settings_note_filter}</p>
<ul class="stream-settings-filter">
{foreach from=$STREAM_EVENT_TYPE item=aEventType}
<li><label><input class="streamEventTypeCheckbox input-checkbox"
type="checkbox"
id="strn_et_{$aEventType.id}"
{math equation="x & y" x=$aEventType.id y=$aStreamConfig.event_types assign=bStreamChecked}
{if $bStreamChecked}checked="checked"{/if}
onClick="if ($(this).get('checked')) { lsStream.switchEventType( {$aEventType.id}) } else { lsStream.switchEventType( {$aEventType.id}) } " />
{$aEventType.name}</label>
</li>
{/foreach}
</ul>
<ul class="stream-settings-filter">
{foreach from=$aStreamEventTypes key=sType item=aEventType}
<li>
<label>
<input class="streamEventTypeCheckbox input-checkbox"
type="checkbox"
id="strn_et_{$sType}"
{if in_array($sType, $aStreamTypesList)}checked="checked"{/if}
onClick="if ($(this).get('checked')) { lsStream.switchEventType( '{$sType}') } else { lsStream.switchEventType( '{$sType}') } " />
{assign var=langKey value="stream_event_type_`$sType`"}
{$aLang.$langKey}
</label>
</li>
{/foreach}
</ul>
<h3>{$aLang.stream_block_users_title}</h3>

View file

@ -1,55 +1,54 @@
{if count($aStreamEvents)}
<ul class="stream-list">
{foreach from=$aStreamEvents item=aEvent}
{assign var=initiatorId value=$aEvent.initiator}
{assign var=initiator value=$aStreamUsers.$initiatorId}
<li class="stream-item-type-{$aEvent.event_type}">
<ul class="stream-list">
{foreach from=$aStreamEvents item=aEvent}
{assign var=initiatorId value=$aEvent.initiator}
{assign var=initiator value=$aStreamUsers.$initiatorId}
<li class="stream-item-type-{$aEvent.event_type}">
<a href="{$initiator->getUserWebPath()}"><img src="{$initiator->getProfileAvatarPath(48)}" alt="avatar" class="avatar" /></a>
<span class="date">{date_format date=$aEvent.date_added}</span>
<a href="{$initiator->getUserWebPath()}"><strong>{$initiator->getLogin()}</strong></a>
{if $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_TOPIC.id}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_COMMENT.id}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_add_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_vote_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_TOPIC.id}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_COMMENT.id}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_USER.id}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$user}
{$aLang.stream_list_event_vote_user} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.JOIN_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_join_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.MAKE_FRIENDS.id}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$aLang.stream_list_event_make_friends} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{/if}
</li>
{/foreach}
</ul>
{if $aEvent.event_type == 'add_topic'}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'add_comment'}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'add_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_add_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_vote_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_topic'}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_comment'}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_user'}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$user}
{$aLang.stream_list_event_vote_user} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{elseif $aEvent.event_type == 'join_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_join_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'make_friends'}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$aLang.stream_list_event_make_friends} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{/if}
</li>
{/foreach}
</ul>
{/if}

View file

@ -1,90 +1,93 @@
{literal}
<script language="JavaScript" type="text/javascript">
document.addEvent('domready', function() {
new Autocompleter.Request.LS.JSON($('stream_users_complete'), aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
'indicatorClass': 'autocompleter-loading', // class added to the input during request
'minLength': 1, // We need at least 1 character
'selectMode': 'pick', // Instant completion
'multiple': false, // Tag support, by default comma separated
});
$('stream_users_complete').addEvent('keydown', function (event) {
if (event.key == 'enter') {
lsStream.appendUser()
}
});
document.addEvent('domready', function() {
new Autocompleter.Request.LS.JSON($('stream_users_complete'), aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
'indicatorClass': 'autocompleter-loading', // class added to the input during request
'minLength': 1, // We need at least 1 character
'selectMode': 'pick', // Instant completion
'multiple': false, // Tag support, by default comma separated
});
$('stream_users_complete').addEvent('keydown', function (event) {
if (event.key == 'enter') {
lsStream.appendUser()
}
});
});
</script>
{/literal}
<div class="block stream-settings">
<div class="tl"><div class="tr"></div></div>
<div class="cl"><div class="cr">
<h1>{$aLang.stream_block_config_title}</h1>
<p class="sp-note">{$aLang.stream_settings_note_filter}</p>
<div class="tl"><div class="tr"></div></div>
<div class="cl"><div class="cr">
<h1>{$aLang.stream_block_config_title}</h1>
<ul class="stream-settings-filter">
{foreach from=$STREAM_EVENT_TYPE item=aEventType}
<li><label><input class="streamEventTypeCheckbox input-checkbox"
type="checkbox"
id="strn_et_{$aEventType.id}"
{math equation="x & y" x=$aEventType.id y=$aStreamConfig.event_types assign=bStreamChecked}
{if $bStreamChecked}checked="checked"{/if}
onClick="if ($(this).get('checked')) { lsStream.switchEventType( {$aEventType.id}) } else { lsStream.switchEventType( {$aEventType.id}) } " />
{$aEventType.name}</label>
</li>
{/foreach}
</ul>
<h3>{$aLang.stream_block_users_title}</h3>
<p class="sp-note">{$aLang.stream_settings_note_follow_user}</p>
<div class="stream-settings-userlist">
<p><input type="text" id="stream_users_complete" autocomplete="off" />
<a href="javascript:lsStream.appendUser()">{$aLang.stream_block_config_append}</a></p>
{if count($aStreamSubscribedUsers)}
<ul id="stream_block_users_list">
{foreach from=$aStreamSubscribedUsers item=oUser}
{assign var=iUserId value=$oUser->getId()}
{if !isset($aStreamFriends.$iUserId)}
<li><input class="streamUserCheckbox input-checkbox"
type="checkbox"
id="strm_u_{$iUserId}"
checked="checked"
onClick="if ($(this).get('checked')) { lsStream.subscribe({$iUserId}) } else { lsStream.unsubscribe({$iUserId}) } " />
<a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a>
</li>
{/if}
{/foreach}
</ul>
{else}
<ul id="stream_block_users_list"></ul>
<p id="stream_no_subscribed_users">{$aLang.stream_no_subscribed_users}</p>
{/if}
</div>
{if count($aStreamFriends)}
<h3>{$aLang.stream_block_users_friends}</h3>
<p class="sp-note">{$aLang.stream_settings_note_follow_friend}</p>
<ul class="stream-settings-friends">
{foreach from=$aStreamFriends item=oUser}
{assign var=iUserId value=$oUser->getId()}
<li><input class="streamUserCheckbox input-checkbox"
type="checkbox"
id="strm_u_{$iUserId}"
{if isset($aStreamSubscribedUsers.$iUserId)} checked="checked"{/if}
onClick="if ($(this).get('checked')) { lsStream.subscribe({$iUserId}) } else { lsStream.unsubscribe({$iUserId}) } " />
<a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a>
</li>
{/foreach}
</ul>
{/if}
</div></div>
<div class="bl"><div class="br"></div></div>
<p class="sp-note">{$aLang.stream_settings_note_filter}</p>
<ul class="stream-settings-filter">
{foreach from=$aStreamEventTypes key=sType item=aEventType}
<li>
<label>
<input class="streamEventTypeCheckbox input-checkbox"
type="checkbox"
id="strn_et_{$sType}"
{if in_array($sType, $aStreamTypesList)}checked="checked"{/if}
onClick="if ($(this).get('checked')) { lsStream.switchEventType( '{$sType}') } else { lsStream.switchEventType( '{$sType}') } " />
{assign var=langKey value="stream_event_type_`$sType`"}
{$aLang.$langKey}
</label>
</li>
{/foreach}
</ul>
<h3>{$aLang.stream_block_users_title}</h3>
<p class="sp-note">{$aLang.stream_settings_note_follow_user}</p>
<div class="stream-settings-userlist">
<p><input type="text" id="stream_users_complete" autocomplete="off" />
<a href="javascript:lsStream.appendUser()">{$aLang.stream_block_config_append}</a></p>
{if count($aStreamSubscribedUsers)}
<ul id="stream_block_users_list">
{foreach from=$aStreamSubscribedUsers item=oUser}
{assign var=iUserId value=$oUser->getId()}
{if !isset($aStreamFriends.$iUserId)}
<li><input class="streamUserCheckbox input-checkbox"
type="checkbox"
id="strm_u_{$iUserId}"
checked="checked"
onClick="if ($(this).get('checked')) { lsStream.subscribe({$iUserId}) } else { lsStream.unsubscribe({$iUserId}) } " />
<a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a>
</li>
{/if}
{/foreach}
</ul>
{else}
<ul id="stream_block_users_list"></ul>
<p id="stream_no_subscribed_users">{$aLang.stream_no_subscribed_users}</p>
{/if}
</div>
{if count($aStreamFriends)}
<h3>{$aLang.stream_block_users_friends}</h3>
<p class="sp-note">{$aLang.stream_settings_note_follow_friend}</p>
<ul class="stream-settings-friends">
{foreach from=$aStreamFriends item=oUser}
{assign var=iUserId value=$oUser->getId()}
<li><input class="streamUserCheckbox input-checkbox"
type="checkbox"
id="strm_u_{$iUserId}"
{if isset($aStreamSubscribedUsers.$iUserId)} checked="checked"{/if}
onClick="if ($(this).get('checked')) { lsStream.subscribe({$iUserId}) } else { lsStream.unsubscribe({$iUserId}) } " />
<a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a>
</li>
{/foreach}
</ul>
{/if}
</div></div>
<div class="bl"><div class="br"></div></div>
</div>

View file

@ -1,54 +1,54 @@
{if count($aStreamEvents)}
<ul class="stream-list">
{foreach from=$aStreamEvents item=aEvent}
{assign var=initiatorId value=$aEvent.initiator}
{assign var=initiator value=$aStreamUsers.$initiatorId}
<li class="stream-item-type-{$aEvent.event_type}">
<ul class="stream-list">
{foreach from=$aStreamEvents item=aEvent}
{assign var=initiatorId value=$aEvent.initiator}
{assign var=initiator value=$aStreamUsers.$initiatorId}
<li class="stream-item-type-{$aEvent.event_type}">
<a href="{$initiator->getUserWebPath()}"><img src="{$initiator->getProfileAvatarPath(48)}" alt="avatar" class="avatar" /></a>
<span class="date">{date_format date=$aEvent.date_added}</span>
<a href="{$initiator->getUserWebPath()}"><strong>{$initiator->getLogin()}</strong></a>
{if $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_TOPIC.id}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_COMMENT.id}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.ADD_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_add_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_vote_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_TOPIC.id}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_COMMENT.id}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.VOTE_USER.id}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$user}
{$aLang.stream_list_event_vote_user} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.JOIN_BLOG.id}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_join_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == $STREAM_EVENT_TYPE.MAKE_FRIENDS.id}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$aLang.stream_list_event_make_friends} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{/if}
</li>
{/foreach}
</ul>
{if $aEvent.event_type == 'add_topic'}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'add_comment'}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_add_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'add_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_add_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_vote_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_topic'}
{assign var=topicId value=$aEvent.target_id}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_topic} <a href="{$topic->getUrl()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_comment'}
{assign var=commentId value=$aEvent.target_id}
{assign var=topicId value=$aStreamComments.$commentId->getTargetId()}
{assign var=topic value=$aStreamTopics.$topicId}
{$aLang.stream_list_event_vote_comment} <a href="{$topic->getUrl()}#comment{$aStreamComments.$commentId->getId()}">{$topic->getTitle()}</a>
{elseif $aEvent.event_type == 'vote_user'}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$user}
{$aLang.stream_list_event_vote_user} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{elseif $aEvent.event_type == 'join_blog'}
{assign var=blogId value=$aEvent.target_id}
{assign var=blog value=$aStreamBlogs.$blogId}
{$aLang.stream_list_event_join_blog} <a href="{$blog->getUrl()}">{$blog->getTitle()}</a>
{elseif $aEvent.event_type == 'make_friends'}
{assign var=userId value=$aEvent.target_id}
{assign var=user value=$aStreamUsers.$userId}
{$aLang.stream_list_event_make_friends} <a href="{$user->getUserWebPath()}">{$user->getLogin()}</a>
{/if}
</li>
{/foreach}
</ul>
{/if}