* Code for task#814.

This commit is contained in:
chencongzhi520@gmail.com
2012-06-14 02:58:19 +00:00
parent 55a8e375c6
commit 15b1ef2f5d
3 changed files with 24 additions and 16 deletions
+5 -3
View File
@@ -198,7 +198,7 @@ class testtask extends control
* @access public
* @return void
*/
public function cases($taskID, $browseType = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function cases($taskID, $browseType = 'byModule', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Save the session. */
$this->app->loadLang('testcase');
@@ -220,11 +220,11 @@ class testtask extends control
{
$modules = '';
if($moduleID) $modules = $this->loadModel('tree')->getAllChildID($moduleID);
$this->view->runs = $this->testtask->getRuns($taskID, $modules, $pager);
$this->view->runs = $this->testtask->getRuns($taskID, $modules, $orderBy, $pager);
}
elseif($browseType == 'assignedtome')
{
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $pager);
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $orderBy, $pager);
}
/* Save testcaseIDs session for get the pre and next testcase. */
@@ -241,6 +241,8 @@ class testtask extends control
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->taskID = $taskID;
$this->view->moduleID = $moduleID;
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
+8 -2
View File
@@ -176,12 +176,15 @@ class testtaskModel extends model
* @access public
* @return array
*/
public function getRuns($taskID, $moduleID, $pager = null)
public function getRuns($taskID, $moduleID, $orderBy, $pager = null)
{
$orderBy = strpos($orderBy, 'assignedTo') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
return $this->dao->select('t2.*,t1.*')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->where('t1.task')->eq((int)$taskID)
->beginIF($moduleID)->andWhere('t2.module')->in($moduleID)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('', false);
}
@@ -195,12 +198,15 @@ class testtaskModel extends model
* @access public
* @return array
*/
public function getUserRuns($taskID, $user, $pager = null)
public function getUserRuns($taskID, $user, $orderBy, $pager = null)
{
$orderBy = strpos($orderBy, 'assignedTo') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
return $this->dao->select('t2.*,t1.*')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->where('t1.task')->eq((int)$taskID)
->andWhere('t1.assignedTo')->eq($user)
->orderBy($orderBy)
->page($pager)
->fetchAll();
}
+11 -11
View File
@@ -11,7 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<?php include '../../common/view/treeview.html.php';?>
<script language="Javascript">
var browseType = '<?php echo $browseType;?>';
@@ -28,7 +27,7 @@ var moduleID = '<?php echo $moduleID;?>';
</div>
<div class='f-right'>
<?php
common::printLink('testcase', 'export', "productID=$productID&orderBy=id_asc&taskID=$task->id", $lang->export, '', 'class="export"');
common::printLink('testcase', 'export', "productID=$productID&orderBy=$orderBy&taskID=$task->id", $lang->export, '', 'class="export"');
common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCase);
echo html::a($this->session->testtaskList, $lang->goback);
?>
@@ -44,18 +43,19 @@ var moduleID = '<?php echo $moduleID;?>';
</td>
<td class='divider <?php echo $treeClass;?>'></td>
<td>
<?php $vars = "taskID=$task->id&browseType=$browseType&param=$param&orderBy=%s&recToal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<table class='table-1 tablesorter datatable mb-zero fixed'>
<thead>
<tr class='colhead'>
<th class='w-id'><nobr><?php echo $lang->idAB;?></nobr></th>
<th class='w-pri'><?php echo $lang->priAB;?></th>
<th><?php echo $lang->testcase->title;?></th>
<th class='w-type'><?php echo $lang->testcase->type;?></th>
<th class='w-user'><?php echo $lang->testtask->assignedTo;?></th>
<th class='w-user'><?php echo $lang->testtask->lastRunAccount;?></th>
<th class='w-100px'><?php echo $lang->testtask->lastRunTime;?></th>
<th class='w-80px'><?php echo $lang->testtask->lastRunResult;?></th>
<th class='w-status'><?php echo $lang->statusAB;?></th>
<th class='w-id'><nobr><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></nobr></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<th class='w-type'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->testcase->type);?></th>
<th class='w-user'> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->testtask->assignedTo);?></th>
<th class='w-user'> <?php common::printOrderLink('lastRunner', $orderBy, $vars, $lang->testtask->lastRunAccount);?></th>
<th class='w-100px'> <?php common::printOrderLink('lastRunDate', $orderBy, $vars, $lang->testtask->lastRunTime);?></th>
<th class='w-80px'> <?php common::printOrderLink('lastRunResult', $orderBy, $vars, $lang->testtask->lastRunResult);?></th>
<th class='w-status'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-140px {sorter: false}'><?php echo $lang->actions;?></th>
</tr>
</thead>