* finish the task #681.

This commit is contained in:
shiyangyangwork@yahoo.cn
2012-02-07 08:25:07 +00:00
parent 1f20b1c301
commit e429df83b1
10 changed files with 21 additions and 37 deletions
-2
View File
@@ -1,8 +1,6 @@
<?php
$config->my->editprofile->requiredFields = 'account,realname';
$config->my->productCounts = 5;
$config->my->projectCounts = 5;
$config->my->dynamicCounts = 16;
$config->my->todoCounts = 10;
$config->my->taskCounts = 10;
+2 -2
View File
@@ -36,8 +36,8 @@ class my extends control
$account = $this->app->user->account;
/* Get project and product stats. */
$projectStats = $this->loadModel('project')->getProjectStats($this->config->my->projectCounts);
$productStats = $this->loadModel('product')->getStats($this->config->my->productCounts);
$projectStats = $this->loadModel('project')->getProjectStats();
$productStats = $this->loadModel('product')->getStats();
/* Set the dynamic pager. */
$this->app->loadClass('pager', true);
+1 -2
View File
@@ -1,4 +1,4 @@
<div class='block' id='productbox'>
<div class='block' id='productbox' style="height:180px; overflow-y:auto">
<?php if(empty($productStats)):?>
<table class='table-1 a-center' height='100%'>
<caption><?php echo $lang->my->home->products;?></caption>
@@ -34,6 +34,5 @@
</tr>
<?php endforeach;?>
</table>
</div>
<?php endif;?>
</div>
+1 -1
View File
@@ -1,4 +1,4 @@
<div class='block' id='projectbox'>
<div class='block' id='projectbox' style="height:180px; overflow-y:auto">
<?php if(count($projectStats) == 0):?>
<table class='table-1 a-center' height='100%'>
<caption><?php echo $lang->my->home->projects;?></caption>
-1
View File
@@ -1,5 +1,4 @@
<?php
$config->product->productCounts = 50;
$config->product->orderBy = 'code';
global $lang, $app;
+2 -2
View File
@@ -46,7 +46,7 @@ class product extends control
if($locate == 'yes') $this->locate($this->createLink($this->moduleName, 'browse'));
$this->app->loadLang('my');
$this->view->productStats = $this->product->getStats($this->config->product->productCounts);
$this->view->productStats = $this->product->getStats();
$this->display();
}
@@ -61,7 +61,7 @@ class product extends control
public function project($status = 'all', $productID = 0)
{
$this->app->loadLang('my');
$this->view->projectStats = $this->loadModel('project')->getProjectStats($this->config->project->projectCounts, $status, $productID);
$this->view->projectStats = $this->loadModel('project')->getProjectStats($status, $productID);
$this->view->productID = $productID;
$this->display();
+2 -6
View File
@@ -353,19 +353,16 @@ class productModel extends model
/**
* Get product stats.
*
* @param int $counts
*
* @access public
* @return array
*/
public function getStats($counts)
public function getStats()
{
$this->loadModel('report');
$this->loadModel('story');
$products = $this->getList(',normal');
$stats = array();
$i = 1;
$stories = $this->dao->select('product, status, count(status) AS count')
->from(TABLE_STORY)
@@ -410,14 +407,13 @@ class productModel extends model
{
if($this->checkPriv($product))
{
if($i <= $counts and $product->status != 'closed')
if($product->status != 'closed')
{
$product->stories = $stories[$product->id];
$product->plans = isset($plans[$product->id]) ? $plans[$product->id] : 0;
$product->releases= isset($releases[$product->id]) ? $releases[$product->id] : 0;
$stats[] = $product;
$i ++;
}
}
else
-1
View File
@@ -1,5 +1,4 @@
<?php
$config->project->projectCounts = 50;
$config->project->defaultWorkhours = 7;
$config->project->orderBy = 'status, id desc';
+1 -1
View File
@@ -42,7 +42,7 @@ class project extends control
if($locate == 'yes') $this->locate($this->createLink('project', 'browse'));
$this->app->loadLang('my');
$this->view->projectStats = $this->project->getProjectStats($this->config->project->projectCounts, $status);
$this->view->projectStats = $this->project->getProjectStats($status);
$this->display();
}
+12 -19
View File
@@ -319,18 +319,16 @@ class projectModel extends model
/**
* Get project stats.
*
* @param int $counts
* @param string $status
* @access public
* @return array
*/
public function getProjectStats($counts, $status = 'undone', $productID = 0)
public function getProjectStats($status = 'undone', $productID = 0)
{
$this->loadModel('report');
$projects = $this->getList($status, 0, $productID);
$stats = array();
$i = 1;
/* Get total estimate, consumed and left hours of project. */
$emptyHour = (object)array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0);
@@ -374,30 +372,25 @@ class projectModel extends model
{
if($this->checkPriv($project))
{
if($i <= $counts)
{
// Process the end time.
$project->end = date(DT_DATE4, strtotime($project->end));
// Process the end time.
$project->end = date(DT_DATE4, strtotime($project->end));
/* Process the burns. */
$project->burns = array();
$burnData = $this->getBurnData($project->id);
foreach($burnData as $data) $project->burns[] = $data->value;
$stats[] = $project;
/* Process the burns. */
$project->burns = array();
$burnData = $this->getBurnData($project->id);
foreach($burnData as $data) $project->burns[] = $data->value;
$stats[] = $project;
/* Process the hours. */
$project->hours = isset($hours[$project->id]) ? $hours[$project->id] : $emptyHour;
/* Process the hours. */
$project->hours = isset($hours[$project->id]) ? $hours[$project->id] : $emptyHour;
/* Process the tasks. */
$project->tasks = isset($tasks[$project->id]) ? $tasks[$project->id] : array();
}
/* Process the tasks. */
$project->tasks = isset($tasks[$project->id]) ? $tasks[$project->id] : array();
}
else
{
unset($projects[$key]);
}
$i ++;
}
return $stats;