문서모듈에 게시물의 확장사 목록을 구하는 기능 추가. 게시판 기본 스킨 + 최근게시글 위젯 기본 스킨에 기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2649 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-09-28 06:29:26 +00:00
parent 9edd6d32af
commit 6043141c6d
16 changed files with 68 additions and 3 deletions

View file

@ -270,7 +270,7 @@
return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
}
function thumbnailExists($width, $height) {
function thumbnailExists($width = 80, $height = 0) {
if(!$this->getThumbnail($width, $height)) return false;
return true;
}
@ -341,6 +341,54 @@
return Context::getRequestUri().$thumbnail_file;
}
/**
* @brief 새글, 최신 업데이트글, 비밀글, 이미지/동영상/첨부파일등의 아이콘 출력용 함수
* $time_interval 지정된 시간() 새글/최신 업데이트글의 판별
**/
function getExtraImages($time_interval = 7200) {
// 아이콘 목록을 담을 변수 미리 설정
$buffs = array();
// 최신 시간 설정
$time_check = date("YmdHis", time()-$time_interval);
// 새글 체크
if($this->get('regdate')>$time_check) $buffs[] = "new";
else if($this->get('last_update')>$time_check) $buffs[] = "update";
// 비밀글 체크
if($this->isSecret()) $buffs[] = "secret";
// 사진 이미지 체크
if(preg_match('!<img([^>]*?)>!is', $this->get('content'))) $buffs[] = "image";
// 동영상 체크
if(preg_match('!<embed([^>]*?)>!is', $this->get('content'))) $buffs[] = "movie";
// 첨부파일 체크
if($this->hasUploadedFiles()) $buffs[] = "file";
return $buffs;
}
/**
* @brief getExtraImages로 구한 값을 이미지 태그를 씌워서 리턴
**/
function printExtraImages($time_check = 7200) {
// 아이콘 디렉토리 구함
$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
$buffs = $this->getExtraImages($time_check);
if(!count($buffs)) return;
$buff = null;
foreach($buffs as $key => $val) {
$buff .= sprintf('<img src="%s%s.gif" alt="%s" title="%s" width="13" height="13" />', $path, $val, $val, $val);
}
return $buff;
}
function hasUploadedFiles() {
if($this->isSecret() && !$this->isGranted()) return false;
return $this->get('uploaded_count')? true : false;