mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Add sort options to declared document/comment list
- 신고된 문서 열람 화면에서 작성일순 정렬 옵션 추가 (최근 신고순 옵션은 이미 있음) - 신고된 댓글 열람 화면에서 작성일순, 최근 신고순 정렬 옵션 추가 - 신고된 문서와 댓글 열람 화면에서 일관성있는 표시를 위해 컬럼 순서를 일부 조정
This commit is contained in:
parent
eacf1c43f0
commit
be9d357f51
6 changed files with 121 additions and 24 deletions
|
|
@ -135,25 +135,76 @@ class commentAdminView extends comment
|
|||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of comment postings to appear on a single page
|
||||
$args->page_count = 10; // /< the number of pages to appear on the page navigation
|
||||
|
||||
$args->sort_index = 'comment_declared.declared_count'; // /< sorting values
|
||||
$args->order_type = 'desc'; // /< sorted value
|
||||
// get a list
|
||||
$declared_output = executeQuery('comment.getDeclaredList', $args);
|
||||
$oCommentModel = getModel('comment');
|
||||
|
||||
if($declared_output->data && count($declared_output->data))
|
||||
|
||||
// select sort method
|
||||
$sort_index = Context::get('sort_index');
|
||||
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
||||
{
|
||||
$comment_list = array();
|
||||
|
||||
foreach($declared_output->data as $key => $comment)
|
||||
$sort_index = 'declared_latest';
|
||||
}
|
||||
Context::set('sort_index', $sort_index);
|
||||
|
||||
// get latest declared list
|
||||
if ($sort_index === 'declared_latest')
|
||||
{
|
||||
$declared_output = executeQueryArray('comment.getDeclaredLatest', $args);
|
||||
if ($declared_output->data && count($declared_output->data))
|
||||
{
|
||||
$comment_list[$key] = new commentItem();
|
||||
$comment_list[$key]->setAttribute($comment);
|
||||
$args->comment_srls = array_map(function($item) { return $item->comment_srl; }, $declared_output->data);
|
||||
$comments = executeQueryArray('comment.getComments', $args);
|
||||
$comment_list = array();
|
||||
foreach ($declared_output->data as $key => $declared_info)
|
||||
{
|
||||
foreach ($comments->data as $comment)
|
||||
{
|
||||
if ($comment->comment_srl == $declared_info->comment_srl)
|
||||
{
|
||||
$comment->declared_count = $declared_info->declared_count;
|
||||
$comment->latest_declared = $declared_info->latest_declared;
|
||||
$comment_list[$key] = new commentItem();
|
||||
$comment_list[$key]->setAttribute($comment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$declared_output->data = $comment_list;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sort_index === 'declared_count')
|
||||
{
|
||||
$args->sort_index = 'comment_declared.declared_count';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->sort_index = 'comments.regdate';
|
||||
}
|
||||
$declared_output = executeQueryArray('comment.getDeclaredList', $args);
|
||||
if ($declared_output->data && count($declared_output->data))
|
||||
{
|
||||
$args->comment_srls = array_map(function($item) { return $item->comment_srl; }, $declared_output->data);
|
||||
$declared_latest = executeQueryArray('comment.getDeclaredLatest', $args);
|
||||
$comment_list = array();
|
||||
foreach ($declared_output->data as $key => $comment)
|
||||
{
|
||||
foreach ($declared_latest->data as $key => $declared_info)
|
||||
{
|
||||
if ($comment->comment_srl == $declared_info->comment_srl)
|
||||
{
|
||||
$comment->declared_count = $declared_info->declared_count;
|
||||
$comment->latest_declared = $declared_info->latest_declared;
|
||||
$comment_list[$key] = new commentItem();
|
||||
$comment_list[$key]->setAttribute($comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
$declared_output->data = $comment_list;
|
||||
}
|
||||
$declared_output->data = $comment_list;
|
||||
}
|
||||
|
||||
$oCommentModel = getModel('comment');
|
||||
$secretNameList = $oCommentModel->getSecretNameList();
|
||||
|
||||
// set values in the return object of comment_model:: getCommentList() in order to use a template.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue