* rewrite the index page.
This commit is contained in:
@@ -36,22 +36,40 @@ class index extends control
|
||||
public function index()
|
||||
{
|
||||
$this->loadModel('report');
|
||||
$this->app->loadLang('task');
|
||||
$this->app->loadLang('story');
|
||||
$this->app->loadLang('bug');
|
||||
$this->app->loadLang('todo');
|
||||
$this->view->header->title = $this->lang->index->common;
|
||||
|
||||
/* 项目的统计数据。*/
|
||||
$burns = array();
|
||||
$projects = $this->project->getList('doing');
|
||||
foreach($projects as $project)
|
||||
{
|
||||
$dataXML = $this->report->createSingleXML($this->project->getBurnData($project->id), $this->lang->project->charts->burn->graph);
|
||||
$burns[$project->id] = $this->report->createJSChart('line', $dataXML, 'auto', 260);
|
||||
$burns[$project->id] = $this->report->createJSChart('line', $dataXML, 'auto', 220);
|
||||
}
|
||||
$projectGroups = array_chunk($projects, 2);
|
||||
|
||||
$this->view->projectGroups = $projectGroups;
|
||||
$this->view->burns = $burns;
|
||||
$this->view->counts = count($projects);
|
||||
$this->view->actions = $this->loadModel('action')->getDynamic('all', 30);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
/* 综合的统计数据。*/
|
||||
$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();
|
||||
$stats['story'] = $this->dao->select('status, count(*) as count')->from(TABLE_STORY)->groupBy('status')->fetchPairs();
|
||||
$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。*/
|
||||
$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');
|
||||
|
||||
$this->view->projects = $projects;
|
||||
$this->view->burns = $burns;
|
||||
$this->view->stats = $stats;
|
||||
$this->view->my = $my;
|
||||
$this->view->actions = $this->loadModel('action')->getDynamic('all', 23);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->users['guest']= 'guest'; // append the guest account.
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -28,3 +28,16 @@ $lang->index->index = 'Index';
|
||||
$lang->index->ping = 'API: update session';
|
||||
$lang->index->latest = 'Latest actions:';
|
||||
$lang->index->action = '%s, %s <i>%s</i> %s <strong>%s</strong>。';
|
||||
|
||||
$lang->index->projects = 'Project';
|
||||
$lang->index->stats = 'Stats';
|
||||
$lang->index->my = 'Dashboard';
|
||||
$lang->index->products = 'Product';
|
||||
$lang->index->stories = 'Story';
|
||||
$lang->index->tasks = 'Task';
|
||||
$lang->index->bugs = 'Bug';
|
||||
$lang->index->todos = 'Todo';
|
||||
$lang->index->total = 'Total <strong>%s</strong>, ';
|
||||
$lang->index->myTodo = 'My Todo';
|
||||
$lang->index->myTask = 'My Task';
|
||||
$lang->index->myBug = 'My Bug';
|
||||
|
||||
@@ -28,3 +28,16 @@ $lang->index->index = '首页';
|
||||
$lang->index->ping = '接口:同步session';
|
||||
$lang->index->latest = '最新动态';
|
||||
$lang->index->action = '%s, %s <i>%s</i> %s <strong>%s</strong>。';
|
||||
|
||||
$lang->index->projects = '项目';
|
||||
$lang->index->stats = '统计信息';
|
||||
$lang->index->my = '我的地盘';
|
||||
$lang->index->products = '产品';
|
||||
$lang->index->stories = '需求';
|
||||
$lang->index->tasks = '任务';
|
||||
$lang->index->bugs = 'Bug';
|
||||
$lang->index->todos = 'Todo';
|
||||
$lang->index->total = '共 <strong>%s</strong> 个,';
|
||||
$lang->index->myTodo = '我的Todo';
|
||||
$lang->index->myTask = '我的任务';
|
||||
$lang->index->myBug = '我的Bug';
|
||||
|
||||
@@ -22,39 +22,123 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/colorize.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()
|
||||
{
|
||||
$("#projectbox").tabs("#projectbox .panes > div", {tabs: '.tabs a'});
|
||||
$("#mybox").tabs("#mybox .panes > div", {tabs: '.tabs a'});
|
||||
});
|
||||
</script>
|
||||
<div class="yui-d0 yui-t6">
|
||||
<div class='yui-main'>
|
||||
<div class='yui-b'>
|
||||
<?php foreach($projectGroups as $projects):?>
|
||||
<div class="yui-g">
|
||||
<?php foreach($projects as $key => $project):?>
|
||||
<?php
|
||||
$class = 0;
|
||||
if($key == 0) $class = 'first';
|
||||
if($key == 2) break;
|
||||
?>
|
||||
<div class="yui-u <?php echo $class;?> mb-10px">
|
||||
<div class='box-title'>
|
||||
<div class='a-center'>
|
||||
<?php
|
||||
echo html::a($this->createLink('project', 'browse', "projectid=$project->id"), $project->name);
|
||||
echo '(' . $project->begin . ' ~ ' . $project->end . ')';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='box-content a-center'>
|
||||
<?php
|
||||
echo $burns[$project->id];
|
||||
common::printLink('project', 'burn', "projectID=$project->id", $lang->project->largeBurnChart);
|
||||
common::printLink('project', 'computeBurn', 'reload=yes', $lang->project->computeBurn, 'hiddenwin');
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class='yui-g'>
|
||||
<table class='table-1' id='projectbox' height='240'>
|
||||
<caption><?php echo $lang->index->projects;?></caption>
|
||||
<tr>
|
||||
<td class='tabs' width='220'><?php foreach($projects as $project) echo "<a href='#' title='$project->name'>$project->name</a>";?></td>
|
||||
<td class='panes'>
|
||||
<?php foreach($projects as $key => $project):?>
|
||||
<div class='a-center'>
|
||||
<?php
|
||||
echo $burns[$project->id];
|
||||
echo html::a($this->createLink('project', 'browse', "projectid=$project->id"), $project->name);
|
||||
common::printLink('project', 'burn', "projectID=$project->id", $lang->project->largeBurnChart);
|
||||
common::printLink('project', 'computeBurn', 'reload=yes', $lang->project->computeBurn, 'hiddenwin');
|
||||
?>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class='yui-g'>
|
||||
<div class='yui-u first'>
|
||||
<table class='table-1' height='200'>
|
||||
<caption><?php echo $lang->index->stats;?></caption>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->products;?></td>
|
||||
<td><?php 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->tasks;?></td>
|
||||
<td><?php 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->index->bugs;?></td>
|
||||
<td><?php 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>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class='yui-u'>
|
||||
<table class='table-1 fixed' id='mybox' height='200'>
|
||||
<caption><?php echo $lang->index->my;?></caption>
|
||||
<tr>
|
||||
<td class='tabs' width='100'>
|
||||
<?php echo html::a('#', $lang->index->myTodo);?>
|
||||
<?php echo html::a('#', $lang->index->myTask);?>
|
||||
<?php echo html::a('#', $lang->index->myBug);?>
|
||||
</td>
|
||||
<td class='panes' valign='top'>
|
||||
<div class='mr-10px'>
|
||||
<?php
|
||||
foreach($my['todos'] as $todo)
|
||||
{
|
||||
echo $lang->arrow . html::a($this->createLink('todo', 'view', "id=$todo->id"), $todo->name) . '<br />';
|
||||
}
|
||||
echo '<div class="a-right">' . html::linkButton($lang->more, $this->createLink('my', 'todo')) . '</div>';
|
||||
?>
|
||||
</div>
|
||||
<div class='mr-10px'>
|
||||
<?php
|
||||
foreach($my['tasks'] as $taskID => $taskName)
|
||||
{
|
||||
echo $lang->arrow . html::a($this->createLink('task', 'view', "id=$taskID"), $taskName) . '<br />';
|
||||
}
|
||||
echo '<div class="a-right">' . html::linkButton($lang->more, $this->createLink('my', 'task')) . '</div>';
|
||||
?>
|
||||
</div>
|
||||
<div class='mr-10px'>
|
||||
<?php
|
||||
foreach($my['bugs'] as $bugID => $bugTitle)
|
||||
{
|
||||
echo $lang->arrow . html::a($this->createLink('bug', 'view', "id=$bugID"), $bugTitle) . '<br />';
|
||||
}
|
||||
echo '<div class="a-right">' . html::linkButton($lang->more, $this->createLink('my', 'bug')) . '</div>';
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='yui-b'>
|
||||
@@ -69,8 +153,8 @@
|
||||
echo "</td></tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script language='Javascript'><?php for($i = 1; $i <= $counts; $i ++) echo "createChart$i();"; ?></script>
|
||||
<script language='Javascript'><?php for($i = 1; $i <= count($projects); $i ++) echo "createChart$i();"; ?></script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user