* finish task #2459.
This commit is contained in:
+16
-2
@@ -115,16 +115,17 @@ class deptModel extends model
|
||||
*
|
||||
* @param int $rootDeptID
|
||||
* @param string $userFunc
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTreeMenu($rootDeptID = 0, $userFunc)
|
||||
public function getTreeMenu($rootDeptID = 0, $userFunc, $groupID = 0)
|
||||
{
|
||||
$deptMenu = array();
|
||||
$stmt = $this->dbh->query($this->buildMenuQuery($rootDeptID));
|
||||
while($dept = $stmt->fetch())
|
||||
{
|
||||
$linkHtml = call_user_func($userFunc, $dept);
|
||||
$linkHtml = call_user_func($userFunc, $dept, $groupID);
|
||||
|
||||
if(isset($deptMenu[$dept->id]) and !empty($deptMenu[$dept->id]))
|
||||
{
|
||||
@@ -202,6 +203,19 @@ class deptModel extends model
|
||||
return $linkHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the group Link.
|
||||
*
|
||||
* @param int $dept
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createGroupLink($dept, $groupID)
|
||||
{
|
||||
return html::a(helper::createLink('group', 'managemember', "groupID=$groupID&deptID={$dept->id}"), $dept->name, '_self', "id='dept{$dept->id}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sons of a department.
|
||||
*
|
||||
|
||||
@@ -221,10 +221,11 @@ class group extends control
|
||||
* Manage members of a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @param int $deptID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function manageMember($groupID)
|
||||
public function manageMember($groupID, $deptID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -234,7 +235,7 @@ class group extends control
|
||||
}
|
||||
$group = $this->group->getById($groupID);
|
||||
$groupUsers = $this->group->getUserPairs($groupID);
|
||||
$allUsers = $this->user->getPairs('nodeleted|noclosed|noempty|noletter');
|
||||
$allUsers = $this->group->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;
|
||||
@@ -244,6 +245,7 @@ class group extends control
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->group = $group;
|
||||
$this->view->deptTree = $this->loadModel('dept')->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createGroupLink'), $groupID);
|
||||
$this->view->groupUsers = $groupUsers;
|
||||
$this->view->otherUsers = $otherUsers;
|
||||
|
||||
|
||||
@@ -178,6 +178,22 @@ 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.
|
||||
*
|
||||
|
||||
@@ -18,7 +18,15 @@
|
||||
<small class='text-muted'> <?php echo $lang->group->manageMember;?> <?php echo html::icon($lang->icons['manage']);?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='side'>
|
||||
<a class='side-handle' data-id='groupTree'><i class='icon-caret-left'></i></a>
|
||||
<div class='side-body'>
|
||||
<div class='panel panel-sm'>
|
||||
<div class='panel-heading nobr'><?php echo html::icon($lang->icons['company']);?> <strong><?php echo $lang->dept->common;?></strong></div>
|
||||
<div class='panel-body'><?php echo $deptTree;?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form class='form-condensed pdb-20' method='post' target='hiddenwin'>
|
||||
<table align='center' class='table table-form'>
|
||||
<?php if($groupUsers):?>
|
||||
|
||||
Reference in New Issue
Block a user