mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 00:59:58 +09:00
댓글 목록에서 cpage가 없으면 제일 뒷페이지가 나타나도록 하고 페이지가 나눠지지 않으면 페이지 목록을 보이지 않도록 함
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3761 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
87bfa7fbe2
commit
4887c0983d
5 changed files with 29 additions and 17 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
<a name="comment"></a>
|
||||||
|
|
||||||
<!--@if($oDocument->getCommentCount())-->
|
<!--@if($oDocument->getCommentCount())-->
|
||||||
<div id="reply" class="comment">
|
<div id="reply" class="comment">
|
||||||
{@ $_comment_list = $oDocument->getComments() }
|
{@ $_comment_list = $oDocument->getComments() }
|
||||||
|
|
@ -89,15 +91,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 댓글 페이지 네비게이션 -->
|
<!-- 댓글 페이지 네비게이션 -->
|
||||||
<div class="commentPageNavigation">
|
<!--@if($oDocument->comment_page_navigation)-->
|
||||||
<a href="{getUrl('cpage',1)}#comment" class="goToFirst"><img src="./images/common/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
|
<div class="commentPageNavigation">
|
||||||
<!--@while($page_no = $comment_page_navigation->getNextPage())-->
|
<a href="{getUrl('cpage',1)}#comment" class="goToFirst"><img src="./images/common/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
|
||||||
<!--@if($cpage == $page_no)-->
|
<!--@while($page_no = $oDocument->comment_page_navigation->getNextPage())-->
|
||||||
<span class="current">{$page_no}</span>
|
<!--@if($cpage == $page_no)-->
|
||||||
<!--@else-->
|
<span class="current">{$page_no}</span>
|
||||||
<a href="{getUrl('cpage',$page_no)}#comment">{$page_no}</a>
|
<!--@else-->
|
||||||
|
<a href="{getUrl('cpage',$page_no)}#comment">{$page_no}</a>
|
||||||
|
<!--@end-->
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
<a href="{getUrl('cpage',$oDocument->comment_page_navigation->last_page)}#comment" class="goToLast"><img src="./images/common/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
|
||||||
|
</div>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
<a href="{getUrl('cpage',$comment_page_navigation->last_page)}#comment" class="goToLast"><img src="./images/common/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
|
|
||||||
</div>
|
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
|
||||||
|
|
@ -90,17 +90,19 @@
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
||||||
<!-- 댓글 페이지 네비게이션 -->
|
<!-- 댓글 페이지 네비게이션 -->
|
||||||
|
<!--@if($oDocument->comment_page_navigation)-->
|
||||||
<div class="pageNavigation">
|
<div class="pageNavigation">
|
||||||
<a href="{getUrl('cpage',1)}#comment" class="goToFirst"><img src="./images/common/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
|
<a href="{getUrl('cpage',1)}#comment" class="goToFirst"><img src="./images/common/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
|
||||||
<!--@while($page_no = $comment_page_navigation->getNextPage())-->
|
<!--@while($page_no = $oDocument->comment_page_navigation->getNextPage())-->
|
||||||
<!--@if($cpage == $page_no)-->
|
<!--@if($cpage == $page_no)-->
|
||||||
<span class="current">{$page_no}</span>
|
<span class="current">{$page_no}</span>
|
||||||
<!--@else-->
|
<!--@else-->
|
||||||
<a href="{getUrl('cpage',$page_no)}#comment">{$page_no}</a>
|
<a href="{getUrl('cpage',$page_no)}#comment">{$page_no}</a>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
<a href="{getUrl('cpage',$comment_page_navigation->last_page)}#comment" class="goToLast"><img src="./images/common/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
|
<a href="{getUrl('cpage',$oDocument->comment_page_navigation->last_page)}#comment" class="goToLast"><img src="./images/common/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
|
||||||
</div>
|
</div>
|
||||||
|
<!--@end-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
|
||||||
|
|
@ -85,17 +85,19 @@
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
||||||
<!-- 댓글 페이지 네비게이션 -->
|
<!-- 댓글 페이지 네비게이션 -->
|
||||||
|
<!--@if($oDocument->comment_page_navigation)-->
|
||||||
<div class="pageNavigation">
|
<div class="pageNavigation">
|
||||||
<a href="{getUrl('cpage',1)}#comment" class="goToFirst"><img src="./images/common/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
|
<a href="{getUrl('cpage',1)}#comment" class="goToFirst"><img src="./images/common/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
|
||||||
<!--@while($page_no = $comment_page_navigation->getNextPage())-->
|
<!--@while($page_no = $oDocument->comment_page_navigation->getNextPage())-->
|
||||||
<!--@if($cpage == $page_no)-->
|
<!--@if($cpage == $page_no)-->
|
||||||
<span class="current">{$page_no}</span>
|
<span class="current">{$page_no}</span>
|
||||||
<!--@else-->
|
<!--@else-->
|
||||||
<a href="{getUrl('cpage',$page_no)}#comment">{$page_no}</a>
|
<a href="{getUrl('cpage',$page_no)}#comment">{$page_no}</a>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
<a href="{getUrl('cpage',$comment_page_navigation->last_page)}#comment" class="goToLast"><img src="./images/common/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
|
<a href="{getUrl('cpage',$oDocument->comment_page_navigation->last_page)}#comment" class="goToLast"><img src="./images/common/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
|
||||||
</div>
|
</div>
|
||||||
|
<!--@end-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief document_srl에 해당하는 문서의 댓글 목록을 가져옴
|
* @brief document_srl에 해당하는 문서의 댓글 목록을 가져옴
|
||||||
**/
|
**/
|
||||||
function getCommentList($document_srl, $page = 1, $is_admin = false) {
|
function getCommentList($document_srl, $page = 0, $is_admin = false) {
|
||||||
// 해당 문서의 모듈에 해당하는 댓글 수를 구함
|
// 해당 문서의 모듈에 해당하는 댓글 수를 구함
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
|
@ -175,7 +175,8 @@
|
||||||
$comment_count = $comment_config->comment_count;
|
$comment_count = $comment_config->comment_count;
|
||||||
if(!$comment_count) $comment_count = 50;
|
if(!$comment_count) $comment_count = 50;
|
||||||
|
|
||||||
if(!$page) !$page = 1;
|
// 페이지가 없으면 제일 뒤 페이지를 구함
|
||||||
|
if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1;
|
||||||
|
|
||||||
// 정해진 수에 따라 목록을 구해옴
|
// 정해진 수에 따라 목록을 구해옴
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
|
|
|
||||||
|
|
@ -375,13 +375,15 @@
|
||||||
if(!$this->allowComment() || !$this->getCommentCount()) return;
|
if(!$this->allowComment() || !$this->getCommentCount()) return;
|
||||||
if(!$this->isGranted() && $this->isSecret()) return;
|
if(!$this->isGranted() && $this->isSecret()) return;
|
||||||
|
|
||||||
|
// cpage는 댓글페이지의 번호
|
||||||
$cpage = Context::get('cpage');
|
$cpage = Context::get('cpage');
|
||||||
if(!$cpage) $cpage = 1;
|
|
||||||
|
|
||||||
|
// 댓글 목록을 구해옴
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
|
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
|
||||||
if(!$output->toBool() || !count($output->data)) return;
|
if(!$output->toBool() || !count($output->data)) return;
|
||||||
|
|
||||||
|
// 구해온 목록을 commentItem 객체로 만듬
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val) {
|
||||||
$oCommentItem = new commentItem();
|
$oCommentItem = new commentItem();
|
||||||
|
|
@ -389,8 +391,9 @@
|
||||||
$comment_list[$val->comment_srl] = $oCommentItem;
|
$comment_list[$val->comment_srl] = $oCommentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('comment_page_navigation', $output->page_navigation);
|
// 스킨에서 출력하기 위한 변수 설정
|
||||||
Context::set('cpage', $output->page_navigation->cur_page);
|
Context::set('cpage', $output->page_navigation->cur_page);
|
||||||
|
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
|
||||||
|
|
||||||
return $comment_list;
|
return $comment_list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue