* put getDeptUserPairs method from group model to dept model.
This commit is contained in:
@@ -333,6 +333,22 @@ class deptModel extends model
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user pairs of a department.
|
||||
*
|
||||
* @param int $deptID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDeptUserPairs($deptID = 0)
|
||||
{
|
||||
return $this->dao->select('account, realname')->from(TABLE_USER)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($deptID)->andWhere('dept')->eq((int)$deptID)->fi()
|
||||
->orderBy('account')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a department.
|
||||
|
||||
@@ -235,7 +235,7 @@ class group extends control
|
||||
}
|
||||
$group = $this->group->getById($groupID);
|
||||
$groupUsers = $this->group->getUserPairs($groupID);
|
||||
$allUsers = $this->group->getDeptUserPairs($deptID);
|
||||
$allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID);
|
||||
$otherUsers = array_diff_assoc($allUsers, $groupUsers);
|
||||
|
||||
$title = $this->lang->company->common . $this->lang->colon . $group->name . $this->lang->colon . $this->lang->group->manageMember;
|
||||
|
||||
@@ -178,22 +178,6 @@ class groupModel extends model
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user pairs of a dept.
|
||||
*
|
||||
* @param int $deptID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDeptUserPairs($deptID = 0)
|
||||
{
|
||||
return $this->dao->select('account, realname')->from(TABLE_USER)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($deptID)->andWhere('dept')->eq((int)$deptID)
|
||||
->orderBy('account')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a group.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user