* adjust code for task #2543.
This commit is contained in:
@@ -343,9 +343,10 @@ class deptModel extends model
|
||||
*/
|
||||
public function getDeptUserPairs($deptID = 0)
|
||||
{
|
||||
$childDepts = $this->getAllChildID($deptID);
|
||||
return $this->dao->select('account, realname')->from(TABLE_USER)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($deptID)->andWhere('dept')->in($this->getAllChildID($deptID))->fi()
|
||||
->beginIF($deptID)->andWhere('dept')->in($childDepts)->fi()
|
||||
->orderBy('account')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
@@ -1555,7 +1555,7 @@ class project extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function manageMembers($projectID = 0, $team2Import = 0, $deptID = 0)
|
||||
public function manageMembers($projectID = 0, $team2Import = 0, $dept = '')
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -1569,11 +1569,11 @@ class project extends control
|
||||
$this->loadModel('dept');
|
||||
|
||||
$project = $this->project->getById($projectID);
|
||||
$allUsers = $this->user->getPairs('noclosed, nodeleted, devfirst');
|
||||
$roles = $this->user->getUserRoles(array_keys($allUsers));
|
||||
$users = $this->user->getPairs('noclosed, nodeleted, devfirst');
|
||||
$roles = $this->user->getUserRoles(array_keys($users));
|
||||
$deptUsers = $dept === '' ? array() : $this->dept->getDeptUserPairs($dept);
|
||||
$currentMembers = $this->project->getTeamMembers($projectID);
|
||||
$members2Import = $this->project->getMembers2Import($team2Import, array_keys($currentMembers));
|
||||
$users = $this->dept->getDeptUserPairs($deptID, 'devfirst');
|
||||
$teams2Import = $this->project->getTeams2Import($this->app->user->account, $projectID);
|
||||
$teams2Import = array($this->lang->project->copyTeam) + $teams2Import;
|
||||
|
||||
@@ -1588,9 +1588,10 @@ class project extends control
|
||||
$this->view->position = $position;
|
||||
$this->view->project = $project;
|
||||
$this->view->users = $users;
|
||||
$this->view->allUsers = $allUsers;
|
||||
$this->view->deptUsers = $deptUsers;
|
||||
$this->view->roles = $roles;
|
||||
$this->view->deptTree = $this->dept->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createPrjManageMemberLink'), array('projectID' => $projectID, 'team2Import' => $team2Import));
|
||||
$this->view->dept = $dept;
|
||||
$this->view->depts = array('' => '') + $this->loadModel('dept')->getOptionMenu();
|
||||
$this->view->currentMembers = $currentMembers;
|
||||
$this->view->members2Import = $members2Import;
|
||||
$this->view->teams2Import = $teams2Import;
|
||||
|
||||
@@ -45,3 +45,10 @@ function deleteItem(obj)
|
||||
{
|
||||
$(obj).closest('.addedItem').remove();
|
||||
}
|
||||
|
||||
function setDeptUsers(obj)
|
||||
{
|
||||
dept = $(obj).val();//Get dept ID.
|
||||
link = createLink('project', 'manageMembers', 'projectID=' + projectID + '&team2Import=' + team2Import + '&dept=' + dept);//Create manageMembers link.
|
||||
location.href=link;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ $lang->project->aboveAllProject = "Above all {$lang->projectCommon}s";
|
||||
$lang->project->selectProject = "Select {$lang->projectCommon}";
|
||||
$lang->project->beginAndEnd = 'Begin and end';
|
||||
$lang->project->lblStats = 'Stats';
|
||||
$lang->project->workHours = '7.0';
|
||||
$lang->project->stats = 'Total work hours is 『%s』hours, <br />Total estimate is『%s』hours,<br />Total confused is『%s』hours<br />Total left is『%s』hours';
|
||||
$lang->project->taskSummary = "<strong>%s</strong> tasks in this page. Pending: <strong>%s</strong>. doing: <strong>%s</strong>. Est: <strong>%s</strong> h. Consumed: <strong>%s</strong> h. Left: <strong>%s</strong>.";
|
||||
$lang->project->memberHours = "%s has <strong>%s</strong> workhours, ";
|
||||
@@ -181,6 +182,7 @@ $lang->project->batchWBS = "Batch WBS";
|
||||
$lang->project->howToUpdateBurn = "<a href='http://api.zentao.net/goto.php?item=burndown&lang=zh-cn' title='How to update burndown?' target='_blank' class='btn btn-sm'>Help</a>";
|
||||
$lang->project->whyNoStories = "There no active stories to added to this {$lang->projectCommon}. Please check the linked {$lang->productCommon}.";
|
||||
$lang->project->doneProjects = 'Done';
|
||||
$lang->project->selectDept = 'Please select a dept';
|
||||
$lang->project->copyTeam = 'Copy a team';
|
||||
$lang->project->copyFromTeam = 'Copy form team: <strong>%s</strong>';
|
||||
$lang->project->noMatched = "No matched {$lang->projectCommon} including '%s'";
|
||||
|
||||
@@ -171,6 +171,7 @@ $lang->project->aboveAllProject = "以上所有{$lang->projectCommon}";
|
||||
$lang->project->selectProject = "请选择{$lang->projectCommon}";
|
||||
$lang->project->beginAndEnd = '起止时间';
|
||||
$lang->project->lblStats = '工时统计';
|
||||
$lang->project->workHours = '7.0';
|
||||
$lang->project->stats = '可用工时<strong>%s</strong>工时<br />总共预计<strong>%s</strong>工时<br />已经消耗<strong>%s</strong>工时<br />预计剩余<strong>%s</strong>工时';
|
||||
$lang->project->taskSummary = "本页共 <strong>%s</strong> 个任务,未开始 <strong>%s</strong>,进行中 <strong>%s</strong>,总预计<strong>%s</strong>工时,已消耗<strong>%s</strong>工时,剩余<strong>%s</strong>工时。";
|
||||
$lang->project->memberHours = "%s共有 <strong>%s</strong> 个可用工时,";
|
||||
@@ -181,6 +182,7 @@ $lang->project->batchWBS = "批量分解";
|
||||
$lang->project->howToUpdateBurn = "<a href='http://api.zentao.net/goto.php?item=burndown&lang=zh-cn' target='_blank' title='如何更新燃尽图?' class='btn btn-sm'>帮助</a>";
|
||||
$lang->project->whyNoStories = "看起来没有需求可以关联。请检查下{$lang->projectCommon}关联的{$lang->productCommon}中有没有需求,而且要确保它们已经审核通过。";
|
||||
$lang->project->doneProjects = '已结束';
|
||||
$lang->project->selectDept = '请选择部门';
|
||||
$lang->project->copyTeam = '复制团队';
|
||||
$lang->project->copyFromTeam = "复制自{$lang->projectCommon}团队: <strong>%s</strong>";
|
||||
$lang->project->noMatched = "找不到包含'%s'的$lang->projectCommon";
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('projectID', $project->id);?>
|
||||
<?php js::set('team2Import', $team2Import);?>
|
||||
<?php js::set('roles', $roles);?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
@@ -19,18 +20,11 @@
|
||||
<strong> <?php echo $lang->project->manageMembers;?></strong>
|
||||
<small class='text-muted'><i class='icon icon-cogs'></i></small>
|
||||
</div>
|
||||
<div><?php echo html::select('dept', $depts, $dept, "class='form-control chosen' onchange='setDeptUsers(this)' data-placeholder='{$lang->project->selectDept}'");?></div>
|
||||
<div class='actions'>
|
||||
<button class='btn' id='itBtn'><?php echo html::icon($lang->icons['copy']) . ' ' . $lang->project->copyTeam;?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class='side'>
|
||||
<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>
|
||||
<div class='main'>
|
||||
<form class='form-condensed' method='post'>
|
||||
<table class='table table-form'>
|
||||
@@ -46,7 +40,7 @@
|
||||
</thead>
|
||||
<?php $i = 1; $memberCount = 0;?>
|
||||
<?php foreach($currentMembers as $member):?>
|
||||
<?php if(!isset($allUsers[$member->account])) continue;?>
|
||||
<?php if(!isset($users[$member->account])) continue;?>
|
||||
<?php unset($users[$member->account]);?>
|
||||
<tr>
|
||||
<td><input type='text' name='realnames[]' id='account<?php echo $i;?>' value='<?php echo $member->realname;?>' readonly class='form-control' /></td>
|
||||
@@ -65,7 +59,7 @@
|
||||
|
||||
<?php foreach($members2Import as $member2Import):?>
|
||||
<tr class='addedItem'>
|
||||
<td><?php echo html::select("accounts[]", $allUsers, $member2Import->account, "class='select-2 chosen' onchange='setRole(this.value, $i)'");?></td>
|
||||
<td><?php echo html::select("accounts[]", $users, $member2Import->account, "class='select-2 chosen' onchange='setRole(this.value, $i)'");?></td>
|
||||
<td><input type='text' name='roles[]' id='role<?php echo $i;?>' class='form-control' value='<?php echo $member2Import->role;?>' /></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo $i;?>' class='form-control' value='<?php echo $project->days?>'/></td>
|
||||
<td>
|
||||
@@ -78,13 +72,30 @@
|
||||
<?php $i ++; $memberCount ++;?>
|
||||
<?php endforeach;?>
|
||||
|
||||
<?php foreach($deptUsers as $deptAccount => $userName):?>
|
||||
<?php if(!isset($users[$deptAccount])) continue;?>
|
||||
<tr class='addedItem'>
|
||||
<td><?php echo html::select("accounts[]", $users, $deptAccount, "class='select-2 chosen' onchange='setRole(this.value, $i)'");?></td>
|
||||
<td><input type='text' name='roles[]' id='role<?php echo $i;?>' class='form-control' value='<?php echo $roles[$deptAccount]?>'/></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo $i;?>' class='form-control' value='<?php echo $project->days?>'/></td>
|
||||
<td>
|
||||
<input type='text' name='hours[]' id='hours<?php echo $i;?>' class='form-control' value='<?php echo $lang->project->workHours?>' />
|
||||
<input type='hidden' name='modes[]' value='create' />
|
||||
</td>
|
||||
<td><a href='javascript:;' onclick='addItem()' class='btn btn-block'><i class='icon-plus'></i></a></td>
|
||||
<td><a href='javascript:;' onclick='deleteItem(this)' class='btn btn-block'><i class='icon icon-remove'></i></a></td>
|
||||
</tr>
|
||||
<?php unset($users[$deptAccount]);?>
|
||||
<?php $i ++; $memberCount ++;?>
|
||||
<?php endforeach;?>
|
||||
|
||||
<?php for($j = 0; $j < 5; $j ++):?>
|
||||
<tr class='addedItem'>
|
||||
<td><?php echo html::select("accounts[]", $users, '', "class='select-2 chosen' onchange='setRole(this.value, $i)'");?></td>
|
||||
<td><input type='text' name='roles[]' id='role<?php echo ($i);?>' class='form-control' /></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo ($i);?>' class='form-control' value='<?php echo $project->days?>'/></td>
|
||||
<td>
|
||||
<input type='text' name='hours[]' id='hours<?php echo ($i);?>' class='form-control' value='7' />
|
||||
<input type='text' name='hours[]' id='hours<?php echo ($i);?>' class='form-control' value='<?php echo $lang->project->workHours?>' />
|
||||
<input type='hidden' name='modes[]' value='create' />
|
||||
</td>
|
||||
<td><a href='javascript:;' onclick='addItem()' class='btn btn-block'><i class='icon-plus'></i></a></td>
|
||||
@@ -110,7 +121,7 @@
|
||||
<td><input type='text' name='roles[]' id='role<?php echo ($i);?>' class='form-control' /></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo ($i);?>' class='form-control' value='<?php echo $project->days?>'/></td>
|
||||
<td>
|
||||
<input type='text' name='hours[]' id='hours<?php echo ($i);?>' class='form-control' value='7' />
|
||||
<input type='text' name='hours[]' id='hours<?php echo ($i);?>' class='form-control' value='<?php echo $lang->project->workHours?>' />
|
||||
<input type='hidden' name='modes[]' value='create' />
|
||||
</td>
|
||||
<td><a href='javascript:;' onclick='addItem()' class='btn btn-block'><i class='icon-plus'></i></a></td>
|
||||
|
||||
Reference in New Issue
Block a user