* rewrite the comments of index module.
This commit is contained in:
@@ -13,7 +13,12 @@
|
||||
*/
|
||||
class index extends control
|
||||
{
|
||||
/* 构造函数。*/
|
||||
/**
|
||||
* Construct function, load project, product.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -21,6 +26,12 @@ class index extends control
|
||||
$this->loadModel('product');
|
||||
}
|
||||
|
||||
/**
|
||||
* The index page of whole zentao system.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->loadModel('report');
|
||||
@@ -30,7 +41,7 @@ class index extends control
|
||||
$this->app->loadLang('todo');
|
||||
$this->view->header->title = $this->lang->index->common;
|
||||
|
||||
/* 项目的统计数据。*/
|
||||
/* Get project stats. */
|
||||
$burns = array();
|
||||
$projects = $this->project->getList('doing');
|
||||
foreach($projects as $project)
|
||||
@@ -39,7 +50,7 @@ class index extends control
|
||||
$burns[$project->id] = $this->report->createJSChart('line', $dataXML, 'auto', 220);
|
||||
}
|
||||
|
||||
/* 综合的统计数据。*/
|
||||
/* stat datas of whole zentao system. */
|
||||
$stats['project'] = $this->dao->select('status, count(*) as count')->from(TABLE_PROJECT)->groupBy('status')->fetchPairs();
|
||||
$stats['product'] = $this->dao->select('status, count(*) as count')->from(TABLE_PRODUCT)->groupBy('status')->fetchPairs();
|
||||
$stats['task'] = $this->dao->select('status, count(*) as count')->from(TABLE_TASK)->groupBy('status')->fetchPairs();
|
||||
@@ -47,7 +58,7 @@ class index extends control
|
||||
$stats['bug'] = $this->dao->select('status, count(*) as count')->from(TABLE_BUG)->groupBy('status')->fetchPairs();
|
||||
$stats['todo'] = $this->dao->select('status, count(*) as count')->from(TABLE_TODO)->groupBy('status')->fetchPairs();
|
||||
|
||||
/* 当前用户的相关任务、todo和bug。*/
|
||||
/* Tasks, bugs, and todos of current user. */
|
||||
$my['tasks'] = $this->dao->select('id, name')->from(TABLE_TASK)->where('owner')->eq($this->session->user->account)->andWhere('deleted')->eq(0)->andWhere('status')->in('wait,doing')->orderBy('id desc')->limit(10)->fetchPairs();
|
||||
$my['bugs'] = $this->dao->select('id, title')->from(TABLE_BUG)->where('assignedTo')->eq($this->session->user->account)->andWhere('deleted')->eq(0)->orderBy('id desc')->limit(10)->fetchPairs();
|
||||
$my['todos'] = $this->loadModel('todo')->getList('all', $this->session->user->account, 'wait, doing');
|
||||
@@ -62,7 +73,12 @@ class index extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* 测试扩展机制。*/
|
||||
/**
|
||||
* Just test the extension engine.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function testext()
|
||||
{
|
||||
echo $this->fetch('misc', 'getsid');
|
||||
|
||||
@@ -11,20 +11,6 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/jquerytools.html.php';?>
|
||||
<?php
|
||||
function printStats($statusList, $stats)
|
||||
{
|
||||
global $lang;
|
||||
$sum = array_sum($stats);
|
||||
$string = sprintf($lang->index->total, $sum);
|
||||
foreach($stats as $status => $value)
|
||||
{
|
||||
$percent = round($value / $sum, 2) * 100 . '%';
|
||||
$string .= strtolower($statusList[$status]) . " <strong>$value<small><i>($percent)</i></small></strong>$lang->comma ";
|
||||
}
|
||||
echo rtrim($string, $lang->comma) . $lang->dot;
|
||||
}
|
||||
?>
|
||||
<script language='Javascript'>
|
||||
$(function()
|
||||
{
|
||||
@@ -61,27 +47,27 @@ $(function()
|
||||
<caption><?php echo $lang->index->stats;?></caption>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->products;?></td>
|
||||
<td><?php printStats($lang->product->statusList, $stats['product']);?></td>
|
||||
<td><?php $this->index->printStats($lang->product->statusList, $stats['product']);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->projects;?></td>
|
||||
<td><?php printStats($lang->project->statusList, $stats['project']);?></td>
|
||||
<td><?php $this->index->printStats($lang->project->statusList, $stats['project']);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->tasks;?></td>
|
||||
<td><?php printStats($lang->task->statusList, $stats['task']);?></td>
|
||||
<td><?php $this->index->printStats($lang->task->statusList, $stats['task']);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->stories;?></td>
|
||||
<td><?php printStats($lang->story->statusList, $stats['story']);?></td>
|
||||
<td><?php $this->index->printStats($lang->story->statusList, $stats['story']);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->bugs;?></td>
|
||||
<td><?php printStats($lang->bug->statusList, $stats['bug']);?></td>
|
||||
<td><?php $this->index->printStats($lang->bug->statusList, $stats['bug']);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->todos;?></td>
|
||||
<td><?php printStats($lang->todo->statusList, $stats['todo']);?></td>
|
||||
<td><?php $this->index->printStats($lang->todo->statusList, $stats['todo']);?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user