2008-09-21 09:36:57 +03:00
|
|
|
|
<?
|
|
|
|
|
/*-------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* LiveStreet Engine Social Networking
|
|
|
|
|
* Copyright © 2008 Mzhelskiy Maxim
|
|
|
|
|
*
|
|
|
|
|
*--------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* Official site: www.livestreet.ru
|
|
|
|
|
* Contact e-mail: rus.engine@gmail.com
|
|
|
|
|
*
|
|
|
|
|
* GNU General Public License, version 2:
|
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
|
*
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Обрабатывает профайл юзера, т.е. УРЛ вида /profile/login/
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
class ActionProfile extends Action {
|
|
|
|
|
/**
|
|
|
|
|
* Логин юзера из УРЛа
|
|
|
|
|
*
|
|
|
|
|
* @var unknown_type
|
|
|
|
|
*/
|
|
|
|
|
protected $sUserLogin=null;
|
|
|
|
|
/**
|
|
|
|
|
* Объект юзера чей профиль мы смотрим
|
|
|
|
|
*
|
|
|
|
|
* @var unknown_type
|
|
|
|
|
*/
|
|
|
|
|
protected $oUserProfile;
|
|
|
|
|
|
2009-01-13 23:13:36 +02:00
|
|
|
|
public function Init() {
|
|
|
|
|
$this->Viewer_AddBlocks('right',array('actions/ActionProfile/sidebar.tpl'));
|
|
|
|
|
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
|
2009-03-01 13:59:53 +02:00
|
|
|
|
protected function RegisterEvent() {
|
|
|
|
|
$this->AddEventPreg('/^[\w\-\_]+$/i','/^(whois)?$/i','EventWhois');
|
|
|
|
|
$this->AddEventPreg('/^[\w\-\_]+$/i','/^favourites$/i','/^(page(\d+))?$/i','EventFavourite');
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************************
|
|
|
|
|
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
|
|
|
|
|
**********************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
/**
|
2009-03-01 13:59:53 +02:00
|
|
|
|
* Выводит список избранноего юзера
|
2008-09-21 09:36:57 +03:00
|
|
|
|
*
|
|
|
|
|
*/
|
2009-03-01 13:59:53 +02:00
|
|
|
|
protected function EventFavourite() {
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем логин из УРЛа
|
|
|
|
|
*/
|
2009-03-01 13:59:53 +02:00
|
|
|
|
$sUserLogin=$this->sCurrentEvent;
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Проверяем есть ли такой юзер
|
|
|
|
|
*/
|
2009-03-01 13:59:53 +02:00
|
|
|
|
if (!($this->oUserProfile=$this->User_GetUserByLogin($sUserLogin))) {
|
2008-09-21 09:36:57 +03:00
|
|
|
|
return parent::EventNotFound();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Передан ли номер страницы
|
2009-03-01 13:59:53 +02:00
|
|
|
|
*/
|
|
|
|
|
$iPage=$this->GetParamEventMatch(1,2) ? $this->GetParamEventMatch(1,2) : 1;
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем список избранных топиков
|
|
|
|
|
*/
|
|
|
|
|
$iCount=0;
|
|
|
|
|
$aResult=$this->Topic_GetTopicsFavouriteByUserId($this->oUserProfile->getId(),$iCount,$iPage,BLOG_TOPIC_PER_PAGE);
|
|
|
|
|
$aTopics=$aResult['collection'];
|
|
|
|
|
/**
|
|
|
|
|
* Формируем постраничность
|
|
|
|
|
*/
|
2009-05-02 08:28:52 +03:00
|
|
|
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/'.ROUTE_PAGE_PROFILE.'/'.$this->oUserProfile->getLogin().'/favourites');
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
|
|
|
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|
|
|
|
$this->Viewer_Assign('aTopics',$aTopics);
|
2009-04-07 17:59:43 +03:00
|
|
|
|
$this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile').' '.$this->oUserProfile->getLogin());
|
|
|
|
|
$this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile_favourites'));
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Устанавливаем шаблон вывода
|
|
|
|
|
*/
|
|
|
|
|
$this->SetTemplateAction('favourites');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Показывает инфу профиля
|
|
|
|
|
*
|
|
|
|
|
*/
|
2009-03-01 13:59:53 +02:00
|
|
|
|
protected function EventWhois() {
|
|
|
|
|
/**
|
|
|
|
|
* Получаем логин из УРЛа
|
|
|
|
|
*/
|
|
|
|
|
$sUserLogin=$this->sCurrentEvent;
|
|
|
|
|
/**
|
|
|
|
|
* Проверяем есть ли такой юзер
|
|
|
|
|
*/
|
|
|
|
|
if (!($this->oUserProfile=$this->User_GetUserByLogin($sUserLogin))) {
|
|
|
|
|
return parent::EventNotFound();
|
|
|
|
|
}
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем список друзей
|
|
|
|
|
*/
|
|
|
|
|
$aUsersFrend=$this->User_GetUsersFrend($this->oUserProfile->getId());
|
2008-09-28 23:07:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем список тех у кого в друзьях
|
|
|
|
|
*/
|
|
|
|
|
$aUsersSelfFrend=$this->User_GetUsersSelfFrend($this->oUserProfile->getId());
|
2008-10-16 07:29:15 +03:00
|
|
|
|
|
|
|
|
|
if (USER_USE_INVITE) {
|
|
|
|
|
/**
|
|
|
|
|
* Получаем список тех кого пригласил юзер
|
|
|
|
|
*/
|
|
|
|
|
$aUsersInvite=$this->User_GetUsersInvite($this->oUserProfile->getId());
|
|
|
|
|
$this->Viewer_Assign('aUsersInvite',$aUsersInvite);
|
|
|
|
|
/**
|
|
|
|
|
* Получаем того юзера, кто пригласил текущего
|
|
|
|
|
*/
|
|
|
|
|
$oUserInviteFrom=$this->User_GetUserInviteFrom($this->oUserProfile->getId());
|
|
|
|
|
$this->Viewer_Assign('oUserInviteFrom',$oUserInviteFrom);
|
|
|
|
|
}
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем список блогов в которых состоит юзер
|
|
|
|
|
*/
|
2009-05-06 23:14:41 +03:00
|
|
|
|
$aBlogsUser=$this->Blog_GetRelationBlogUsersByUserId($this->oUserProfile->getId(),0);
|
|
|
|
|
$aBlogsModeration=$this->Blog_GetRelationBlogUsersByUserId($this->oUserProfile->getId(),1);
|
|
|
|
|
$aBlogsAdministration=$this->Blog_GetRelationBlogUsersByUserId($this->oUserProfile->getId(),2);
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем список блогов которые создал юзер
|
|
|
|
|
*/
|
2009-05-09 20:53:25 +03:00
|
|
|
|
$aBlogsOwner=$this->Blog_GetBlogsByOwnerId($this->oUserProfile->getId());
|
|
|
|
|
/**
|
|
|
|
|
* Вызов хуков
|
|
|
|
|
*/
|
|
|
|
|
$this->Hook_Run('profile_whois_show',array("oUserProfile"=>$this->oUserProfile));
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
|
|
|
|
$this->Viewer_Assign('aBlogsUser',$aBlogsUser);
|
2009-05-06 23:14:41 +03:00
|
|
|
|
$this->Viewer_Assign('aBlogsModeration',$aBlogsModeration);
|
|
|
|
|
$this->Viewer_Assign('aBlogsAdministration',$aBlogsAdministration);
|
2008-09-21 09:36:57 +03:00
|
|
|
|
$this->Viewer_Assign('aBlogsOwner',$aBlogsOwner);
|
2008-10-16 07:29:15 +03:00
|
|
|
|
$this->Viewer_Assign('aUsersFrend',$aUsersFrend);
|
2008-09-28 23:07:57 +03:00
|
|
|
|
$this->Viewer_Assign('aUsersSelfFrend',$aUsersSelfFrend);
|
2009-04-07 17:59:43 +03:00
|
|
|
|
$this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile').' '.$this->oUserProfile->getLogin());
|
|
|
|
|
$this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile_whois'));
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Устанавливаем шаблон вывода
|
|
|
|
|
*/
|
|
|
|
|
$this->SetTemplateAction('whois');
|
2009-03-01 13:59:53 +02:00
|
|
|
|
}
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
2009-03-01 13:59:53 +02:00
|
|
|
|
* Выполняется при завершении работы экшена
|
2008-09-21 09:36:57 +03:00
|
|
|
|
*
|
|
|
|
|
*/
|
2009-03-01 13:59:53 +02:00
|
|
|
|
public function EventShutdown() {
|
|
|
|
|
if (!$this->oUserProfile) {
|
|
|
|
|
return ;
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
/**
|
2009-03-01 13:59:53 +02:00
|
|
|
|
* Загружаем в шаблон необходимые переменные
|
2008-09-21 09:36:57 +03:00
|
|
|
|
*/
|
2009-03-01 13:59:53 +02:00
|
|
|
|
$iCountTopicFavourite=$this->Topic_GetCountTopicsFavouriteByUserId($this->oUserProfile->getId());
|
|
|
|
|
$iCountTopicUser=$this->Topic_GetCountTopicsPersonalByUser($this->oUserProfile->getId(),1);
|
|
|
|
|
$iCountCommentUser=$this->Comment_GetCountCommentsByUserId($this->oUserProfile->getId());
|
|
|
|
|
$this->Viewer_Assign('oUserProfile',$this->oUserProfile);
|
|
|
|
|
$this->Viewer_Assign('iCountTopicUser',$iCountTopicUser);
|
|
|
|
|
$this->Viewer_Assign('iCountCommentUser',$iCountCommentUser);
|
|
|
|
|
$this->Viewer_Assign('iCountTopicFavourite',$iCountTopicFavourite);
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|