mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52: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
|
|
@ -35,6 +35,7 @@
|
|||
var $errno = 0; ///< 에러 발생시 에러 코드 (0이면 에러가 없다고 정의)
|
||||
var $errstr = ''; ///< 에러 발생시 에러 메세지
|
||||
var $query = ''; ///< 가장 최근에 수행된 query string
|
||||
var $elapsed_time = 0; ///< 가장 최근에 수행된 query 의 실행시간
|
||||
|
||||
var $transaction_started = false; ///< 트랙잭션 처리 flag
|
||||
|
||||
|
|
@ -126,12 +127,14 @@
|
|||
$this->setError(0,'success');
|
||||
$this->query = $query;
|
||||
$this->act_start = getMicroTime();
|
||||
$this->elapsed_time = 0;
|
||||
}
|
||||
|
||||
function actFinish() {
|
||||
if(!$this->query ) return;
|
||||
$this->act_finish = getMicroTime();
|
||||
$elapsed_time = $this->act_finish - $this->act_start;
|
||||
$this->elapsed_time = $elapsed_time;
|
||||
$GLOBALS['__db_elapsed_time__'] += $elapsed_time;
|
||||
|
||||
$str = sprintf("\t%02d. %s (%0.6f sec)\n", ++$GLOBALS['__dbcnt'], $this->query, $elapsed_time);
|
||||
|
|
@ -169,8 +172,6 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
$this->query = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -270,9 +271,11 @@
|
|||
break;
|
||||
}
|
||||
|
||||
if($this->errno !=0 ) return new Object($this->errno, $this->errstr);
|
||||
if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) return $output;
|
||||
return new Object();
|
||||
if($this->errno != 0 ) $output = new Object($this->errno, $this->errstr);
|
||||
else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) $output = new Object();
|
||||
$output->add('_query', $this->query);
|
||||
$output->add('_elapsed_time', sprintf("%0.5f",$this->elapsed_time));
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@
|
|||
|
||||
// 특정 문서의 permalink로 직접 접속할 경우 page값을 직접 구함
|
||||
if(count($_GET)==1 && isset($_GET['document_srl']) && $oDocument->isExists() && !$oDocument->isNotice()) {
|
||||
$page = $oDocumentModel->getDocumentPage($oDocument->document_srl, $this->module_srl, $this->list_count);
|
||||
$page = $oDocumentModel->getDocumentPage($oDocument, $args);
|
||||
Context::set('page', $page);
|
||||
$args->page = $page;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,22 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module_srl" var="module_srl" />
|
||||
<condition operation="more" column="document_srl" var="document_srl" filter="number" notnull="notnull" pipe="and" />
|
||||
<condition operation="more" column="comment_count" var="comment_count" filter="number" pipe="and" />
|
||||
<condition operation="less" column="comment_count" var="rev_comment_count" filter="number" pipe="and" />
|
||||
<condition operation="more" column="voted_count" var="voted_count" filter="number" pipe="and" />
|
||||
<condition operation="less" column="voted_count" var="rev_voted_count" filter="number" pipe="and" />
|
||||
<condition operation="more" column="readed_count" var="readed_count" filter="number" pipe="and" />
|
||||
<condition operation="less" column="readed_count" var="rev_readed_count" filter="number" pipe="and" />
|
||||
<condition operation="less" column="list_order" var="list_order" filter="number" pipe="and" />
|
||||
<condition operation="more" column="list_order" var="rev_list_order" filter="number" pipe="and" />
|
||||
<condition operation="more" column="title" var="title" filter="number" pipe="and" />
|
||||
<condition operation="less" column="title" var="rev_title" filter="number" pipe="and" />
|
||||
<condition operation="more" column="regdate" var="regdate" filter="number" pipe="and" />
|
||||
<condition operation="less" column="regdate" var="rev_regdate" filter="number" pipe="and" />
|
||||
<condition operation="less" column="update_order" var="update_order" filter="number" pipe="and" />
|
||||
<condition operation="more" column="update_order" var="rev_update_order" filter="number" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="list_order" order="order_type" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue