24 public $mActionForm =
null;
25 public $mRegistForm =
null;
26 public $mConfig =
null;
28 public $mNewUser =
null;
30 public $mRedirectMessage =
null;
38 public function prepare(&$controller, &$xoopsUser, $moduleConfig)
40 $this->mConfig = $moduleConfig;
42 $this->_getRegistForm($controller);
43 $this->_processActionForm();
46 public function execute(&$controller, &$xoopsUser)
48 if (
null != XCube_Root::getSingleton()->mContext->mRequest->getRequest(
'_form_control_cancel')) {
49 return USER_FRAME_VIEW_CANCEL;
52 $memberHandler =& xoops_gethandler(
'member');
53 $this->mNewUser =& $memberHandler->createUser();
54 $this->mRegistForm->update($this->mNewUser);
55 $this->mNewUser->set(
'uorder', $controller->mRoot->mContext->getXoopsConfig(
'com_order'),
true);
56 $this->mNewUser->set(
'umode', $controller->mRoot->mContext->getXoopsConfig(
'com_mode'),
true);
57 if (1 == $this->mConfig[
'activation_type']) {
58 $this->mNewUser->set(
'level', 1,
true);
61 if (!$memberHandler->insertUser($this->mNewUser)) {
62 $this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
63 return USER_FRAME_VIEW_ERROR;
66 if (!$memberHandler->addUserToGroup(XOOPS_GROUP_USERS, $this->mNewUser->get(
'uid'))) {
67 $this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
68 return USER_FRAME_VIEW_ERROR;
71 $this->_clearRegistForm($controller);
73 $this->_processMail($controller);
74 $this->_eventNotifyMail($controller);
76 XCube_DelegateUtils::call(
'Legacy.Event.RegistUser.Success',
new XCube_Ref($this->mNewUser));
78 return USER_FRAME_VIEW_SUCCESS;
81 public function getDefaultView(&$controller, &$xoopsUser)
83 return USER_FRAME_VIEW_INPUT;
91 public function _getRegistForm(&$controller)
93 $this->mRegistForm = unserialize($_SESSION[
'user_register_actionform']);
94 if (!is_object($this->mRegistForm)) {
95 $controller->executeForward(
'./register.php?action=UserRegister');
104 public function _clearRegistForm(&$controller)
106 unset($_SESSION[
'user_register_actionform']);
109 public function _processMail(&$controller)
111 $activationType = $this->mConfig[
'activation_type'];
113 if (1 == $activationType) {
121 $director =
new User_UserRegistMailDirector($builder, $this->mNewUser, $controller->mRoot->mContext->getXoopsConfig(), $this->mConfig);
122 $director->contruct();
123 $mailer =& $builder->getResult();
124 XCube_DelegateUtils::call(
'Legacy.Event.RegistUser.SendMail',
new XCube_Ref($mailer), (0 == $activationType)?
'Register' :
'AdminActivate');
126 if (!$mailer->send()) {
131 public function _eventNotifyMail(&$controller)
133 if (1 == $this->mConfig[
'new_user_notify'] && !empty($this->mConfig[
'new_user_notify_group'])) {
135 $director =
new User_UserRegistMailDirector($builder, $this->mNewUser, $controller->mRoot->mContext->getXoopsConfig(), $this->mConfig);
136 $director->contruct();
137 $mailer =& $builder->getResult();
138 XCube_DelegateUtils::call(
'Legacy.Event.RegistUser.SendMail',
new XCube_Ref($mailer),
'Notify');
143 public function _processActionForm()
146 $this->mActionForm->prepare();
149 public function executeViewError(&$controller, &$xoopsUser, &$render)
151 $controller->executeRedirect(XOOPS_URL .
'/', 1, $this->mRedirectMessage);
165 $controller->executeForward(XOOPS_URL.
'/register.php');
168 public function executeViewInput(&$controller, &$xoopsUser, &$render)
170 $render->setTemplateName(
'user_register_confirm.html');
171 $render->setAttribute(
'actionForm', $this->mActionForm);
172 $render->setAttribute(
'registForm', $this->mRegistForm);
175 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
177 $activationType = $this->mConfig[
'activation_type'];
179 if (0 == $activationType) {
180 $render->setTemplateName(
'user_register_finish.html');
181 $render->setAttribute(
'complete_message', _MD_USER_MESSAGE_YOURREGISTERED);
182 } elseif (1 == $activationType) {
183 $controller->executeRedirect(XOOPS_URL .
'/', 4, _MD_USER_MESSAGE_ACTLOGIN);
184 } elseif (2 == $activationType) {
185 $render->setTemplateName(
'user_register_finish.html');
186 $render->setAttribute(
'complete_message', _MD_USER_MESSAGE_YOURREGISTERED2);
191 $render->setTemplateName(
'user_register_finish.html');
192 $render->setAttribute(
'complete_message', _MD_USER_MESSAGE_YOURREGISTERED2);