* Finish task #59706.
This commit is contained in:
@@ -980,7 +980,6 @@ class project extends control
|
||||
$this->view->productID = $productID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->project = $project;
|
||||
$this->view->projects = array('') + $this->project->getPairsByProgram();
|
||||
$this->view->pager = $pager;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
@@ -11,32 +11,33 @@ $(function()
|
||||
window.addEventListener('scroll', this.handleScroll)
|
||||
function handleScroll(e)
|
||||
{
|
||||
var relative = 500; // 相对距离
|
||||
if(getScrollTop() + getWindowHeight() >= getScrollHeight() - relative)
|
||||
{
|
||||
throttle(loadData(), 250)
|
||||
}
|
||||
}
|
||||
|
||||
function loadData()
|
||||
{
|
||||
var relative = 200; // 相对距离
|
||||
$('tr.showmore').each(function()
|
||||
{
|
||||
var offsetTop = $(this)[0].offsetTop;
|
||||
var $showmore = $(this);
|
||||
var offsetTop = $showmore[0].offsetTop;
|
||||
if(offsetTop == 0) return true;
|
||||
$(this).removeClass('showmore');
|
||||
|
||||
var showmoreTr = this;
|
||||
var executionID = $(this).attr('data-parent');
|
||||
var maxTaskID = $(this).attr('data-id');
|
||||
var link = createLink('task', 'ajaxGetTasks', 'executionID=' + executionID + '&maxTaskID=' + maxTaskID);
|
||||
$.get(link, function(data)
|
||||
if(getScrollTop() + getWindowHeight() >= offsetTop - relative)
|
||||
{
|
||||
$(showmoreTr).before(data);
|
||||
$(".iframe").modalTrigger({type:'iframe'});
|
||||
throttle(loadData($showmore), 150)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#executionForm').table('initNestedList');
|
||||
})
|
||||
function loadData($showmore)
|
||||
{
|
||||
$showmore.removeClass('showmore');
|
||||
|
||||
var executionID = $showmore.attr('data-parent');
|
||||
var maxTaskID = $showmore.attr('data-id');
|
||||
var link = createLink('task', 'ajaxGetTasks', 'executionID=' + executionID + '&maxTaskID=' + maxTaskID);
|
||||
$.get(link, function(data)
|
||||
{
|
||||
$showmore.before(data);
|
||||
$(".iframe").modalTrigger({type:'iframe'});
|
||||
|
||||
$('#executionForm').table('initNestedList');
|
||||
})
|
||||
}
|
||||
|
||||
@@ -75,11 +76,6 @@ function getScrollTop()
|
||||
return scrollTop = document.body.scrollTop + document.documentElement.scrollTop
|
||||
}
|
||||
|
||||
function getScrollHeight()
|
||||
{
|
||||
return scrollHeight = document.documentElement.scrollHeight
|
||||
}
|
||||
|
||||
function getWindowHeight()
|
||||
{
|
||||
return document.compatMode == "CSS1Compat" ? windowHeight = document.documentElement.clientHeight : windowHeight = document.body.clientHeight
|
||||
|
||||
@@ -2091,6 +2091,100 @@ class projectModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print execution list.
|
||||
*
|
||||
* @param object $execution
|
||||
* @param int $isChild
|
||||
* @param array $users
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printExecutionList($execution, $isChild = false, $users, $productID)
|
||||
{
|
||||
$this->loadModel('task');
|
||||
$this->loadModel('execution');
|
||||
$this->loadModel('programplan');
|
||||
|
||||
if(!$isChild)
|
||||
{
|
||||
$trClass = 'is-top-level table-nest-child-hide';
|
||||
$trAttrs = "data-id='$execution->id' data-order='$execution->order' data-nested='true'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$trClass = 'is-nest-child';
|
||||
$trAttrs = "data-id={$execution->id} data-parent={$execution->parent}";
|
||||
$trAttrs .= " data-nest-parent='$execution->parent' data-order='$execution->order' data-nest-path=',$execution->parent,$execution->id,'";
|
||||
}
|
||||
|
||||
$burns = join(',', $execution->burns);
|
||||
echo "<tr $trAttrs class=$trClass>";
|
||||
echo "<td><span id=$execution->id class='table-nest-icon icon table-nest-toggle'></span>";
|
||||
if($this->config->systemMode == 'new')
|
||||
{
|
||||
$spanClass = $execution->type == 'stage' ? 'label-warning' : 'label-info';
|
||||
echo "<span class='project-type-label label label-outline $spanClass'>{$this->lang->execution->typeList[$execution->type]}</span>";
|
||||
}
|
||||
echo html::a(helper::createLink('execution', 'view', "executionID=$execution->id"), $execution->name);
|
||||
echo '<td>' . zget($users, $execution->PM) . '</td>';
|
||||
echo '<td>' . zget($this->lang->project->statusList, $execution->status) . '</td>';
|
||||
echo '<td>' . html::ring($execution->hours->progress) . '</td>';
|
||||
echo '<td>' . $execution->begin . '</td>';
|
||||
echo '<td>' . $execution->end . '</td>';
|
||||
echo "<td class='hours' title='{$execution->hours->totalEstimate}{$this->lang->execution->workHour}'>" . $execution->hours->totalEstimate . $this->lang->execution->workHourUnit . '</td>';
|
||||
echo "<td class='hours' title='{$execution->hours->totalConsumed}{$this->lang->execution->workHour}'>" . $execution->hours->totalConsumed . $this->lang->execution->workHourUnit . '</td>';
|
||||
echo "<td class='hours' title='{$execution->hours->totalLeft}{$this->lang->execution->workHour}'>" . $execution->hours->totalLeft . $this->lang->execution->workHourUnit . '</td>';
|
||||
echo "<td id='spark-{$execution->id} class='sparkline text-left no-padding' values='$burns'></td>";
|
||||
echo '<td class="c-actions">';
|
||||
common::printIcon('execution', 'start', "executionID={$execution->id}", $execution, 'list', '', '', 'iframe', true);
|
||||
$class = !empty($execution->children) ? 'disabled' : '';
|
||||
common::printIcon('task', 'create', "executionID={$execution->id}", $execution, 'list', '', '', $class, false, "data-app='execution'");
|
||||
|
||||
if($execution->grade == 1 && $this->loadModel('programplan')->isCreateTask($execution->id))
|
||||
{
|
||||
common::printIcon('programplan', 'create', "program={$execution->parent}&productID=$productID&planID=$execution->id", $execution, 'list', 'split', '', '', '', '', $this->lang->programplan->createSubPlan);
|
||||
}
|
||||
else
|
||||
{
|
||||
$disabled = ($execution->grade == 2) ? ' disabled' : '';
|
||||
echo common::hasPriv('programplan', 'create') ? html::a('javascript:alert("' . $this->lang->programplan->error->createdTask . '");', '<i class="icon-programplan-create icon-split"></i>', '', 'class="btn ' . $disabled . '"') : '';
|
||||
}
|
||||
|
||||
common::printIcon('programplan', 'edit', "stageID=$execution->id&projectID=$execution->project", $execution, 'list', '', '', 'iframe', true);
|
||||
|
||||
$disabled = !empty($execution->children) ? ' disabled' : '';
|
||||
if($execution->status != 'closed' and common::hasPriv('execution', 'close', $execution))
|
||||
{
|
||||
common::printIcon('execution', 'close', "stageID=$execution->id", $execution, 'list', 'off', 'hiddenwin' , $disabled . ' iframe', true, '', $this->lang->programplan->close);
|
||||
}
|
||||
elseif($execution->status == 'closed' and common::hasPriv('execution', 'activate', $execution))
|
||||
{
|
||||
common::printIcon('execution', 'activate', "stageID=$execution->id", $execution, 'list', 'magic', 'hiddenwin' , $disabled . ' iframe', true, '', $this->lang->programplan->activate);
|
||||
}
|
||||
|
||||
if(common::hasPriv('execution', 'delete', $execution))
|
||||
{
|
||||
common::printIcon('execution', 'delete', "stageID=$execution->id&confirm=no", $execution, 'list', 'trash', 'hiddenwin' , $disabled, '', '', $this->lang->programplan->delete);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if(!empty($execution->children))
|
||||
{
|
||||
foreach($execution->children as $child) $this->printExecutionList($child, true, $users, $productID);
|
||||
}
|
||||
|
||||
if(!empty($execution->tasks))
|
||||
{
|
||||
foreach($execution->tasks as $task)
|
||||
{
|
||||
$showmore = (count($execution->tasks) == 50) && ($task == end($execution->tasks));
|
||||
echo $this->task->buildNestedList($execution, $task, false, $showmore, $users);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert budget unit.
|
||||
*
|
||||
|
||||
@@ -75,227 +75,7 @@
|
||||
</thead>
|
||||
<tbody id="executionTableList">
|
||||
<?php foreach($executionStats as $execution):?>
|
||||
<?php
|
||||
$trClass = '';
|
||||
$trAttrs = "data-id='$execution->id' data-order='$execution->order' data-nested='true'";
|
||||
$trClass .= ' is-top-level table-nest-child-hide';
|
||||
?>
|
||||
<tr <?php echo $trAttrs;?> class="<?php echo $trClass;?>">
|
||||
<td>
|
||||
<span id = <?php echo $execution->id;?> class="table-nest-icon icon table-nest-toggle"></span>
|
||||
<?php if($config->systemMode == 'new'):?>
|
||||
<span class='project-type-label label label-outline <?php echo $execution->type == 'stage' ? 'label-warning' : 'label-info';?>'><?php echo $lang->execution->typeList[$execution->type]?></span>
|
||||
<?php endif;?>
|
||||
<?php echo html::a($this->createLink('execution', 'view', "executionID=$execution->id"), $execution->name);?>
|
||||
</td>
|
||||
<td><?php echo zget($users, $execution->PM);?></td>
|
||||
<td><?php echo zget($lang->project->statusList, $execution->status);?></td>
|
||||
<td><?php echo html::ring($execution->hours->progress); ?></td>
|
||||
<td><?php echo $execution->begin;?></td>
|
||||
<td><?php echo $execution->end;?></td>
|
||||
<td class='hours' title='<?php echo $execution->hours->totalEstimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $execution->hours->totalEstimate . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $execution->hours->totalConsumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $execution->hours->totalConsumed . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $execution->hours->totalLeft . ' ' . $this->lang->execution->workHour;?>'><?php echo $execution->hours->totalLeft . $this->lang->execution->workHourUnit;?></td>
|
||||
<td id='spark-<?php echo $execution->id?>' class='sparkline text-left no-padding' values='<?php echo join(',', $execution->burns);?>'></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
common::printIcon('execution', 'start', "executionID={$execution->id}", $execution, 'list', '', '', 'iframe', true);
|
||||
$class = !empty($execution->children) ? 'disabled' : '';
|
||||
common::printIcon('task', 'create', "executionID={$execution->id}", $execution, 'list', '', '', $class, false, "data-app='execution'");
|
||||
|
||||
if($execution->grade == 1 && $this->loadModel('programplan')->isCreateTask($execution->id))
|
||||
{
|
||||
common::printIcon('programplan', 'create', "program={$execution->parent}&productID=$productID&planID=$execution->id", $execution, 'list', 'split', '', '', '', '', $this->lang->programplan->createSubPlan);
|
||||
}
|
||||
else
|
||||
{
|
||||
$disabled = ($execution->grade == 2) ? ' disabled' : '';
|
||||
echo common::hasPriv('programplan', 'create') ? html::a('javascript:alert("' . $this->lang->programplan->error->createdTask . '");', '<i class="icon-programplan-create icon-split"></i>', '', 'class="btn ' . $disabled . '"') : '';
|
||||
}
|
||||
|
||||
common::printIcon('programplan', 'edit', "stageID=$execution->id&projectID=$execution->project", $execution, 'list', '', '', 'iframe', true);
|
||||
|
||||
$disabled = !empty($execution->children) ? ' disabled' : '';
|
||||
if($execution->status != 'closed' and common::hasPriv('execution', 'close', $execution))
|
||||
{
|
||||
common::printIcon('execution', 'close', "stageID=$execution->id", $execution, 'list', 'off', 'hiddenwin' , $disabled . ' iframe', true, '', $this->lang->programplan->close);
|
||||
}
|
||||
elseif($execution->status == 'closed' and common::hasPriv('execution', 'activate', $execution))
|
||||
{
|
||||
common::printIcon('execution', 'activate', "stageID=$execution->id", $execution, 'list', 'magic', 'hiddenwin' , $disabled . ' iframe', true, '', $this->lang->programplan->activate);
|
||||
}
|
||||
|
||||
if(common::hasPriv('execution', 'delete', $execution))
|
||||
{
|
||||
common::printIcon('execution', 'delete', "stageID=$execution->id&confirm=no", $execution, 'list', 'trash', 'hiddenwin' , $disabled, '', '', $this->lang->programplan->delete);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if(!empty($execution->tasks)):?>
|
||||
<?php foreach($execution->tasks as $task):?>
|
||||
<?php
|
||||
$trClass = '';
|
||||
$trAttrs = "data-id={$task->id} data-parent={$task->execution}";
|
||||
$trClass .= " is-nest-child no-nest";
|
||||
$trAttrs .= " data-nest-parent='$task->execution' data-nest-path=',$execution->id,$task->id,'";
|
||||
if(empty($task->children)) $trAttrs .= " data-nested='false'";
|
||||
if($task == end($child->tasks) and count($execution->tasks) == 50) $trClass .= ' showmore';
|
||||
?>
|
||||
<tr <?php echo $trAttrs;?> class='<?php echo $trClass;?>'>
|
||||
<td><?php echo html::a($this->createLink('task', 'view', "id=$task->id"), $task->name, '', "data-app={$this->app->tab}");?></td>
|
||||
<td><?php echo zget($users, $task->assignedTo);?></td>
|
||||
<td><?php echo zget($lang->task->statusList, $task->status);?></td>
|
||||
<td></td>
|
||||
<td><?php echo $task->estStarted;?></td>
|
||||
<td><?php echo $task->deadline;?></td>
|
||||
<td class='hours' title='<?php echo $task->estimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $task->estimate . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $task->consumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $task->consumed . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $task->left . ' ' . $this->lang->execution->workHour;?>'><?php echo $task->left . $this->lang->execution->workHourUnit;?></td>
|
||||
<td></td>
|
||||
<td class='c-actions'><?php echo $this->task->buildOperateMenu($task, 'browse');?></td>
|
||||
</tr>
|
||||
|
||||
<?php if(!empty($task->children)):?>
|
||||
<?php foreach($task->children as $childTask):?>
|
||||
<?php
|
||||
$trClass = '';
|
||||
$trAttrs = "data-id={$childTask->id} data-parent={$child->parent}";
|
||||
$trClass .= " is-nest-child no-nest";
|
||||
$trAttrs .= " data-nest-parent='$childTask->parent' data-nest-path=',$execution->id,$childTask->parent,$childTask->id,'";
|
||||
?>
|
||||
<tr <?php echo $trAttrs;?> class='<?php echo $trClass;?>'>
|
||||
<td><?php echo html::a($this->createLink('task', 'view', "id=$childTask->id"), $childTask->name);?></td>
|
||||
<td><?php echo zget($users, $childTask->assignedTo);?></td>
|
||||
<td><?php echo zget($lang->task->statusList, $childTask->status);?></td>
|
||||
<td></td>
|
||||
<td><?php echo $childTask->estStarted;?></td>
|
||||
<td><?php echo $childTask->deadline;?></td>
|
||||
<td class='hours' title='<?php echo $childTask->estimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $childTask->estimate . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $childTask->consumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $childTask->consumed . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $childTask->left . ' ' . $this->lang->execution->workHour;?>'><?php echo $childTask->left . $this->lang->execution->workHourUnit;?></td>
|
||||
<td></td>
|
||||
<td class='c-actions'><?php echo $this->task->buildOperateMenu($childTask, 'browse');?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if(!empty($execution->children)):?>
|
||||
<?php foreach($execution->children as $child):?>
|
||||
<?php
|
||||
$trClass = '';
|
||||
$trAttrs = "data-id={$child->id} data-parent={$child->parent}";
|
||||
$trClass .= " is-nest-child";
|
||||
$trAttrs .= " data-nest-parent='$child->parent' data-order='$child->order' data-nest-path=',$execution->id,$child->id,'";
|
||||
?>
|
||||
<tr <?php echo $trAttrs;?> class='<?php echo $trClass;?>'>
|
||||
<td>
|
||||
<?php if($config->systemMode == 'new'):?>
|
||||
<span class='project-type-label label label-outline <?php echo $child->type == 'stage' ? 'label-warning' : 'label-info';?>'><?php echo $lang->execution->typeList[$child->type]?></span>
|
||||
<?php endif;?>
|
||||
<?php echo html::a($this->createLink('execution', 'view', "executionID=$child->id"), $child->name);?>
|
||||
</td>
|
||||
<td><?php echo zget($users, $child->PM);?></td>
|
||||
<td><?php echo zget($lang->project->statusList, $child->status);?></td>
|
||||
<td><?php echo html::ring($child->hours->progress); ?></td>
|
||||
<td><?php echo $child->begin;?></td>
|
||||
<td><?php echo $child->end;?></td>
|
||||
<td class='hours' title='<?php echo $child->hours->totalEstimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $child->hours->totalEstimate . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $child->hours->totalConsumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $child->hours->totalConsumed . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $child->hours->totalLeft . ' ' . $this->lang->execution->workHour;?>'><?php echo $child->hours->totalLeft . $this->lang->execution->workHourUnit;?></td>
|
||||
<td id='spark-<?php echo $child->id?>' class='sparkline text-left no-padding' values='<?php echo join(',', $child->burns);?>'></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
common::printIcon('execution', 'start', "executionID={$child->id}", $child, 'list', '', '', 'iframe', true);
|
||||
$class = !empty($child->children) ? 'disabled' : '';
|
||||
common::printIcon('task', 'create', "executionID={$child->id}", $child, 'list', '', '', $class, false, "data-app='execution'");
|
||||
|
||||
if($child->grade == 1 && $this->loadModel('programplan')->isCreateTask($child->id))
|
||||
{
|
||||
common::printIcon('programplan', 'create', "program={$child->parent}&productID=$productID&planID=$child->id", $child, 'list', 'split', '', '', '', '', $this->lang->programplan->createSubPlan);
|
||||
}
|
||||
else
|
||||
{
|
||||
$disabled = ($child->grade == 2) ? ' disabled' : '';
|
||||
echo common::hasPriv('programplan', 'create') ? html::a('javascript:alert("' . $this->lang->programplan->error->createdTask . '");', '<i class="icon-programplan-create icon-split"></i>', '', 'class="btn ' . $disabled . '"') : '';
|
||||
}
|
||||
|
||||
common::printIcon('programplan', 'edit', "stageID=$child->id&projectID=$child->project", $child, 'list', '', '', 'iframe', true);
|
||||
|
||||
$disabled = !empty($child->children) ? ' disabled' : '';
|
||||
if($child->status != 'closed' and common::hasPriv('execution', 'close', $child))
|
||||
{
|
||||
common::printIcon('execution', 'close', "stageID=$child->id", $child, 'list', 'off', 'hiddenwin' , $disabled . ' iframe', true, '', $this->lang->programplan->close);
|
||||
}
|
||||
elseif($child->status == 'closed' and common::hasPriv('execution', 'activate', $child))
|
||||
{
|
||||
common::printIcon('execution', 'activate', "stageID=$child->id", $child, 'list', 'magic', 'hiddenwin' , $disabled . ' iframe', true, '', $this->lang->programplan->activate);
|
||||
}
|
||||
|
||||
if(common::hasPriv('execution', 'delete', $child))
|
||||
{
|
||||
common::printIcon('execution', 'delete', "stageID=$child->id&confirm=no", $child, 'list', 'trash', 'hiddenwin' , $disabled, '', '', $this->lang->programplan->delete);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if(!empty($child->tasks)):?>
|
||||
<?php foreach($child->tasks as $task):?>
|
||||
<?php
|
||||
$trClass = '';
|
||||
$trAttrs = "data-id={$task->id} data-parent={$task->execution}";
|
||||
$trClass .= " is-nest-child no-nest";
|
||||
$trAttrs .= " data-nest-parent='$task->execution' data-nest-path=',$execution->id,$child->id,$task->id,'";
|
||||
if(empty($task->children)) $trAttrs .= " data-nested='false'";
|
||||
if($task == end($child->tasks) and count($child->tasks) == 50) $trClass .= ' showmore';
|
||||
?>
|
||||
<tr <?php echo $trAttrs;?> class='<?php echo $trClass;?>'>
|
||||
<td><?php echo html::a($this->createLink('task', 'view', "id=$task->id"), $task->name, '', "data-app={$this->app->tab}");?></td>
|
||||
<td><?php echo zget($users, $task->assignedTo);?></td>
|
||||
<td><?php echo zget($lang->task->statusList, $task->status);?></td>
|
||||
<td></td>
|
||||
<td><?php echo $task->estStarted;?></td>
|
||||
<td><?php echo $task->deadline;?></td>
|
||||
<td class='hours' title='<?php echo $task->estimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $task->estimate . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $task->consumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $task->consumed . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $task->left . ' ' . $this->lang->execution->workHour;?>'><?php echo $task->left . $this->lang->execution->workHourUnit;?></td>
|
||||
<td></td>
|
||||
<td class='c-actions'><?php echo $this->task->buildOperateMenu($task, 'browse');?></td>
|
||||
</tr>
|
||||
|
||||
<?php if(!empty($task->children)):?>
|
||||
<?php foreach($task->children as $childTask):?>
|
||||
<?php
|
||||
$trClass = '';
|
||||
$trAttrs = "data-id={$childTask->id} data-parent={$child->parent}";
|
||||
$trClass .= " is-nest-child no-nest";
|
||||
$trAttrs .= " data-nest-parent='$childTask->parent' data-nest-path=',$execution->id,$child->id,$childTask->parent,$childTask->id,' data-nested='false'";
|
||||
?>
|
||||
<tr <?php echo $trAttrs;?> class='<?php echo $trClass;?>'>
|
||||
<td><?php echo html::a($this->createLink('task', 'view', "id=$childTask->id"), $childTask->name);?></td>
|
||||
<td><?php echo zget($users, $childTask->assignedTo);?></td>
|
||||
<td><?php echo zget($lang->task->statusList, $childTask->status);?></td>
|
||||
<td></td>
|
||||
<td><?php echo $childTask->estStarted;?></td>
|
||||
<td><?php echo $childTask->deadline;?></td>
|
||||
<td class='hours' title='<?php echo $childTask->estimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $childTask->estimate . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $childTask->consumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $childTask->consumed . $this->lang->execution->workHourUnit;?></td>
|
||||
<td class='hours' title='<?php echo $childTask->left . ' ' . $this->lang->execution->workHour;?>'><?php echo $childTask->left . $this->lang->execution->workHourUnit;?></td>
|
||||
<td></td>
|
||||
<td class='c-actions'><?php echo $this->task->buildOperateMenu($childTask, 'browse');?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
|
||||
<?php endif;?>
|
||||
<?php $this->project->printExecutionList($execution, false, $users, $productID);?>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+4
-43
@@ -1798,56 +1798,17 @@ class task extends control
|
||||
}
|
||||
}
|
||||
|
||||
$body = '';
|
||||
$list = '';
|
||||
$tasks = array_chunk($tasks, 50, true);
|
||||
$tasks = $tasks[0];
|
||||
$count = count($tasks);
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
$path = $execution->grade == 2 ? "$execution->parent,$execution->id,$task->id," : ",$execution->id,$task->id,";
|
||||
$showmore = ($count == 50 and $task == end($tasks)) ? 'showmore' : '';
|
||||
$trAttrs = empty($task->children) ? " data-nested='false'" : '';
|
||||
|
||||
$body .= "<tr data-parent=$executionID data-id=$task->id data-nest-path='$path' $trAttrs data-nest-parent=$executionID class=' $showmore'>";
|
||||
$body .= '<td>' . html::a($this->createLink('task', 'view', "id=$task->id"), $task->name, '', "data-app='project'") . '</td>';
|
||||
$body .= '<td>' . zget($users, $task->assignedTo, '') . '</td>';
|
||||
$body .= '<td>' . zget($this->lang->task->statusList, $task->status, '') . '</td>';
|
||||
$body .= '<td></td>';
|
||||
$body .= '<td>' . $task->estStarted . '</td>';
|
||||
$body .= '<td>' . $task->deadline . '</td>';
|
||||
$body .= '<td>' . $task->estimate . $this->lang->execution->workHourUnit . '</td>';
|
||||
$body .= '<td>' . $task->consumed . $this->lang->execution->workHourUnit . '</td>';
|
||||
$body .= '<td>' . $task->left . $this->lang->execution->workHourUnit . '</td>';
|
||||
$body .= '<td></td>';
|
||||
$body .= '<td class="c-actions">';
|
||||
$body .= $this->task->buildOperateMenu($task, 'browse');
|
||||
$body .= '</td></tr>';
|
||||
|
||||
if(!empty($task->children))
|
||||
{
|
||||
foreach($task->children as $childTask)
|
||||
{
|
||||
$path = $execution->grade == 2 ? "$execution->parent,$execution->id,$childTask->parent,$childTask->id," : ",$execution->id,$childTask->parent,$childTask->id,";
|
||||
|
||||
$body .= "<tr data-parent=$executionID data-id=$childTask->id data-nest-path=$path data-nested='false' data-nest-parent=$executionID class='is-nest-child no-nest'>";
|
||||
$body .= '<td>' . html::a($this->createLink('task', 'view', "id=$childTask->id"), $childTask->name, '', "data-app='project'") . '</td>';
|
||||
$body .= '<td>' . zget($users, $childTask->assignedTo, '') . '</td>';
|
||||
$body .= '<td>' . zget($this->lang->task->statusList, $childTask->status, '') . '</td>';
|
||||
$body .= '<td></td>';
|
||||
$body .= '<td>' . $childTask->estStarted . '</td>';
|
||||
$body .= '<td>' . $childTask->deadline . '</td>';
|
||||
$body .= '<td>' . $childTask->estimate . $this->lang->execution->workHourUnit . '</td>';
|
||||
$body .= '<td>' . $childTask->consumed . $this->lang->execution->workHourUnit . '</td>';
|
||||
$body .= '<td>' . $childTask->left . $this->lang->execution->workHourUnit . '</td>';
|
||||
$body .= '<td></td>';
|
||||
$body .= '<td class="c-actions">';
|
||||
$body .= $this->task->buildOperateMenu($childTask, 'browse');
|
||||
$body .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
$showmore = ($count == 50) && ($task == end($tasks));
|
||||
$list .= $this->task->buildNestedList($execution, $task, false, $showmore, $users);
|
||||
}
|
||||
|
||||
die($body);
|
||||
die($list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3734,6 +3734,61 @@ class taskModel extends model
|
||||
->fetchPairs('actor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build nested list.
|
||||
*
|
||||
* @param objecct $execution
|
||||
* @param object $task
|
||||
* @param bool $isChild
|
||||
* @param bool $showmore
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildNestedList($execution, $task, $isChild = false, $showmore = false, $users)
|
||||
{
|
||||
$showmore = $showmore ? 'showmore' : '';
|
||||
$trAttrs = "data-id=$task->id";
|
||||
if(!$isChild)
|
||||
{
|
||||
$path = $execution->grade == 2 ? "$execution->parent,$execution->id,$task->id," : ",$execution->id,$task->id,";
|
||||
$trAttrs .= " data-parent=$execution->id data-nest-parent=$execution->id data-nest-path=$path";
|
||||
if(empty($task->children)) $trAttrs .= " data-nested='false'";
|
||||
$trClass = empty($task->children) ? '' : " has-nest-child";
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $execution->grade == 2 ? "$execution->parent,$execution->id,$task->parent,$task->id," : ",$execution->id,$task->parent,$task->id,";
|
||||
$trClass = 'is-nest-child no-nest';
|
||||
$trAttrs .= " data-nested='false' data-parent=$task->parent data-nest-parent=$task->parent data-nest-path=$path";
|
||||
}
|
||||
|
||||
$list = "<tr $trAttrs class='$trClass $showmore'>";
|
||||
$list .= '<td>' . html::a(helper::createLink('task', 'view', "id=$task->id"), $task->name, '', "data-app='project'") . '</td>';
|
||||
$list .= '<td>' . zget($users, $task->assignedTo, '') . '</td>';
|
||||
$list .= '<td>' . zget($this->lang->task->statusList, $task->status, '') . '</td>';
|
||||
$list .= '<td></td>';
|
||||
$list .= '<td>' . $task->estStarted . '</td>';
|
||||
$list .= '<td>' . $task->deadline . '</td>';
|
||||
$list .= '<td>' . $task->estimate . $this->lang->execution->workHourUnit . '</td>';
|
||||
$list .= '<td>' . $task->consumed . $this->lang->execution->workHourUnit . '</td>';
|
||||
$list .= '<td>' . $task->left . $this->lang->execution->workHourUnit . '</td>';
|
||||
$list .= '<td></td>';
|
||||
$list .= '<td class="c-actions">';
|
||||
$list .= $this->buildOperateMenu($task, 'browse');
|
||||
$list .= '</td></tr>';
|
||||
|
||||
if(!empty($task->children))
|
||||
{
|
||||
foreach($task->children as $child)
|
||||
{
|
||||
$showmore = (count($task->children) == 50) && ($child == end($task->children));
|
||||
$list .= $this->buildNestedList($execution, $child, true, $showmore, $users);
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build task menu.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user