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

This commit is contained in:
zero 2007-02-14 05:14:10 +00:00
parent c14b78030e
commit 0d1a4ce1ce
3 changed files with 151 additions and 128 deletions

View file

@ -3,6 +3,7 @@
* @class AddOnHandler
* @author zero (zero@nzeo.com)
* @brief addon을 호출하여 실행
* @todo 미구현
**/
class AddOnHandler {

View file

@ -1,45 +1,50 @@
<?php
/**
* @file : classes/layout/LayoutHandler.class.php
* @author : zero <zero@nzeo.com>
* @desc : layout 실행
**/
/**
* @class LayoutHandler
* @author zero (zero@nzeo.com)
* @brief 레이아웃 관리
* @todo 미구현
**/
class LayoutHandler {
class LayoutHandler {
var $layout_info;
var $layout_name;
var $layout_name; ///< 레이아웃의 이름
var $layout_info; ///< 레이아웃의 정보
function callLayout(&$oModule, $oModuleInfo) {
if($oModule->getActType() != 'disp') return;
if(!$oModuleInfo->isLayoutExists()) return;
/**
* @brief 레이아웃 정보를 구함
**/
function callLayout(&$oModule, $oModuleInfo) {
if($oModule->getActType() != 'disp') return;
if(!$oModuleInfo->isLayoutExists()) return;
$oLayout = new LayoutHandler();
$oLayout->proc($oModule, $oModuleInfo);
$oLayout = new LayoutHandler();
$oLayout->proc($oModule, $oModuleInfo);
}
/**
* @brief 레이아웃 template을 실행하여 html코드로 변환
**/
function proc(&$oModule, $oModuleInfo) {
$this->layout_info = $oModuleInfo->getLayout();
$this->layout_name = $this->layout_info->layout_name;
$this->layout_name = 'test';
// 해당 모듈을 읽어서 객체를 만듬
$layout_file = sprintf('./layouts/%s/%s.layout.php', $this->layout_name, $this->layout_name);
// 모듈 파일이 없으면 에러
if(!file_exists($layout_file)) return;
// 모듈 파일을 include
require_once($layout_file);
// 선택된 모듈의 instance는 eval string으로 처리
$eval_str = sprintf('$oLayout = new %s();', $this->layout_name);
eval($eval_str);
// 애드온 실행
$oLayout->proc($oModule, $oModuleInfo);
}
}
function proc(&$oModule, $oModuleInfo) {
$this->layout_info = $oModuleInfo->getLayout();
$this->layout_name = $this->layout_info->layout_name;
$this->layout_name = 'test';
// 해당 모듈을 읽어서 객체를 만듬
$layout_file = sprintf('./layouts/%s/%s.layout.php', $this->layout_name, $this->layout_name);
// 모듈 파일이 없으면 에러
if(!file_exists($layout_file)) return;
// 모듈 파일을 include
require_once($layout_file);
// 선택된 모듈의 instance는 eval string으로 처리
$eval_str = sprintf('$oLayout = new %s();', $this->layout_name);
eval($eval_str);
// 애드온 실행
$oLayout->proc($oModule, $oModuleInfo);
}
}
?>

View file

@ -1,110 +1,127 @@
<?php
/**
* @file : classes/output/Output.class.php
* @author : zero <zero@nzeo.com>
* @desc : result 객체
* request method에 따라서 error+message+variables[] xml문서로
* 또는 html 출력을
* 또는 사용법에 따라 error로 결과를 리턴한다
* error != 0 이면 에러가 발생하였다는 것으로 정의
**/
/**
* @class Output
* @author zero (zero@nzeo.com)
* @brief 결과 데이터를 담당하는 class
*
* 모듈이나 DB등의 모든 행위의 결과를 담당.\n
* 에러 코드를 보관하고 기타 추가 정보가 있을 시에 add/get을 통해\n
* parameter를 넘길때도 사용....\n
*
* @todo 설명이 .. 좋음.. 수정 요망!
* @todo result 객체로 사용하면 되는데 왠지 구조적으로 다듬어졌음. 차후 다듬어야
**/
class Output {
class Output {
// template path 지정
var $template_path = NULL;
var $template_file = NULL;
var $template_path = NULL; ///< template path 지정
var $template_file = NULL; ///< template 파일 지정
// 기본 에러와 메세지
var $error = 0;
var $message = 'success';
var $error = 0; ///< 에러 코드 (0이면 에러 아님)
var $message = 'success'; ///< 에러 메세지 (success이면 에러 아님)
// 추가 변수
var $variables = array();
var $variables = array(); ///< 추가 변수
// public void Output($error = 0, $message = 'success')/*{{{*/
// error 코드를 지정
function Output($error = 0, $message = 'success') {
$this->error = $error;
$this->message = $message;
}/*}}}*/
/**
* @brief constructor
**/
function Output($error = 0, $message = 'success') {
$this->error = $error;
$this->message = $message;
}
// public void setError($error)/*{{{*/
// error 코드를 지정
function setError($error = 0) {
$this->error = $error;
}/*}}}*/
/**
* @brief error 코드를 지정
**/
function setError($error = 0) {
$this->error = $error;
}
// public string getError()/*{{{*/
function getError() {
return $this->error;
}/*}}}*/
/**
* @brief error 코드를 return
**/
function getError() {
return $this->error;
}
// public void setMessage($message)/*{{{*/
// 메세지 지정
function setMessage($message = 'success') {
if(Context::getLang($message)) $message = Context::getLang($message);
$this->message = $message;
return true;
}/*}}}*/
/**
* @brief 에러 메세지 지정
**/
function setMessage($message = 'success') {
if(Context::getLang($message)) $message = Context::getLang($message);
$this->message = $message;
return true;
}
// public string getMessage()/*{{{*/
// 메세지 지정
function getMessage() {
return $this->message;
}/*}}}*/
/**
* @brief 에러 메세지 return
**/
function getMessage() {
return $this->message;
}
// public void add($key, $val)/*{{{*/
// xml문서를 작성시 필요한 key, val 추가
function add($key, $val) {
$this->variables[$key] = $val;
}/*}}}*/
/**
* @brief 추가 변수
**/
function add($key, $val) {
$this->variables[$key] = $val;
}
// public string get($key)/*{{{*/
// 추가된 변수의 key에 해당하는 값을 return
function get($key) {
return $this->variables[$key];
}/*}}}*/
/**
* @brief 추가된 변수의 key에 해당하는 값을 return
**/
function get($key) {
return $this->variables[$key];
}
// public array getVariables()/*{{{*/
// 설정된 variables를 return
function getVariables() {
return $this->variables;
}/*}}}*/
/**
* @brief 추가변수 전체 return
**/
function getVariables() {
return $this->variables;
}
// public boolean toBool()/*{{{*/
// error값이 0이 아니면 오류
function toBool() {
return $this->error==0?true:false;
}/*}}}*/
/**
* @brief error값이 0 아니면 오류
**/
function toBool() {
return $this->error==0?true:false;
}
// public boolean toBoolean()/*{{{*/
// error값이 0이 아니면 오류
function toBoolean() {
return $this->toBool();
}/*}}}*/
/**
* @brief error값이 0 아니면 오류 (Output::toBool() aliasing)
**/
function toBoolean() {
return $this->toBool();
}
// public void setTemplatePath($path)/*{{{*/
// 현재 모듈의 tpl 파일을 저장
function setTemplatePath($path) {
if(!substr($path,-1)!='/') $path .= '/';
$this->template_path = $path;
}/*}}}*/
/**
* @brief tpl 경로을 지정
**/
function setTemplatePath($path) {
if(!substr($path,-1)!='/') $path .= '/';
$this->template_path = $path;
}
// public string getTemplatePath()/*{{{*/
// 설정된 template path를 return
function getTemplatePath() {
return $this->template_path;
}/*}}}*/
/**
* @brief tpl 경로를 return
**/
function getTemplatePath() {
return $this->template_path;
}
// public void setTemplateFile($filename)/*{{{*/
function setTemplateFile($filename) {
$this->template_file = $filename;
}/*}}}*/
/**
* @brief tpl 파일을 지정
**/
function setTemplateFile($filename) {
$this->template_file = $filename;
}
// public string getTemplateFile()/*{{{*/
function getTemplateFile() {
return $this->template_file;
}/*}}}*/
}
/**
* @brief tpl 파일을 지정
**/
function getTemplateFile() {
return $this->template_file;
}
}
?>