mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
최근 게시물 출력 위젯에 최신순으로 가져올 경우 공지사항의 속성을 무시하고 무조건 최근 순으로 가져오도록 수정.
widget에서 xml query를 이용할 수 있는 방법을 적용해서 직접 쿼리문을 실행해서 데이터 호출하는 코드 추가 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2376 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
59b2878587
commit
f5fc930ec6
2 changed files with 57 additions and 4 deletions
|
|
@ -18,27 +18,64 @@
|
|||
// 위젯 자체적으로 설정한 변수들을 체크
|
||||
$title = $args->title;
|
||||
$order_target = $args->order_target;
|
||||
if(!in_array($order_target, array('list_order','update_order'))) $order_target = 'list_order';
|
||||
$order_type = $args->order_type;
|
||||
if(!in_array($order_type, array('asc','desc'))) $order_type = 'desc';
|
||||
$list_count = (int)$args->list_count;
|
||||
if(!$list_count) $list_count = 5;
|
||||
$mid_list = explode(",",$args->mid_list);
|
||||
$subject_cut_size = $args->subject_cut_size;
|
||||
if(!$subject_cut_size) $subject_cut_size = 0;
|
||||
|
||||
/**
|
||||
* order_target=list_order일 경우 document 테이블의 list_order 컬럼말고 document_srl을 이용하게 하고 순서를 반대로 한다
|
||||
* 이유는 공지사항을 적용하지 않은 순수한 글 작성 순서로만 사용하기 위해성.ㅁ
|
||||
* 2007. 8. 22. zero
|
||||
**/
|
||||
if($order_target == 'list_order') $order_target = 'document_srl';
|
||||
|
||||
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
|
||||
if($mid_list) {
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_srl = $oModuleModel->getModuleSrlByMid($mid_list);
|
||||
}
|
||||
|
||||
// DocumentModel::getDocumentList()를 이용하기 위한 변수 정리
|
||||
$obj->mid = $mid_list;
|
||||
$obj->module_srl = implode(',',$module_srl);
|
||||
$obj->sort_index = $order_target;
|
||||
$obj->order_type = $order_type;
|
||||
$obj->list_count = $list_count;
|
||||
|
||||
// document 모듈의 model 객체를 받아서 getDocumentList() method를 실행
|
||||
$output = executeQuery('widgets.newest_document.getNewestDocuments', $obj);
|
||||
|
||||
// document 모듈의 model 객체를 받아서 결과를 객체화 시킴
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($obj);
|
||||
|
||||
// 오류가 생기면 그냥 무시
|
||||
if(!$output->toBool()) return;
|
||||
|
||||
// 결과가 있으면 각 문서 객체화를 시킴
|
||||
if(count($output->data)) {
|
||||
foreach($output->data as $key => $attribute) {
|
||||
$document_srl = $attribute->document_srl;
|
||||
|
||||
$oDocument = null;
|
||||
$oDocument = new documentItem();
|
||||
$oDocument->setAttribute($attribute);
|
||||
|
||||
$document_list[$key] = $oDocument;
|
||||
}
|
||||
} else {
|
||||
|
||||
$document_list = array();
|
||||
|
||||
}
|
||||
|
||||
// 템플릿 파일에서 사용할 변수들을 세팅
|
||||
if(count($mid_list)==1) $widget_info->module_name = $mid_list[0];
|
||||
|
||||
$widget_info->title = $title;
|
||||
$widget_info->document_list = $output->data;
|
||||
$widget_info->document_list = $document_list;
|
||||
$widget_info->subject_cut_size = $subject_cut_size;
|
||||
|
||||
Context::set('widget_info', $widget_info);
|
||||
|
|
|
|||
16
widgets/newest_document/queries/getNewestDocuments.xml
Normal file
16
widgets/newest_document/queries/getNewestDocuments.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<query id="getDocumentList" action="select">
|
||||
<tables>
|
||||
<table name="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
|
||||
<condition operation="equal" column="category_srl" var="category_srl" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="document_srl" order="order_type" />
|
||||
<list_count var="list_count" default="20" />
|
||||
</navigation>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue