mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@79 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
319b390b9a
commit
d753280e12
3 changed files with 95 additions and 127 deletions
|
|
@ -1,148 +1,116 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @file : modules/admin/admin.module.php
|
|
||||||
* @author : zero <zero@nzeo.com>
|
|
||||||
* @desc : 기본 모듈중의 하나인 admin module
|
|
||||||
* Module class에서 상속을 받아서 사용
|
|
||||||
* action 의 경우 disp/proc 2가지만 존재하며 이는 action명세서에
|
|
||||||
* 미리 기록을 하여야 함
|
|
||||||
**/
|
|
||||||
|
|
||||||
class admin extends Module {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 모듈의 정보
|
* @class adminView
|
||||||
**/
|
* @author zero (zero@nzeo.com)
|
||||||
var $cur_version = "20070130_0.01";
|
* @brief admin 모듈의 view class
|
||||||
|
|
||||||
/**
|
|
||||||
* 기본 action 지정
|
|
||||||
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
|
|
||||||
**/
|
|
||||||
var $default_act = '';
|
|
||||||
|
|
||||||
// 모듈에서 사용할 변수들
|
|
||||||
var $skin = "default";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
|
|
||||||
* css/js파일의 load라든지 lang파일 load등을 미리 선언
|
|
||||||
*
|
|
||||||
* Init() => 공통
|
|
||||||
* dispInit() => disp시에
|
|
||||||
* procInit() => proc시에
|
|
||||||
*
|
|
||||||
* $this->module_path는 현재 이 모듈파일의 위치를 나타낸다
|
|
||||||
* (ex: $this->module_path = "./modules/admin/";
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// 초기화
|
class adminView extends Module {
|
||||||
function init() {/*{{{*/
|
|
||||||
// admin 모듈의 언어 로드
|
|
||||||
Context::loadLang($this->module_path.'lang');
|
|
||||||
|
|
||||||
// 관리자 모듈 목록을 세팅
|
/**
|
||||||
$module_list = module_manager::getAdminModuleList();
|
* @brief 초기화
|
||||||
Context::set('module_list', $module_list);
|
**/
|
||||||
}/*}}}*/
|
function init() {
|
||||||
|
// 관리자 모듈 목록을 세팅
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
$module_list = $oModuleModel->getAdminModuleList();
|
||||||
|
Context::set('module_list', $module_list);
|
||||||
|
|
||||||
// disp 초기화
|
// 접속 사용자에 대한 체크
|
||||||
function dispInit() {/*{{{*/
|
$oMemberModel = getModel('member');
|
||||||
// 접속 사용자에 대한 체크
|
$logged_info = $oMemberModel->getLoggedInfo();
|
||||||
$oMember = getModule('member');
|
|
||||||
$logged_info = $oMember->getLoggedInfo();
|
|
||||||
|
|
||||||
// 로그인 하지 않았다면 로그인 폼 출력
|
// 로그인 하지 않았다면 로그인 폼 출력
|
||||||
if(!$oMember->isLogged()) return $this->act = 'dispLogin';
|
if(!$oMemberModel->isLogged()) return $this->act = 'dispLogin';
|
||||||
|
|
||||||
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
|
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
|
||||||
if($logged_info->is_admin != 'Y') {
|
if($logged_info->is_admin != 'Y') {
|
||||||
Context::set('msg_code', 'msg_is_not_administrator');
|
Context::set('msg_code', 'msg_is_not_administrator');
|
||||||
return $this->act = 'dispError';
|
return $this->act = 'dispError';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 관리자용 레이아웃으로 변경
|
// 관리자용 레이아웃으로 변경
|
||||||
$this->setLayoutPath($this->getLayoutPath());
|
$this->setLayoutPath($this->getLayoutPath());
|
||||||
$this->setLayoutTpl($this->getLayoutTpl());
|
$this->setLayoutTpl($this->getLayoutTpl());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
// proc 초기화
|
// proc 초기화
|
||||||
function procInit() {/*{{{*/
|
function procInit() {
|
||||||
// 로그인/로그아웃 act의 경우는 패스~
|
// 로그인/로그아웃 act의 경우는 패스~
|
||||||
if(in_array($this->act, array('procLogin', 'procLogout'))) return true;
|
if(in_array($this->act, array('procLogin', 'procLogout'))) return true;
|
||||||
|
|
||||||
// 접속 사용자에 대한 체크
|
// 접속 사용자에 대한 체크
|
||||||
$oMember = getModule('member');
|
$oMember = getModule('member');
|
||||||
$logged_info = $oMember->getLoggedInfo();
|
$logged_info = $oMember->getLoggedInfo();
|
||||||
|
|
||||||
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
|
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
|
||||||
if($logged_info->is_admin != 'Y') {
|
if($logged_info->is_admin != 'Y') {
|
||||||
$this->setError(-1);
|
$this->setError(-1);
|
||||||
$this->setMessage('msg_is_not_administrator');
|
$this->setMessage('msg_is_not_administrator');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 여기서부터는 action의 구현
|
* 여기서부터는 action의 구현
|
||||||
* request parameter의 경우 각 method의 첫번째 인자로 넘어온다
|
* request parameter의 경우 각 method의 첫번째 인자로 넘어온다
|
||||||
*
|
*
|
||||||
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
|
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
|
||||||
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
|
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
|
||||||
*
|
*
|
||||||
* 변수의 사용은 Context::get('이름')으로 얻어오면 된다
|
* 변수의 사용은 Context::get('이름')으로 얻어오면 된다
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// 출력부분
|
// 출력부분
|
||||||
function dispAdminIndex() {/*{{{*/
|
function dispAdminIndex() {
|
||||||
$this->setTemplateFile('index');
|
$this->setTemplateFile('index');
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
function dispLogin() {/*{{{*/
|
function dispLogin() {
|
||||||
if(Context::get('is_logged')) return $this->dispAdminIndex();
|
if(Context::get('is_logged')) return $this->dispAdminIndex();
|
||||||
$this->setTemplateFile('login_form');
|
$this->setTemplateFile('login_form');
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
function dispLogout() {/*{{{*/
|
function dispLogout() {
|
||||||
if(!Context::get('is_logged')) return $this->dispAdminIndex();
|
if(!Context::get('is_logged')) return $this->dispAdminIndex();
|
||||||
$this->setTemplateFile('logout');
|
$this->setTemplateFile('logout');
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
function dispError() {/*{{{*/
|
function dispError() {
|
||||||
Context::set('error_msg', Context::getLang( Context::get('msg_code') ) );
|
Context::set('error_msg', Context::getLang( Context::get('msg_code') ) );
|
||||||
$this->setTemplateFile('error');
|
$this->setTemplateFile('error');
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
// 실행부분
|
// 실행부분
|
||||||
function procLogin() {/*{{{*/
|
function procLogin() {
|
||||||
// 아이디, 비밀번호를 받음
|
// 아이디, 비밀번호를 받음
|
||||||
$user_id = Context::get('user_id');
|
$user_id = Context::get('user_id');
|
||||||
$password = Context::get('password');
|
$password = Context::get('password');
|
||||||
// member모듈 객체 생성
|
// member모듈 객체 생성
|
||||||
$oMember = getModule('member');
|
$oMember = getModule('member');
|
||||||
return $oMember->doLogin($user_id, $password);
|
return $oMember->doLogin($user_id, $password);
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
function procLogout() {/*{{{*/
|
function procLogout() {
|
||||||
// member모듈 객체 생성
|
// member모듈 객체 생성
|
||||||
$oMember = getModule('member');
|
$oMember = getModule('member');
|
||||||
return $oMember->doLogout();
|
return $oMember->doLogout();
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 여기부터는 이 모듈과 관련된 라이브러리 개념의 method들
|
* 여기부터는 이 모듈과 관련된 라이브러리 개념의 method들
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function getLayoutPath() {/*{{{*/
|
function getLayoutPath() {
|
||||||
return $this->template_path;
|
return $this->template_path;
|
||||||
}/*}}}*/
|
}
|
||||||
|
|
||||||
function getLayoutTpl() {/*{{{*/
|
function getLayoutTpl() {
|
||||||
return "layout.html";
|
return "layout.html";
|
||||||
}/*}}}*/
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<module version="0.1">
|
<module default_action="dispAdminIndex" manage_action="">
|
||||||
<action name="dispAdminIndex" type="view" default="true" />
|
<action name="dispAdminIndex" type="view" grant="" />
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<module version="0.1">
|
<module version="0.1">
|
||||||
<title xml:lang="ko">관리자 툴</title>
|
<title xml:lang="ko">관리자 모듈</title>
|
||||||
<title xml:lang="en">Admin tool</title>
|
<title xml:lang="en">admin module</title>
|
||||||
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
|
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
|
||||||
<name xml:lang="ko">제로</name>
|
<name xml:lang="ko">제로</name>
|
||||||
<name xml:lang="en">zero</name>
|
<name xml:lang="en">zero</name>
|
||||||
<description xml:lang="ko">모듈 관리 툴</description>
|
<description xml:lang="ko">관리자 모듈</description>
|
||||||
<description xml:lang="en">Admin tool</description>
|
<description xml:lang="en">admin module</description>
|
||||||
</author>
|
</author>
|
||||||
<module>
|
<module>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue