diff --git a/module/group/model.php b/module/group/model.php
index 61bf61f85e..226de25beb 100644
--- a/module/group/model.php
+++ b/module/group/model.php
@@ -130,6 +130,22 @@ class groupModel extends model
return $this->dao->findById($groupID)->from(TABLE_GROUP)->fetch();
}
+ /**
+ * Get group by account.
+ *
+ * @param string $account
+ * @access public
+ * @return array
+ */
+ public function getByAccount($account)
+ {
+ return $this->dao->select('t2.*')->from(TABLE_USERGROUP)->alias('t1')
+ ->leftJoin(TABLE_GROUP)->alias('t2')
+ ->on('t1.group = t2.id')
+ ->where('t1.account')->eq($account)
+ ->fetchAll('id');
+ }
+
/**
* Get privileges of a groups.
*
diff --git a/module/my/control.php b/module/my/control.php
index 590b16ee56..c5c52a486e 100644
--- a/module/my/control.php
+++ b/module/my/control.php
@@ -411,13 +411,13 @@ class my extends control
{
if($this->app->user->account == 'guest') die(js::alert('guest') . js::locate('back'));
- $user = $this->user->getById($this->app->user->account);
- $deptPath = $this->dept->getParents($user->dept);
+ $user = $this->user->getById($this->app->user->account);
- $this->view->deptPath = $deptPath;
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->profile;
$this->view->position[] = $this->lang->my->profile;
$this->view->user = $this->user->getById($this->app->user->id);
+ $this->view->groups = $this->loadModel('group')->getByAccount($this->app->user->account);
+ $this->view->deptPath = $this->dept->getParents($user->dept);
$this->display();
}
diff --git a/module/my/view/profile.html.php b/module/my/view/profile.html.php
index 3409b72e03..b50003ac6c 100644
--- a/module/my/view/profile.html.php
+++ b/module/my/view/profile.html.php
@@ -13,7 +13,15 @@
- my->profile;?>
+
+ my->profile;?>
+
+ createLink('user', 'editGroup', "account={$this->app->user->account}"), $lang->user->editGroup);
+ echo html::a($this->createLink('my', 'editprofile'), $lang->user->editProfile);
+ ?>
+
+
| user->dept;?> |
@@ -42,6 +50,17 @@
| user->realname;?> |
realname;?> |
+
+ | user->group;?> |
+
+ name . ' ';
+ }
+ ?>
+ |
+
| user->role;?> |
user->roleList[$user->role];?> |
@@ -112,13 +131,5 @@
user->zipcode;?> |
zipcode;?> |
-
- |
- createLink('my', 'editprofile'), $lang->user->editProfile);
- echo html::a($this->createLink('user', 'logout'), $lang->logout);
- ?>
- |
-
diff --git a/module/user/control.php b/module/user/control.php
index b0ae18d5c7..a757fa0ce2 100644
--- a/module/user/control.php
+++ b/module/user/control.php
@@ -208,22 +208,18 @@ class user extends control
*/
public function profile($account)
{
- $position[] = $this->lang->user->profile;
-
/* Set menu. */
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
$this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed'), $account);
$user = $this->user->getById($account);
- $deptPath = $this->dept->getParents($user->dept);
- $title = "USER #$user->id $user->account/" . $this->lang->user->profile;
- $this->view->title = $title;
- $this->view->position = $position;
- $this->view->account = $account;
- $this->view->user = $user;
-
- $this->view->deptPath = $deptPath;
+ $this->view->title = "USER #$user->id $user->account/" . $this->lang->user->profile;
+ $this->view->position[] = $this->lang->user->profile;
+ $this->view->account = $account;
+ $this->view->user = $user;
+ $this->view->groups = $this->loadModel('group')->getByAccount($account);
+ $this->view->deptPath = $this->dept->getParents($user->dept);
$this->display();
}
@@ -428,7 +424,8 @@ class user extends control
$this->view->title = $this->lang->company->common . $this->lang->colon . $this->lang->user->editGroup;
$this->view->position[] = $this->lang->user->editGroup;
- $this->view->userGroups = $this->dao->select('`group`')->from(TABLE_USERGROUP)->where('account')->eq($account)->fetchPairs();
+ $this->view->account = $account;
+ $this->view->userGroups = $this->loadModel('group')->getByAccount($account);
$this->view->groups = $this->loadModel('group')->getList($this->app->company->id);
$this->display();
}
diff --git a/module/user/view/editgroup.html.php b/module/user/view/editgroup.html.php
index 267ade714c..f11450c2ed 100644
--- a/module/user/view/editgroup.html.php
+++ b/module/user/view/editgroup.html.php
@@ -15,7 +15,7 @@