- Remove unused methods.

This commit is contained in:
caoyanyi
2023-05-31 16:04:48 +08:00
parent fc3cf42eb2
commit 51286cd882
-235
View File
@@ -2589,199 +2589,6 @@ class taskModel extends model
return $this->dao->lastInsertID();
}
/**
* Print cell data.
*
* @param object $col
* @param object $task
* @param array $users
* @param string $browseType
* @param array $branchGroups
* @param array $modulePairs
* @param bool $showBranch
* @access public
* @return void
*/
public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $showBranch = false)
{
$canBatchEdit = common::hasPriv('task', 'batchEdit', !empty($task) ? $task : null);
$canBatchClose = (common::hasPriv('task', 'batchClose', !empty($task) ? $task : null) and strtolower($browseType) != 'closed');
$canBatchCancel = common::hasPriv('task', 'batchCancel', !empty($task) ? $task : null);
$canBatchChangeModule = common::hasPriv('task', 'batchChangeModule', !empty($task) ? $task : null);
$canBatchAssignTo = common::hasPriv('task', 'batchAssignTo', !empty($task) ? $task : null);
$canBatchAction = in_array(true, array($canBatchEdit, $canBatchClose, $canBatchCancel, $canBatchChangeModule, $canBatchAssignTo));
$storyChanged = (!empty($task->storyStatus) and $task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion and !in_array($task->status, array('cancel', 'closed')));
$canView = common::hasPriv('task', 'view');
$taskLink = helper::createLink('task', 'view', "taskID=$task->id");
$account = $this->app->user->account;
$id = $col->id;
if($col->show)
{
$class = "c-{$id}";
if($id == 'status') $class .= ' task-' . $task->status;
if($id == 'id') $class .= ' cell-id';
if($id == 'name') $class .= ' text-left';
if($id == 'deadline') $class .= ' text-center';
if($id == 'deadline' and isset($task->delay)) $class .= ' delayed';
if($id == 'assignedTo') $class .= ' has-btn text-left';
if($id == 'lane') $class .= ' text-left';
if(strpos('progress', $id) !== false) $class .= ' text-right';
$title = '';
if($id == 'name')
{
$title = " title='{$task->name}'";
if(!empty($task->children)) $class .= ' has-child';
}
if($id == 'story') $title = " title='{$task->storyTitle}'";
if($id == 'estimate' || $id == 'consumed' || $id == 'left')
{
$value = round($task->$id, 1);
$title = " title='{$value} {$this->lang->execution->workHour}'";
}
if($id == 'lane') $title = " title='{$task->lane}'";
if($id == 'finishedBy') $title = " title='" . zget($users, $task->finishedBy) . "'";
if($id == 'openedBy') $title = " title='" . zget($users, $task->openedBy) . "'";
if($id == 'lastEditedBy') $title = " title='" . zget($users, $task->lastEditedBy) . "'";
echo "<td class='" . $class . "'" . $title . ">";
if($this->config->edition != 'open') $this->loadModel('flow')->printFlowCell('task', $task, $id);
switch($id)
{
case 'id':
if($canBatchAction)
{
echo html::checkbox('taskIdList', array($task->id => '')) . html::a(helper::createLink('task', 'view', "taskID=$task->id"), sprintf('%03d', $task->id));
}
else
{
printf('%03d', $task->id);
}
break;
case 'pri':
$priClass = $task->pri ? "label-pri label-pri-{$task->pri}" : '';
echo "<span class='$priClass' title='" . zget($this->lang->task->priList, $task->pri, $task->pri) . "'>";
echo zget($this->lang->task->priList, $task->pri, $task->pri);
echo "</span>";
break;
case 'name':
if($showBranch) $showBranch = isset($this->config->execution->task->showBranch) ? $this->config->execution->task->showBranch : 1;
if($task->parent > 0 and isset($task->parentName)) $task->name = "{$task->parentName} / {$task->name}";
if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $showBranch) echo "<span class='label label-badge label-outline'>" . $branchGroups[$task->product][$task->branch] . '</span> ';
if($task->module and isset($modulePairs[$task->module])) echo "<span class='label label-gray label-badge'>" . $modulePairs[$task->module] . '</span> ';
if($task->parent > 0) echo '<span class="label label-badge label-light" title="' . $this->lang->task->children . '">' . $this->lang->task->childrenAB . '</span> ';
if(!empty($task->team)) echo '<span class="label label-badge label-light" title="' . $this->lang->task->multiple . '">' . $this->lang->task->multipleAB . '</span> ';
echo $canView ? html::a($taskLink, $task->name, null, "style='color: $task->color' title='$task->name'") : "<span style='color: $task->color'>$task->name</span>";
if(!empty($task->children)) echo '<a class="task-toggle" data-id="' . $task->id . '"><i class="icon icon-angle-double-right"></i></a>';
if($task->fromBug) echo html::a(helper::createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '', "class='bug'");
break;
case 'type':
echo zget($this->lang->task->typeList, $task->type, $task->type);
break;
case 'status':
$storyChanged ? print("<span class='status-story status-changed' title='{$this->lang->story->changed}'>{$this->lang->story->changed}</span>") : print("<span class='status-task status-{$task->status}' title='{$this->processStatus('task', $task)}'> " . $this->processStatus('task', $task) . "</span>");
break;
case 'estimate':
echo round($task->estimate, 1) . $this->lang->execution->workHourUnit;
break;
case 'consumed':
echo round($task->consumed, 1) . $this->lang->execution->workHourUnit;
break;
case 'left':
echo round($task->left, 1) . $this->lang->execution->workHourUnit;
break;
case 'progress':
echo round($task->progress, 2) . '%';
break;
case 'deadline':
if($task->deadline && substr($task->deadline, 0, 4) > 0) echo '<span>' . substr($task->deadline, 5, 6) . '</span>';
break;
case 'openedBy':
echo zget($users, $task->openedBy);
break;
case 'openedDate':
echo substr($task->openedDate, 5, 11);
break;
case 'estStarted':
echo helper::isZeroDate($task->estStarted) ? '' : substr($task->estStarted, 5, 11);
break;
case 'realStarted':
echo helper::isZeroDate($task->realStarted) ? '' : substr($task->realStarted, 5, 11);
break;
case 'assignedTo':
$this->printAssignedHtml($task, $users);
break;
case 'lane':
echo mb_substr($task->lane, 0, 8);
break;
case 'assignedDate':
echo helper::isZeroDate($task->assignedDate) ? '' : substr($task->assignedDate, 5, 11);
break;
case 'finishedBy':
echo zget($users, $task->finishedBy);
break;
case 'finishedDate':
echo helper::isZeroDate($task->finishedDate) ? '' : substr($task->finishedDate, 5, 11);
break;
case 'canceledBy':
echo zget($users, $task->canceledBy);
break;
case 'canceledDate':
echo helper::isZeroDate($task->canceledDate) ? '' : substr($task->canceledDate, 5, 11);
break;
case 'closedBy':
echo zget($users, $task->closedBy);
break;
case 'closedDate':
echo helper::isZeroDate($task->closedDate) ? '' : substr($task->closedDate, 5, 11);
break;
case 'closedReason':
echo $this->lang->task->reasonList[$task->closedReason];
break;
case 'story':
if(!empty($task->storyID))
{
if(common::hasPriv('story', 'view'))
{
echo html::a(helper::createLink('story', 'view', "storyid=$task->storyID", 'html', true), "<i class='icon icon-{$this->lang->icons['story']}'></i>", '', "class='iframe' data-width='1050' title='{$task->storyTitle}'");
}
else
{
echo "<i class='icon icon-{$this->lang->icons['story']}' title='{$task->storyTitle}'></i>";
}
}
break;
case 'mailto':
$mailto = explode(',', $task->mailto);
foreach($mailto as $account)
{
$account = trim($account);
if(empty($account)) continue;
echo zget($users, $account) . ' &nbsp;';
}
break;
case 'lastEditedBy':
echo zget($users, $task->lastEditedBy);
break;
case 'lastEditedDate':
echo helper::isZeroDate($task->lastEditedDate) ? '' : substr($task->lastEditedDate, 5, 11);
break;
case 'activatedDate':
echo helper::isZeroDate($task->activatedDate) ? '' : substr($task->activatedDate, 5, 11);
break;
case 'actions':
echo $this->buildOperateMenu($task, 'browse');
break;
default:
echo '';
break;
}
echo '</td>';
}
}
/**
* Print assigned html
*
@@ -2836,48 +2643,6 @@ class taskModel extends model
echo !common::hasPriv('task', 'assignTo', $task) ? "<span style='padding-left: 21px' class='{$btnTextClass}'>{$assignedToText}</span>" : $assignToHtml;
}
/**
* Get toList and ccList.
*
* @param object $task
* @access public
* @return bool|array
*/
public function getToAndCcList($task)
{
/* Set toList and ccList. */
$toList = $task->assignedTo;
$ccList = trim($task->mailto, ',');
$toTeamTaskList = '';
if($task->mode == 'multi')
{
$toTeamTaskList = $this->getTeamMembers($task->id);
$toTeamTaskList = implode(',', $toTeamTaskList);
$toList = $toTeamTaskList;
}
if(empty($toList))
{
if(empty($ccList)) return false;
if(strpos($ccList, ',') === false)
{
$toList = $ccList;
$ccList = '';
}
else
{
$commaPos = strpos($ccList, ',');
$toList = substr($ccList, 0, $commaPos);
$ccList = substr($ccList, $commaPos + 1);
}
}
elseif(strtolower($toList) == 'closed')
{
$toList = $task->finishedBy;
}
return array($toList, $ccList);
}
/**
* Get task's team member pairs.