mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-21 04:09:55 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@145 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
853c469c67
commit
99c88fee14
12 changed files with 60 additions and 16 deletions
|
|
@ -68,6 +68,13 @@
|
|||
// 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴
|
||||
$xml_info = $oModuleModel->getModuleXmlInfo($module);
|
||||
|
||||
// module_info가 없고(mid가 없다는 의미) standalone이 false이면 오류 표시
|
||||
if(!$module_info&&!$xml_info->standalone) {
|
||||
$module = 'message';
|
||||
Context::set('message', Context::getLang('msg_invalid_request_module'));
|
||||
$xml_info = $oModuleModel->getModuleXmlInfo($module);
|
||||
}
|
||||
|
||||
// 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용
|
||||
if(!$act || !$xml_info->action->{$act}) $act = $xml_info->default_action;
|
||||
|
||||
|
|
@ -83,14 +90,15 @@
|
|||
// 모듈 객체 생성
|
||||
$oModule = &$this->getModuleInstance($module, $type);
|
||||
|
||||
// 모듈에 act값을 세팅
|
||||
$oModule->setAct($act);
|
||||
|
||||
// 모듈 정보 세팅
|
||||
$oModule->setModuleInfo($module_info, $xml_info);
|
||||
|
||||
if(!is_object($oModule)) return;
|
||||
|
||||
$act = Context::get('act');
|
||||
$oModule->proc($act);
|
||||
$oModule->proc();
|
||||
|
||||
$this->oModule = $oModule;
|
||||
}
|
||||
|
|
@ -160,6 +168,7 @@
|
|||
|
||||
// 생성된 객체에 자신이 호출된 위치를 세팅해줌
|
||||
$oModule->setModulePath($class_path);
|
||||
$oModule->init();
|
||||
|
||||
// GLOBALS 변수에 생성된 객체 저장
|
||||
$GLOBALS['_loaded_module'][$module][$type] = $oModule;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue