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
|
|
|
|
|
*
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Обработка статистики юзеров, т.е. УРЛа вида /people/
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
class ActionPeople extends Action {
|
2009-02-14 13:56:04 +02:00
|
|
|
|
/**
|
|
|
|
|
* Главное меню
|
|
|
|
|
*
|
|
|
|
|
* @var unknown_type
|
|
|
|
|
*/
|
|
|
|
|
protected $sMenuHeadItemSelect='people';
|
2008-09-21 09:36:57 +03:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Инициализация
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function Init() {
|
|
|
|
|
$this->SetDefaultEvent('good');
|
|
|
|
|
$this->Viewer_AddHtmlTitle('Люди');
|
2009-01-18 22:38:45 +02:00
|
|
|
|
|
|
|
|
|
$this->Viewer_AddBlocks('right',array('actions/ActionPeople/sidebar.tpl'));
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Регистрируем евенты
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function RegisterEvent() {
|
|
|
|
|
$this->AddEvent('good','EventGood');
|
|
|
|
|
$this->AddEvent('bad','EventBad');
|
2009-01-20 21:45:16 +02:00
|
|
|
|
$this->AddEvent('online','EventOnline');
|
|
|
|
|
$this->AddEvent('new','EventNew');
|
2009-01-24 00:46:27 +02:00
|
|
|
|
$this->AddEvent('country','EventCountry');
|
|
|
|
|
$this->AddEvent('city','EventCity');
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************************
|
|
|
|
|
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
|
|
|
|
|
**********************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
2009-01-24 00:46:27 +02:00
|
|
|
|
/**
|
|
|
|
|
* Показывает юзеров по стране
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function EventCountry() {
|
|
|
|
|
if (!($oCountry=$this->User_GetCountryByName(urldecode($this->getParam(0))))) {
|
|
|
|
|
$this->Message_AddErrorSingle('Страна не найдена',$this->Lang_Get('error'));
|
|
|
|
|
return Router::Action('error');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику
|
|
|
|
|
*/
|
|
|
|
|
$this->GetStats();
|
|
|
|
|
/**
|
|
|
|
|
* Передан ли номер страницы
|
|
|
|
|
*/
|
|
|
|
|
if (preg_match("/^page(\d+)$/i",$this->getParam(1),$aMatch)) {
|
|
|
|
|
$iPage=$aMatch[1];
|
|
|
|
|
} else {
|
|
|
|
|
$iPage=1;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получаем список юзеров
|
|
|
|
|
*/
|
|
|
|
|
$iCount=0;
|
|
|
|
|
$aResult=$this->User_GetUsersByCountry($oCountry->getName(),$iPage,USER_PER_PAGE);
|
|
|
|
|
$aUsersCountry=$aResult['collection'];
|
|
|
|
|
/**
|
|
|
|
|
* Формируем постраничность
|
|
|
|
|
*/
|
|
|
|
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,USER_PER_PAGE,4,DIR_WEB_ROOT.'/people/'.$this->sCurrentEvent.'/'.$oCountry->getName());
|
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
|
|
|
|
if ($aUsersCountry) {
|
|
|
|
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|
|
|
|
}
|
|
|
|
|
$this->Viewer_Assign('oCountry',$oCountry);
|
|
|
|
|
$this->Viewer_Assign('aUsersCountry',$aUsersCountry);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Показывает юзеров по городу
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function EventCity() {
|
|
|
|
|
if (!($oCity=$this->User_GetCityByName(urldecode($this->getParam(0))))) {
|
|
|
|
|
$this->Message_AddErrorSingle('Город не найден',$this->Lang_Get('error'));
|
|
|
|
|
return Router::Action('error');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику
|
|
|
|
|
*/
|
|
|
|
|
$this->GetStats();
|
|
|
|
|
/**
|
|
|
|
|
* Передан ли номер страницы
|
|
|
|
|
*/
|
|
|
|
|
if (preg_match("/^page(\d+)$/i",$this->getParam(1),$aMatch)) {
|
|
|
|
|
$iPage=$aMatch[1];
|
|
|
|
|
} else {
|
|
|
|
|
$iPage=1;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получаем список юзеров
|
|
|
|
|
*/
|
|
|
|
|
$iCount=0;
|
|
|
|
|
$aResult=$this->User_GetUsersByCity($oCity->getName(),$iPage,USER_PER_PAGE);
|
|
|
|
|
$aUsersCity=$aResult['collection'];
|
|
|
|
|
/**
|
|
|
|
|
* Формируем постраничность
|
|
|
|
|
*/
|
|
|
|
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,USER_PER_PAGE,4,DIR_WEB_ROOT.'/people/'.$this->sCurrentEvent.'/'.$oCity->getName());
|
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
|
|
|
|
if ($aUsersCity) {
|
|
|
|
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|
|
|
|
}
|
|
|
|
|
$this->Viewer_Assign('oCity',$oCity);
|
|
|
|
|
$this->Viewer_Assign('aUsersCity',$aUsersCity);
|
|
|
|
|
}
|
2009-01-20 21:45:16 +02:00
|
|
|
|
/**
|
|
|
|
|
* Показываем последних на сайте
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function EventOnline() {
|
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику
|
|
|
|
|
*/
|
|
|
|
|
$this->GetStats();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Показываем новых на сайте
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function EventNew() {
|
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику
|
|
|
|
|
*/
|
|
|
|
|
$this->GetStats();
|
|
|
|
|
}
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Показываем хороших юзеров
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function EventGood() {
|
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику
|
|
|
|
|
*/
|
|
|
|
|
$this->GetStats();
|
|
|
|
|
/**
|
|
|
|
|
* Получаем хороших юзеров
|
|
|
|
|
*/
|
|
|
|
|
$this->GetUserRating('good');
|
|
|
|
|
/**
|
|
|
|
|
* Устанавливаем шаблон вывода
|
|
|
|
|
*/
|
|
|
|
|
$this->SetTemplateAction('index');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Показываем плохих юзеров
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function EventBad() {
|
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику
|
|
|
|
|
*/
|
|
|
|
|
$this->GetStats();
|
|
|
|
|
/**
|
|
|
|
|
* Получаем хороших юзеров
|
|
|
|
|
*/
|
|
|
|
|
$this->GetUserRating('bad');
|
|
|
|
|
/**
|
|
|
|
|
* Устанавливаем шаблон вывода
|
|
|
|
|
*/
|
|
|
|
|
$this->SetTemplateAction('index');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получение статистики
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
protected function GetStats() {
|
|
|
|
|
/**
|
|
|
|
|
* Последние по визиту на сайт
|
|
|
|
|
*/
|
|
|
|
|
$aUsersLast=$this->User_GetUsersByDateLast(15);
|
|
|
|
|
/**
|
|
|
|
|
* Последние по регистрации
|
|
|
|
|
*/
|
|
|
|
|
$aUsersRegister=$this->User_GetUsersByDateRegister(15);
|
|
|
|
|
/**
|
|
|
|
|
* Статистика кто, где и т.п.
|
|
|
|
|
*/
|
|
|
|
|
$aStat=$this->User_GetStatUsers();
|
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
|
|
|
|
$this->Viewer_Assign('aUsersLast',$aUsersLast);
|
|
|
|
|
$this->Viewer_Assign('aUsersRegister',$aUsersRegister);
|
|
|
|
|
$this->Viewer_Assign('aStat',$aStat);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получаем список юзеров
|
|
|
|
|
*
|
|
|
|
|
* @param unknown_type $sType
|
|
|
|
|
*/
|
|
|
|
|
protected function GetUserRating($sType) {
|
|
|
|
|
/**
|
|
|
|
|
* Передан ли номер страницы
|
|
|
|
|
*/
|
|
|
|
|
if (preg_match("/^page(\d+)$/i",$this->getParam(0),$aMatch)) {
|
|
|
|
|
$iPage=$aMatch[1];
|
|
|
|
|
} else {
|
|
|
|
|
$iPage=1;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Получаем список юзеров
|
|
|
|
|
*/
|
|
|
|
|
$iCount=0;
|
|
|
|
|
$aResult=$this->User_GetUsersRating($sType,$iCount,$iPage,USER_PER_PAGE);
|
|
|
|
|
$aUsersRating=$aResult['collection'];
|
|
|
|
|
/**
|
|
|
|
|
* Формируем постраничность
|
|
|
|
|
*/
|
|
|
|
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,USER_PER_PAGE,4,DIR_WEB_ROOT.'/people/'.$this->sCurrentEvent);
|
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
|
|
|
|
if ($aUsersRating) {
|
|
|
|
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|
|
|
|
}
|
|
|
|
|
$this->Viewer_Assign('aUsersRating',$aUsersRating);
|
|
|
|
|
}
|
2009-02-14 13:56:04 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Выполняется при завершении работы экшена
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function EventShutdown() {
|
|
|
|
|
/**
|
|
|
|
|
* Загружаем в шаблон необходимые переменные
|
|
|
|
|
*/
|
|
|
|
|
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
|
|
|
|
|
}
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
?>
|