2009-05-10 10:50:39 +03:00
|
|
|
|
<?php
|
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
|
|
|
|
|
*
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Обработка персональных блогов, т.е. УРла вида /log/
|
|
|
|
|
*
|
|
|
|
|
*/
|
2008-10-30 08:12:44 +02:00
|
|
|
|
class ActionPersonalBlog extends Action {
|
2009-02-14 13:56:04 +02:00
|
|
|
|
/**
|
|
|
|
|
* Главное меню
|
|
|
|
|
*
|
|
|
|
|
* @var unknown_type
|
|
|
|
|
*/
|
|
|
|
|
protected $sMenuHeadItemSelect='blog';
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Меню
|
|
|
|
|
*
|
|
|
|
|
* @var unknown_type
|
|
|
|
|
*/
|
|
|
|
|
protected $sMenuItemSelect='log';
|
|
|
|
|
/**
|
|
|
|
|
* Субменю
|
|
|
|
|
*
|
|
|
|
|
* @var unknown_type
|
|
|
|
|
*/
|
|
|
|
|
protected $sMenuSubItemSelect='good';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Инициализация
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function Init() {
|
|
|
|
|
$this->SetDefaultEvent('good');
|
|
|
|
|
/**
|
|
|
|
|
* Добавляем блоки для отображения
|
|
|
|
|
*/
|
2009-01-10 21:28:03 +02:00
|
|
|
|
$this->Viewer_AddBlocks('right',array('stream','tags'));
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Регистрируем необходимые евенты
|
|
|
|
|
*
|
|
|
|
|
*/
|
2009-06-13 12:24:09 +03:00
|
|
|
|
protected function RegisterEvent() {
|
|
|
|
|
$this->AddEventPreg('/^good$/i','/^(page(\d+))?$/i','EventTopics');
|
|
|
|
|
$this->AddEvent('good','EventTopics');
|
|
|
|
|
$this->AddEventPreg('/^bad$/i','/^(page(\d+))?$/i','EventTopics');
|
|
|
|
|
$this->AddEventPreg('/^new$/i','/^(page(\d+))?$/i','EventTopics');
|
2008-09-21 09:36:57 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************************
|
|
|
|
|
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
|
|
|
|
|
**********************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
/**
|
2009-06-13 12:24:09 +03:00
|
|
|
|
* Показ топиков
|
2008-09-21 09:36:57 +03:00
|
|
|
|
*
|
|
|
|
|
*/
|
2009-06-13 12:24:09 +03:00
|
|
|
|
protected function EventTopics() {
|
|
|
|
|
$sShowType=$this->sCurrentEvent;
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Меню
|
|
|
|
|
*/
|
2009-06-13 12:24:09 +03:00
|
|
|
|
$this->sMenuSubItemSelect=$sShowType;
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Передан ли номер страницы
|
|
|
|
|
*/
|
2009-06-13 12:24:09 +03:00
|
|
|
|
$iPage=$this->GetParamEventMatch(0,2) ? $this->GetParamEventMatch(0,2) : 1;
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем список топиков
|
2009-06-13 12:24:09 +03:00
|
|
|
|
*/
|
2009-08-20 10:43:06 +03:00
|
|
|
|
$aResult=$this->Topic_GetTopicsPersonal($iPage,Config::Get('module.topic.per_page'),$sShowType);
|
2009-06-13 12:24:09 +03:00
|
|
|
|
$aTopics=$aResult['collection'];
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Формируем постраничность
|
|
|
|
|
*/
|
2009-08-20 10:43:06 +03:00
|
|
|
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,Config::Get('module.topic.per_page'),4,Router::GetPath('personal_blog').$sShowType);
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
2009-06-13 12:24:09 +03:00
|
|
|
|
* Вызов хуков
|
2008-09-21 09:36:57 +03:00
|
|
|
|
*/
|
2009-06-13 12:24:09 +03:00
|
|
|
|
$this->Hook_Run('personal_show',array('sShowType'=>$sShowType));
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
2009-06-13 12:24:09 +03:00
|
|
|
|
$this->Viewer_Assign('aTopics',$aTopics);
|
|
|
|
|
$this->Viewer_Assign('aPaging',$aPaging);
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* Устанавливаем шаблон вывода
|
|
|
|
|
*/
|
|
|
|
|
$this->SetTemplateAction('index');
|
2009-06-13 12:24:09 +03:00
|
|
|
|
}
|
2008-09-21 09:36:57 +03:00
|
|
|
|
/**
|
|
|
|
|
* При завершении экшена загружаем в шаблон необходимые переменные
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function EventShutdown() {
|
|
|
|
|
/**
|
|
|
|
|
* Подсчитываем новые топики
|
|
|
|
|
*/
|
|
|
|
|
$iCountTopicsCollectiveNew=$this->Topic_GetCountTopicsCollectiveNew();
|
|
|
|
|
$iCountTopicsPersonalNew=$this->Topic_GetCountTopicsPersonalNew();
|
|
|
|
|
$iCountTopicsNew=$iCountTopicsCollectiveNew+$iCountTopicsPersonalNew;
|
|
|
|
|
/**
|
|
|
|
|
* Загружаем переменные в шаблон
|
|
|
|
|
*/
|
2009-02-14 13:56:04 +02:00
|
|
|
|
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
|
2008-09-21 09:36:57 +03:00
|
|
|
|
$this->Viewer_Assign('sMenuItemSelect',$this->sMenuItemSelect);
|
|
|
|
|
$this->Viewer_Assign('sMenuSubItemSelect',$this->sMenuSubItemSelect);
|
|
|
|
|
$this->Viewer_Assign('iCountTopicsCollectiveNew',$iCountTopicsCollectiveNew);
|
|
|
|
|
$this->Viewer_Assign('iCountTopicsPersonalNew',$iCountTopicsPersonalNew);
|
|
|
|
|
$this->Viewer_Assign('iCountTopicsNew',$iCountTopicsNew);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|