mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
관리페이지 첨부파일 목록 개선
* 첨부 대상 표시 : 댓글, 모듈(페이지), 임시저장 문서
* 회원 닉네임 출력 추가
* 대기 상태 파일의 닉네임 출력 안되는건 문제 아님
* 모듈 업데이트 필요 (필드 추가)
* 파일 업로드시에는 값을 주지 않고
관리페이지에서 조회시에 업데이트 (업로드시 값 넣으면 오히려 방해)
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6310 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a42e14c552
commit
f57734760b
5 changed files with 170 additions and 73 deletions
|
|
@ -31,67 +31,138 @@
|
|||
$output = $oFileModel->getFileList($args);
|
||||
|
||||
// 목록의 loop를 돌면서 document를 구하기
|
||||
if($output->total_count) {
|
||||
$document_srl_list = array();
|
||||
$module_srls= array();
|
||||
if($output->data) {
|
||||
$oCommentModel = &getModel('comment');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
foreach($output->data as $val) {
|
||||
if(!in_array($val->upload_target_srl, $document_srl_list)) $document_srl_list[] = $val->upload_target_srl;
|
||||
if(!in_array($val->module_srl, $module_srls)) $module_srls[] = $val->module_srl;
|
||||
}
|
||||
$file_list = array();
|
||||
$document_list = array();
|
||||
$comment_list = array();
|
||||
$module_list= array();
|
||||
|
||||
if(count($module_srls)) {
|
||||
$module_args->module_srls = implode(',', $module_srls);
|
||||
$module_output = executeQueryArray('module.getModulesInfo', $module_args);
|
||||
$doc_srls = array();
|
||||
$com_srls = array();
|
||||
$mod_srls= array();
|
||||
|
||||
if($module_output->data) {
|
||||
foreach($module_output->data as $module) {
|
||||
$module_list[$module->module_srl] = $module;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($output->data as $file) {
|
||||
$file_srl = $file->file_srl;
|
||||
$target_srl = $file->upload_target_srl;
|
||||
$file_update_args = null;
|
||||
$file_update_args->file_srl = $file_srl;
|
||||
|
||||
// comment의 첨부파일이면 document_srl을 추가로 구함
|
||||
if($document_srl_list) {
|
||||
$oCommentModel = &getModel('comment');
|
||||
$comment_output = $oCommentModel->getComments($document_srl_list);
|
||||
|
||||
if($comment_output) {
|
||||
foreach($comment_output as $val) {
|
||||
$comment_list[$val->comment_srl] = $val->document_srl;
|
||||
// upload_target_type이 없으면 찾아서 업데이트
|
||||
if(!$file->upload_target_type) {
|
||||
// 찾아둔게 있으면 패스
|
||||
if($document_list[$target_srl]) {
|
||||
$file->upload_target_type = 'doc';
|
||||
} else if($comment_list[$target_srl]) {
|
||||
$file->upload_target_type = 'com';
|
||||
} else if($module_list[$target_srl]) {
|
||||
$file->upload_target_type = 'mod';
|
||||
} else {
|
||||
// document
|
||||
$document = $oDocumentModel->getDocument($target_srl);
|
||||
if($document->isExists()) {
|
||||
$file->upload_target_type = 'doc';
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$document_list[$target_srl] = $document;
|
||||
}
|
||||
// comment
|
||||
if(!$file->upload_target_type) {
|
||||
$comment = $oCommentModel->getComment($target_srl);
|
||||
if($comment->isExists()) {
|
||||
$file->upload_target_type = 'com';
|
||||
$file->target_document_srl = $comment->document_srl;
|
||||
debugPrint($comment->document_srl);
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$comment_list[$target_srl] = $comment;
|
||||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
// module (페이지인 경우)
|
||||
if(!$file->upload_target_type) {
|
||||
$module = $oModuleModel->getModulesInfo($target_srl);
|
||||
if($module) {
|
||||
$file->upload_target_type = 'mod';
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$module_list[$module->comment_srl] = $module;
|
||||
}
|
||||
}
|
||||
if($file_update_args->upload_target_type) {
|
||||
executeQuery('file.updateFile', $file_update_args);
|
||||
}
|
||||
}
|
||||
|
||||
$file_list_keys = array_keys($output->data);
|
||||
for($i=0; $i < $file_count; $i++) {
|
||||
$output->data[$file_list_keys[$i]]->target_document_srl = $comment_list[$output->data[$file_list_keys[$i]]->upload_target_srl];
|
||||
// 이미 구해진 데이터가 있는 확인
|
||||
for($i = 0; $i < $com_srls_count; ++$i) {
|
||||
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
|
||||
}
|
||||
|
||||
foreach($comment_output as $val) {
|
||||
if(!in_array($val->document_srl, $document_srl_list)) $document_srl_list[] = $val->document_srl;
|
||||
for($i = 0; $i < $doc_srls_count; ++$i) {
|
||||
if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]);
|
||||
}
|
||||
for($i = 0; $i < $mod_srls_count; ++$i) {
|
||||
if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$args->document_srls = implode(',', $document_srl_list);
|
||||
$args->list_order = 'document_srl';
|
||||
$args->order_type = 'desc';
|
||||
$document_output = executeQueryArray('document.getDocuments', $args);
|
||||
|
||||
if($document_output->data) {
|
||||
foreach($document_output->data as $document) {
|
||||
$document_list[$document->document_srl] = $document;
|
||||
if($file->upload_target_type) {
|
||||
if(!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'})) {
|
||||
${$file->upload_target_type.'_srls'}[] = $target_srl;
|
||||
}
|
||||
}
|
||||
|
||||
$file_list[$file_srl] = $file;
|
||||
$mod_srls[] = $file->module_srl;
|
||||
}
|
||||
|
||||
// 중복 제거
|
||||
$doc_srls = array_unique($doc_srls);
|
||||
$com_srls = array_unique($com_srls);
|
||||
$mod_srls = array_unique($mod_srls);
|
||||
|
||||
// 댓글 목록
|
||||
$com_srls_count = count($com_srls);
|
||||
if($com_srls_count) {
|
||||
$comment_output = $oCommentModel->getComments($com_srls);
|
||||
foreach($comment_output as $comment) {
|
||||
$comment_list[$comment->comment_srl] = $comment;
|
||||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
|
||||
// 문서 목록
|
||||
$doc_srls_count = count($doc_srls);
|
||||
if($doc_srls_count) {
|
||||
$document_output = $oDocumentModel->getDocuments($doc_srls);
|
||||
foreach($document_output as $document) {
|
||||
$document_list[$document->document_srl] = $document;
|
||||
}
|
||||
}
|
||||
|
||||
// 모듈 목록
|
||||
$mod_srls_count = count($mod_srls);
|
||||
if($mod_srls_count) {
|
||||
$module_output = $oModuleModel->getModulesInfo($mod_srls);
|
||||
foreach($module_output as $module) {
|
||||
$module_list[$module->module_srl] = $module;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($file_list as $srl => $file) {
|
||||
if($file->upload_target_type == 'com') {
|
||||
$file_list[$srl]->target_document_srl = $comment_list[$file->upload_target_srl]->document_srl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('file_list', $file_list);
|
||||
Context::set('document_list', $document_list);
|
||||
Context::set('comment_list', $comment_list);
|
||||
Context::set('module_list', $module_list);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('file_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
Context::set('document_list', $document_list);
|
||||
Context::set('module_list', $module_list);
|
||||
|
||||
// 템플릿 지정
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue