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

This commit is contained in:
zero 2007-02-15 09:59:59 +00:00
parent d753280e12
commit bbfa91a7cd
5 changed files with 104 additions and 85 deletions

View file

@ -0,0 +1,37 @@
<?php
/**
* @class adminController
* @author zero (zero@nzeo.com)
* @brief admin 모듈의 controller class
**/
class adminController extends Module {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 로그인 시킴
**/
function procLogin() {
// 아이디, 비밀번호를 받음
$user_id = Context::get('user_id');
$password = Context::get('password');
// member controller 객체 생성
$oMemberController = getController('member');
return $oMemberController->doLogin($user_id, $password);
}
/**
* @brief 로그아웃 시킴
**/
function procLogout() {
// member controller 객체 생성
$oMemberController = getController('member');
return $oMemberController->doLogout();
}
}
?>

View file

@ -0,0 +1,30 @@
<?php
/**
* @class adminModel
* @author zero (zero@nzeo.com)
* @brief admin 모듈의 model class
**/
class adminModel extends Module {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 레이아웃 경로를 return
**/
function getLayoutPath() {
return $this->template_path;
}
/**
* @brief 레이아웃 파일을 return
**/
function getLayoutTpl() {
return "layout.html";
}
}
?>

View file

@ -25,92 +25,61 @@
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
Context::set('msg_code', 'msg_is_not_administrator');
return $this->act = 'dispError';
Context::set('msg_code', 'msg_is_not_administrator');
return $this->act = 'dispError';
}
// 관리자용 레이아웃으로 변경
$this->setLayoutPath($this->getLayoutPath());
$this->setLayoutTpl($this->getLayoutTpl());
// 로그인/로그아웃 act의 경우는 패스~
if(in_array($this->act, array('procLogin', 'procLogout'))) return true;
// 접속 사용자에 대한 체크
$logged_info = $oMemberModel->getLoggedInfo();
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
$this->setError(-1);
$this->setMessage('msg_is_not_administrator');
return false;
}
return true;
}
// proc 초기화
function procInit() {
// 로그인/로그아웃 act의 경우는 패스~
if(in_array($this->act, array('procLogin', 'procLogout'))) return true;
// 접속 사용자에 대한 체크
$oMember = getModule('member');
$logged_info = $oMember->getLoggedInfo();
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
$this->setError(-1);
$this->setMessage('msg_is_not_administrator');
return false;
}
return true;
}
/**
* 여기서부터는 action의 구현
* request parameter의 경우 method의 첫번째 인자로 넘어온다
*
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
*
* 변수의 사용은 Context::get('이름')으로 얻어오면 된다
* @brief 관리자 메인 페이지 출력
**/
// 출력부분
function dispAdminIndex() {
$this->setTemplateFile('index');
}
function dispLogin() {
if(Context::get('is_logged')) return $this->dispAdminIndex();
$this->setTemplateFile('login_form');
}
function dispLogout() {
if(!Context::get('is_logged')) return $this->dispAdminIndex();
$this->setTemplateFile('logout');
}
function dispError() {
Context::set('error_msg', Context::getLang( Context::get('msg_code') ) );
$this->setTemplateFile('error');
}
// 실행부분
function procLogin() {
// 아이디, 비밀번호를 받음
$user_id = Context::get('user_id');
$password = Context::get('password');
// member모듈 객체 생성
$oMember = getModule('member');
return $oMember->doLogin($user_id, $password);
}
function procLogout() {
// member모듈 객체 생성
$oMember = getModule('member');
return $oMember->doLogout();
$this->setTemplateFile('index');
}
/**
* 여기부터는 모듈과 관련된 라이브러리 개념의 method들
* @brief 관리자 로그인 페이지 출력
**/
function getLayoutPath() {
return $this->template_path;
function dispLogin() {
if(Context::get('is_logged')) return $this->dispAdminIndex();
$this->setTemplateFile('login_form');
}
function getLayoutTpl() {
return "layout.html";
/**
* @brief 관리자 로그아웃 페이지 출력
**/
function dispLogout() {
if(!Context::get('is_logged')) return $this->dispAdminIndex();
$this->setTemplateFile('logout');
}
/**
* @brief 에러 출력
**/
function dispError() {
Context::set('error_msg', Context::getLang( Context::get('msg_code') ) );
$this->setTemplateFile('error');
}
}
?>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<module default_action="dispIntroduce" manage_action="">
<action name="dispIntroduce" type="view" grant="" />
<action name="dispInstallForm" type="view" grant="" />
<action name="procInstall" type="controller" grant="" />
</module>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">설치관리</title>
<title xml:lang="en">install</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<name xml:lang="en">zero</name>
<description xml:lang="ko">설치 관리 모듈</description>
<description xml:lang="en">install</description>
</author>
<module>