mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2327 201d5d3c-b55e-5fd7-737f-ddc643e51545
83 lines
2.5 KiB
PHP
83 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* @class fileModel
|
|
* @author zero (zero@nzeo.com)
|
|
* @brief file 모듈의 model 클래스
|
|
**/
|
|
|
|
class fileModel extends file {
|
|
|
|
/**
|
|
* @brief 초기화
|
|
**/
|
|
function init() {
|
|
}
|
|
|
|
/**
|
|
* @brief 특정 문서에 속한 첨부파일의 개수를 return
|
|
**/
|
|
function getFilesCount($upload_target_srl) {
|
|
$args->upload_target_srl = $upload_target_srl;
|
|
$output = executeQuery('file.getFilesCount', $args);
|
|
return (int)$output->data->count;
|
|
}
|
|
|
|
/**
|
|
* @brief 다운로드 경로를 구함
|
|
**/
|
|
function getDownloadUrl($file_srl, $sid) {
|
|
return getUrl('','module','file','act','procFileDownload','file_srl',$file_srl,'sid',$sid);
|
|
}
|
|
|
|
/**
|
|
* @brief 파일 설정 정보를 구함
|
|
**/
|
|
function getFileConfig() {
|
|
// 설정 정보를 받아옴 (module model 객체를 이용)
|
|
$oModuleModel = &getModel('module');
|
|
$config = $oModuleModel->getModuleConfig('file');
|
|
|
|
if(!$config->allowed_filesize) $config->allowed_filesize = '2';
|
|
if(!$config->allowed_attach_size) $config->allowed_attach_size = '3';
|
|
if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*';
|
|
return $config;
|
|
}
|
|
|
|
/**
|
|
* @brief 파일 정보를 구함
|
|
**/
|
|
function getFile($file_srl) {
|
|
$args->file_srl = $file_srl;
|
|
$output = executeQuery('file.getFile', $args);
|
|
if(!$output->toBool()) return $output;
|
|
|
|
$file = $output->data;
|
|
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
|
|
|
return $file;
|
|
}
|
|
|
|
/**
|
|
* @brief 특정 문서에 속한 파일을 모두 return
|
|
**/
|
|
function getFiles($upload_target_srl) {
|
|
$args->upload_target_srl = $upload_target_srl;
|
|
$args->sort_index = 'file_srl';
|
|
$output = executeQuery('file.getFiles', $args);
|
|
if(!$output->data) return;
|
|
|
|
$file_list = $output->data;
|
|
|
|
if($file_list && !is_array($file_list)) $file_list = array($file_list);
|
|
|
|
$file_count = count($file_list);
|
|
for($i=0;$i<$file_count;$i++) {
|
|
$file = $file_list[$i];
|
|
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
|
$file_list[$i] = $file;
|
|
}
|
|
|
|
return $file_list;
|
|
}
|
|
}
|
|
?>
|