mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-16 21:34:25 +03:00
199 lines
5.3 KiB
PHP
199 lines
5.3 KiB
PHP
|
<?
|
|||
|
/*-------------------------------------------------------
|
|||
|
*
|
|||
|
* 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/
|
|||
|
*
|
|||
|
*/
|
|||
|
class ActionLog extends Action {
|
|||
|
/**
|
|||
|
* Меню
|
|||
|
*
|
|||
|
* @var unknown_type
|
|||
|
*/
|
|||
|
protected $sMenuItemSelect='log';
|
|||
|
/**
|
|||
|
* Субменю
|
|||
|
*
|
|||
|
* @var unknown_type
|
|||
|
*/
|
|||
|
protected $sMenuSubItemSelect='good';
|
|||
|
|
|||
|
/**
|
|||
|
* Инициализация
|
|||
|
*
|
|||
|
*/
|
|||
|
public function Init() {
|
|||
|
$this->SetDefaultEvent('good');
|
|||
|
/**
|
|||
|
* Добавляем блоки для отображения
|
|||
|
*/
|
|||
|
$this->Viewer_AddBlocksRight(array('comments','tags'));
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Регистрируем необходимые евенты
|
|||
|
*
|
|||
|
*/
|
|||
|
protected function RegisterEvent() {
|
|||
|
$this->AddEvent('good','EventGood');
|
|||
|
$this->AddEvent('bad','EventBad');
|
|||
|
$this->AddEvent('new','EventNew');
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**********************************************************************************
|
|||
|
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
|
|||
|
**********************************************************************************
|
|||
|
*/
|
|||
|
|
|||
|
/**
|
|||
|
* Выводит хорошие топики
|
|||
|
*
|
|||
|
*/
|
|||
|
protected function EventGood() {
|
|||
|
/**
|
|||
|
* Меню
|
|||
|
*/
|
|||
|
$this->sMenuSubItemSelect='good';
|
|||
|
/**
|
|||
|
* Передан ли номер страницы
|
|||
|
*/
|
|||
|
if (preg_match("/^page(\d+)$/i",$this->getParam(0),$aMatch)) {
|
|||
|
$iPage=$aMatch[1];
|
|||
|
} else {
|
|||
|
$iPage=1;
|
|||
|
}
|
|||
|
/**
|
|||
|
* Получаем список топиков
|
|||
|
*/
|
|||
|
$iCount=0;
|
|||
|
$aResult=$this->Topic_GetTopicsPersonalGood($iCount,$iPage,BLOG_TOPIC_PER_PAGE);
|
|||
|
$aTopics=$aResult['collection'];
|
|||
|
/**
|
|||
|
* Формируем постраничность
|
|||
|
*/
|
|||
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/log/good');
|
|||
|
/**
|
|||
|
* Загружаем переменные в шаблон
|
|||
|
*/
|
|||
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|||
|
$this->Viewer_Assign('aTopics',$aTopics);
|
|||
|
/**
|
|||
|
* Устанавливаем шаблон вывода
|
|||
|
*/
|
|||
|
$this->SetTemplateAction('index');
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Выводит плохие топики
|
|||
|
*
|
|||
|
*/
|
|||
|
protected function EventBad() {
|
|||
|
/**
|
|||
|
* Меню
|
|||
|
*/
|
|||
|
$this->sMenuSubItemSelect='bad';
|
|||
|
/**
|
|||
|
* Передан ли номер страницы
|
|||
|
*/
|
|||
|
if (preg_match("/^page(\d+)$/i",$this->getParam(0),$aMatch)) {
|
|||
|
$iPage=$aMatch[1];
|
|||
|
} else {
|
|||
|
$iPage=1;
|
|||
|
}
|
|||
|
/**
|
|||
|
* Получаем список топиков
|
|||
|
*/
|
|||
|
$iCount=0;
|
|||
|
$aResult=$this->Topic_GetTopicsPersonalBad($iCount,$iPage,BLOG_TOPIC_PER_PAGE);
|
|||
|
$aTopics=$aResult['collection'];
|
|||
|
/**
|
|||
|
* Формируем постраничность
|
|||
|
*/
|
|||
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/log/bad');
|
|||
|
/**
|
|||
|
* Загружаем переменные в шаблон
|
|||
|
*/
|
|||
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|||
|
$this->Viewer_Assign('aTopics',$aTopics);
|
|||
|
/**
|
|||
|
* Устанавливаем шаблон вывода
|
|||
|
*/
|
|||
|
$this->SetTemplateAction('index');
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Выводит новые топики
|
|||
|
*
|
|||
|
*/
|
|||
|
protected function EventNew() {
|
|||
|
/**
|
|||
|
* Меню
|
|||
|
*/
|
|||
|
$this->sMenuSubItemSelect='new';
|
|||
|
/**
|
|||
|
* Передан ли номер страницы
|
|||
|
*/
|
|||
|
if (preg_match("/^page(\d+)$/i",$this->getParam(0),$aMatch)) {
|
|||
|
$iPage=$aMatch[1];
|
|||
|
} else {
|
|||
|
$iPage=1;
|
|||
|
}
|
|||
|
/**
|
|||
|
* Получаем список топиков
|
|||
|
*/
|
|||
|
$iCount=0;
|
|||
|
$aResult=$this->Topic_GetTopicsPersonalNew($iCount,$iPage,BLOG_TOPIC_PER_PAGE);
|
|||
|
$aTopics=$aResult['collection'];
|
|||
|
/**
|
|||
|
* Формируем постраничность
|
|||
|
*/
|
|||
|
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/log/bad');
|
|||
|
/**
|
|||
|
* Загружаем переменные в шаблон
|
|||
|
*/
|
|||
|
$this->Viewer_Assign('aPaging',$aPaging);
|
|||
|
$this->Viewer_Assign('aTopics',$aTopics);
|
|||
|
/**
|
|||
|
* Устанавливаем шаблон вывода
|
|||
|
*/
|
|||
|
$this->SetTemplateAction('index');
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* При завершении экшена загружаем в шаблон необходимые переменные
|
|||
|
*
|
|||
|
*/
|
|||
|
public function EventShutdown() {
|
|||
|
/**
|
|||
|
* Подсчитываем новые топики
|
|||
|
*/
|
|||
|
$iCountTopicsCollectiveNew=$this->Topic_GetCountTopicsCollectiveNew();
|
|||
|
$iCountTopicsPersonalNew=$this->Topic_GetCountTopicsPersonalNew();
|
|||
|
$iCountTopicsNew=$iCountTopicsCollectiveNew+$iCountTopicsPersonalNew;
|
|||
|
/**
|
|||
|
* Загружаем переменные в шаблон
|
|||
|
*/
|
|||
|
$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);
|
|||
|
}
|
|||
|
}
|
|||
|
?>
|