78 if (
null == $this->mActionName) {
79 $this->mActionName = xoops_getrequest(
'action');
80 if (
null == $this->mActionName) {
81 $this->mActionName =
'DataEdit';
85 if (!preg_match(
"/^\w+$/", $this->mActionName)) {
86 $this->doActionNotFoundError();
93 $fileName = ucfirst($this->mActionName) .
'Action';
94 if ($this->mAdminFlag) {
95 $className =
'Profile_Admin_' . ucfirst($this->mActionName) .
'Action';
96 $fileName = XOOPS_MODULE_PATH .
"/profile/admin/actions/{$fileName}.class.php";
98 $className =
'Profile_' . ucfirst($this->mActionName) .
'Action';
99 $fileName = XOOPS_MODULE_PATH .
"/profile/actions/{$fileName}.class.php";
102 if (!file_exists($fileName)) {
103 $this->doActionNotFoundError();
107 require_once $fileName;
109 if (class_exists($className)) {
110 $this->mAction =
new $className();
113 if (!is_object($this->mAction)) {
114 $this->doActionNotFoundError();
118 if ($this->mAction->isMemberOnly() && !$controller->mRoot->mContext->mUser->isInRole(
'Site.RegisteredUser')) {
119 $this->doPermissionError();
123 if ($this->mAction->isAdminOnly() && !$controller->mRoot->mContext->mUser->isInRole(
'Module.profile.Admin')) {
124 $this->doPermissionError();
128 if (
false === $this->mAction->prepare()) {
129 $this->doPreparationError();
133 if (!$this->mAction->hasPermission()) {
134 $this->doPermissionError();
138 if (
'POST' == xoops_getenv(
'REQUEST_METHOD')) {
139 $viewStatus = $this->mAction->execute();
141 $viewStatus = $this->mAction->getDefaultView();
144 switch ($viewStatus) {
145 case PROFILE_FRAME_VIEW_SUCCESS:
146 $this->mAction->executeViewSuccess($controller, $controller->mRoot->mContext->mModule->getRenderTarget());
148 case PROFILE_FRAME_VIEW_ERROR:
149 $this->mAction->executeViewError($controller->mRoot->mContext->mModule->getRenderTarget());
151 case PROFILE_FRAME_VIEW_INDEX:
152 $this->mAction->executeViewIndex($controller->mRoot->mContext->mModule->getRenderTarget());
154 case PROFILE_FRAME_VIEW_INPUT:
155 $this->mAction->executeViewInput($controller->mRoot->mContext->mModule->getRenderTarget());
157 case PROFILE_FRAME_VIEW_PREVIEW:
158 $this->mAction->executeViewPreview($controller->mRoot->mContext->mModule->getRenderTarget());
160 case PROFILE_FRAME_VIEW_CANCEL:
161 $this->mAction->executeViewCancel($controller->mRoot->mContext->mModule->getRenderTarget());