ticket:324 . Fixed lifepod module

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3588 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2008-01-24 08:25:50 +00:00
parent f9c41b78fd
commit 8ac478e552
2 changed files with 33 additions and 23 deletions

View file

@ -31,15 +31,15 @@
return $oReqeust;
}
function getURL($address, $start, $end) {
return sprintf("%s&start=%s&end=%s", $address, $start, $end);
function getURL($address, $start, $end, $pageNumber) {
return sprintf("%s&start=%s&end=%s&page=%d", $address, $start, $end, $pageNumber);
}
/**
* @brief lifepod 페이지 정보 가져오기
* @remarks 한해씩 끊어서 페이지를 가져옵니다. 아직 50 이상의 calendar info가 있는 경우 앞에 것만 가져오는 문제가 있습니다.
**/
function getPage($address, $year) {
function getPage($address, $year, $pageNumber) {
if($year == null)
{
$year = date("Y");
@ -48,7 +48,7 @@
$start = sprintf("%s-01-01",$year);
$end = sprintf("%s-01-01",$year+1);
$url = $this->getURL($address, $start, $end);
$url = $this->getURL($address, $start, $end, $pageNumber);
$oReqeust = $this->getRequest($url);
$oResponse = $oReqeust->sendRequest();
@ -77,6 +77,9 @@
$page->data[] = $data;
}
$page->color = $xmldoc->childNodes["feed"]->childNodes["color"]->body;
$page->total = intval($xmldoc->childNodes["feed"]->childNodes["opensearch:totalresults"]->body);
$page->start = intval($xmldoc->childNodes["feed"]->childNodes["opensearch:startindex"]->body);
$page->perpage = intval($xmldoc->childNodes["feed"]->childNodes["opensearch:itemsperpage"]->body);
return $page;
}

View file

@ -53,28 +53,35 @@
foreach($caladdresses as $key=>$val)
{
$page = $oLifepodModel->getPage($val, $cYear, $cMonth, $cDay);
for($j=0;$j<count($page->data);$j++)
{
$data = &$page->data[$j];
if($data->childNodes["date-start"])
$shouldGetMore = false;
$pageNumber = 1;
$page = null;
do {
$page = $oLifepodModel->getPage($val, $cYear, $pageNumber);
if(!$page) break;
for($j=0;$j<count($page->data);$j++)
{
$data->childNodes["date-start"]->body = $this->dateFormatChange($data->childNodes["date-start"]->body);
}
$data = &$page->data[$j];
if($data->childNodes["date-start"])
{
$data->childNodes["date-start"]->body = $this->dateFormatChange($data->childNodes["date-start"]->body);
}
if($data->childNodes["date-end"])
{
$plus = 0;
if($data->childNodes["type"]->body == "daylong")
$plus = -1;
$data->childNodes["date-end"]->body = $this->dateFormatChange($data->childNodes["date-end"]->body, $plus);
}
if($data->childNodes["date-end"])
{
$plus = 0;
if($data->childNodes["type"]->body == "daylong")
$plus = -1;
$data->childNodes["date-end"]->body = $this->dateFormatChange($data->childNodes["date-end"]->body, $plus);
}
$data->childNodes["description"]->body = str_replace("\n", "<BR />", $data->childNodes["description"]->body);
$data->childNodes["description"]->body = str_replace("'", "\'", $data->childNodes["description"]->body);
$data->childNodes["title"]->body = str_replace("'", "\'", $data->childNodes["title"]->body);
}
$calendars[] = $page;
$data->childNodes["description"]->body = str_replace("\n", "<BR />", $data->childNodes["description"]->body);
$data->childNodes["description"]->body = str_replace("'", "\'", $data->childNodes["description"]->body);
$data->childNodes["title"]->body = str_replace("'", "\'", $data->childNodes["title"]->body);
}
$calendars[] = $page;
$pageNumber++;
} while ( $page->start + $page->perpage - 1 < $page->total );
}
Context::set('calendars', $calendars);