git-svn-id: http://xe-core.googlecode.com/svn/trunk@145 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-02-21 08:56:19 +00:00
parent 853c469c67
commit 99c88fee14
12 changed files with 60 additions and 16 deletions

View file

@ -3,9 +3,6 @@
* @class ModuleObject
* @author zero (zero@nzeo.com)
* @brief module의 abstract class
*
* @todo 모듈에서 mid가 필요한지를 체크하는 단계가 필요 (admin은 mid불필요, board는 필요.., 미설정시 필요함으로.. 기본)
*
**/
class ModuleObject extends Object {
@ -25,6 +22,8 @@
var $layout_path = './common/tpl/'; ///< 레이아웃 경로
var $layout_file = 'default_layout.html'; ///< 레이아웃 파일
var $stop_proc = false; ///< action 수행중 dispMessage를 호출하면 ModuleObject::proc()를 수행하지 않음
/**
* @brief 현재 모듈의 path를 지정
**/
@ -42,6 +41,13 @@
$this->add('redirect_url', $url);
}
/**
* @brief act값 지정
**/
function setAct($act) {
$this->act = $act;
}
/**
* @brief 모듈의 정보 세팅
**/
@ -110,6 +116,26 @@
$this->init();
}
/**
* @brief 메세지 출력
**/
function dispMessage($msg_code) {
// proc 수행을 중지 시키기 위한 플래그 세팅
$this->stop_proc = true;
// RequestMethod가 XMLRPC일 경우를 대비
if(Context::getRequestMethod()=='XMLRPC') {
$this->setError(-1);
$this->setMessage($msg_code);
} else {
Context::set('message', Context::getLang($msg_code));
$oMessageView = &getView('message');
$oMessageView->dispMessage();
$this->setTemplatePath($oMessageView->getTemplatePath());
$this->setTemplateFile($oMessageView->getTemplateFile());
}
}
/**
* @brief template 파일 지정
**/
@ -129,8 +155,8 @@
* @brief template 경로 지정
**/
function setTemplatePath($path) {
if(substr($path,-1)!='/') $path .= '/';
if(substr($path,0,2)!='./') $path = './'.$path;
if(substr($path,-1)!='/') $path .= '/';
$this->template_path = $path;
}
@ -178,13 +204,15 @@
*
* $act값에 의해서 $action_list에 선언된 것들을 실행한다
**/
function proc($act) {
function proc() {
// stop_proc==true이면 그냥 패스
if($this->stop_proc==true) return;
// 기본 act조차 없으면 return
if(!method_exists($this, $act)) return false;
if(!method_exists($this, $this->act)) return;
// act값으로 method 실행
$output = call_user_method($act, $this);
// this->act값으로 method 실행
$output = call_user_method($this->act, $this);
if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) {
$this->setError($output->getError());