* finish task#732.
This commit is contained in:
@@ -189,18 +189,25 @@ class testtask extends control
|
||||
/**
|
||||
* Browse cases of a test task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param string $taskID
|
||||
* @param string $browseType bymodule|all|assignedtome
|
||||
* @param int $param
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function cases($taskID, $browseType = 'byModule', $param = 0)
|
||||
public function cases($taskID, $browseType = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* Save the session. */
|
||||
$this->app->loadLang('testcase');
|
||||
$this->session->set('caseList', $this->app->getURI(true));
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
|
||||
/* Set the browseType and moduleID. */
|
||||
$browseType = strtolower($browseType);
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
@@ -215,11 +222,11 @@ class testtask extends control
|
||||
{
|
||||
$modules = '';
|
||||
if($moduleID) $modules = $this->loadModel('tree')->getAllChildID($moduleID);
|
||||
$this->view->runs = $this->testtask->getRuns($taskID, $modules);
|
||||
$this->view->runs = $this->testtask->getRuns($taskID, $modules, $pager);
|
||||
}
|
||||
elseif($browseType == 'assignedtome')
|
||||
{
|
||||
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account);
|
||||
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $pager);
|
||||
}
|
||||
|
||||
$this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases;
|
||||
@@ -235,6 +242,7 @@ class testtask extends control
|
||||
$this->view->taskID = $taskID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
|
||||
$this->view->pager = $pager;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -170,34 +170,38 @@ class testtaskModel extends model
|
||||
/**
|
||||
* Get test runs of a test task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $moduleID
|
||||
* @param int $taskID
|
||||
* @param int $moduleID
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRuns($taskID, $moduleID)
|
||||
public function getRuns($taskID, $moduleID, $pager = null)
|
||||
{
|
||||
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()
|
||||
->fetchAll();
|
||||
->page($pager)
|
||||
->fetchAll('', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get test runs of a user.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $user
|
||||
* @param int $taskID
|
||||
* @param int $user
|
||||
* @param obejct $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUserRuns($taskID, $user)
|
||||
public function getUserRuns($taskID, $user, $pager = null)
|
||||
{
|
||||
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)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,18 +83,21 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<?php if($canBatchAssign):?>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan='10'>
|
||||
<?php if($canBatchAssign):?>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
echo html::selectAll() . html::selectReverse();
|
||||
echo html::select('assignedTo', $users) . html::submitButton($lang->testtask->assign);
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php echo $pager->show();?>
|
||||
</td>
|
||||
</tr>
|
||||
<tfoot>
|
||||
<?php endif;?>
|
||||
</table>
|
||||
<?php if($canBatchAssign) echo '</form>';?>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user