플래닛모듈의 이전/다음 날짜를 DB를 통해서 글이 존재하는 날짜를 구하도록 코드 변경

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5140 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-12-22 02:12:20 +00:00
parent 8175cbc67b
commit bcd0ec91fb
5 changed files with 47 additions and 6 deletions

View file

@ -122,6 +122,23 @@
return $this->get('close_notice')=='Y'?true:false;
}
function getPrevDate($date) {
if(!$this->isExists()) return;
$args->cur_date = substr($date,0,8).'000000';
if(!$this->isHome()) $args->module_srl = $this->getModuleSrl();
$output = executeQuery('planet.getPrevDate', $args);
return substr($output->data->prev_date,0,8);
}
function getNextDate($date) {
if(!$this->isExists()) return;
if(!$date) return;
$args->cur_date = substr($date,0,8).'235959';
if(!$this->isHome()) $args->module_srl = $this->getModuleSrl();
$output = executeQuery('planet.getNextDate', $args);
return substr($output->data->next_date,0,8);
}
function isMyPlanet($planet = null) {
if(!$this->isExists()) return;
if(!Context::get('is_logged')) return false;

View file

@ -76,8 +76,8 @@
$date = Context::get('date');
if(!$date || $date > $last_date) $date = $last_date;
Context::set('date', $date);
Context::set('prev_date', date("Ymd",ztime($date)-60*60*24));
Context::set('next_date', date("Ymd",ztime($date)+60*60*24));
Context::set('prev_date', $this->planet->getPrevDate($date));
Context::set('next_date', $this->planet->getNextDate($date));
// 초기화면에서 tagtab이 나오기 위해 set type 한다
@ -181,8 +181,8 @@
$date = Context::get('date');
if(!$date || $date > $last_date) $date = $last_date;
Context::set('date', $date);
Context::set('prev_date', date("Ymd",ztime($date)-60*60*24));
Context::set('next_date', date("Ymd",ztime($date)+60*60*24));
Context::set('prev_date', $this->planet->getPrevDate($date));
Context::set('next_date', $this->planet->getNextDate($date));
// 최신 업데이트 글 추출
$page = Context::get('page');

View file

@ -0,0 +1,12 @@
<query id="getNextDate" action="select">
<tables>
<table name="documents" alias="modules" />
</tables>
<columns>
<column name="min(regdate)" alias="next_date" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="more" column="regdate" var="cur_date" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -0,0 +1,12 @@
<query id="getPrevDate" action="select">
<tables>
<table name="documents" alias="modules" />
</tables>
<columns>
<column name="max(regdate)" alias="prev_date" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="less" column="regdate" var="cur_date" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -83,12 +83,12 @@
<!--@if($date && !($act=='dispPlanetLogin' || $act=='dispPlanetContentTagSearch' || $act=='dispPlanetTagSearch' || $act=='dispPlanetContentSearch'))-->
<div class="timeNav">
<a class="prev" href="{getUrl('date',$prev_date)}" title="{$lang->cmd_prev}">&lt;</a>
<!--@if($prev_date)--><a class="prev" href="{getUrl('date',$prev_date)}" title="{$lang->cmd_prev}">&lt;</a><!--@end-->
<strong>{zdate($date,'Y')}</strong>{$lang->unit_year}
<strong>{zdate($date,'m')}</strong>{$lang->unit_month}
<strong>{zdate($date,'d')}</strong>{$lang->unit_day}
(<em>{zdate($date,'l')}</em>)
<a class="next" href="{getUrl('date',$next_date)}" title="{$lang->cmd_next}">&gt;</a>
<!--@if($next_date)--><a class="next" href="{getUrl('date',$next_date)}" title="{$lang->cmd_next}">&gt;</a><!--@end-->
</div>
<!--@end-->
</div>