1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Доработка бэкенда

This commit is contained in:
Denis Shakhov 2014-06-11 16:17:16 +07:00
parent 7531165532
commit f8bba6a1c2
5 changed files with 30 additions and 53 deletions

View file

@ -1845,8 +1845,14 @@ class ActionAjax extends Action {
if ($this->Comment_UpdateComment($oComment)) {
$oViewerLocal=$this->Viewer_GetLocalViewer();
$oViewerLocal->Assign('oUserCurrent',$this->oUserCurrent);
$oViewerLocal->Assign('bOneComment',true);
$oViewerLocal->Assign('oComment',$oComment);
$oViewerLocal->Assign('bOneComment',true, true);
if ($oComment->getTargetType() == 'topic') {
$oViewerLocal->Assign('bShowFavourite', true, true);
$oViewerLocal->Assign('bShowVote', true, true);
}
$oViewerLocal->Assign('oComment',$oComment, true);
$sHtml=$oViewerLocal->Fetch($this->Comment_GetTemplateCommentByTarget($oComment->getTargetId(),$oComment->getTargetType()));
$this->Viewer_AssignAjax('sHtml',$sHtml);
} else {

View file

@ -1301,15 +1301,19 @@ class ActionBlog extends Action {
*/
if (getRequest('bUsePaging',null,'post') and $selfIdComment) {
if ($oComment=$this->Comment_GetCommentById($selfIdComment) and $oComment->getTargetId()==$oTopic->getId() and $oComment->getTargetType()=='topic') {
$oViewerLocal=$this->Viewer_GetLocalViewer();
$oViewerLocal->Assign('oUserCurrent',$this->oUserCurrent);
$oViewerLocal->Assign('bOneComment',true);
$oViewerLocal = $this->Viewer_GetLocalViewer();
$oViewerLocal->Assign('oComment',$oComment);
$sText=$oViewerLocal->Fetch($this->Comment_GetTemplateCommentByTarget($oTopic->getId(),'topic'));
$aCmt=array();
$aCmt[]=array(
'html' => $sText,
$oViewerLocal->Assign('oUserCurrent', $this->oUserCurrent);
$oViewerLocal->Assign('bOneComment', true, true);
$oViewerLocal->Assign('bShowFavourite', true, true);
$oViewerLocal->Assign('bShowVote', true, true);
$oViewerLocal->Assign('oComment', $oComment, true);
$sHtml = $oViewerLocal->Fetch($this->Comment_GetTemplateCommentByTarget($oTopic->getId(),'topic'));
$aCmt = array();
$aCmt[] = array(
'html' => $sHtml,
'obj' => $oComment,
);
} else {

View file

@ -45,7 +45,6 @@ class ActionComments extends Action {
* Регистрация евентов
*/
protected function RegisterEvent() {
$this->AddEventPreg('/^(page([1-9]\d{0,5}))?$/i','EventComments');
$this->AddEventPreg('/^\d+$/i','EventShowComment');
}
@ -55,45 +54,6 @@ class ActionComments extends Action {
**********************************************************************************
*/
/**
* Выводим список комментариев
*
*/
protected function EventComments() {
/**
* Передан ли номер страницы
*/
$iPage=$this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1;
/**
* Исключаем из выборки идентификаторы закрытых блогов (target_parent_id)
*/
$aCloseBlogs = ($this->oUserCurrent)
? $this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent)
: $this->Blog_GetInaccessibleBlogsByUser();
/**
* Получаем список комментов
*/
$aResult=$this->Comment_GetCommentsAll('topic',$iPage,Config::Get('module.comment.per_page'),array(),$aCloseBlogs);
$aComments=$aResult['collection'];
/**
* Формируем постраничность
*/
$aPaging=$this->Viewer_MakePaging($aResult['count'],$iPage,Config::Get('module.comment.per_page'),Config::Get('pagination.pages.count'),Router::GetPath('comments'));
/**
* Загружаем переменные в шаблон
*/
$this->Viewer_Assign('aPaging',$aPaging);
$this->Viewer_Assign("aComments",$aComments);
/**
* Устанавливаем title страницы
*/
$this->Viewer_AddHtmlTitle($this->Lang_Get('comments_all'));
$this->Viewer_SetHtmlRssAlternate(Router::GetPath('rss').'allcomments/',$this->Lang_Get('comments_all'));
/**
* Устанавливаем шаблон вывода
*/
$this->SetTemplateAction('index');
}
/**
* Обрабатывает ссылку на конкретный комментарий, определят к какому топику он относится и перенаправляет на него
* Актуально при использовании постраничности комментариев

View file

@ -455,7 +455,7 @@ class ActionTalk extends Action {
}
}
$this->SetTemplateAction('message');
$this->SetTemplateAction('talk');
}
/**
* Проверка полей при создании письма

View file

@ -620,9 +620,16 @@ class ModuleComment extends Module {
if($sTargetType!='topic') {
$oViewerLocal->Assign('bNoCommentFavourites',true);
}
elseif($sTargetType=='topic') {
$oViewerLocal->Assign('bShowFavourite', true, true);
$oViewerLocal->Assign('bShowVote', true, true);
$oViewerLocal->Assign('bShowScroll', true, true);
$oViewerLocal->Assign('bShowEdit', true, true);
$oViewerLocal->Assign('sDateReadLast', '1', true);
}
$aCmt=array();
foreach ($aCmts as $oComment) {
$oViewerLocal->Assign('oComment',$oComment);
$oViewerLocal->Assign('oComment',$oComment,true);
$sText=$oViewerLocal->Fetch($this->GetTemplateCommentByTarget($sId,$sTargetType));
$aCmt[]=array(
'html' => $sText,
@ -640,7 +647,7 @@ class ModuleComment extends Module {
* @return string
*/
public function GetTemplateCommentByTarget($iTargetId,$sTargetType) {
return "comments/comment.tpl";
return "components/comment/comment.tpl";
}
/**
* Строит дерево комментариев