* complete task #207
 + complete task #207
This commit is contained in:
fujia
2010-05-28 09:30:25 +00:00
parent ed45dfdbfa
commit c18ebfddc9
3 changed files with 51 additions and 6 deletions

View File

@@ -29,8 +29,11 @@ class project extends control
public function __construct()
{
parent::__construct();
$this->projects = $this->project->getPairs();
if(!$this->projects and $this->methodName != 'create') $this->locate($this->createLink('project', 'create'));
if($this->methodName != 'computeburn')
{
$this->projects = $this->project->getPairs();
if(!$this->projects and $this->methodName != 'create') $this->locate($this->createLink('project', 'create'));
}
}
/* 项目视图首页,*/
@@ -320,7 +323,8 @@ class project extends control
/* 计算燃烧图数据。*/
public function computeBurn()
{
$this->project->computeBurn();
$this->view->burns = $this->project->computeBurn();
$this->display();
}
/* 团队成员。*/

View File

@@ -397,17 +397,27 @@ class projectModel extends model
public function computeBurn()
{
$today = helper::today();
$projects = $this->dao->select('id')->from(TABLE_PROJECT)
$burns = array();
$projects = $this->dao->select('id, name')->from(TABLE_PROJECT)
->where("end >= '$today'")
->orWhere('end')->eq('0000-00-00')
->fetchPairs();
if(!$projects) return $burns;
$burns = $this->dao->select("project, '$today' AS date, sum(`left`) AS `left`, SUM(consumed) AS `consumed`")
->from(TABLE_TASK)
->where('project')->in($projects)
->where('project')->in(array_keys($projects))
->andWhere('status')->ne('cancel')
->groupBy('project')
->fetchAll();
foreach($burns as $burn) $this->dao->replace(TABLE_BURN)->data($burn)->exec();
foreach($burns as $Key => $burn)
{
$this->dao->replace(TABLE_BURN)->data($burn)->exec();
$burn->projectName = $projects[$burn->project];
}
return $burns;
}
/* 燃烧图所需要的数据。*/
@@ -422,6 +432,7 @@ class projectModel extends model
if($burnCounts > $itemCounts)
{
$sets = $sql->orderBy('date DESC')->limit($itemCounts)->fetchAll('name');
$sets = array_reverse($sets);
}
else
{

View File

@@ -0,0 +1,30 @@
<?php
/**
* The computeburn view file of project module of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright 2009-2010 青岛易软天创网络科技有限公司(www.cnezsoft.com)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package project
* @version $Id$
* @link http://www.zentaoms.com
*/
?>
<?php
foreach($burns as $burn)
{
echo $burn->project . "\t" . $burn->projectName . "\t" . $burn->date . "\t" . $burn->left . "\n";
}
?>