mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
게시판 모듈에서 조회/추천/제목/댓글수 정렬외의 정렬대상에서 문서번호만으로 접속시 해당 문서의 페이지를 자동으로 구하는 루틴을 보다 정교하게 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4276 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cf8d8c720a
commit
4496358bad
4 changed files with 51 additions and 12 deletions
|
|
@ -412,15 +412,35 @@
|
|||
/**
|
||||
* @brief 해당 document의 page 가져오기, module_srl이 없으면 전체에서..
|
||||
**/
|
||||
function getDocumentPage($document_srl, $module_srl=0, $list_count) {
|
||||
// 변수 설정
|
||||
$args->document_srl = $document_srl;
|
||||
$args->module_srl = $module_srl;
|
||||
function getDocumentPage($oDocument, $opt) {
|
||||
// 정렬 형식에 따라서 query args 변경
|
||||
switch($opt->sort_index) {
|
||||
case 'update_order' :
|
||||
if($opt->order_type == 'desc') $args->rev_update_order = $oDocument->get('update_order');
|
||||
else $args->update_order = $oDocument->get('update_order');
|
||||
break;
|
||||
case 'regdate' :
|
||||
if($opt->order_type == 'desc') $args->rev_regdate = $oDocument->get('regdate');
|
||||
else $args->regdate = $oDocument->get('regdate');
|
||||
break;
|
||||
case 'voted_count' :
|
||||
case 'readed_count' :
|
||||
case 'comment_count' :
|
||||
case 'title' :
|
||||
return 1;
|
||||
break;
|
||||
default :
|
||||
if($opt->order_type == 'desc') $args->rev_list_order = $oDocument->get('list_order');
|
||||
else $args->list_order = $oDocument->get('list_order');
|
||||
break;
|
||||
}
|
||||
$args->sort_index = $opt->sort_index;
|
||||
$args->order_type = $opt->order_type;
|
||||
|
||||
// 전체 갯수를 구한후 해당 글의 페이지를 검색
|
||||
$output = executeQuery('document.getDocumentPage', $args);
|
||||
$count = $output->data->count;
|
||||
$page = (int)(($count-1)/$list_count)+1;
|
||||
$page = (int)(($count-1)/$opt->list_count)+1;
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue