1: <?php
2: 3: 4: 5:
6:
7: if (!defined('XOOPS_ROOT_PATH')) exit();
8:
9: require_once XOOPS_MODULE_PATH . "/user/class/AbstractEditAction.class.php";
10: require_once XOOPS_MODULE_PATH . "/user/admin/forms/UserAdminEditForm.class.php";
11:
12: class User_UserEditAction extends User_AbstractEditAction
13: {
14: function _getId()
15: {
16: return xoops_getrequest('uid');
17: }
18:
19: function &_getHandler()
20: {
21: $handler =& xoops_getmodulehandler('users');
22: return $handler;
23: }
24:
25: function _setupActionForm()
26: {
27: $this->mActionForm =new User_UserAdminEditForm();
28: $this->mActionForm->prepare();
29: }
30:
31: function _setupObject()
32: {
33: $id = $this->_getId();
34:
35: $this->mObjectHandler = $this->_getHandler();
36:
37: $this->mObject =& $this->mObjectHandler->get($id);
38:
39: if ($this->mObject == null && $this->isEnableCreate()) {
40: $root =& XCube_Root::getSingleton();
41: $this->mObject =& $this->mObjectHandler->create();
42: $this->mObject->set('timezone_offset', $root->mContext->getXoopsConfig('server_TZ'));
43: }
44: }
45:
46: function executeViewInput(&$controller, &$xoopsUser, &$render)
47: {
48: $render->setTemplateName("user_edit.html");
49: $render->setAttribute("actionForm", $this->mActionForm);
50:
51:
52:
53:
54: $tzoneHandler =& xoops_gethandler('timezone');
55: $timezones =& $tzoneHandler->getObjects();
56:
57: $render->setAttribute('timezones', $timezones);
58:
59: $rankHandler =& xoops_getmodulehandler('ranks');
60: $ranks =& $rankHandler->getObjects(new Criteria('rank_special', 1));
61:
62: $render->setAttribute('ranks', $ranks);
63:
64: $groupHandler =& xoops_gethandler('group');
65: $groups =& $groupHandler->getObjects(null, true);
66:
67: $groupOptions = array();
68: foreach ($groups as $gid => $group) {
69: $groupOptions[$gid] = $group->getVar('name');
70: }
71:
72: $render->setAttribute('groupOptions', $groupOptions);
73:
74:
75:
76:
77: $umodeOptions = array("nest" => _NESTED, "flat" => _FLAT, "thread" => _THREADED);
78: $render->setAttribute('umodeOptions', $umodeOptions);
79:
80:
81:
82:
83: $uorderOptions = array(0 => _OLDESTFIRST, 1 => _NEWESTFIRST);
84: $render->setAttribute('uorderOptions', $uorderOptions);
85:
86:
87:
88:
89:
90:
91:
92:
93: $root =& XCube_Root::getSingleton();
94: $root->mLanguageManager->loadPageTypeMessageCatalog('notification');
95: require_once XOOPS_ROOT_PATH . "/include/notification_constants.php";
96:
97:
98: $service =& $root->mServiceManager->getService('privateMessage');
99:
100: $methodOptions = array();
101: $methodOptions[XOOPS_NOTIFICATION_METHOD_DISABLE] = _NOT_METHOD_DISABLE;
102: if ($service != null) {
103: $methodOptions[XOOPS_NOTIFICATION_METHOD_PM] = _NOT_METHOD_PM;
104: }
105: $methodOptions[XOOPS_NOTIFICATION_METHOD_EMAIL] = _NOT_METHOD_EMAIL;
106:
107: $render->setAttribute('notify_methodOptions', $methodOptions);
108:
109: $modeOptions = array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS,
110: XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE,
111: XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN
112: );
113: $render->setAttribute('notify_modeOptions', $modeOptions);
114: }
115:
116: function _doExecute()
117: {
118: $ret = parent::_doExecute();
119: if($ret===true){
120: XCube_DelegateUtils::call('Legacy_Profile.SaveProfile', new XCube_Ref($ret), $this->mActionForm);
121: }
122: return $ret;
123: }
124:
125: function executeViewSuccess(&$controller, &$xoopsUser, &$render)
126: {
127: $controller->executeForward("./index.php?action=UserList");
128: }
129:
130: function executeViewError(&$controller, &$xoopsUser, &$render)
131: {
132: $controller->executeRedirect("index.php", 1, _MD_USER_ERROR_DBUPDATE_FAILED);
133: }
134:
135: function executeViewCancel(&$controller, &$xoopsUser, &$render)
136: {
137: $controller->executeForward("./index.php?action=UserList");
138: }
139: }
140:
141: ?>
142: