1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 01:14:24 +03:00
ifhub.club/classes/actions/ActionPersonalBlog.class.php

199 lines
5.3 KiB
PHP
Raw Normal View History

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/
*
*/
class ActionPersonalBlog extends Action {
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');
/**
* Добавляем блоки для отображения
*/
$this->Viewer_AddBlocks('right',array('comments','tags'));
2008-09-21 09:36:57 +03:00
}
/**
* Регистрируем необходимые евенты
*
*/
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);
}
}
?>