mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
This commit is contained in:
parent
61181c436a
commit
510ae944ad
|
@ -113,10 +113,12 @@ class ActionBlog extends Action {
|
|||
* Регистрируем евенты, по сути определяем УРЛы вида /blog/.../
|
||||
*
|
||||
*/
|
||||
protected function RegisterEvent() {
|
||||
$this->AddEvent('good','EventGood');
|
||||
$this->AddEvent('bad','EventBad');
|
||||
$this->AddEvent('new','EventNew');
|
||||
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');
|
||||
|
||||
$this->AddEvent('add','EventAddBlog');
|
||||
$this->AddEvent('edit','EventEditBlog');
|
||||
$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=$aMatch[1];
|
||||
} else {
|
||||
$iPage=1;
|
||||
}
|
||||
$iPage=$this->GetParamEventMatch(0,2) ? $this->GetParamEventMatch(0,2) : 1;
|
||||
/**
|
||||
* Получаем список топиков
|
||||
*/
|
||||
$aResult=$this->Topic_GetTopicsCollectiveGood($iPage,BLOG_TOPIC_PER_PAGE);
|
||||
$aResult=$this->Topic_GetTopicsCollective($iPage,BLOG_TOPIC_PER_PAGE,$sShowType);
|
||||
$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');
|
||||
}
|
||||
/**
|
||||
* Вывод новых топиков из коллективных блогов
|
||||
*
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Показ топика из персонального блога
|
||||
*
|
||||
|
|
|
@ -506,63 +506,41 @@ class LsTopic extends Module {
|
|||
return $data;
|
||||
}
|
||||
/**
|
||||
* Получает список топиков хороших из коллективных блогов
|
||||
* список топиков из коллективных блогов
|
||||
*
|
||||
* @param unknown_type $iPage
|
||||
* @param unknown_type $iPerPage
|
||||
* @param unknown_type $sShowType
|
||||
* @return unknown
|
||||
*/
|
||||
public function GetTopicsCollectiveGood($iPage,$iPerPage) {
|
||||
public function GetTopicsCollective($iPage,$iPerPage,$sShowType='good') {
|
||||
$aFilter=array(
|
||||
'blog_type' => array(
|
||||
'open',
|
||||
),
|
||||
'topic_publish' => 1,
|
||||
'topic_rating' => array(
|
||||
'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
|
||||
'type' => 'top',
|
||||
),
|
||||
'topic_publish' => 1,
|
||||
);
|
||||
return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage);
|
||||
}
|
||||
/**
|
||||
* Получает список топиков плохих из коллективных блогов
|
||||
*
|
||||
* @param unknown_type $iPage
|
||||
* @param unknown_type $iPerPage
|
||||
* @return unknown
|
||||
*/
|
||||
public function GetTopicsCollectiveBad($iPage,$iPerPage) {
|
||||
$aFilter=array(
|
||||
'blog_type' => array(
|
||||
'open',
|
||||
),
|
||||
'topic_publish' => 1,
|
||||
'topic_rating' => array(
|
||||
'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
|
||||
'type' => 'down',
|
||||
),
|
||||
);
|
||||
return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage);
|
||||
switch ($sShowType) {
|
||||
case 'good':
|
||||
$aFilter['topic_rating']=array(
|
||||
'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
|
||||
'type' => 'top',
|
||||
);
|
||||
break;
|
||||
case 'bad':
|
||||
$aFilter['topic_rating']=array(
|
||||
'value' => BLOG_COLLECTIVE_LIMIT_GOOD,
|
||||
'type' => 'down',
|
||||
);
|
||||
break;
|
||||
case 'new':
|
||||
$aFilter['topic_new']=date("Y-m-d H:00:00",time()-BLOG_TOPIC_NEW_TIME);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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);
|
||||
}
|
||||
/**
|
||||
* Получает число новых топиков в коллективных блогах
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue