* adjust the chart.

This commit is contained in:
wangchunsheng
2009-11-13 03:57:48 +00:00
parent f64c8e74c8
commit 3fffc25981
4 changed files with 63 additions and 25 deletions

View File

@@ -214,4 +214,33 @@ class projectModel extends model
$sql = "DELETE FROM " . TABLE_TEAM . " WHERE project = '$projectID' AND account = '$account'";
return $this->dbh->exec($sql);
}
/* 燃烧图所需要的数据。*/
public function getBurnData($projectID = 0)
{
$sets = $this->dao->select('date AS name, `left` AS value')->from(TABLE_BURN)->where('project')->eq((int)$projectID)->orderBy('date')->fetchAll('name');
/* 取得burn表中最大的日期和project的结束时间。*/
end($sets);
$current = key($sets);
$end = $this->dao->select('end')->from(TABLE_PROJECT)->where('id')->eq((int)$projectID)->fetch('end');
/* 根据当前日期和项目最后结束的日期,补足后续日期。*/
if($end != '0000-00-00' and helper::diffDate($end, $current) > 0)
{
while(true)
{
$nextDay = date('Y-m-d', strtotime('next day', strtotime($current)));
$current = $nextDay;
$sets[$current]->name = $current;
$sets[$current]->value = ''; // value为空这样fushioncharts不会打印节点。
if($nextDay == $end) break;
}
}
foreach($sets as $set)
{
$set->name = substr($set->name, 5);
}
return $sets;
}
}