묻고답하기

다운로드 랭킹 위젯에서

 

 

다운로드랭킹 위젯 정보와 더불어 플래시 플레이어를 뿌려주기 위하여 업로드한 파일들의

$oDocument->hasUploadedFiles() 를 선언해야하는데

 

위젯의 class.php 파일에

            //추가
            $oDocumentModel = &getModel('document');
            $oDocument = $oDocumentModel->getDocument($obj->upload_target_srl, false, false);

 

 

이런식으로  변수를 추가하고

 

list.html 부분에 아래 태그를 입력해도

 

upload된 파일들을 읽지 못하는 것 같습니다.

 

위젯에서 업로드된 파일들을 불러오려면 어떻게 해야할까요??

 

 

 

     <!--// musicplayer(mKAEkr, 2014-08-11) -->
       <block cond="$oDocument->hasUploadedFiles()">
        {@
         $AttachmentList = $oDocument->hasUploadedFiles();
         $attachment_loop = 0;
         $allow_extension = array('mp3', 'wav');
         $replace_text_target = array("'", '"');
         $replace_text_needle = array(''', '"');
        }

 

 

 

<?php
    /**
     * @class rank_download
     * @author Simulz.com (k10206@naver.com)
     * @brief 파일 다운로드 랭킹
     **/

    class rank_download extends WidgetHandler {

        /**
         * @brief 위젯의 실행 부분
         *
         * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
         * 결과를 만든후 print가 아니라 return 해주어야 한다
         **/
        function proc($args) {
            // 대상 모듈 (mid_list는 기존 위젯의 호환을 위해서 처리하는 루틴을 유지. module_srls로 위젯에서 변경)
            $oModuleModel = &getModel('module');
            if($args->mid_list) {
                $mid_list = explode(",",$args->mid_list);
                if(count($mid_list)) {
                    $module_srls = $oModuleModel->getModuleSrlByMid($mid_list);
                    if(count($module_srls)) $args->module_srls = implode(',',$module_srls);
                    else $args->module_srls = null;
                } 
            }


            //추가
            $oDocumentModel = &getModel('document');
            $oDocument = $oDocumentModel->getDocument($obj->upload_target_srl, false, false);


            // 제목
            $title = $args->title;

            // 정렬 대상
            $order_target = $args->order_target;

            // 정렬 순서
            $order_type = $args->order_type;
            if(!in_array($order_type, array('asc','desc'))) $order_type = 'asc';

            // 출력된 목록 수
            $list_count = (int)$args->list_count;
            if(!$list_count) $list_count = 5;

            // 대상 모듈이 선택되어 있지 않으면 해당 사이트의 전체 모듈을 대상으로 함
            $site_module_info = Context::get('site_module_info');
            if($args->module_srls) $obj->module_srl = $args->module_srls;
            else if($site_module_info) $obj->site_srl = (int)$site_module_info->site_srl;

            // FileModel::getFileList()를 이용하기 위한 변수 정리
            $obj->direct_download = ($args->attach_type == "noimage") ? "N": (($args->attach_type == "image") ? "Y" : "");

            if($args->without_image == "true") $obj->direct_download = "N";
            $obj->list_count = $list_count;
            $obj->sort_index = $order_target;
            $obj->order_type = $args->order_type;

            // 다운로드 횟수 1이상만 검색
            $obj->download_count = 1;
			if($args->regdate) $obj->regdate = date("Ymd", strtotime("-{$args->regdate} day"));
            $output = executeQueryArray('widgets.rank_download.getFileList', $obj);

            // 오류가 생기면 그냥 무시
            if(!$output->toBool()) ;

            $oFileModel = &getModel('file');

            if(count($output->data)) {
                foreach($output->data as $key => $val) {
                    $file = $val;
                    $file->download_url = $oFileModel->getDownloadUrl($val->file_srl, $val->sid);

                    $file->source_filename = htmlspecialchars($val->source_filename);

					if($args->short_title && !preg_match("/[^0-9]/", $args->short_title))
						{
						if(!$args->short_type) $args->short_type = "...";
						if($args->ext_option != "Y")
						$file->source_filename = cut_str($file->source_filename, $args->short_title, $args->short_type);
							else
							{
							preg_match("/\.[a-zA-Z0-9_]+$/", $val->source_filename, $ext);
							$newTitle = substr($val->source_filename, 0, strlen($val->source_filename)-strlen($ext[0]));
							$file->source_filename = cut_str($newTitle, $args->short_title, $args->short_type).$ext[0];
							}
						}

                    $file_list[$key] = $file;
                }
            }

            $widget_info->title = $title;
            $widget_info->list_count = $list_count;
            $widget_info->file_list = $file_list;
            $widget_info->download = $args->download == "Y" ? true : false;
            $widget_info->subject_cut_size = $subject_cut_size;

            Context::set('widget_info', $widget_info);

            // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
            $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
            Context::set('colorset', $args->colorset);

            // 템플릿 파일을 지정
            $tpl_file = 'list';

            // 템플릿 컴파일
            $oTemplate = &TemplateHandler::getInstance();
            $output = $oTemplate->compile($tpl_path, $tpl_file);
            return $output;
        }
    }
?>
 
<!--// 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->

<!--%import("css/default.css")-->



<div class="sz_download">


    <div class="sz_{$colorset}">
        <!--@if($widget_info->title)-->
        <h2>{$widget_info->title} Top {$widget_info->list_count}</h2>
        <!--@end-->

        <!--@if(count($widget_info->file_list))-->
        <ul>
        {@ $no = 1}
        <!--@foreach($widget_info->file_list as $val)-->
 
		<li>
            <div class="title">{$no}위. <a href="{getUrl('','document_srl',$val->upload_target_srl)}">{$val->source_filename} ({FileHandler::filesize($val->file_size)})</a></div>
            <!--@if($widget_info->download)--><div class="download"><a href="{$val->download_url}" onClick="return (confirm('다운시 포인트가 차감됩니다'))?true:false">
			[다운]</a></div><!--@end-->
            <div class="count">{$val->download_count}회</div>
            <div class="clear"></div>
        </li>
        {@ $no++}
        <!--@end-->
        </ul>
        <!--@end-->
    </div>
</div>







        


 


글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
튼구름 숫자아이디 사용 [2] 2014.11.05 by 튼구름
sepiron 윈도우7 apm -> 우분투 서버 이전 후 화면이 깨지는데 원인을 모르겠습니다.  
SO.. 게시판 설정에 관해 기초적인 질문 좀 드립니다; [2] 2014.11.05 by SO..
구름상자 게시판 모듈 스케치북 스킨 '게시물을 뷰어로 보기' 질문입니다. file  
세상의종말 확장자 jsp 가능한가요 [2] 2014.11.05 by 로이조52
쫑효다컴 xe 만들고 회원가입 오픈되어 스팸회원 2만명이 가입되었는데 일괄정리 어디서 해야할까요? [1] 2014.11.05 by 로이조52
토라상 헤스티아(Hestia) 레이아웃 혹시 사용하시는 분 궁금합니다. [2] 2014.11.05 by 토라상
홍우진127 모바일 뷰 사용 안함 [8] 2014.11.05 by 키스투엑스이
쫑효다컴 제로보드 마이그레이션 문의 입니다. [2] 2014.11.05 by 쫑효다컴
designslam 기본 url 설정이 안 되어 있습니다. 문제가 있습니다.  
WhiteAT 최신 버전 설치후, 로그인, 첨부파일 오류  
세상의종말 구글 애드센스 위치 잡아주세요 ㅠ [4] 2014.11.05 by 세상의종말
sepiron 프레임 나누면 메인 위젯이 작동 안합니다.  
추향1호 신디케이션 비밀글 크롤링 막기  
죽방망이 댓글달면 글이 최신글로 등록되는거 어떻게??하나요 [2] 2014.11.05 by 죽방망이
꾸링 변수를 호출하고싶습니다!  
곰구리312 회원포인트목록 누르면 깨진화면 나와요.. [1] file 2014.11.05 by 퍼니엑스이
oscarmike 신디케이션 질문 [1] 2014.11.05 by 퍼니엑스이
단군e 게시판쓰기 권한에서요.. [1] 2014.11.05 by 퍼니엑스이
양손어 첨부파일 1개로 제한했는데 삭제후 다시 업로드할때...  
똥위엔 게시판 화면이 깨지는 경우는 어떻게 해야하나요? [2] 2014.11.04 by 똥위엔
머찌니 파일 첨부가 않되는 문제 (특히 xpresseditor) [4] 2014.11.04 by 해오진
해오진 Textyle...dreditor에서 파일첨부 기능이 작동하지 않음 [2] 2014.11.04 by 해오진
타우렌힐농장 dreditor 이미지를 업로드 하면 문제가 발생합니다. [1] 2014.11.04 by 해오진
李玩映 게시판에서 "내용 값은 필수입니다" 이라는 오류메시지 [3] 2014.11.04 by 최윤한
최윤한 xe기본 모바일스킨(Color code)에서는 쪽지확인 안되나요?  
Kyrillos 게시판에서 이름 대신 닉네임이 나오는 현상 file  
추향1호 게시물 이동시에 연관된 위젯에서 목록이 안 나타나요 [3] 2014.11.04 by 추향1호
inurface /index.php?mid= 이게 도대체 먼가요? [8] 2014.11.04 by inurface
inurface contact us 적용 어떻게 하나요?