rhymix/modules/lifepod/lifepod.view.php
haneul 3a6abc6b97 added lifepod module
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3288 201d5d3c-b55e-5fd7-737f-ddc643e51545
2007-12-10 07:21:22 +00:00

80 lines
2.5 KiB
PHP

<?php
/**
* @class lifepodView
* @author haneul (haneul0318@gmail.com)
* @brief lifepod 모듈의 admin view 클래스
**/
class lifepodView extends lifepod {
/**
* @brief 초기화
**/
function init() {
/**
* 템플릿에서 사용할 변수를 Context::set()
* 혹시 사용할 수 있는 module_srl 변수를 설정한다.
**/
if($this->module_srl) Context::set('module_srl',$this->module_srl);
Context::set('module_info',$this->module_info);
/**
* 모듈정보에서 넘어오는 skin값을 이용하여 최종 출력할 템플릿의 위치를 출력한다.
* $this->module_path는 ./modules/guestbook/의 값을 가지고 있다
**/
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
$this->setTemplatePath($template_path);
}
function dateFormatChange($dates) {
$dates = str_replace( "T", " ", $dates);
$dates = str_replace( "Z", "+0", $dates);
$dates = date("Y-m-d H:i:s", strtotime($dates));
return $dates;
}
/**
* @brief 달력
**/
function dispLifepodContent() {
// 권한 체크
if(!$this->grant->view) return $this->dispLifepodMessage('msg_not_permitted');
$oLifepodModel = &getModel('lifepod');
$oLifepodModel->setInfo($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"])
{
$val->childNodes["date-end"]->body = $this->dateFormatChange($val->childNodes["date-end"]->body);
}
}
Context::set('page', $page);
$this->setTemplateFile('list');
}
/**
* @brief 메세지 출력
**/
function dispLifepodMessage($msg_code) {
$msg = Context::getLang($msg_code);
if(!$msg) $msg = $msg_code;
Context::set('message', $msg);
$this->setTemplateFile('message');
}
}
?>