Calendar 여러개 지원

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3342 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2007-12-14 06:56:17 +00:00
parent b6d51b3635
commit e9e8f89d7d
3 changed files with 33 additions and 40 deletions

View file

@ -14,7 +14,6 @@
var $userid = '';
var $userkey = '';
var $address = '';
/**
* @brief 초기화
@ -22,13 +21,6 @@
function init() {
}
/**
* @brief lifepod 페이지를 가져오기 위한 기본 설정
**/
function setInfo($address) {
$this->address = $address;
}
/**
* @brief HTTP request 객체 생성
**/
@ -39,15 +31,15 @@
return $oReqeust;
}
function getURL($start, $end) {
return sprintf("%s&start=%s&end=%s", $this->address, $start, $end);
function getURL($address, $start, $end) {
return sprintf("%s&start=%s&end=%s", $address, $start, $end);
}
/**
* @brief lifepod 페이지 정보 가져오기
* @remarks 한해씩 끊어서 페이지를 가져옵니다. 아직 50 이상의 calendar info가 있는 경우 앞에 것만 가져오는 문제가 있습니다.
**/
function getPage($year) {
function getPage($address, $year) {
if($year == null)
{
$year = date("Y");
@ -56,7 +48,7 @@
$start = sprintf("%s-01-01",$year);
$end = sprintf("%s-01-01",$year+1);
$url = $this->getURL($start, $end);
$url = $this->getURL($address, $start, $end);
$oReqeust = $this->getRequest($url);
$oResponse = $oReqeust->sendRequest();

View file

@ -44,39 +44,38 @@
if(!$this->grant->view) return $this->dispLifepodMessage('msg_not_permitted');
$oLifepodModel = &getModel('lifepod');
Context::get('member_srl', $this->member_srl);
if($this->member_srl)
{
$args->member_srl = $this->member_srl;
}
else
{
$oLifepodModel->setInfo($this->module_info->calendar_address);
}
$caladdresses = split(", ", $this->module_info->calendar_address);
$cYear = Context::get('year');
$cMonth = Context::get('month');
$cDay = Context::get('day');
$page = $oLifepodModel->getPage($cYear, $cMonth, $cDay);
foreach ($page->data as $key => $val)
{
if($val->childNodes["date-start"])
{
$val->childNodes["date-start"]->body = $this->dateFormatChange($val->childNodes["date-start"]->body);
}
if($val->childNodes["date-end"])
{
$plus = 0;
if($val->childNodes["type"]->body == "daylong")
$plus = -1;
$val->childNodes["date-end"]->body = $this->dateFormatChange($val->childNodes["date-end"]->body, $plus);
}
$val->childNodes["description"]->body = str_replace("\n", "<BR />", $val->childNodes["description"]->body);
$calendars = array();
foreach($caladdresses as $key => $val)
{
$page = $oLifepodModel->getPage($val, $cYear, $cMonth, $cDay);
foreach ($page->data as $key => $val)
{
if($val->childNodes["date-start"])
{
$val->childNodes["date-start"]->body = $this->dateFormatChange($val->childNodes["date-start"]->body);
}
if($val->childNodes["date-end"])
{
$plus = 0;
if($val->childNodes["type"]->body == "daylong")
$plus = -1;
$val->childNodes["date-end"]->body = $this->dateFormatChange($val->childNodes["date-end"]->body, $plus);
}
$val->childNodes["description"]->body = str_replace("\n", "<BR />", $val->childNodes["description"]->body);
}
$calendars[] = $page;
}
Context::set('page', $page);
Context::set('calendars', $calendars);
$this->setTemplateFile('list');
}

View file

@ -8,8 +8,10 @@
<!--@end-->
<script type="text/javascript">//<![CDATA[
xAddEventListener(window, 'load', startLifepod);
<!--@foreach($page->data as $key => $val)-->
<!--@foreach($calendars as $key => $page)-->
<!--@foreach($page->data as $key => $val)-->
calAdd({$val->childNodes["identifier"]->body},'{$val->childNodes["date-start"]->body}', '{$val->childNodes["date-end"]->body}', '{$val->childNodes["title"]->body}', '{$val->childNodes["description"]->body}', '{$val->childNodes["type"]->body}', '{$page->title}', '{$module_info->calendar_color}');
<!--@end-->
<!--@end-->
<!--@if($day)-->
setDate({$year},{$month},{$day});