- Remove unuse code.

This commit is contained in:
tianshujie
2023-08-17 16:27:21 +08:00
parent 2a2ee64912
commit 87f433d8a9
5 changed files with 0 additions and 322 deletions
-127
View File
@@ -5198,133 +5198,6 @@ class executionModel extends model
return $treeData;
}
/**
* Print execution nested list.
*
* @param object $execution
* @param bool $isChild
* @param array $users
* @param int $productID
* @access public
* @return void
*/
public function printNestedList($execution, $isChild, $users, $productID)
{
$this->loadModel('task');
$this->loadModel('execution');
$this->loadModel('programplan');
$today = helper::today();
if(!$isChild)
{
$trClass = 'is-top-level table-nest-child-hide';
$trAttrs = "data-id='$execution->id' data-order='$execution->order' data-nested='true' data-status={$execution->status}";
}
else
{
if(strpos($execution->path, ",$execution->project,") !== false)
{
$path = explode(',', trim($execution->path, ','));
$path = array_slice($path, array_search($execution->project, $path) + 1);
$path = implode(',', $path);
}
$trClass = 'table-nest-hide';
$trAttrs = "data-id={$execution->id} data-parent={$execution->parent} data-status={$execution->status}";
$trAttrs .= " data-nest-parent='$execution->parent' data-order='$execution->order' data-nest-path='$path'";
}
$burns = implode(',', $execution->burns);
echo "<tr $trAttrs class='$trClass'>";
echo "<td class='c-name text-left flex sort-handler'>";
if(common::hasPriv('execution', 'batchEdit')) echo "<span id=$execution->id class='table-nest-icon icon table-nest-toggle'></span>";
$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> ";
if(empty($execution->children))
{
echo html::a(helper::createLink('execution', 'view', "executionID=$execution->id"), $execution->name, '', "class='text-ellipsis' title='{$execution->name}'");
}
else
{
echo "<span class='text-ellipsis'>" . $execution->name . '</span>';
}
if(!helper::isZeroDate($execution->end) && $execution->status != 'closed')
{
echo strtotime($today) > strtotime($execution->end) ? '<span class="label label-danger label-badge">' . $this->lang->execution->delayed . '</span>' : '';
}
if(($execution->stageBy == 'project') and $execution->hasProduct) echo "<td class='text-left' title='{$execution->productName}'>{$execution->productName}</td>";
echo "<td class='status-{$execution->status} text-center'>" . zget($this->lang->project->statusList, $execution->status) . '</td>';
echo '<td>' . zget($users, $execution->PM) . '</td>';
echo helper::isZeroDate($execution->begin) ? '<td class="c-date"></td>' : '<td class="c-date">' . $execution->begin . '</td>';
echo helper::isZeroDate($execution->end) ? '<td class="c-date"></td>' : '<td class="c-date">' . $execution->end . '</td>';
echo "<td class='hours text-right' title='{$execution->hours->totalEstimate}{$this->lang->execution->workHour}'>" . $execution->hours->totalEstimate . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours text-right' title='{$execution->hours->totalConsumed}{$this->lang->execution->workHour}'>" . $execution->hours->totalConsumed . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours text-right' title='{$execution->hours->totalLeft}{$this->lang->execution->workHour}'>" . $execution->hours->totalLeft . $this->lang->execution->workHourUnit . '</td>';
echo '<td>' . html::ring($execution->hours->progress) . '</td>';
echo "<td id='spark-{$execution->id}' class='sparkline text-left no-padding' values='$burns'></td>";
echo '<td class="c-actions text-center">';
common::printIcon('execution', 'start', "executionID={$execution->id}", $execution, 'list', '', '', 'iframe', true);
$class = !empty($execution->children) ? 'disabled' : '';
common::printIcon('task', 'create', "executionID={$execution->id}", '', 'list', '', '', $class, false, "data-app='execution'");
$project = $this->loadModel('project')->getByID($execution->project);
if($execution->type == 'stage' or ($this->app->tab == 'project' and !empty($project->model) and $project->model == 'waterfallplus'))
{
$isCreateTask = $this->loadModel('programplan')->isCreateTask($execution->id);
$disabled = ($isCreateTask and $execution->type == 'stage') ? '' : ' disabled';
$title = !$isCreateTask ? $this->lang->programplan->error->createdTask : $this->lang->programplan->createSubPlan;
$title = (!empty($disabled) and $execution->type != 'stage') ? $this->lang->programplan->error->notStage : $title;
common::printIcon('programplan', 'create', "program={$execution->project}&productID=$productID&planID=$execution->id", $execution, 'list', 'split', '', $disabled, '', '', $title);
}
if($execution->type == 'stage')
{
common::printIcon('programplan', 'edit', "stageID=$execution->id&projectID=$execution->project", $execution, 'list', '', '', 'iframe', true);
}
else
{
common::printIcon('execution', 'edit', "executionID=$execution->id", $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->execution->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->execution->activate);
}
if(common::hasPriv('execution', 'delete', $execution))
{
common::printIcon('execution', 'delete', "stageID=$execution->id&confirm=no", $execution, 'list', 'trash', 'hiddenwin' , $disabled, '', '', $this->lang->delete);
}
echo '</td>';
echo '</tr>';
if(!empty($execution->children))
{
foreach($execution->children as $child)
{
$child->stageBy = $execution->stageBy;
$this->printNestedList($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);
}
}
}
/**
* Update user view of execution and it's product.
*
-19
View File
@@ -2756,25 +2756,6 @@ class executionTest
return $this->executionModel->buildOperateMenu($execution);
}
/**
* Test print nested list.
*
* @param int $projectID
* @access public
* @return string
*/
public function printNestedListTest($projectID = 0)
{
$executions = $this->executionModel->getStatData($projectID);
global $app;
$app->moduleName = 'execution';
ob_start();
$this->executionModel->printNestedList($executions[0], false, array(), 1);
$result = ob_get_clean();
return mb_substr(strip_tags($result), 0, 2);
}
/**
* Test print nested list.
*
@@ -1,56 +0,0 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/execution.class.php';
zdTable('user')->gen(5);
su('admin');
$execution = zdTable('project');
$execution->id->range('1-6');
$execution->name->range('项目集1,项目1,项目2,迭代1,阶段1,看板1');
$execution->type->range('program,project{2},sprint,stage,kanban');
$execution->code->range('1-6')->prefix('code');
$execution->parent->range('0,1{2},2{2},3');
$execution->project->range('0,1{2},2{2},3');
$execution->status->range('wait{3},suspended,closed,doing');
$execution->openedBy->range('admin,user1');
$execution->hasProduct->range('0');
$execution->begin->range('20220110 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->end->range('20220220 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->gen(6);
$burn = zdTable('burn');
$burn->execution->range('3{5},4{5},5{5}');
$burn->date->range('20220111 000000:1D')->type('timestamp')->format('YY/MM/DD');
$burn->estimate->range('94.3,56.3,55.3,37.8,33.8');
$burn->left->range('95.3,68.5,73.9,40.2,36,3');
$burn->consumed->range('20.1,33.4,41,56.55,59.55');
$burn->storyPoint->range('0,16.5,16,11.5,9');
$burn->gen(15);
$product = zdTable('product');
$product->id->range('1-3');
$product->name->range('1-3')->prefix('产品');
$product->code->range('1-3')->prefix('product');
$product->type->range('normal');
$product->status->range('normal');
$product->gen(3);
zdTable('projectproduct')->gen(0);
/**
title=测试executionModel->printNestedList();
cid=1
pid=1
查询所有项目下第一个执行 >> 迭代
查询项目2下第一个执行 >> 看板
*/
$projectIDList = array(0, 3);
$execution = new executionTest();
r($execution->printNestedListTest($projectIDList[0])) && p() && e('迭代'); // 查询所有项目下第一个执行
r($execution->printNestedListTest($projectIDList[1])) && p() && e('看板'); // 查询项目2下第一个执行