module_path = $path; } /** * @brief 모듈의 정보 세팅 **/ function setModuleInfo($module_info) { // 기본 변수 설정 $this->mid = $module_info->mid; $this->module = $module_info->module; $this->module_srl = $module_info->module_srl; $this->module_info = $module_info; // 웹서비스에서 꼭 필요한 인증 정보와 권한 설정 체크 $is_logged = Context::get('is_logged'); $logged_info = Context::get('logged_info'); $user_id = $logged_info->user_id; $user_group = $logged_info->group_list; // 로그인되어 있다면 admin 체크 if($is_logged && ($logged_info->is_admin == 'Y' || in_array($user_id, $this->module_info->admin_id) )) { $grant->is_admin = true; } else { $grant->is_admin = false; } // 권한 설정 if($this->grant_list) { foreach($this->grant_list as $grant_name) { $grant->{$grant_name} = false; if($grant->is_admin || !$this->module_info->grant[$grant_name]) { $grant->{$grant_name} = true; continue; } if(count($user_group)) { foreach($user_group as $group_srl) { if(in_array($group_srl, $this->module_info->grant[$grant_name])) { $grant->{$grant_name} = true; break; } } } } } // 권한변수 설정 Context::set('grant',$grant); $this->grant = $grant; // 모듈의 init method 실행 $this->init(); } /** * @brief template 파일 지정 **/ function setTemplateFile($filename) { if(substr($filename,-5)!='.html') $filename .= '.html'; $this->template_file = $filename; } /** * @brief template 파일 return **/ function getTemplateFile() { return $this->template_file; } /** * @brief template 경로 지정 **/ function setTemplatePath($path) { if(substr($path,-1)!='/') $path .= '/'; if(substr($path,0,2)!='./') $path = './'.$path; $this->template_path = $path; } /** * @brief template 경로 return **/ function getTemplatePath() { return $this->template_path; } /** * @brief 모듈의 action에 해당하는 method를 실행 * * $act값에 의해서 $action_list에 선언된 것들을 실행한다 **/ function proc($act = null) { // 별도로 요청한 act가 없으면 주어진 act를 이용 if($act) $this->act = $act; else $this->act = Context::get('act'); // act값이 없거나 존재하지 않는 method를 호출시에 default_act를 지정 if(!$this->act || !method_exists($this, $this->act)) $this->act = $this->default_act; // 기본 act조차 없으면 return if(!method_exists($this, $this->act)) return false; // act값으로 method 실행 $output = call_user_method($this->act, $this); if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) { $this->setError($output->getError()); $this->setMessage($output->getMessage()); } } } ?>