* add actions of testtask.

This commit is contained in:
zhujinyong
2013-01-18 05:43:47 +00:00
parent 5d0b629775
commit 7323683405
7 changed files with 205 additions and 2 deletions
+61
View File
@@ -147,6 +147,49 @@ class testtaskModel extends model
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
/**
* Start testtask.
*
* @param int $taskID
* @access public
* @return void
*/
public function start($taskID)
{
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
->setDefault('status', 'doing')
->remove('comment')->get();
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->where('id')->eq((int)$taskID)
->exec();
if(!dao::isError()) return common::createChanges($oldTesttask, $testtask);
}
/**
* Close testtask.
*
* @access public
* @return void
*/
public function close($taskID)
{
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
->setDefault('status', 'done')
->remove('comment')->get();
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->where('id')->eq((int)$taskID)
->exec();
if(!dao::isError()) return common::createChanges($oldTesttask, $testtask);
}
/**
* Link cases.
*
@@ -421,4 +464,22 @@ class testtaskModel extends model
}
return $results;
}
/**
* Judge an action is clickable or not.
*
* @param object $product
* @param string $action
* @access public
* @return void
*/
public function isClickable($testtask, $action)
{
$action = strtolower($action);
if($action == 'start') return $testtask->status == 'wait';
if($action == 'close') return $testtask->status != 'done';
return true;
}
}