- 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下第一个执行
-47
View File
@@ -987,53 +987,6 @@ class task extends control
return print(json_encode($items));
}
/**
* 获取执行列表中的任务信息。
* Ajax get tasks for execution list.
*
* @param int $executionID
* @param int $maxTaskID
* @access public
* @return void
*/
public function ajaxGetTasks(int $executionID, int $maxTaskID = 0)
{
$this->loadModel('task');
$this->loadModel('execution');
$execution = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch();
$tasks = $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq('0')
->andWhere('status')->notin('closed,cancel')
->andWhere('parent')->le('0')
->andWhere('execution')->eq($executionID)
->andWhere('id')->gt($maxTaskID)
->orderBy('id_asc')
->limit(50)
->fetchAll('id');
if(empty($tasks)) return print('');
$parentGroup = $this->dao->select('*')->from(TABLE_TASK)
->where('parent')->in(array_keys($tasks))
->andWhere('parent')->gt('0')
->andWhere('deleted')->eq('0')
->fetchGroup('parent', 'id');
$users = $this->loadModel('user')->getPairs('noletter|nodeleted');
foreach($tasks as $taskID => $task) $tasks[$taskID]->children = isset($parentGroup[$taskID]) ? $parentGroup[$taskID] : array();
$list = '';
$count = count($tasks);
foreach($tasks as $task)
{
$showmore = ($count == 50) && ($task == end($tasks));
$list .= $this->task->buildNestedList($execution, $task, false, $showmore, $users);
}
return print($list);
}
/**
* 禅道客户端获取任务动态。
* AJAX: get the actions of a task. for web app.
-73
View File
@@ -2586,79 +2586,6 @@ class taskModel extends model
->fetchPairs('id', 'account');
}
/**
* Build nested list.
*
* @param object $execution
* @param object $task
* @param bool $isChild
* @param bool $showmore
* @access public
* @return string
*/
public function buildNestedList($execution, $task, $isChild = false, $showmore = false, $users = array())
{
$this->app->loadLang('execution');
$today = helper::today();
$showmore = $showmore ? 'showmore' : '';
$trAttrs = "data-id='t$task->id'";
/* Remove projectID in execution path. */
$executionPath = $execution->path;
$executionPath = trim($executionPath, ',');
$executionPath = substr($executionPath, strpos($executionPath, ',') + 1);
if(!$isChild)
{
$path = ",{$executionPath},t{$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 = ",{$executionPath},{$task->parent},t{$task->id},";
$trClass = 'is-nest-child no-nest';
$trAttrs .= " data-nested='false' data-parent='t$task->parent' data-nest-parent='t$task->parent' data-nest-path='$path'";
}
$list = "<tr $trAttrs class='$trClass $showmore'>";
$list .= '<td>';
if($task->parent > 0) $list .= '<span class="label label-badge label-light" title="' . $this->lang->task->children . '">' . $this->lang->task->childrenAB . '</span> ';
$list .= common::hasPriv('task', 'view') ? html::a(helper::createLink('task', 'view', "id=$task->id"), $task->name, '', "style='color: $task->color'", "data-app='project'") : "<span style='color:$task->color'>$task->name</span>";
if(!helper::isZeroDate($task->deadline) && $task->status != 'done')
{
$list .= strtotime($today) > strtotime($task->deadline) ? '<span class="label label-danger label-badge">' . $this->lang->execution->delayed . '</span>' : '';
}
$list .= '</td>';
if($execution->stageBy == 'product' and $execution->hasProduct) $list .= '<td></td>';
$list .= "<td class='status-{$task->status} text-center'>" . $this->processStatus('task', $task) . '</td>';
$list .= '<td>' . zget($users, $task->assignedTo, '') . '</td>';
$list .= helper::isZeroDate($task->estStarted) ? '<td class="c-date"></td>' : '<td class="c-date">' . $task->estStarted . '</td>';
$list .= helper::isZeroDate($task->deadline) ? '<td class="c-date"></td>' : '<td class="c-date">' . $task->deadline . '</td>';
$list .= '<td class="hours text-right">' . $task->estimate . $this->lang->execution->workHourUnit . '</td>';
$list .= '<td class="hours text-right">' . $task->consumed . $this->lang->execution->workHourUnit . '</td>';
$list .= '<td class="hours text-right">' . $task->left . $this->lang->execution->workHourUnit . '</td>';
$list .= '<td></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.
*