* finish the task #629.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -39,10 +39,9 @@ class testtaskModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function create($productID)
|
||||
function create()
|
||||
{
|
||||
$task = fixer::input('post')
|
||||
->add('product', $productID)
|
||||
->stripTags('name')
|
||||
->get();
|
||||
$this->dao->insert(TABLE_TESTTASK)->data($task)->autoCheck()->batchcheck($this->config->testtask->create->requiredFields, 'notempty')->exec();
|
||||
|
||||
@@ -16,6 +16,17 @@
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $lang->testtask->create;?></caption>
|
||||
<?php if(isset($projectID)):?>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testtask->product;?></th>
|
||||
<td><?php echo html::select('product', $products, '', 'class=select-3');?></td>
|
||||
</tr>
|
||||
<?php else:?>
|
||||
<tr class='hidden'>
|
||||
<th><?php echo $lang->testtask->product;?></th>
|
||||
<td><?php echo html::input('product', $productID, 'class=select-3');?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->testtask->project;?></th>
|
||||
<td><?php echo html::select('project', $projects, '', 'class=select-3');?></td>
|
||||
|
||||
Reference in New Issue
Block a user