12 public $mActionForm =
null;
17 public $mGetUserPosts =
null;
19 public function __construct()
21 parent::__construct();
23 $this->mGetUserPosts->register(
'User_UserViewAction.GetUserPosts');
26 public function prepare(&$controller, &$xoopsUser, $moduleConfig)
28 parent::prepare($controller, $xoopsUser, $moduleConfig);
30 $this->mActionForm->prepare();
33 public function _getId()
35 return xoops_getrequest(
'uid');
38 public function &_getHandler()
40 $handler =& xoops_getmodulehandler(
'users');
44 public function getDefaultView(&$controller, &$xoopsUser)
46 if (is_object($this->mObject)) {
47 $this->mActionForm->load($this->mObject);
50 $ret = parent::getDefaultView($controller, $xoopsUser);
55 if (USER_FRAME_VIEW_SUCCESS == $ret) {
56 return USER_FRAME_VIEW_INDEX;
62 public function execute(&$controller, &$xoopsUser)
64 if (
null == $this->mObject) {
65 return USER_FRAME_VIEW_ERROR;
68 $this->mActionForm->load($this->mObject);
70 $this->mActionForm->fetch();
71 $this->mActionForm->validate();
73 if ($this->mActionForm->hasError()) {
74 return $this->getDefaultView($controller, $xoopsUser);
81 $this->mGetUserPosts->call(
new XCube_Ref($posts), $this->mObject);
83 $handler =& xoops_getmodulehandler(
'users');
84 return $handler->insert($this->mObject) ? USER_FRAME_VIEW_SUCCESS
85 : USER_FRAME_VIEW_ERROR;
88 public function executeViewIndex(&$controller, &$xoopsUser, &$render)
90 $render->setTemplateName(
'user_view.html');
91 $render->setAttribute(
'actionForm', $this->mActionForm);
92 $render->setAttribute(
'object', $this->mObject);
94 $render->setAttribute(
'rank', $this->mObject->getRank());
96 $handler =& xoops_gethandler(
'timezone');
97 $timezone =& $handler->get($this->mObject->get(
'timezone_offset'));
98 $render->setAttribute(
'timezone', $timezone);
103 $umodeOptions = [
'nest' => _NESTED,
'flat' => _FLAT,
'thread' => _THREADED];
104 $render->setAttribute(
'umode', $umodeOptions[$this->mObject->get(
'umode')]);
106 $uorderOptions = [0 => _OLDESTFIRST, 1 => _NEWESTFIRST];
107 $render->setAttribute(
'uorder', $uorderOptions[$this->mObject->get(
'uorder')]);
112 $controller->mRoot->mLanguageManager->loadPageTypeMessageCatalog(
'notification');
113 require_once XOOPS_ROOT_PATH .
'/include/notification_constants.php';
116 XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE,
117 XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM,
118 XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL
120 $render->setAttribute(
'notify_method', $methodOptions[$this->mObject->get(
'notify_method')]);
123 XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS,
124 XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE,
125 XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN
127 $render->setAttribute(
'notify_mode', $modeOptions[$this->mObject->get(
'notify_mode')]);
131 XCube_DelegateUtils::call(
'Legacy_Profile.GetDefinition',
new XCube_Ref($definitions),
'view');
132 XCube_DelegateUtils::call(
'Legacy_Profile.GetProfile',
new XCube_Ref($profile), $this->mObject->get(
'uid'));
133 $render->setAttribute(
'definitions', $definitions);
134 $render->setAttribute(
'data', $profile);
137 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
139 $controller->executeRedirect(
'./index.php?action=UserView&uid=' . $this->mObject->get(
'uid'), 1, _AD_USER_MESSAGE_RECOUNT_SUCCESS);
142 public function executeViewError(&$controller, &$xoopsUser, &$render)
144 $controller->executeRedirect(
'./index.php?action=UserList', 1, _AD_USER_ERROR_CONTENT_IS_NOT_FOUND);