* finish the task #629.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-11-28 08:23:09 +00:00
parent 1e9b5980f8
commit 794795844b
9 changed files with 65 additions and 12 deletions
+35 -4
View File
@@ -81,16 +81,41 @@ class testtask extends control
* @access public
* @return void
*/
public function create($productID)
public function create($productID, $projectID = 0, $build = 0)
{
if(!empty($_POST))
{
$taskID = $this->testtask->create($productID);
$taskID = $this->testtask->create();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('testtask', $taskID, 'opened');
die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent'));
}
if($projectID != 0 and $build != 0)
{
$products = $this->dao->select('t2.id, t2.name')
->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product = t2.id')
->where('t1.project')->eq($projectID)
->fetchPairs('id');
foreach($products as $key => $value)
{
$productID = $key;
break;
}
$projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetchPairs('id');
$builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->fetchPairs('id');
}
if($projectID == 0)
{
$projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
$builds = $this->loadModel('build')->getProductBuildPairs($productID);
}
/* Set menu. */
$productID = $this->product->saveState($productID, $this->products);
$this->testtask->setMenu($this->products, $productID);
@@ -99,8 +124,14 @@ class testtask extends control
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testtask->create;
$this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
if($projectID != 0)
{
$this->view->products = $products;
$this->view->projectID = $projectID;
}
$this->view->projects = $projects;
$this->view->productID = $productID;
$this->view->builds = $builds;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$this->display();