mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-22 12:49:55 +09:00
사이트 전체 RSS 발행. 모든 mid를 체크하여 open_rss가 Y또는 H인 경우에만 글을 찾아서 RSS로 출력
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1886 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
03eaa01d56
commit
88bd5f049b
3 changed files with 63 additions and 18 deletions
|
|
@ -8,6 +8,7 @@
|
|||
<conditions>
|
||||
<condition operation="equal" column="module_category_srl" var="module_category_srl" />
|
||||
<condition operation="equal" column="module" var="module" pipe="and" />
|
||||
<condition operation="in" column="open_rss" var="open_rss" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="mid" order="asc" />
|
||||
|
|
|
|||
|
|
@ -22,39 +22,78 @@
|
|||
function rss() {
|
||||
// RSS를 출력하고자 하는 mid를 구함 (없으면 오류)
|
||||
$mid = Context::get('mid');
|
||||
if(!$mid) return $this->dispError();
|
||||
|
||||
// 모듈의 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($mid);
|
||||
if($module_info->mid != $mid) return $this->dispError();
|
||||
$mid_list = array();
|
||||
|
||||
// RSS 비활성화 되었는지 체크하여 비활성화시 에러 출력
|
||||
if($module_info->open_rss == 'N') return $this->dispError();
|
||||
// mid값이 없으면 전체 mid중 open_rss == 'Y|H'인 걸 고름
|
||||
if(!$mid) {
|
||||
$args->open_rss = "'Y','H'";
|
||||
$module_list = $oModuleModel->getMidList($args);
|
||||
if(!$module_list) return $this->dispError();
|
||||
|
||||
// 출력할 컨텐츠 추출
|
||||
$args->module_srl = $module_info->module_srl;
|
||||
$args->page = Context::get('page');
|
||||
$args->list_count = 20;
|
||||
// 대상 모듈을 정리함
|
||||
$module_srl_list = array();
|
||||
foreach($module_list as $mid => $val) {
|
||||
$module_srl_list[] = $val->module_srl;
|
||||
$mid_list[$val->module_srl] = $val;
|
||||
}
|
||||
if(!count($module_srl_list)) return $this->dispError();
|
||||
unset($output);
|
||||
unset($args);
|
||||
|
||||
$module_srl = implode(',',$module_srl_list);
|
||||
|
||||
// 있으면 해당 모듈의 정보를 구함
|
||||
} else {
|
||||
// 모듈의 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($mid);
|
||||
if($module_info->mid != $mid) return $this->dispError();
|
||||
|
||||
// RSS 비활성화 되었는지 체크하여 비활성화시 에러 출력
|
||||
if($module_info->open_rss == 'N') return $this->dispError();
|
||||
|
||||
$module_srl = $module_info->module_srl;
|
||||
$mid_list[$module_info->module_srl] = $module_info;
|
||||
|
||||
unset($args);
|
||||
}
|
||||
|
||||
// 변수 설정
|
||||
$page = (int)Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
$list_count = (int)Context::get('list_count');
|
||||
if(!$list_count|| $list_count>100) $list_count = 100;
|
||||
|
||||
// 출력할 컨텐츠 추출을 위한 인자 정리
|
||||
$args->module_srl = $module_srl;
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
|
||||
$args->search_target = Context::get('search_target');
|
||||
$args->search_keyword = Context::get('search_keyword');
|
||||
if($module_info->use_category=='Y') $args->category_srl = Context::get('category');
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
|
||||
// 대상 문서들을 가져옴
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($args);
|
||||
$document_list = $output->data;
|
||||
|
||||
// rss 제목 및 정보등을 추출
|
||||
$info->title = Context::getBrowserTitle();
|
||||
$info->description = $this->module_info->description;
|
||||
$info->language = Context::getLangType();
|
||||
$info->date = gmdate("D, d M Y H:i:s");
|
||||
$info->link = getUrl('','mid',Context::get('mid'));
|
||||
if($this->mid) {
|
||||
$info->title = Context::getBrowserTitle();
|
||||
$info->description = $this->module_info->description;
|
||||
$info->link = getUrl('','mid',Context::get('mid'));
|
||||
} else {
|
||||
$info->title = $info->link = Context::getRequestUri();
|
||||
}
|
||||
$info->total_count = $output->total_count;
|
||||
$info->date = gmdate("D, d M Y H:i:s");
|
||||
$info->language = Context::getLangType();
|
||||
|
||||
// rss2.0으로 출력
|
||||
if(count($document_list)) {
|
||||
$idx = 0;
|
||||
foreach($document_list as $key => $item) {
|
||||
|
|
@ -70,8 +109,10 @@
|
|||
$item->link = $item->getPermanentUrl();
|
||||
$item->title = $item->getTitleText();
|
||||
|
||||
$module_srl = $item->get('module_srl');
|
||||
|
||||
// 전문 공개일 경우
|
||||
if($module_info->open_rss=='Y') {
|
||||
if($mid_list[$module_srl]->open_rss=='Y') {
|
||||
$item->description = $item->getContent();
|
||||
// 요약 공개일 경우
|
||||
} else {
|
||||
|
|
@ -80,7 +121,7 @@
|
|||
$item->date = gmdate("D, d M Y H:i:s", $time);
|
||||
$content[$idx++] = $item;
|
||||
}
|
||||
}
|
||||
} else return $this->dispError();
|
||||
|
||||
// RSS 출력물에서 사용될 변수 세팅
|
||||
Context::set('info', $info);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue