This commit is contained in:
hufangzhou
2020-12-04 13:56:19 +08:00
14 changed files with 129 additions and 95 deletions
+6 -5
View File
@@ -203,6 +203,7 @@ class block extends control
* Display dashboard for app.
*
* @param string $module
* @param string $type
* @access public
* @return void
*/
@@ -1331,14 +1332,14 @@ class block extends control
}
/**
* Print srcum project block.
* Print sprint block.
*
* @access public
* @return void
*/
public function printSprintBlock()
{
$status = $this->dao->select('status, count(*) as count')->from(TABLE_PROJECT)
$sprints = $this->dao->select('status, count(*) as sprints')->from(TABLE_EXECUTION)
->where('deleted')->eq(0)
->andWhere('type')->eq('sprint')
->andWhere('parent')->eq($this->session->PRJ)
@@ -1346,9 +1347,9 @@ class block extends control
->fetchPairs();
$summary = new stdclass();
$summary->total = array_sum($status);
$summary->doing = zget($status, 'doing', 0);
$summary->closed = zget($status, 'closed', 0);
$summary->total = array_sum($sprints);
$summary->doing = zget($sprints, 'doing', 0);
$summary->closed = zget($sprints, 'closed', 0);
$progress = new stdclass();
$progress->doing = $summary->total == 0 ? 0 : round($summary->doing / $summary->total, 3);
+7
View File
@@ -217,6 +217,13 @@ $lang->block->default['project']['4']['params']['count'] = 15;
$lang->block->default['project']['4']['params']['orderBy'] = 'id_desc';
$lang->block->default['project']['4']['params']['type'] = 'assignedTo';
$lang->block->default['project']['5']['title'] = 'Build List';
$lang->block->default['project']['5']['block'] = 'build';
$lang->block->default['project']['5']['grid'] = 8;
$lang->block->default['project']['5']['params']['count'] = 15;
$lang->block->default['project']['5']['params']['orderBy'] = 'id_desc';
$lang->block->default['qa']['1']['title'] = 'Test Report';
$lang->block->default['qa']['1']['block'] = 'statistic';
$lang->block->default['qa']['1']['grid'] = 8;
+7
View File
@@ -217,6 +217,13 @@ $lang->block->default['project']['4']['params']['count'] = 15;
$lang->block->default['project']['4']['params']['orderBy'] = 'id_desc';
$lang->block->default['project']['4']['params']['type'] = 'assignedTo';
$lang->block->default['project']['5']['title'] = 'Build List';
$lang->block->default['project']['5']['block'] = 'build';
$lang->block->default['project']['5']['grid'] = 8;
$lang->block->default['project']['5']['params']['count'] = 15;
$lang->block->default['project']['5']['params']['orderBy'] = 'id_desc';
$lang->block->default['qa']['1']['title'] = 'Test Report';
$lang->block->default['qa']['1']['block'] = 'statistic';
$lang->block->default['qa']['1']['grid'] = 8;
+7
View File
@@ -218,6 +218,13 @@ $lang->block->default['project']['4']['params']['count'] = 15;
$lang->block->default['project']['4']['params']['orderBy'] = 'id_desc';
$lang->block->default['project']['4']['params']['type'] = 'assignedTo';
$lang->block->default['project']['5']['title'] = 'Build List';
$lang->block->default['project']['5']['block'] = 'build';
$lang->block->default['project']['5']['grid'] = 8;
$lang->block->default['project']['5']['params']['count'] = 15;
$lang->block->default['project']['5']['params']['orderBy'] = 'id_desc';
$lang->block->default['qa']['1']['title'] = 'Rapport de Tests';
$lang->block->default['qa']['1']['block'] = 'statistic';
$lang->block->default['qa']['1']['grid'] = 8;
+7
View File
@@ -217,6 +217,13 @@ $lang->block->default['project']['4']['params']['count'] = 15;
$lang->block->default['project']['4']['params']['orderBy'] = 'id_desc';
$lang->block->default['project']['4']['params']['type'] = 'assignedTo';
$lang->block->default['project']['5']['title'] = 'Build List';
$lang->block->default['project']['5']['block'] = 'build';
$lang->block->default['project']['5']['grid'] = 8;
$lang->block->default['project']['5']['params']['count'] = 15;
$lang->block->default['project']['5']['params']['orderBy'] = 'id_desc';
$lang->block->default['qa']['1']['title'] = 'Báo cáo Test';
$lang->block->default['qa']['1']['block'] = 'statistic';
$lang->block->default['qa']['1']['grid'] = 8;
+7
View File
@@ -217,6 +217,13 @@ $lang->block->default['project']['4']['params']['count'] = 15;
$lang->block->default['project']['4']['params']['orderBy'] = 'id_desc';
$lang->block->default['project']['4']['params']['type'] = 'assignedTo';
$lang->block->default['project']['5']['title'] = '版本列表';
$lang->block->default['project']['5']['block'] = 'build';
$lang->block->default['project']['5']['grid'] = 8;
$lang->block->default['project']['5']['params']['count'] = 15;
$lang->block->default['project']['5']['params']['orderBy'] = 'id_desc';
$lang->block->default['qa']['1']['title'] = '测试统计';
$lang->block->default['qa']['1']['block'] = 'statistic';
$lang->block->default['qa']['1']['grid'] = 8;
@@ -56,7 +56,7 @@
<div class="col-3 total-block hide-in-sm">
<div><strong><?php echo $lang->block->totalStory;?></strong></div>
<div class="tile-amount">
<?php echo $totalData[$projectID]->allStories ? html::a($this->createLink('project', 'story', 'projectID=' . $projectID), $totalData[$projectID]->allStories) : 0;?>
<?php echo $totalData[$projectID]->allStories;?>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="<?php echo $totalData[$projectID]->doneStories;?>" aria-valuemin="0" aria-valuemax="<?php echo $totalData[$projectID]->allStories;?>" style="width: <?php echo floor(($totalData[$projectID]->doneStories/$totalData[$projectID]->allStories)*100).'%';?>"></div>
+6 -12
View File
@@ -33,35 +33,29 @@ class build extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID")));
}
$this->session->set('buildCreate', $this->app->getURI(true));
/* Load these models. */
$this->loadModel('project');
$this->loadModel('user');
$this->session->set('buildCreate', $this->app->getURI(true));
$execution = $this->loadModel('project')->getExecutionById($executionID);
/* Set menu. */
$executions = $this->project->getExecutionPairs($this->session->PRJ);
$this->project->setMenu($executions, $executionID);
/* Get stories and bugs. */
$orderBy = 'status_asc, stage_asc, id_desc';
/* Assign. */
$project = $this->loadModel('project')->getExecutionById($executionID);
$productGroups = $this->project->getProducts($executionID);
$productID = $productID ? $productID : key($productGroups);
$products = array();
foreach($productGroups as $product) $products[$product->id] = $product->name;
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->create;
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$executionID"), $project->name);
$this->view->title = $execution->name . $this->lang->colon . $this->lang->build->create;
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$executionID"), $execution->name);
$this->view->position[] = $this->lang->build->create;
$this->view->product = isset($productGroups[$productID]) ? $productGroups[$productID] : '';
$this->view->branches = (isset($productGroups[$productID]) and $productGroups[$productID]->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->executionID = $executionID;
$this->view->orderBy = $orderBy;
$this->view->products = $products;
$this->view->lastBuild = $this->build->getLast($executionID);
$this->view->productGroups = $productGroups;
+4 -4
View File
@@ -1,19 +1,19 @@
<?php
/**
* The story view file of dashboard module of ZenTaoPMS.
* The story view file of my module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package dashboard
* @version $Id: story.html.php 5116 2013-07-12 06:37:48Z chencongzhi520@gmail.com $
* @package my
* @version $Id
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<div class="btn-group angle-btn active">
<div class="btn-group active">
<div class="btn-group">
<button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown'>
<?php $label = $storyType == 'story' ? $lang->generalSR : $lang->generalUR;?>
+1
View File
@@ -635,6 +635,7 @@ class product extends control
{
$projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : $branch);
}
if($this->app->getViewType() == 'json') die(json_encode($projects));
if($number === '')
+22 -1
View File
@@ -729,6 +729,26 @@ class productModel extends model
return $stories;
}
/**
* Get the total number of requirements associated with the product.
*
* @param array $productIdList
* @param array $type
* @param array $status closed|active|draft
* @access public
* @return array
*/
public function getTotalStoriesByProduct($productIdList, $type, $status)
{
return $this->dao->select("count(*) as stories")->from(TABLE_STORY)
->where('type')->eq($type)
->andWhere('product')->in($productIdList)
->andWhere('status')->eq($status)
->beginIF($status == 'closed')->andWhere('closedReason')->eq('done')->fi()
->andWhere('deleted')->eq(0)
->fetch('stories');
}
/**
* Batch get story stage.
*
@@ -799,6 +819,7 @@ class productModel extends model
->orderBy($orderBy)
->fetchAll('id');
$executionList = array('0' => '');
$project = $this->loadModel('program')->getPRJByID($this->session->PRJ);
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
@@ -818,7 +839,7 @@ class productModel extends model
{
if(isset($execution->children))
{
$executionList = array_merge($executionList, $execution->children);
$executionList = $executionList + $execution->children;
continue;
}
$executionList[$execution->id] = $execution->name;
+40 -55
View File
@@ -895,6 +895,8 @@ class programModel extends model
if(empty($projects)) return array();
$projectIdList = array_keys($projects);
$teams = $this->dao->select('root, count(*) as teams')->from(TABLE_TEAM)->where('root')->in($projectIdList)->groupBy('root')->fetchPairs();
$hours = $this->dao->select('PRJ,
cast(sum(consumed) as decimal(10,2)) as consumed,
cast(sum(estimate) as decimal(10,2)) as estimate')
@@ -905,72 +907,37 @@ class programModel extends model
->groupBy('PRJ')
->fetchAll('PRJ');
$teams = $this->dao->select('root, count(*) as count')->from(TABLE_TEAM)
->where('root')->in($projectIdList)
->groupBy('root')
->fetchAll('root');
$leftTasks = $this->dao->select('PRJ, count(*) as leftTasks')->from(TABLE_TASK)
$leftTasks = $this->dao->select('PRJ, count(*) as tasks')->from(TABLE_TASK)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->in('wait,doing,pause')
->groupBy('PRJ')
->fetchAll('PRJ');
->fetchPairs();
$allStories = $this->dao->select('PRJ, count(*) as allStories')->from(TABLE_STORY)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->ne('draft')
->groupBy('PRJ')
->fetchAll('PRJ');
foreach($projectIdList as $projectID)
{
$productIdList = $this->loadModel('product')->getProductIDByProject($projectID);
$allStories[$projectID] = $this->product->getTotalStoriesByProduct($productIdList, 'story', 'draft');
$doneStories[$projectID] = $this->product->getTotalStoriesByProduct($productIdList, 'story', 'closed');
$leftStories[$projectID] = $this->product->getTotalStoriesByProduct($productIdList, 'story', 'active');
}
$doneStories = $this->dao->select('PRJ, count(*) as doneStories')->from(TABLE_STORY)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->eq('closed')
->andWhere('closedReason')->eq('done')
->groupBy('PRJ')
->fetchAll('PRJ');
$leftStories = $this->dao->select('PRJ, count(*) as leftStories')->from(TABLE_STORY)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->eq('active')
->groupBy('PRJ')
->fetchAll('PRJ');
$leftBugs = $this->dao->select('PRJ, count(*) as leftBugs')->from(TABLE_BUG)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->eq('active')
->groupBy('PRJ')
->fetchAll('PRJ');
$allBugs = $this->dao->select('PRJ, count(*) as allBugs')->from(TABLE_BUG)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->groupBy('PRJ')
->fetchAll('PRJ');
$doneBugs = $this->dao->select('PRJ, count(*) as doneBugs')->from(TABLE_BUG)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->eq('resolved')
->groupBy('PRJ')
->fetchAll('PRJ');
$leftBugs = $this->getTotalBugByPRJ($projectIdList, 'active');
$allBugs = $this->getTotalBugByPRJ($projectIdList, 'all');
$doneBugs = $this->getTotalBugByPRJ($projectIdList, 'resolved');
foreach($projects as $projectID => $project)
{
$project->teamCount = isset($teams[$projectID]) ? $teams[$projectID]->count : 0;
$project->consumed = isset($hours[$projectID]) ? $hours[$projectID]->consumed : 0;
$project->estimate = isset($hours[$projectID]) ? $hours[$projectID]->estimate : 0;
$project->leftTasks = isset($leftTasks[$projectID]) ? $leftTasks[$projectID]->leftTasks : 0;
$project->allStories = isset($allStories[$projectID]) ? $allStories[$projectID]->allStories : 0;
$project->doneStories = isset($doneStories[$projectID]) ? $doneStories[$projectID]->doneStories : 0;
$project->leftStories = isset($leftStories[$projectID]) ? $leftStories[$projectID]->leftStories : 0;
$project->leftBugs = isset($leftBugs[$projectID]) ? $leftBugs[$projectID]->leftBugs : 0;
$project->allBugs = isset($allBugs[$projectID]) ? $allBugs[$projectID]->allBugs : 0;
$project->doneBugs = isset($doneBugs[$projectID]) ? $doneBugs[$projectID]->doneBugs : 0;
$project->teamCount = isset($teams[$projectID]) ? $teams[$projectID] : 0;
$project->leftTasks = isset($leftTasks[$projectID]) ? $leftTasks[$projectID] : 0;
$project->leftBugs = isset($leftBugs[$projectID]) ? $leftBugs[$projectID] : 0;
$project->allBugs = isset($allBugs[$projectID]) ? $allBugs[$projectID] : 0;
$project->doneBugs = isset($doneBugs[$projectID]) ? $doneBugs[$projectID] : 0;
$project->allStories = $allStories[$projectID];
$project->doneStories = $doneStories[$projectID];
$project->leftStories = $leftStories[$projectID];
}
return $projects;
@@ -1096,6 +1063,24 @@ class programModel extends model
->fetchAll('id');
}
/**
* Get associated bugs by project.
*
* @param array $projectIdList
* @param string $status active|resolved|all
* @access public
* @return object
*/
public function getTotalBugByPRJ($projectIdList, $status)
{
return $this->dao->select('PRJ, count(*) as bugs')->from(TABLE_BUG)
->where('PRJ')->in($projectIdList)
->andWhere('deleted')->eq(0)
->beginIF($status != 'all')->andWhere('status')->eq($status)->fi()
->groupBy('PRJ')
->fetchPairs('PRJ');
}
/**
* Build the query.
*
+5 -12
View File
@@ -62,12 +62,12 @@ class projectModel extends model
*/
public function setMenu($projects, $projectID, $buildID = 0, $extra = '')
{
$program = $this->getByID($this->session->PRJ);
$project = $this->getByID($this->session->PRJ);
if(empty($projects))
{
if($program->model == 'waterfall')
if($project->model == 'waterfall')
{
if(($this->app->moduleName == 'programplan' && $this->app->methodName != 'create') || $this->app->moduleName == 'project') die(js::locate(helper::createLink('programplan', 'create', "progarmID=$program->id")));
if(($this->app->moduleName == 'programplan' && $this->app->methodName != 'create') || $this->app->moduleName == 'project') die(js::locate(helper::createLink('programplan', 'create', "projectID=$project->id")));
}
else
{
@@ -82,7 +82,7 @@ class projectModel extends model
if(!empty($project))
{
$isProgram = $project->model;
$program = $isProgram ? $project : $this->getByID($project->parent);
$project = $isProgram ? $project : $this->getByID($project->parent);
}
if($isProgram)
@@ -2942,12 +2942,10 @@ class projectModel extends model
* @param array $products
* @param int $queryID
* @param string $actionURL
* @param array $projects
* @param string $type projectBuild
* @access public
* @return void
*/
public function buildProjectBuildSearchForm($products, $queryID, $actionURL, $projects = '', $type = '')
public function buildProjectBuildSearchForm($products, $queryID, $actionURL)
{
$this->loadModel('build');
@@ -2956,11 +2954,6 @@ class projectModel extends model
$this->config->build->search['actionURL'] = $actionURL;
$this->config->build->search['queryID'] = $queryID;
$this->config->build->search['params']['product']['values'] = $products;
if($type == 'projectBuild')
{
$this->config->build->search['fields']['project'] = $this->lang->projectCommon;
$this->config->build->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => array('' => '') + $projects);
}
$this->loadModel('search')->setSearchParams($this->config->build->search);
}
+9 -5
View File
@@ -22,27 +22,31 @@ class projectBuild extends control
public function browse($projectID = 0, $type = 'all', $param = 0)
{
$this->loadModel('project');
$this->loadModel('build');
$project = $this->loadModel('program')->getPRJByID($projectID);
/* Get products' list. */
$products = $this->project->getProducts($projectID, false);
$products = array('' => '') + $products;
$projects = $this->project->getExecutionsByProject((int)$projectID, 'all', '', true);
/* Build the search form. */
$type = strtolower($type);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
$queryID = ($type == 'bysearch') ? (int)$param : 0;
$actionURL = $this->createLink('projectbuild', 'browse', "projectID=$projectID&type=bysearch&queryID=myQueryID");
$projects = $this->project->getExecutionsByProject($projectID, 'all', '', true);
$this->config->build->search['fields']['project'] = $this->project->lang->projectCommon;
$this->config->build->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => array('' => '') + $projects);
$this->project->buildProjectBuildSearchForm($products, $queryID, $actionURL, $projects, 'projectBuild');
if($type == 'bysearch')
{
$builds = $this->loadModel('build')->getProjectBuildsBySearch((int)$projectID, (int)$param);
$builds = $this->build->getProjectBuildsBySearch((int)$projectID, (int)$param);
}
else
{
$builds = $this->loadModel('build')->getProjectBuilds((int)$projectID, $type, $param);
$builds = $this->build->getProjectBuilds((int)$projectID, $type, $param);
}
/* Set project builds. */