rhymix/modules/trash/trash.admin.view.php
Kijin Sung 84e5542d77 Remove unnecessary use of BaseObject
- 트리거 등 반환값이 필요하지 않은 곳에서 new BaseObject()를 반환하는 것 삭제
- 모듈 설치, 업데이트 후 무의미한 new BaseObject()를 반환하는 것 삭제
- 사용자에게 에러 메시지를 돌려주는 용도로 new BaseObject(-1, '에러메시지')를
  사용하는 경우는 대부분 $this->setError()로 변경함. 언어 변환과 sprintf()
  처리까지 한 번에 이루어지므로 이쪽이 더 편리함.
2017-12-01 00:54:51 +09:00

128 lines
3.7 KiB
PHP

<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/**
* trashAdminView class
* Admin view class of the trash module
*
* @author NAVER (developers@xpressengine.com)
* @package /modules/trash
* @version 0.1
*/
class trashAdminView extends trash
{
/**
* Initialization
* @return void
*/
function init()
{
// 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음)
$template_path = sprintf("%stpl/",$this->module_path);
$this->setTemplatePath($template_path);
}
/**
* Trash list
* @return void
*/
function dispTrashAdminList()
{
$args = new stdClass();
$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->originModule = Context::get('originModule');
$search_target = Context::get('search_target'); // /< search (title, contents ...)
$search_keyword = Context::get('search_keyword'); // /< keyword to search
switch($search_target)
{
case 'title':
$args->s_title = $search_keyword;
break;
case 'user_id':
$args->s_user_id = $search_keyword;
break;
case 'nick_name':
$args->s_nick_name = $search_keyword;
break;
case 'trash_ipaddress':
$args->s_ipaddress = $search_keyword;
break;
}
$oTrashModel = getModel('trash');
$output = $oTrashModel->getTrashList($args);
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);
$oModuleModel = getModel('module');
$module_list = array();
$mod_srls = array();
foreach($output->data as $oTrashVO)
{
$mod_srls[] = $oTrashVO->unserializedObject['module_srl'];
}
$mod_srls = array_unique($mod_srls);
// Module List
$mod_srls_count = count($mod_srls);
if($mod_srls_count)
{
$columnList = array('module_srl', 'mid', 'browser_title');
$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
if($module_output && is_array($module_output))
{
foreach($module_output as $module)
{
$module_list[$module->module_srl] = $module;
}
}
}
Context::set('module_list', $module_list);
// 템플릿 파일 지정
$this->setTemplateFile('trash_list');
}
// Trash View - sejin7940
function dispTrashAdminView()
{
$trash_srl = Context::get('trash_srl');
$oTrashModel = getModel('trash');
$output = $oTrashModel->getTrash($trash_srl);
if(!$output->data->getTrashSrl()) return $this->setError('msg_invalid_request');
$originObject = unserialize($output->data->getSerializedObject());
if(is_array($originObject)) $originObject = (object)$originObject;
Context::set('oTrashVO',$output->data);
Context::set('oOrigin',$originObject);
$oMemberModel = &getModel('member');
$remover_info = $oMemberModel->getMemberInfoByMemberSrl($output->data->getRemoverSrl());
Context::set('remover_info', $remover_info);
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($originObject->module_srl);
Context::set('module_info', $module_info);
if($originObject) {
$args_extra = new stdClass;
$args_extra->module_srl = $originObject->module_srl;
$args_extra->document_srl = $originObject->document_srl;
$output_extra = executeQueryArray('trash.getDocumentExtraVars', $args_extra);
Context::set('oOriginExtraVars',$output_extra->data);
}
$this->setTemplateFile('trash_view');
}
}
/* End of file trash.admin.view.php */
/* Location: ./modules/trash/trash.admin.view.php */