* Modified something for the task #438

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-04-28 02:52:38 +00:00
parent 1cac260989
commit 0982bcb3e3
2 changed files with 57 additions and 40 deletions
+55 -10
View File
@@ -110,6 +110,16 @@ class project extends control
$project = $this->commonAction($projectID);
$projectID = $project->id;
/* Init vars */
$statusWait = 0;
$statusDone = 0;
$statusDoing = 0;
$statusCancel = 0;
$totalEstimate = 0.0;
$totalConsumed = 0.0;
$totalLeft = 0.0;
/* Save to session. */
$uri = $this->app->getURI(true);
$this->app->session->set('taskList', $uri);
@@ -160,6 +170,32 @@ class project extends control
$this->session->set('taskReportCondition', $sql[0]);
}
/* count the information of task*/
$tasks = $tasks ? $tasks : array();
foreach($tasks as $task)
{
$taskLink = $this->createLink('task','view',"taskID=$task->id");
$totalEstimate += $task->estimate;
$totalConsumed += $task->consumed;
$totalLeft += $task->left;
if($task->status == 'wait')
{
$statusWait++;
}
elseif($task->status == 'doing')
{
$statusDoing++;
}
elseif($task->status == 'done')
{
$statusDone++;
}
else
{
$statusCancel++;
}
}
/* Build the search form. */
$this->config->project->search['actionURL'] = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch&param=myQueryID");
$this->config->project->search['queryID'] = $queryID;
@@ -167,16 +203,25 @@ class project extends control
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->project->search);
/* Assign. */
$this->view->tasks = $tasks ? $tasks : array();
$this->view->tabID = 'task';
$this->view->pager = $pager->get();
$this->view->recTotal = $pager->recTotal;
$this->view->recPerPage = $pager->recPerPage;
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->status = $status;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->param = $param;
$this->view->tasks = $tasks;
$this->view->tabID = 'task';
$this->view->pager = $pager->get();
$this->view->recTotal = $pager->recTotal;
$this->view->recPerPage = $pager->recPerPage;
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->status = $status;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->param = $param;
$this->view->statusWait =$statusWait;
$this->view->statusDone =$statusDone;
$this->view->statusDoing =$statusDoing;
$this->view->statusCancel =$statusCancel;
$this->view->totalEstimate =$totalEstimate;
$this->view->totalConsumed =$totalConsumed;
$this->view->totalLeft =$totalLeft;
$this->display();
}
+2 -30
View File
@@ -40,38 +40,10 @@ $("#bysearchTab").toggle(
</tr>
</thead>
<tbody>
<?php $statusWait = 0;
$statusDone = 0;
$statusDoing = 0;
$statusCancel = 0;
$totalEstimate = 0.0;
$totalConsumed = 0.0;
$totalLeft = 0.0;
?>
<?php foreach($tasks as $task):?>
<?php $class = $task->assignedTo == $app->user->account ? 'style=color:red' : '';?>
<?php $taskLink = $this->createLink('task','view',"taskID=$task->id");
$totalEstimate += $task->estimate;
$totalConsumed += $task->consumed;
$totalLeft += $task->left;
if($task->status == 'wait')
{
$statusWait++;
}
elseif($task->status == 'doing')
{
$statusDoing++;
}
elseif($task->status == 'done')
{
$statusDone++;
}
else
{
$statusCancel++;
}
?>
<tr class='a-center'>
<tr class='a-center'>
<td><?php if(!common::printLink('task', 'view', "task=$task->id", sprintf('%03d', $task->id))) printf('%03d', $task->id);?></td>
<td><?php echo $lang->task->priList[$task->pri];?></td>
<td class='a-left nobr'><?php if(!common::printLink('task', 'view', "task=$task->id", $task->name)) echo $task->name;?></td>