28 public $mObject =
null;
29 public $mRankObject =
null;
30 public $mSearchResults =
null;
32 public $mSelfDelete =
false;
34 public $mPmliteURL =
null;
48 public function prepare(&$controller, &$xoopsUser, $moduleConfig)
50 $this->mSelfDelete = $moduleConfig[
'self_delete'];
53 public function isSecure()
58 public function getDefaultView(&$controller, &$xoopsUser)
60 $uid = isset($_GET[
'uid']) ? (int)xoops_getrequest(
'uid') : 0;
62 $handler =& xoops_gethandler(
'user');
63 $this->mObject =& $handler->get($uid);
65 if (!is_object($this->mObject)) {
66 return USER_FRAME_VIEW_ERROR;
69 $t_rank = xoops_getrank($this->mObject->get(
'rank'), $this->mObject->get(
'posts'));
71 $rankHandler =& xoops_getmodulehandler(
'ranks',
'user');
72 $this->mRankObject =& $rankHandler->get($t_rank[
'id']);
74 $root =& $controller->mRoot;
76 $service =& $root->mServiceManager->getService(
'privateMessage');
77 if ($service !=
null) {
78 $client =& $root->mServiceManager->createClient($service);
79 $this->mPmliteURL = $client->call(
'getPmliteUrl', [
'fromUid' => is_object($xoopsUser) ? $xoopsUser->get(
'uid') : 0,
'toUid' => $uid]);
83 $service =& $root->mServiceManager->getService(
'LegacySearch');
84 if (
null != $service) {
85 $this->mSearchResults = [];
87 $client =& $root->mServiceManager->createClient($service);
89 $moduleArr = $client->call(
'getActiveModules', []);
90 $uid = $this->mObject->get(
'uid');
92 foreach ($moduleArr as $t_module) {
94 'mid' => $t_module[
'mid'],
96 'maxhit' => USER_USERINFO_MAXHIT,
101 'name' => $t_module[
'name'],
102 'mid' => $t_module[
'mid'],
103 'results' => $client->call(
'searchItemsOfUser', $params)
106 $nresult = is_countable($module[
'results']) ? count($module[
'results']) : 0;
108 $module[
'has_more'] = $nresult >= USER_USERINFO_MAXHIT;
109 $this->mSearchResults[] = &$module;
115 return USER_FRAME_VIEW_SUCCESS;
126 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
128 $render->setTemplateName(
'user_userinfo.html');
129 $render->setAttribute(
'thisUser', $this->mObject);
130 $render->setAttribute(
'rank', $this->mRankObject);
132 $render->setAttribute(
'pmliteUrl', $this->mPmliteURL);
134 $userSignature = $this->mObject->getShow(
'user_sig');
136 $render->setAttribute(
'user_signature', $userSignature);
138 $render->setAttribute(
'searchResults', $this->mSearchResults);
143 $user_ownpage = (is_object($xoopsUser) && $xoopsUser->get(
'uid') == $this->mObject->get(
'uid'));
144 $render->setAttribute(
'user_ownpage', $user_ownpage);
149 $render->setAttribute(
'self_delete', $this->mSelfDelete);
150 if ($user_ownpage && $this->mSelfDelete) {
151 $render->setAttribute(
'enableSelfDelete',
true);
153 $render->setAttribute(
'enableSelfDelete',
false);
157 public function executeViewError(&$controller, &$xoopsUser, &$render)
159 $controller->executeForward(XOOPS_URL .
'/user.php');