Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
tianshujie98
2020-08-28 12:19:47 +08:00
5 changed files with 138 additions and 105 deletions
+41 -12
View File
@@ -206,10 +206,19 @@ class block extends control
{
if($this->loadModel('user')->isLogon()) $this->session->set('blockModule', $module);
$blocks = $this->block->getBlockList($module, $type);
$inited = empty($this->config->$module->common->blockInited) ? '' : $this->config->$module->common->blockInited;
if($module == 'program')
{
$program = $this->loadModel('project')->getByID($this->app->session->program);
$common = $program->template . 'common';
$inited = empty($this->config->$module->$common->blockInited) ? '' : $this->config->$module->$common->blockInited;
}
else
{
$inited = empty($this->config->$module->common->blockInited) ? '' : $this->config->$module->common->blockInited;
}
/* Init block when vist index first. */
if((empty($blocks) and !$inited and !defined('TUTORIAL')) || (empty($blocks) and $module == 'program'))
if((empty($blocks) and !$inited and !defined('TUTORIAL')))
{
if($this->block->initBlock($module, $type)) die(js::reload());
}
@@ -1127,7 +1136,7 @@ class block extends control
{
$products = $this->loadModel('product')->getPairs();
$productID = isset($this->session->product) ? 0 : $this->session->product;
if(!$productID || !array_key_exists($productID, $products)) $productID = key($products);
if(!$productID) $productID = key($products);
$this->view->plans = $this->loadModel('programplan')->getDataForGantt($this->session->program, $productID, 0, 'task', false);
$this->view->products = $products;
@@ -1262,12 +1271,19 @@ class block extends control
*/
public function printScrumproductBlock()
{
$products = $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('program')->eq($this->session->program)->limit(15)->fetchPairs();
$productID = array_keys($products);
$stories = array();
$bugs = array();
$releases = array();
$stories = empty($productID) ? array() : $this->dao->select('count(*) as total, product')->from(TABLE_STORY)->where('product')->in($productID)->andWhere('deleted')->eq('0')->groupBy('product')->fetchPairs('product', 'total');
$bugs = empty($productID) ? array() : $this->dao->select('count(*) as total, product')->from(TABLE_BUG)->where('product')->in($productID)->andWhere('deleted')->eq('0')->groupBy('product')->fetchPairs('product', 'total');
$releases = empty($productID) ? array() : $this->dao->select('count(*) as total, product')->from(TABLE_RELEASE)->where('product')->in($productID)->andWhere('deleted')->eq('0')->groupBy('product')->fetchPairs('product', 'total');
$products = $this->dao->select('id, name')->from(TABLE_PRODUCT)->where('program')->eq($this->session->program)->limit(15)->fetchPairs();
$productIdList = array_keys($products);
if(!empty($productIdList))
{
$fields = 'product, count(*) as total';
$stories = $this->dao->select($fields)->from(TABLE_STORY)->where('product')->in($productIdList)->andWhere('deleted')->eq('0')->groupBy('product')->fetchPairs();
$bugs = $this->dao->select($fields)->from(TABLE_BUG)->where('product')->in($productIdList)->andWhere('deleted')->eq('0')->groupBy('product')->fetchPairs();
$releases = $this->dao->select($fields)->from(TABLE_RELEASE)->where('product')->in($productIdList)->andWhere('deleted')->eq('0')->groupBy('product')->fetchPairs();
}
$this->view->products = $products;
$this->view->stories = $stories;
@@ -1283,10 +1299,23 @@ class block extends control
*/
public function printScrumprojectBlock()
{
$this->view->summary = $this->dao->select('count(*) as total, count(if(status="doing", id, null)) as doing, count(if(status="closed", id, null)) as finish')->from(TABLE_PROJECT)
->where('program')->eq($this->session->program)
->andWhere('deleted')->eq('0')
->fetch();
$status = $this->dao->select('status, count(*) as count')->from(TABLE_PROJECT)
->where('deleted')->eq(0)
->andWhere('program')->eq($this->session->program)
->groupBy('status')
->fetchPairs();
$summary = new stdclass();
$summary->total = array_sum($status);
$summary->doing = zget($status, 'doing', 0);
$summary->closed = zget($status, 'closed', 0);
$progress = new stdclass();
$progress->doing = $summary->total == 0 ? 0 : round($summary->doing / $summary->total, 3);
$progress->closed = $summary->total == 0 ? 0 : round($summary->closed / $summary->total, 3);
$this->view->summary = $summary;
$this->view->progress = $progress;
}
/**
+41 -40
View File
@@ -212,6 +212,31 @@ class blockModel extends model
return $data;
}
/**
* Get contribute block data.
*
* @access public
* @return array
*/
public function getContributeBlockData()
{
$account = $this->app->user->account;
$count = 'count(*) AS count';
$data = array();
$data['todos'] = $this->dao->select($count)->from(TABLE_TODO)->where('account')->eq($account)->fetch('count');
$data['stories'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$data['bugs'] = $this->dao->select($count)->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$data['cases'] = $this->dao->select($count)->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('product')->ne(0)->fetch('count');
$data['tasks'] = $this->dao->select($count)->from(TABLE_TASK)->where('deleted')->eq('0')
->andWhere('finishedBy', true)->eq($account)
->orWhere('finishedList')->like("%,{$account},%")
->markRight(1)
->fetch('count');
return $data;
}
/**
* Init block when account use first.
*
@@ -223,11 +248,23 @@ class blockModel extends model
{
$flow = isset($this->config->global->flow) ? $this->config->global->flow : 'full';
$account = $this->app->user->account;
if($module == 'program') $blocks = $this->lang->block->default[$type]['program'];
else $blocks = $module == 'my' ? $this->lang->block->default[$flow][$module] : $this->lang->block->default[$module];
if($module == 'program')
{
$blocks = $this->lang->block->default[$type]['program'];
$programID = $this->session->program;
$program = $this->loadModel('project')->getByID($programID);
/* Mark program block has init. */
$this->loadModel('setting')->setItem("$account.$module.{$program->template}common.blockInited", true);
}
else
{
$blocks = $module == 'my' ? $this->lang->block->default[$flow][$module] : $this->lang->block->default[$module];
/* Mark this app has init. */
$this->loadModel('setting')->setItem("$account.$module.common.blockInited", true);
}
/* Mark this app has init. */
$this->loadModel('setting')->setItem("$account.$module.common.blockInited", true);
$this->loadModel('setting')->setItem("$account.$module.block.initVersion", $this->config->block->version);
foreach($blocks as $index => $block)
{
@@ -756,42 +793,6 @@ class blockModel extends model
return $blockPairs;
}
/**
* Get contribute block data.
*
* @access public
* @return array
*/
public function getContributeBlockData()
{
$data = array();
$data['todos'] = $this->dao->select('count(*) AS count')->from(TABLE_TODO)
->where('account')->eq($this->app->user->account)
->fetch('count');
$data['stories'] = $this->dao->select('count(*) AS count')->from(TABLE_STORY)
->where('openedBy')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->fetch('count');
$data['tasks'] = $this->dao->select('count(*) AS count')->from(TABLE_TASK)
->where('deleted')->eq('0')
->andWhere('finishedBy')->eq($this->app->user->account)
->orWhere('finishedList')->like("%,{$this->app->user->account},%")
->fetch('count');
$data['bugs'] = $this->dao->select('count(*) AS count')->from(TABLE_BUG)
->where('resolvedBy')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->fetch('count');
$data['cases'] = $this->dao->select('count(*) AS count')->from(TABLE_CASE)
->where('openedBy')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('product')->ne(0)
->andWhere('auto')->ne('unit')
->fetch('count');
return $data;
}
/**
* Build number params.
*
+7 -3
View File
@@ -10,7 +10,7 @@
* @link http://www.zentao.net
*/
?>
<?php if(empty($summary)): ?>
<?php if(!$summary->total): ?>
<div class='empty-tip'><?php echo $lang->block->emptyTip;?></div>
<?php else:?>
<style>
@@ -27,11 +27,15 @@
<div class="col-8 text-middle">
<ul class="status-bars all-statistics">
<li>
<span class="bar" style="height: <?php echo empty($summary->total) ? 0 : round(($summary->doing/$summary->total) * 100);?>%"><span class="value"><?php echo $summary->doing;?></span></span>
<span class="bar" style="height: <?php echo $progress->doing * 100;?>%">
<span class="value"><?php echo $summary->doing;?></span>
</span>
<span class="title"><?php echo $lang->block->doingProject;?></span>
</li>
<li>
<span class="bar" style="height: <?php echo empty($summary->total) ? 0 : round(($summary->finish/$summary->total) * 100);?>%"><span class="value"><?php echo $summary->finish;?></span></span>
<span class="bar" style="height: <?php echo $progress->closed * 100;?>%">
<span class="value"><?php echo $summary->closed;?></span>
</span>
<span class="title"><?php echo $lang->block->finishProject;?></span>
</li>
</ul>
+21 -26
View File
@@ -1,6 +1,6 @@
<?php
/**
* The control file of design currentModule of ZenTaoPMS.
* The control file of design 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)
@@ -12,35 +12,33 @@
class design extends control
{
/**
* Browse designs.
*
* @param int $productID
* @param string $type all|HLDS|DDS|DBDS|ADS
* @param string $param myQueryID|queryID(This is a number)
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browse($productID = 0, $type = 'all', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
* Browse designs.
*
* @param int $productID
* @param string $type all|bySearch|HLDS|DDS|DBDS|ADS
* @param string $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browse($productID = 0, $type = 'all', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save session for design list and process product id. */
$this->session->set('designList', $this->app->getURI(true));
$productID = $this->loadModel('product')->saveState($productID, $this->product->getPairs('nocode'));
$this->design->setProductMenu($productID);
$queryID = ($type == 'bySearch') ? (int)$param : 0;
/* Build the search form. */
$queryID = ($type == 'bySearch') ? (int)$param : 0;
$actionURL = $this->createLink('design', 'browse', "productID=$productID&type=bySearch&queryID=myQueryID");
$this->design->buildSearchForm($queryID, $actionURL);
$this->app->session->set('designList', $this->app->getURI(true));
/* Init pager and get designs. */
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPager = 10;
$pager = pager::init($recTotal, $recPerPage, $pageID);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$designs = $this->design->getList($productID, $type, $queryID, $orderBy, $pager);
$this->view->title = $this->lang->design->browse;
@@ -49,9 +47,6 @@ class design extends control
$this->view->designs = $designs;
$this->view->type = $type;
$this->view->param = $param;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->orderBy = $orderBy;
$this->view->productID = $productID;
$this->view->pager = $pager;
@@ -152,8 +147,8 @@ class design extends control
$design = $this->design->getById($designID);
$this->design->setProductMenu($design->product);
$this->view->title = $this->lang->design->designView;
$this->view->position[] = $this->lang->design->designView;
$this->view->title = $this->lang->design->view;
$this->view->position[] = $this->lang->design->view;
$this->view->design = $design;
$this->view->stories = $this->loadModel('story')->getProductStoryPairs($design->product);
+28 -24
View File
@@ -1,6 +1,6 @@
<?php
/**
* The design module zh-cn file of ZenTaoPMS.
* The zh-cn file of design module.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
@@ -9,45 +9,48 @@
* @version $Id: zh-cn.php 4729 2013-05-03 07:53:55Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
$lang->design->common = '设计';
$lang->design->browse = '浏览列表';
$lang->design->commit = '关联提交';
/* 字段列表. */
$lang->design->id = '编号';
$lang->design->name = '设计名称';
$lang->design->story = '需求';
$lang->design->type = '设计类型';
$lang->design->ditto = '同上';
$lang->design->submission = '相关提交';
$lang->design->version = '版本号';
$lang->design->assignedTo = '指派给';
$lang->design->actions = '操作';
$lang->design->delete = '删除';
$lang->design->confirmDelete = '您确定要删除这个设计吗?';
$lang->design->edit = '变更';
$lang->design->byQuery = '搜索';
$lang->design->products = '所属产品';
$lang->design->story = '相关需求';
$lang->design->file = '附件';
$lang->design->id = '编号';
$lang->design->story = '需求';
$lang->design->ditto = '同上';
$lang->design->type = '设计类型';
$lang->design->name = '设计名称';
$lang->design->create = '创建设计';
$lang->design->batchCreate = '批量创建';
$lang->design->view = '设计概况';
$lang->design->desc = '设计描述';
$lang->design->range = '影响范围';
$lang->design->product = '所属产品';
$lang->design->basicInfo = '基础信息';
$lang->design->commitBy = '由谁提交';
$lang->design->commitDate = '提交时间';
$lang->design->affectedStory = "影响{$lang->storyCommon}";
$lang->design->affectedTasks = '影响任务';
$lang->design->submit = '提交评审';
$lang->design->revision = '查看关联代码';
$lang->design->designView = '查看详情';
$lang->design->reviewObject = '评审对象';
$lang->design->createdBy = '由谁创建';
$lang->design->createdDate = '创建时间';
$lang->design->basicInfo = '基本信息';
$lang->design->assignTo = '指派';
$lang->design->noAssigned = '未指派';
/* 动作列表. */
$lang->design->common = '设计';
$lang->design->create = '创建设计';
$lang->design->batchCreate = '批量创建';
$lang->design->edit = '变更';
$lang->design->delete = '删除';
$lang->design->view = '设计概况';
$lang->design->browse = '浏览列表';
$lang->design->commit = '关联提交';
$lang->design->submit = '提交评审';
$lang->design->assignTo = '指派';
$lang->design->revision = '查看关联代码';
/* 字段取值. */
$lang->design->typeList = array();
$lang->design->typeList[''] = '';
$lang->design->typeList['HLDS'] = '概要设计';
@@ -55,14 +58,15 @@ $lang->design->typeList['DDS'] = '详细设计';
$lang->design->typeList['DBDS'] = '数据库设计';
$lang->design->typeList['ADS'] = '接口设计';
$lang->design->range = '影响范围';
$lang->design->errorSelection = '还没有选中记录!';
$lang->design->noDesign = '暂时没有记录';
$lang->design->noCommit = '暂时没有提交记录';
$lang->design->rangeList = array();
$lang->design->rangeList['all'] = '全部记录';
$lang->design->rangeList['assign'] = '选中记录';
$lang->design->featureBar['all'] = '所有';
$lang->design->featureBar += $lang->design->typeList;
/* 提示信息. */
$lang->design->errorSelection = '还没有选中记录!';
$lang->design->noDesign = '暂时没有记录';
$lang->design->noCommit = '暂时没有提交记录';
$lang->design->confirmDelete = '您确定要删除这个设计吗?';