1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-03 06:55:03 +03:00
This commit is contained in:
Mzhelskiy Maxim 2009-06-07 18:40:54 +00:00
parent 61181c436a
commit 510ae944ad
2 changed files with 39 additions and 144 deletions

View file

@ -113,10 +113,12 @@ class ActionBlog extends Action {
* Регистрируем евенты, по сути определяем УРЛы вида /blog/.../ * Регистрируем евенты, по сути определяем УРЛы вида /blog/.../
* *
*/ */
protected function RegisterEvent() { protected function RegisterEvent() {
$this->AddEvent('good','EventGood'); $this->AddEventPreg('/^good$/i','/^(page(\d+))?$/i','EventTopics');
$this->AddEvent('bad','EventBad'); $this->AddEvent('good','EventTopics');
$this->AddEvent('new','EventNew'); $this->AddEventPreg('/^bad$/i','/^(page(\d+))?$/i','EventTopics');
$this->AddEventPreg('/^new$/i','/^(page(\d+))?$/i','EventTopics');
$this->AddEvent('add','EventAddBlog'); $this->AddEvent('add','EventAddBlog');
$this->AddEvent('edit','EventEditBlog'); $this->AddEvent('edit','EventEditBlog');
$this->AddEvent('admin','EventAdminBlog'); $this->AddEvent('admin','EventAdminBlog');
@ -502,35 +504,32 @@ class ActionBlog extends Action {
} }
/** /**
* Вывод хороших топиков из коллективных блогов * Показ всех топиков
* *
*/ */
protected function EventGood() { protected function EventTopics() {
$sShowType=$this->sCurrentEvent;
/** /**
* Меню * Меню
*/ */
$this->sMenuSubItemSelect='good'; $this->sMenuSubItemSelect=$sShowType;
/** /**
* Передан ли номер страницы * Передан ли номер страницы
*/ */
if (preg_match("/^page(\d+)$/i",$this->getParam(0),$aMatch)) { $iPage=$this->GetParamEventMatch(0,2) ? $this->GetParamEventMatch(0,2) : 1;
$iPage=$aMatch[1];
} else {
$iPage=1;
}
/** /**
* Получаем список топиков * Получаем список топиков
*/ */
$aResult=$this->Topic_GetTopicsCollectiveGood($iPage,BLOG_TOPIC_PER_PAGE); $aResult=$this->Topic_GetTopicsCollective($iPage,BLOG_TOPIC_PER_PAGE,$sShowType);
$aTopics=$aResult['collection']; $aTopics=$aResult['collection'];
/** /**
* Формируем постраничность * Формируем постраничность
*/ */
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/'.ROUTE_PAGE_BLOG.'/'.$this->sCurrentEvent); $aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/'.ROUTE_PAGE_BLOG.'/'.$sShowType);
/** /**
* Вызов хуков * Вызов хуков
*/ */
$this->Hook_Run('blog_good_show'); $this->Hook_Run('blog_show',array('sShowType'=>$sShowType));
/** /**
* Загружаем переменные в шаблон * Загружаем переменные в шаблон
*/ */
@ -539,90 +538,8 @@ class ActionBlog extends Action {
/** /**
* Устанавливаем шаблон вывода * Устанавливаем шаблон вывода
*/ */
$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;
}
/**
* Получаем список топиков
*/
$aResult=$this->Topic_GetTopicsCollectiveBad($iPage,BLOG_TOPIC_PER_PAGE);
$aTopics=$aResult['collection'];
/**
* Формируем постраничность
*/
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/'.ROUTE_PAGE_BLOG.'/'.$this->sCurrentEvent);
/**
* Вызов хуков
*/
$this->Hook_Run('blog_bad_show');
/**
* Загружаем переменные в шаблон
*/
$this->Viewer_Assign('aPaging',$aPaging);
$this->Viewer_Assign('aTopics',$aTopics);
/**
* Устанавливаем шаблон вывода
*/
$this->SetTemplateAction('index'); $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;
}
/**
* Получаем список топиков
*/
$aResult=$this->Topic_GetTopicsCollectiveNew($iPage,BLOG_TOPIC_PER_PAGE);
$aTopics=$aResult['collection'];
/**
* Формируем постраничность
*/
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,BLOG_TOPIC_PER_PAGE,4,DIR_WEB_ROOT.'/'.ROUTE_PAGE_BLOG.'/'.$this->sCurrentEvent);
/**
* Вызов хуков
*/
$this->Hook_Run('blog_new_show');
/**
* Загружаем переменные в шаблон
*/
$this->Viewer_Assign('aPaging',$aPaging);
$this->Viewer_Assign('aTopics',$aTopics);
/**
* Устанавливаем шаблон вывода
*/
$this->SetTemplateAction('index');
}
/** /**
* Показ топика из персонального блога * Показ топика из персонального блога
* *

View file

@ -506,63 +506,41 @@ class LsTopic extends Module {
return $data; return $data;
} }
/** /**
* Получает список топиков хороших из коллективных блогов * список топиков из коллективных блогов
* *
* @param unknown_type $iPage * @param unknown_type $iPage
* @param unknown_type $iPerPage * @param unknown_type $iPerPage
* @param unknown_type $sShowType
* @return unknown * @return unknown
*/ */
public function GetTopicsCollectiveGood($iPage,$iPerPage) { public function GetTopicsCollective($iPage,$iPerPage,$sShowType='good') {
$aFilter=array( $aFilter=array(
'blog_type' => array( 'blog_type' => array(
'open', 'open',
), ),
'topic_publish' => 1, 'topic_publish' => 1,
'topic_rating' => array(
'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
'type' => 'top',
),
); );
return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage); switch ($sShowType) {
} case 'good':
/** $aFilter['topic_rating']=array(
* Получает список топиков плохих из коллективных блогов 'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
* 'type' => 'top',
* @param unknown_type $iPage );
* @param unknown_type $iPerPage break;
* @return unknown case 'bad':
*/ $aFilter['topic_rating']=array(
public function GetTopicsCollectiveBad($iPage,$iPerPage) { 'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
$aFilter=array( 'type' => 'down',
'blog_type' => array( );
'open', break;
), case 'new':
'topic_publish' => 1, $aFilter['topic_new']=date("Y-m-d H:00:00",time()-BLOG_TOPIC_NEW_TIME);
'topic_rating' => array( break;
'value' => BLOG_COLLECTIVE_LIMIT_GOOD, default:
'type' => 'down', break;
), }
); return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage);
return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage);
} }
/**
* Получает список топиков новых из коллективных блогов
*
* @param unknown_type $iPage
* @param unknown_type $iPerPage
* @return unknown
*/
public function GetTopicsCollectiveNew($iPage,$iPerPage) {
$sDate=date("Y-m-d H:00:00",time()-BLOG_TOPIC_NEW_TIME);
$aFilter=array(
'blog_type' => array(
'open',
),
'topic_publish' => 1,
'topic_new' => $sDate,
);
return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage);
}
/** /**
* Получает число новых топиков в коллективных блогах * Получает число новых топиков в коллективных блогах
* *