Recognize comment_srl in address to find cpage automatically #904 #1191 #1192

This commit is contained in:
Kijin Sung 2019-09-14 20:05:33 +09:00
parent 941542b991
commit 6961155f9c
4 changed files with 123 additions and 6 deletions

View file

@ -942,6 +942,8 @@ class documentItem extends BaseObject
return;
}
$oCommentModel = getModel('comment');
// cpage is a number of comment pages
$cpageStr = sprintf('%d_cpage', $this->document_srl);
$cpage = Context::get($cpageStr);
@ -949,9 +951,16 @@ class documentItem extends BaseObject
{
$cpage = Context::get('cpage');
}
if(!$cpage && ($comment_srl = Context::get('comment_srl')))
{
$cpage = $oCommentModel->getCommentPage($this->document_srl, $comment_srl);
}
if(!$cpage && ($comment_srl = Context::get('_comment_srl')))
{
$cpage = $oCommentModel->getCommentPage($this->document_srl, $comment_srl);
}
// Get a list of comments
$oCommentModel = getModel('comment');
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
if(!$output->toBool() || !count($output->data)) return;