mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +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.
|
||||
|
|
|
|||
27
modules/comment/queries/getDeclaredLatest.xml
Normal file
27
modules/comment/queries/getDeclaredLatest.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<query id="getDeclaredLatest" action="select">
|
||||
<tables>
|
||||
<table name="comments" />
|
||||
<table name="comment_declared" />
|
||||
<table name="comment_declared_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="comment_declared_log.comment_srl" />
|
||||
<column name="count(*)" alias="declared_count" />
|
||||
<column name="max(comment_declared_log.regdate)" alias="latest_declared" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comments.comment_srl" default="comment_declared_log.comment_srl" />
|
||||
<condition operation="equal" column="comment_declared.comment_srl" default="comment_declared_log.comment_srl" pipe="and" />
|
||||
<condition operation="more" column="comment_declared.declared_count" default="1" pipe="and" />
|
||||
<condition operation="in" column="comment_declared_log.comment_srl" var="comment_srls" pipe="and" />
|
||||
</conditions>
|
||||
<groups>
|
||||
<group column="comment_declared_log.comment_srl" />
|
||||
</groups>
|
||||
<navigation>
|
||||
<index var="sort_index" default="latest_declared" order="order_type" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="comments.comment_srl" default="comment_declared.comment_srl" />
|
||||
<condition operation="equal" column="comments.comment_srl" default="comment_declared.comment_srl" />
|
||||
<condition operation="more" column="comment_declared.declared_count" default="1" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="comment_declared.declared_count" order="order_type" />
|
||||
|
|
|
|||
|
|
@ -33,10 +33,11 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{$lang->comment}</th>
|
||||
<th scope="col">{$lang->user_name}</th>
|
||||
<th scope="col">{$lang->date}</th>
|
||||
<th scope="col">{$lang->cmd_declare}</th>
|
||||
<th scope="col">{$lang->writer}</th>
|
||||
<th scope="col">{$lang->ipaddress}</th>
|
||||
<th scope="col"><a href="{getUrl('sort_index', 'declared_count')}">{lang('document.declared_count')} <block cond="$sort_index == 'declared_count'">▼</block></a></th></th>
|
||||
<th scope="col"><a href="{getUrl('sort_index', 'regdate')}">{$lang->original_date} <block cond="$sort_index == 'regdate'">▼</block></a></th>
|
||||
<th scope="col"><a href="{getUrl('sort_index', 'declared_latest')}">{$lang->latest_declared_date} <block cond="$sort_index == 'declared_latest'">▼</block></a></th>
|
||||
<th scope="col" style="width:15px"><input type="checkbox" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -44,9 +45,10 @@
|
|||
<tr loop="$comment_list => $no, $oComment">
|
||||
<td><a href="{getUrl('','document_srl',$oComment->get('document_srl'))}#comment_{$oComment->get('comment_srl')}" target="_blank">{$oComment->getSummary(100)}</a></td>
|
||||
<td><span class="member_{$oComment->getMemberSrl()}">{$oComment->getNickName()}</span></td>
|
||||
<td>{$oComment->getRegdate("Y-m-d")}</td>
|
||||
<td><strong>{$oComment->get('declared_count')} (<a href="{getUrl('', 'act', 'dispCommentAdminDeclaredLogByCommentSrl', 'target_srl',$oComment->get('comment_srl'))}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_comment_declare_reason}</a>)</strong></td>
|
||||
<td>{$oComment->get('ipaddress')}</td>
|
||||
<td>{$oComment->get('declared_count')} (<a href="{getUrl('', 'act', 'dispCommentAdminDeclaredLogByCommentSrl', 'target_srl',$oComment->get('comment_srl'))}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_comment_declare_reason}</a>)</td>
|
||||
<td>{$oComment->getRegdate('Y-m-d H:i')}</td>
|
||||
<td>{zdate($oComment->get('latest_declared'), 'Y-m-d H:i')}</td>
|
||||
<td><input type="checkbox" name="cart[]" value="{$oComment->get('comment_srl')}" /></td>
|
||||
</tr>
|
||||
<tr cond="!$comment_list">
|
||||
|
|
|
|||
|
|
@ -177,8 +177,16 @@ class documentAdminView extends document
|
|||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
$args->order_type = strtolower(Context::get('order_type')) === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
// select sort method
|
||||
$sort_index = Context::get('sort_index');
|
||||
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
||||
{
|
||||
$sort_index = 'declared_latest';
|
||||
}
|
||||
Context::set('sort_index', $sort_index);
|
||||
|
||||
// get latest declared list
|
||||
if (Context::get('sort_index') === 'declared_latest')
|
||||
if ($sort_index === 'declared_latest')
|
||||
{
|
||||
$declared_output = executeQueryArray('document.getDeclaredLatest', $args);
|
||||
if ($declared_output->data && count($declared_output->data))
|
||||
|
|
@ -205,6 +213,14 @@ class documentAdminView extends document
|
|||
}
|
||||
else
|
||||
{
|
||||
if ($sort_index === 'declared_count')
|
||||
{
|
||||
$args->sort_index = 'document_declared.declared_count';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->sort_index = 'documents.regdate';
|
||||
}
|
||||
$declared_output = executeQueryArray('document.getDeclaredList', $args);
|
||||
if ($declared_output->data && count($declared_output->data))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
|
|||
<tr>
|
||||
<th scope="col" class="title">{$lang->title}</th>
|
||||
<th scope="col" class="nowr">{$lang->writer}</th>
|
||||
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'declared_count')}">{$lang->declared_count} <block cond="$sort_index != 'declared_latest'">▼</block></a></th>
|
||||
<th scope="col" class="nowr">{$lang->readed_count}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_vote}(+/-)</th>
|
||||
<th scope="col" class="nowr">{$lang->original_date}</th>
|
||||
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'declared_count')}">{$lang->declared_count} <block cond="$sort_index == 'declared_count'">▼</block></a></th>
|
||||
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'regdate')}">{$lang->original_date} <block cond="$sort_index == 'regdate'">▼</block></a></th>
|
||||
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'declared_latest')}">{$lang->latest_declared_date} <block cond="$sort_index == 'declared_latest'">▼</block></a></th>
|
||||
<th scope="col"><input type="checkbox" name="cart" title="Check All" /></th>
|
||||
</tr>
|
||||
|
|
@ -47,9 +47,9 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
|
|||
<tr loop="$document_list => $no,$oDocument">
|
||||
<td class="title"><a href="{getUrl('','document_srl',$oDocument->document_srl)}" target="_blank">{$oDocument->getTitle()}</a></td>
|
||||
<td class="nowr"><a href="#popup_menu_area" class="member_{$oDocument->get('member_srl')}">{$oDocument->getNickName()}</a></td>
|
||||
<td class="nowr">{$oDocument->get('declared_count')} (<a href="{getUrl('', 'act', 'dispDocumentAdminDeclaredLogByDocumentSrl', 'target_srl',$oDocument->document_srl)}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_document_declare_reason}</a>)</td>
|
||||
<td class="nowr">{$oDocument->get('readed_count')}</td>
|
||||
<td class="nowr">{$oDocument->get('voted_count')}/{$oDocument->get('blamed_count')}</td>
|
||||
<td class="nowr">{$oDocument->get('voted_count')} / {$oDocument->get('blamed_count')}</td>
|
||||
<td class="nowr">{$oDocument->get('declared_count')} (<a href="{getUrl('', 'act', 'dispDocumentAdminDeclaredLogByDocumentSrl', 'target_srl',$oDocument->document_srl)}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_document_declare_reason}</a>)</td>
|
||||
<td class="nowr">{$oDocument->getRegdate("Y-m-d H:i")}</td>
|
||||
<td class="nowr">{zdate($oDocument->get('latest_declared'), 'Y-m-d H:i')}</td>
|
||||
<td><input type="checkbox" name="cart" value="{$oDocument->document_srl}" /></td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue