git-svn-id: http://xe-core.googlecode.com/svn/trunk@1063 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-10 03:48:59 +00:00
parent bf19a8cf2a
commit c383b4af56
3 changed files with 20 additions and 8 deletions

View file

@ -600,8 +600,8 @@
$flag_list = $_SESSION['document_management'][$this->module_srl];
// 목록이 있으면 게시글을 가져옴
$document_srl_list = array_keys($flag_list);
if(count($document_srl_list)) {
if(count($flag_list)) $document_srl_list = array_keys($flag_list);
if(is_array($document_srl_list) && count($document_srl_list)) {
$oDocumentModeul = &getModel('document');
$document_list = $oDocumentModeul->getDocuments($document_srl_list, $this->grant->is_admin);
Context::set('document_list', $document_list);

View file

@ -273,7 +273,7 @@
// 첨부 파일 삭제
if($document->uploaded_count) {
$oFileController = &getController('file');
$oFileController->deleteFiles($document->module_srl, $document_srl);
$oFileController->deleteFiles($document_srl);
}
// 카테고리가 있으면 카테고리 정보 변경

View file

@ -142,17 +142,29 @@
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
**/
function deleteFiles($module_srl, $upload_target_srl) {
function deleteFiles($upload_target_srl) {
// 첨부파일 목록을 받음
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($upload_target_srl);
// 첨부파일이 없으면 성공 return
if(!is_array($file_list)||!count($file_list)) return new Object();
// DB에서 삭제
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.deleteFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $upload_target_srl);
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $upload_target_srl);
$file_count = count($file_list);
for($i=0;$i<count($file_count);$i++) {
$module_srl = $file_list[$i]->module_srl;
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $upload_target_srl);
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $upload_target_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
}
return $output;
}