mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-26 14:49:56 +09:00
포럼형 위젯 스킨 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3577 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
905826c0d1
commit
554ccd6d71
20 changed files with 339 additions and 0 deletions
95
widgets/forum/forum.class.php
Normal file
95
widgets/forum/forum.class.php
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
/**
|
||||
* @class forum
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 최근 게시물을 출력하는 위젯
|
||||
* @version 0.1
|
||||
**/
|
||||
|
||||
class forum extends WidgetHandler {
|
||||
|
||||
/**
|
||||
* @brief 위젯의 실행 부분
|
||||
*
|
||||
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
|
||||
* 결과를 만든후 print가 아니라 return 해주어야 한다
|
||||
**/
|
||||
function proc($args) {
|
||||
// 제목
|
||||
$title = $args->title;
|
||||
|
||||
// 최근 글 표시 시간
|
||||
$duration_new = $args->duration_new;
|
||||
if(!$duration_new) $duration_new = 12;
|
||||
|
||||
// 제목 길이 자르기
|
||||
$subject_cut_size = $args->subject_cut_size;
|
||||
if(!$subject_cut_size) $subject_cut_size = 0;
|
||||
|
||||
// 대상 모듈
|
||||
if($args->mid_list) $mid_list = explode(",",$args->mid_list);
|
||||
else return;
|
||||
|
||||
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_srls = $oModuleModel->getModuleSrlByMid($mid_list);
|
||||
|
||||
// 대상 모듈의 정보를 구함
|
||||
$module_list = $oModuleModel->getModulesInfo($module_srls);
|
||||
|
||||
// 각 모듈별로 먼저 정리 시작
|
||||
foreach($module_list as $module) {
|
||||
$modules[$module->module_srl]->title = $module->browser_title;
|
||||
$modules[$module->module_srl]->mid = $module->mid;
|
||||
$modules[$module->module_srl]->description = $module->description;
|
||||
$modules[$module->module_srl]->document_count = 0;
|
||||
$modules[$module->module_srl]->comment_count = 0;
|
||||
|
||||
// 최근 수정된 댓글의 정보
|
||||
$last_args = null;
|
||||
$last_args->module_srl = $module->module_srl;
|
||||
$output = executeQuery('widgets.forum.getLatestComments', $last_args);
|
||||
|
||||
if(is_array($output->data)) $modules[$module->module_srl]->last_comment = array_pop($output->data);
|
||||
else $modules[$module->module_srl]->last_comment = null;
|
||||
}
|
||||
|
||||
// 각 모듈별 전체글을 구함
|
||||
$total_documents_args->module_srl = $module->module_srl;
|
||||
$total_documents_args->module_srls = implode(',',$module_srls);
|
||||
|
||||
$total_documents_output = executeQueryArray('widgets.forum.getTotalDocuments',$total_documents_args);
|
||||
foreach($total_documents_output->data as $val) {
|
||||
$modules[$val->module_srl]->document_count = $val->count;
|
||||
}
|
||||
|
||||
// 각 모듈별 댓글 수를 구함
|
||||
$total_comments_args->module_srl = $module->module_srl;
|
||||
$total_comments_args->module_srls = implode(',',$module_srls);
|
||||
|
||||
$total_comments_output = executeQueryArray('widgets.forum.getTotalComments',$total_comments_args);
|
||||
foreach($total_comments_output->data as $val) {
|
||||
$modules[$val->module_srl]->comment_count = $val->count;
|
||||
}
|
||||
|
||||
$widget_info->title = $title;
|
||||
$widget_info->modules = $modules;
|
||||
$widget_info->subject_cut_size = $subject_cut_size;
|
||||
$widget_info->duration_new = $duration_new * 60*60;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue