79 lines
2.7 KiB
PHP
79 lines
2.7 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
/**
|
|
* The tao file of execution module of ZenTaoPMS.
|
|
*
|
|
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
|
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
* @author Shujie Tian <tianshujie@easysoft.ltd>
|
|
* @package execution
|
|
* @link https://www.zentao.net
|
|
*/
|
|
class executionTao extends executionModel
|
|
{
|
|
/**
|
|
* 将执行ID保存到session中。
|
|
* Save the execution ID to the session.
|
|
*
|
|
* @param int $executionID
|
|
* @access protected
|
|
* @return void
|
|
*/
|
|
protected function saveSession(int $executionID): void
|
|
{
|
|
$this->session->set('execution', $executionID, $this->app->tab);
|
|
$this->setProjectSession($executionID);
|
|
}
|
|
|
|
/**
|
|
* 获取执行团队成员数量。
|
|
* Get execution team member count.
|
|
*
|
|
* @param array $executionIdList
|
|
* @access protected
|
|
* @return void
|
|
*/
|
|
protected function getMemberCountGroup(array $executionIdList): array
|
|
{
|
|
return $this->dao->select('t1.root,count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1')
|
|
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
|
|
->where('t1.root')->in($executionIdList)
|
|
->andWhere('t1.type')->ne('project')
|
|
->andWhere('t2.deleted')->eq(0)
|
|
->groupBy('t1.root')
|
|
->fetchAll('root');
|
|
}
|
|
|
|
/**
|
|
* 获取执行关联的产品信息。
|
|
* Get product information of the linked execution.
|
|
*
|
|
* @param int $projectID
|
|
* @access protected
|
|
* @return array
|
|
*/
|
|
protected function getProductList(int $projectID): array
|
|
{
|
|
$executions = $this->dao->select('t1.id,t2.product,t3.name')->from(TABLE_EXECUTION)->alias('t1')
|
|
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
|
|
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t2.product=t3.id')
|
|
->where('t1.project')->eq($projectID)
|
|
->andWhere('t1.type')->in('kanban,sprint,stage')
|
|
->fetchAll();
|
|
|
|
$productList = array();
|
|
foreach($executions as $execution)
|
|
{
|
|
if(!isset($productList[$execution->id]))
|
|
{
|
|
$productList[$execution->id] = new stdclass();
|
|
$productList[$execution->id]->product = '';
|
|
$productList[$execution->id]->productName = '';
|
|
}
|
|
$productList[$execution->id]->product .= $execution->product . ',';
|
|
$productList[$execution->id]->productName .= $execution->name . ',';
|
|
}
|
|
return $productList;
|
|
}
|
|
}
|