25 public $mUserCookie =
'';
27 public $mSelfDelete =
false;
29 public function prepare(&$controller, &$xoopsUser, $moduleConfig)
31 parent::prepare($controller, $xoopsUser, $moduleConfig);
32 $this->mUserCookie = $moduleConfig[
'usercookie'];
37 $root =& XCube_Root::getSingleton();
38 $uid = is_object($root->mContext->mXoopsUser) ? $root->mContext->mXoopsUser->get(
'uid') : 0;
40 return isset($_REQUEST[
'uid']) ? (int)xoops_getrequest(
'uid') : $uid;
45 $handler =& xoops_getmodulehandler(
'users',
'user');
58 $this->mActionForm->prepare();
78 public function isSecure()
95 if (!is_object($this->mObject)) {
99 if ($controller->mRoot->mContext->mUser->isInRole(
'Module.user.Admin')) {
103 return ($this->mObject->get(
'uid') == $xoopsUser->get(
'uid'));
108 if ($this->mObjectHandler->insert($this->mObject)) {
109 if ($this->mActionForm->get(
'usercookie')) {
110 setcookie($this->mUserCookie, $this->mObject->getShow(
'uname'), [
'expires' => time() + USER_COOKIE_KEEP_TIME]);
112 setcookie($this->mUserCookie);
115 XCube_DelegateUtils::call(
'Legacy_Profile.SaveProfile',
new XCube_Ref($ret), $this->mActionForm);
122 public function executeViewInput(&$controller, &$xoopsUser, &$render)
124 $render->setTemplateName(
'user_edituser.html');
125 $render->setAttribute(
'actionForm', $this->mActionForm);
126 $render->setAttribute(
'thisUser', $this->mObject);
127 $render->setAttribute(
'currentUser', $xoopsUser);
128 $render->setAttribute(
'allow_chgmail', $this->mConfig[
'allow_chgmail']);
130 $handler =& xoops_gethandler(
'timezone');
131 $timezoneArr =& $handler->getObjects();
132 $render->setAttribute(
'timezones', $timezoneArr);
137 $user_ownpage = (is_object($xoopsUser) && $xoopsUser->get(
'uid') == $this->mObject->get(
'uid'));
138 $render->setAttribute(
'user_ownpage', $user_ownpage);
142 $render->setAttribute(
'self_delete', $this->mSelfDelete);
143 if ($user_ownpage && $this->mSelfDelete) {
144 $render->setAttribute(
'enableSelfDelete',
true);
146 $render->setAttribute(
'enableSelfDelete',
false);
152 $umodeOptions = [
'nest' => _NESTED,
'flat' => _FLAT,
'thread' => _THREADED];
153 $render->setAttribute(
'umodeOptions', $umodeOptions);
158 $uorderOptions = [0 => _OLDESTFIRST, 1 => _NEWESTFIRST];
159 $render->setAttribute(
'uorderOptions', $uorderOptions);
168 $root =& XCube_Root::getSingleton();
169 $root->mLanguageManager->loadPageTypeMessageCatalog(
'notification');
170 require_once XOOPS_ROOT_PATH .
'/include/notification_constants.php';
173 $root =& XCube_Root::getSingleton();
174 $service =& $root->mServiceManager->getService(
'privateMessage');
177 $methodOptions[XOOPS_NOTIFICATION_METHOD_DISABLE] = _NOT_METHOD_DISABLE;
178 if (
null != $service) {
179 $methodOptions[XOOPS_NOTIFICATION_METHOD_PM] = _NOT_METHOD_PM;
181 $methodOptions[XOOPS_NOTIFICATION_METHOD_EMAIL] = _NOT_METHOD_EMAIL;
183 $render->setAttribute(
'notify_methodOptions', $methodOptions);
186 XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS,
187 XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE,
188 XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN
191 $render->setAttribute(
'notify_modeOptions', $modeOptions);
192 $this->_setDatepicker();
195 protected function _setDatepicker()
197 $headerScript = XCube_Root::getSingleton()->mContext->getAttribute(
'headerScript');
198 $headerScript->addScript(
'$(".datepicker").each(function(){$(this).datepicker({dateFormat: "'._JSDATEPICKSTRING.
'"});});');
201 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
203 $redirect = xoops_getrequest(
'xoops_redirect');
204 $controller->executeForward(($redirect &&
'/' === $redirect[0])? $redirect : (XOOPS_URL .
'/userinfo.php?uid=' . $this->mObject->getShow(
'uid')));
207 public function executeViewError(&$controller, &$xoopsUser, &$render)
209 $controller->executeRedirect(XOOPS_URL .
'/', 1, _MD_USER_ERROR_DBUPDATE_FAILED);