issue 70 list count modified in content admin

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8854 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-08-24 05:35:15 +00:00
parent b87aedbd2b
commit ac9bf88af4
13 changed files with 355 additions and 183 deletions

View file

@ -32,15 +32,6 @@
$columnList = array('comment_srl', 'document_srl', 'is_secret', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress');
$output = $oCommentModel->getTotalCommentList($args, $columnList);
// get total comment count group by is_secret status
$tmp->search_target = Context::get('search_target');
$tmp->search_keyword = Context::get('search_keyword');
Context::set('search_target', '');
Context::set('search_keyword', '');
$countOutput = $oCommentModel->getTotalCommentCount($args);
Context::set('search_target', $tmp->search_target);
Context::set('search_keyword', $tmp->search_keyword);
// set values in the return object of comment_model:: getTotalCommentList() in order to use a template.
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
@ -48,7 +39,6 @@
Context::set('comment_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('secret_name_list', $secretNameList);
Context::set('countOutput', $countOutput);
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('comment_list');

View file

@ -6,14 +6,20 @@
<h1 class="h1">{$lang->comment}</h1>
<div class="table even">
<div class="cnb">
All({number_format($total_count)})
<!--@foreach($countOutput AS $key=>$value)-->
| <a href="{getUrl('search_target','is_secret','search_keyword', $value->is_secret)}">{$secret_name_list[$value->is_secret]}({$value->count})</a>
<!--@end-->
<a href="{getUrl('','act','dispCommentAdminList', 'Y')}" <!--@if($search_keyword == '')-->class="active"<!--@end-->>All</a>
| <a href="{getUrl('search_target','is_secret','search_keyword', 'N')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'N')-->class="active"<!--@end-->>{$secret_name_list['N']}</a>
| <a href="{getUrl('search_target','is_secret','search_keyword', 'Y')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$secret_name_list['Y']}</a>
</div>
<table width="100%" border="1" cellspacing="0" id="commentListTable">
<caption>
All({number_format($total_count)})
<!--@if($search_keyword == '')-->
All
<!--@elseif($search_target == 'is_secret' && $search_keyword == 'N')-->
{$secret_name_list['N']}
<!--@elseif($search_target == 'is_secret' && $search_keyword == 'Y')-->
{$secret_name_list['Y']}
<!--@end-->
({number_format($total_count)})
<div class="side">
<span class="btn"><a href="#listManager" class="modalAnchor" onclick="getCommentList();">{$lang->comment_manager}...</a></span>
</div>

View file

@ -43,19 +43,6 @@
$oDocumentModel = &getModel('document');
$output = $oDocumentModel->getDocumentList($args);
// count eache status, not in trash...
$countOutput = $oDocumentModel->getDocumentCountByGroupStatus($args);;
if(is_array($countOutput))
{
$statusCount = array();
foreach($countOutput AS $key=>$value)
$statusCount[$value->status] = $value->count;
if(!array_key_exists('PUBLIC', $statusCount)) $statusCount['PUBLIC'] = 0;
if(!array_key_exists('SECRET', $statusCount)) $statusCount['SECRET'] = 0;
if(!array_key_exists('TEMP', $statusCount)) $statusCount['TEMP'] = 0;
}
// get Status name list
$statusNameList = $oDocumentModel->getStatusNameList();
@ -66,7 +53,6 @@
Context::set('document_list', $output->data);
Context::set('status_name_list', $statusNameList);
Context::set('page_navigation', $output->page_navigation);
Context::set('statusCount', $statusCount);
// set a search option used in the template
$count_search_option = count($this->search_option);

View file

@ -7,14 +7,24 @@
<h1 class="h1">{$lang->document}</h1>
<div class="table even">
<div class="cnb">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList')}" class="active">All</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'N')}">{$status_name_list['PUBLIC']}({$statusCount['PUBLIC']})</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'Y')}">{$status_name_list['SECRET']}({$statusCount['SECRET']})</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'temp')}">{$status_name_list['TEMP']}({$statusCount['TEMP']})</a>
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList')}" <!--@if($search_keyword == '')-->class="active"<!--@end-->>All</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'N')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'N')-->class="active"<!--@end-->>{$status_name_list['PUBLIC']}</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'Y')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$status_name_list['SECRET']}</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'temp')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'temp')-->class="active"<!--@end-->>{$status_name_list['TEMP']}</a>
| <a href="{getUrl('', 'module', 'admin', 'act', 'dispTrashAdminList')}">{$lang->cmd_trash}</a>
</div>
<table width="100%" border="1" cellspacing="0" id="documentListTable">
<caption>
All({number_format($total_count)})
<!--@if($search_keyword == '')-->
All
<!--@elseif($search_target == 'is_secret' && $search_keyword == 'N')-->
{$status_name_list['PUBLIC']}
<!--@elseif($search_target == 'is_secret' && $search_keyword == 'Y')-->
{$status_name_list['SECRET']}
<!--@elseif($search_target == 'is_secret' && $search_keyword == 'temp')-->
{$status_name_list['TEMP']}
<!--@end-->
({number_format($total_count)})
<div class="side">
<span class="btn"><a href="#listManager" class="modalAnchor" onclick="getDocumentList();">{$lang->document_manager}...</a></span>
</div>

View file

@ -155,16 +155,6 @@
}
}
$countOutput = $oFileAdminModel->getFilesCountByGroupValid();
$validCount = array();
if(is_array($countOutput))
{
foreach($countOutput AS $key=>$value)
{
$validCount[$value->isvalid] = $value->count;
}
}
Context::set('file_list', $file_list);
Context::set('document_list', $document_list);
Context::set('comment_list', $comment_list);
@ -173,7 +163,6 @@
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('page_navigation', $output->page_navigation);
Context::set('valid_count', $validCount);
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('file_list');

View file

@ -6,13 +6,20 @@
<h1 class="h1">{$lang->file}</h1>
<div class="table">
<div class="cnb">
<a href="#">All</a>
| <a href="{getUrl('search_target','isvalid','search_keyword','Y')}">{$lang->is_valid}({number_format((int)$valid_count['Y'])})</a>
| <a href="{getUrl('search_target','isvalid','search_keyword','N')}">{$lang->is_stand_by}({number_format((int)$valid_count['N'])})</a>
<a href="{getUrl('', 'module', 'admin', 'act', 'dispFileAdminList')}" <!--@if($search_keyword == '')-->class="active"<!--@end-->>All</a>
| <a href="{getUrl('search_target','isvalid','search_keyword','Y')}" <!--@if($search_target == 'isvalid' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$lang->is_valid}</a>
| <a href="{getUrl('search_target','isvalid','search_keyword','N')}" <!--@if($search_target == 'isvalid' && $search_keyword == 'N')-->class="active"<!--@end-->>{$lang->is_stand_by}</a>
</div>
<table width="100%" border="1" cellspacing="0" id="fileListTable">
<caption>
All({number_format($total_count)})
<!--@if($search_keyword == '')-->
All
<!--@elseif($search_target == 'isvalid' && $search_keyword == 'Y')-->
{$lang->is_valid}
<!--@elseif($search_target == 'isvalid' && $search_keyword == 'N')-->
{$lang->is_stand_by}
<!--@end-->
({number_format($total_count)})
<span class="side"><span class="btn"><a href="#listManager" class="modalAnchor" onclick="getFileList();">{$lang->file_manager}...</a></span></span>
</caption>
<thead>

View file

@ -33,14 +33,6 @@
$oTrackbackAdminModel = &getAdminModel('trackback');
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
if(is_array($output->data))
{
foreach($output->data AS $key=>$value)
{
if($_SESSION['trackback_management'][$value->trackback_srl]) $value->isCarted = true;
else $value->isCarted = false;
}
}
// To write to a template parameter settings
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);

View file

@ -6,9 +6,25 @@
<permission action="procTrashAdminRestore" target="manager" />
</permissions>
<actions>
<action name="dispTrashAdminList" type="view" standalone="true" admin_index="true" />
<action name="dispTrashAdminList" type="view" standalone="true" admin_index="true" menu_name="document" menu_index="true" />
<action name="procTrashAdminEmptyTrash" type="controller" standalone="true" ruleset="emptyTrash" />
<action name="procTrashAdminRestore" type="controller" standalone="true" />
<action name="procTrashAdminGetList" type="controller" standalone="true" />
</actions>
<menus>
<menu name="document">
<title xml:lang="en">Document</title>
<title xml:lang="ko">문서</title>
<title xml:lang="zh-CN">Document</title>
<title xml:lang="jp">Document</title>
<title xml:lang="es">Document</title>
<title xml:lang="ru">Document</title>
<title xml:lang="fr">Document</title>
<title xml:lang="zh-TW">Document</title>
<title xml:lang="vi">Document</title>
<title xml:lang="mn">Document</title>
<title xml:lang="tr">Document</title>
</menu>
</menus>
</module>

View file

@ -10,7 +10,7 @@
</columns>
<conditions>
<condition operation="equal" column="T.remover_srl" default="M.member_srl" notnull="notnull" />
<condition operation="equal" column="trash_srl" var="trashSrl" filter="number" />
<condition operation="in" column="trash_srl" var="trashSrl" filter="number" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="trash_srl" order="desc" />

View file

@ -31,3 +31,48 @@ function completeRestore(ret_obj)
alert(message);
if(error == '0') window.location.reload();
}
function getTrashList()
{
var trashListTable = jQuery('#trashListTable');
var cartList = [];
trashListTable.find(':checkbox[name=cart').each(function(){
if(this.checked) cartList.push(this.value);
});
var params = new Array();
var response_tags = ['error','message', 'trash_list'];
params["trash_srls"] = cartList.join(",");
exec_xml('trash','procTrashAdminGetList',params, completeGetTrashList, response_tags);
}
function completeGetTrashList(ret_obj, response_tags)
{
var htmlListBuffer = '';
if(ret_obj['trash_list'] == null)
{
htmlListBuffer = '<tr>' +
'<td colspan="3" style="text-align:center;">'+ret_obj['message']+'</td>' +
'</tr>';
}
else
{
var trash_list = ret_obj['trash_list']['item'];
if(!jQuery.isArray(trash_list)) trash_list = [trash_list];
for(var x in trash_list)
{
var objTrash = trash_list[x];
htmlListBuffer += '<tr>' +
'<td class="title">'+ objTrash.title +'</td>' +
'<td>'+ objTrash.nickName +'</td>' +
'<td>'+ objTrash.ipaddress +'</td>' +
'</tr>' +
'<input type="hidden" name="cart[]" value="'+objTrash.trashSrl+'" />';
}
jQuery('#selectedTrashCount').html(trash_list.length);
}
jQuery('#trashManageListTable>tbody').html(htmlListBuffer);
}

View file

@ -1,72 +1,148 @@
<script>
var confirm_restore_msg = '{$lang->confirm_restore}';
</script>
<!--#include("header.html")-->
<!--%import("js/trash_admin.js")-->
<div class="content" id="content">
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="emptyTrash" id="fo_list" action="./" method="post">
<input type="hidden" name="act" value="procTrashAdminEmptyTrash" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_all" value="false" />
<form ruleset="emptyTrash" action="./" method="post" class="form">
<input type="hidden" name="act" value="procTrashAdminEmptyTrash" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_all" value="true" />
<h1 class="h1">{$lang->document}</h1>
<div class="table even">
<div class="cnb">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList')}">All</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'N')}">{$status_name_list['PUBLIC']}</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'Y')}">{$status_name_list['SECRET']}</a>
| <a href="{getUrl('search_target', 'is_secret', 'search_keyword', 'temp')}">{$status_name_list['TEMP']}</a>
| <a href="{getUrl('', 'module', 'admin', 'act', 'dispTrashAdminList')}" class="active">{$lang->cmd_trash}</a>
</div>
<table width="100%" border="1" cellspacing="0" id="trashListTable">
<caption>
{$lang->cmd_trash}({number_format($total_count)})
<span class="side"><span class="btn"><a href="#listManager" class="modalAnchor" onclick="getTrashList();">선택한 글 관리...</a></span>
<span class="btn"><button type="submit" name="is_all" value="true">{$lang->empty_trash_all}</button></span></span>
</caption>
<thead>
<tr>
<th scope="col" class="title">{$lang->document} ({$lang->trash_type})</th>
<th scope="col">{$lang->trash_nick_name}</th>
<th scope="col">{$lang->trash_date}</th>
<th scope="col">{$lang->ipaddress}</th>
<th scope="col">{$lang->trash_description}</th>
<th scope="col"><input type="checkbox" title="Check All" data-name="cart" /></th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col" class="title">{$lang->document} ({$lang->trash_type})</th>
<th scope="col">{$lang->trash_nick_name}</th>
<th scope="col">{$lang->trash_date}</th>
<th scope="col">{$lang->ipaddress}</th>
<th scope="col">{$lang->trash_description}</th>
<th scope="col"><input type="checkbox" title="Check All" data-name="cart" /></th>
</tr>
</tfoot>
<tbody>
<!--@foreach($trash_list as $no => $oTrashVO)-->
<tr>
<td class="title">
{$oTrashVO->getTitle()} (
<!--@if($oTrashVO->getOriginModule() == 'document')-->
{$lang->document}
<!--@else if($oTrashVO->getOriginModule() == 'comment')-->
{$lang->replies}
<!--@else-->
{$lang->etc}
<!--@end-->
)
</td>
<td><span class="member_{$oTrashVO->getMemberSrl()">{htmlspecialchars($oTrashVO->getNickName())}</span></td>
<td>{zdate($oTrashVO->getRegdate(), "Y-m-d H:i:s")}</td>
<td>{$oTrashVO->getIpaddress()}</td>
<td>{$oTrashVO->getDescription()}</td>
<td><input type="checkbox" name="cart" value="{$oTrashVO->getTrashSrl()}" /></td>
</tr>
<!--@end-->
</tbody>
</table>
</div>
<div class="btnArea">
<span class="btn"><a href="#listManager" class="modalAnchor" onclick="getTrashList();">선택한 글 관리...</a></span>
<span class="btn"><button type="submit" name="is_all" value="true">{$lang->empty_trash_all}</button></span>
</div>
</form>
<div class="modal" id="listManager">
<form ruleset="emptyTrash" id="fo_list" action="./" method="post" class="fg form">
<input type="hidden" name="act" value="procTrashAdminEmptyTrash" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_all" value="false" />
<h2 class="h2">선택한 글 관리</h2>
<div class="table even">
<table width="100%" border="1" cellspacing="0" id="trashManageListTable">
<caption>선택한 글 <strong id="selectedTrashCount">8</strong></caption>
<thead>
<tr>
<th scope="col" class="title">{$lang->document} ({$lang->trash_type})</th>
<th scope="col">{$lang->trash_nick_name}</th>
<th scope="col">{$lang->ipaddress}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="btnArea">
<span class="btn"><button type="submit" name="is_all" value="false">{$lang->empty_trash_selected}</button></span>
<span class="btn"><button type="submit" name="act" value="procTrashAdminRestore">{$lang->cmd_restore}</button></span>
</div>
</form>
</div>
<div class="search">
<form action="" class="pagination">
<input type="hidden" name="error_return_url" value="" />
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<input cond="$search_keyword" type="hidden" name="search_keyword" value="{$search_keyword}" />
<input cond="$search_target" type="hidden" name="search_target" value="{$search_target}" />
<!-- 목록 -->
<table cellspacing="0" class="rowTable clear">
<caption>Total {number_format($total_count)}, Page {number_format($page)}/{number_format($total_page)}</caption>
<thead>
<tr>
<th scope="col"><div>{$lang->no}</div></th>
<th scope="col"><div><input type="checkbox" onclick="XE.checkboxToggleAll('trash_srls[]');" /></div></th>
<th scope="col" class="wide"><div>{$lang->document} ({$lang->trash_type})</div></th>
<th scope="col"><div>{$lang->trash_nick_name}</div></th>
<th scope="col"><div>{$lang->trash_date}</div></th>
<th scope="col"><div>{$lang->ipaddress}</div></th>
<th scope="col"><dib>{$lang->trash_description}</div></th>
<th scope="col"><div>{$lang->cmd_restore}</div></th>
</tr>
</thead>
<tbody>
<!--@foreach($trash_list as $no => $oTrashVO)-->
<tr>
<td class="number center">{$no}</td>
<td><div><input type="checkbox" name="trash_srls[]" value="{$oTrashVO->getTrashSrl()}" /></div></t>
<td class="left subject">
{$oTrashVO->getTitle()} (
<!--@if($oTrashVO->getOriginModule() == 'document')-->
{$lang->document}
<!--@else if($oTrashVO->getOriginModule() == 'comment')-->
{$lang->replies}
<!--@else-->
{$lang->etc}
<!--@end-->
)
</td>
<td class="nowrap"><span class="member_{$oTrashVO->getMemberSrl()">{htmlspecialchars($oTrashVO->getNickName())}</span></td>
<td class="date center nowrap">{zdate($oTrashVO->getRegdate(), "Y-m-d H:i:s")}</td>
<td class="number center nowrap">{$oTrashVO->getIpaddress()}</td>
<td class="left">{$oTrashVO->getDescription()}</td>
<td class="center"><a href="#" onclick="goRestore({$oTrashVO->getTrashSrl()})">{$lang->cmd_restore}</a></td>
</tr>
<!--@end-->
</tbody>
</table>
<div class="fr">
<span class="button green"><input type="submit" value="{$lang->empty_trash_selected}" onclick="this.form.is_all.value=false" /></span>
<span class="button blue"><input type="submit" value="{$lang->empty_trash_all}" onclick="this.form.is_all.value=true" /></span>
</div>
<a href="{getUrl('page', '')}" class="direction">&laquo; FIRST</a>
<block cond="$page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page && $page_navigation->page_count != $page_navigation->total_page">
<a href="{getUrl('page', '')}">1</a>
<a href="#goTo" class="tgSimple" title="{$lang->cmd_go_to_page}">...</a>
</block>
<!--@while($page_no = $page_navigation->getNextPage())-->
{@$last_page = $page_no}
<strong cond="$page_no == $page">{$page_no}</strong>
<a cond="$page_no != $page" href="{getUrl('page', $page_no)}">{$page_no}</a>
<!--@end-->
<block cond="$last_page != $page_navigation->last_page">
<a href="#goTo" class="tgSimple" title="{$lang->cmd_go_to_page}">...</a>
<a href="{getUrl('page', $page_navigation->last_page)}">{$page_navigation->last_page}</a>
</block>
<a href="{getUrl('page', $page_navigation->last_page)}" class="direction">LAST &raquo;</a>
<span id="goTo" class="tgContent">
<input name="page" title="{$lang->cmd_go_to_page}" />
<button type="submit">Go</button>
</span>
</form>
<!-- 페이지 네비게이션 -->
<div class="pagination a1">
<a href="{getUrl('page','','module_srl',$module_srl)}" class="prevEnd">{$lang->first_page}</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
<strong>{$page_no}</strong>
<!--@else-->
<a href="{getUrl('page',$page_no,'module_srl',$module_srl)}">{$page_no}</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl',$module_srl)}" class="nextEnd">{$lang->last_page}</a>
<form action="">
<select>
<option>제목</option>
<option>내용</option>
<option>닉네임</option>
<option>아이디</option>
<option>사용자 이름</option>
<option>공지사항</option>
<option>IP 주소</option>
<option>모듈 아이디</option>
</select>
<input title="Search" />
<input type="submit" value="Search" />
<a href="#">Cancel</a>
</form>
</div>
</div>

View file

@ -39,93 +39,136 @@ class trashAdminController extends trash
{
global $lang;
$isAll = Context::get('is_all');
$tmpTrashSrls = Context::get('trash_srls');
$tmpTrashSrls = Context::get('cart');
if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls;
else $trashSrls = explode('|@|', $tmpTrashSrls);
$oTrashModel = &getModel('trash');
if($isAll == 'true')
{
$trashSrls = array();
//module relation data delete...
$output = $this->_relationDataDelete($isAll, $trashSrls);
if(!$output->toBool()) return new Object(-1, $output->message);
//module relation data delete...
$output = $oTrashModel->getTrashList($args);
if(!$output->toBool()) return new Object(-1, $output->message);
if(is_array($output->data))
{
foreach($output->data AS $key=>$oTrashVO)
{
//class file check
$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory');
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule());
$classFile = FileHandler::getRealPath($classFile);
if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file');
$oAdminController = &getAdminController($oTrashVO->getOriginModule());
if(!method_exists($oAdminController, 'emptyTrash')) return new Object(-1, 'not exist restore method in module class file');
$output = $oAdminController->emptyTrash($oTrashVO->getSerializedObject());
}
}
}
if(!$this->_emptyTrash($trashSrls))
return new Object(-1, $lang->fail_empty);
if(!$this->_emptyTrash($trashSrls)) return new Object(-1, $lang->fail_empty);
$this->setMessage('success_deleted', 'info');
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrashAdminList');
header('location:'.$returnUrl);
$this->setRedirectUrl($returnUrl);
return;
}
return new Object(0, $lang->success_empty);
}
/**
* @brief empty trash - private method
**/
function _relationDataDelete($isAll, &$trashSrls)
{
if($isAll == 'true') $trashSrls = array();
$oTrashModel = &getModel('trash');
if(count($trashSrls) > 0) $args->trashSrl = $trashSrls;
$output = $oTrashModel->getTrashList($args);
if(!$output->toBool()) return new Object(-1, $output->message);
if(is_array($output->data))
{
foreach($output->data AS $key=>$oTrashVO)
{
if($isAll == 'true') array_push($trashSrls, $oTrashVO->getTrashSrl());
//class file check
$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory');
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule());
$classFile = FileHandler::getRealPath($classFile);
if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file');
$oAdminController = &getAdminController($oTrashVO->getOriginModule());
if(!method_exists($oAdminController, 'emptyTrash')) return new Object(-1, 'not exist restore method in module class file');
$output = $oAdminController->emptyTrash($oTrashVO->getSerializedObject());
if(!$output->toBool()) return new Object(-1, $output->message);
}
}
return new Object(0, $lang->success_deleted);
}
/**
* @brief restore content object
**/
function procTrashAdminRestore()
{
global $lang;
$trashSrl = Context::get('trash_srl');
$trashSrlList = Context::get('cart');
$oTrashModel = &getModel('trash');
$output = $oTrashModel->getTrash($trashSrl);
if(!$output->toBool()) return new Object(-1, $output->message);
if(is_array($trashSrlList))
{
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// eache restore method call in each classfile
foreach($trashSrlList AS $key=>$value)
{
$oTrashModel = &getModel('trash');
$output = $oTrashModel->getTrash($value);
if(!$output->toBool()) return new Object(-1, $output->message);
//class file check
$classPath = ModuleHandler::getModulePath($output->data->getOriginModule());
if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory');
//class file check
$classPath = ModuleHandler::getModulePath($output->data->getOriginModule());
if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory');
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule());
$classFile = FileHandler::getRealPath($classFile);
if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file');
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule());
$classFile = FileHandler::getRealPath($classFile);
if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file');
$oAdminController = &getAdminController($output->data->getOriginModule());
if(!method_exists($oAdminController, 'restoreTrash')) return new Object(-1, 'not exist restore method in module class file');
$oAdminController = &getAdminController($output->data->getOriginModule());
if(!method_exists($oAdminController, 'restoreTrash')) return new Object(-1, 'not exist restore method in module class file');
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
$originObject = unserialize($output->data->getSerializedObject());
$output = $oAdminController->restoreTrash($originObject);
$originObject = unserialize($output->data->getSerializedObject());
$output = $oAdminController->restoreTrash($originObject);
if(!$output->toBool()) {
$oDB->rollback();
return new Object(-1, $output->message);
}
}
if(!$output->toBool()) {
$oDB->rollback();
return new Object(-1, $output->message);
// restore object delete in trash box
if(!$this->_emptyTrash($trashSrlList)) {
$oDB->rollback();
return new Object(-1, $lang->fail_empty);
}
$oDB->commit();
}
$this->setMessage('success_restore', 'info');
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrashAdminList');
$this->setRedirectUrl($returnUrl);
return;
}
}
function procTrashAdminGetList()
{
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
$trashSrls = Context::get('trash_srls');
if($trashSrls) $trashSrlList = explode(',', $trashSrls);
if(count($trashSrlList) > 0) {
$oTrashModel = &getModel('trash');
$args->trashSrl = $trashSrlList;
$output = $oTrashModel->getTrashList($args);
$trashList = $output->data;
}
else
{
Context::set('is_all', 'false');
Context::set('trash_srls', $trashSrl);
$output = $this->procTrashAdminEmptyTrash();
if(!$output->toBool()) {
$oDB->rollback();
return new Object(-1, $output->message);
}
global $lang;
$trashList = array();
$this->setMessage($lang->no_documents);
}
$oDB->commit();
return new Object(0, $lang->success_restore);
$this->add('trash_list', $trashList);
}
/**

View file

@ -20,14 +20,26 @@ class trashAdminView extends trash {
* @brief trash list
**/
function dispTrashAdminList() {
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of posts to display on a single page
$args->page_count = 5; // /< the number of pages that appear in the page navigation
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
$oTrashModel = getModel('trash');
$output = $oTrashModel->getTrashList($args);
// get Status name list
$oDocumentModel = &getModel('document');
$statusNameList = $oDocumentModel->getStatusNameList();
Context::set('trash_list', $output->data);
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('page_navigation', $output->page_navigation);
Context::set('status_name_list', $statusNameList);
// 템플릿 파일 지정
$this->setTemplateFile('trash_list');