* Code for task #36041.
This commit is contained in:
@@ -333,7 +333,6 @@ class product extends control
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
|
||||
$this->view->programs = array('') + $this->loadModel('program')->getTopPGMPairs();
|
||||
$this->view->lines = array('') + $this->loadModel('tree')->getLinePairs();
|
||||
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
|
||||
|
||||
unset($this->lang->product->typeList['']);
|
||||
@@ -481,7 +480,7 @@ class product extends control
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
|
||||
$this->view->programs = array('') + $this->loadModel('program')->getTopPGMPairs();
|
||||
$this->view->lines = array('') + $this->loadModel('tree')->getLinePairs();
|
||||
$this->view->lines = array('') + $this->product->getLinePairs($product->program);
|
||||
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
|
||||
$this->view->canChangePGM = $canChangePGM;
|
||||
$this->view->singleLinkProjects = $singleLinkProjects;
|
||||
@@ -556,7 +555,7 @@ class product extends control
|
||||
|
||||
$this->view->title = $this->lang->product->batchEdit;
|
||||
$this->view->position[] = $this->lang->product->batchEdit;
|
||||
$this->view->lines = array('') + $this->tree->getLinePairs();
|
||||
$this->view->lines = array('') + $this->product->getLinePairs();
|
||||
$this->view->productIDList = $productIDList;
|
||||
$this->view->products = $products;
|
||||
$this->view->poUsers = $poUsers;
|
||||
@@ -804,7 +803,7 @@ class product extends control
|
||||
$this->view->product = $product;
|
||||
$this->view->actions = $this->loadModel('action')->getList('product', $productID);
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->lines = array('') + $this->loadModel('tree')->getLinePairs();
|
||||
$this->view->lines = array('') + $this->product->getLinePairs();
|
||||
$this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, $productID);
|
||||
$this->view->roadmaps = $this->product->getRoadmap($productID, 0, 6);
|
||||
|
||||
@@ -872,6 +871,19 @@ class product extends control
|
||||
die($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get product lines.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetLine($programID)
|
||||
{
|
||||
$lines = $this->product->getLinePairs($programID);
|
||||
die(html::select('line', array('' => '') + $lines, '', "class='form-control chosen'"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop menu page.
|
||||
*
|
||||
@@ -1100,7 +1112,7 @@ class product extends control
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
$lines = $this->loadModel('tree')->getLinePairs();
|
||||
$lines = $this->product->getLinePairs();
|
||||
$productStats = $this->product->getStats($orderBy, null, $status);
|
||||
foreach($productStats as $i => $product)
|
||||
{
|
||||
|
||||
@@ -13,3 +13,15 @@ function loadProductLines(rootID)
|
||||
$(this).find('select').chosen()
|
||||
});
|
||||
}
|
||||
|
||||
$('#program').change(function()
|
||||
{
|
||||
var programID = $(this).val();
|
||||
|
||||
$.get(createLink('product', 'ajaxGetLine', 'programID=' + programID), function(data)
|
||||
{
|
||||
$('#line_chosen').remove();
|
||||
$('#line').replaceWith(data);
|
||||
$('#line').chosen();
|
||||
})
|
||||
})
|
||||
|
||||
@@ -13,6 +13,18 @@ $(function()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$('#program').change(function()
|
||||
{
|
||||
var programID = $(this).val();
|
||||
|
||||
$.get(createLink('product', 'ajaxGetLine', 'programID=' + programID), function(data)
|
||||
{
|
||||
$('#line_chosen').remove();
|
||||
$('#line').replaceWith(data);
|
||||
$('#line').chosen();
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -388,7 +388,7 @@ class productModel extends model
|
||||
|
||||
if(empty($products)) return $products;
|
||||
|
||||
$lines = $this->loadModel('tree')->getLinePairs($useShort = true);
|
||||
$lines = $this->getLinePairs();
|
||||
$productList = array();
|
||||
foreach($lines as $id => $name)
|
||||
{
|
||||
@@ -1358,6 +1358,22 @@ class productModel extends model
|
||||
return $stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product line pairs.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getLinePairs($programID = 0)
|
||||
{
|
||||
return $this->dao->select('id,name')->from(TABLE_MODULE)
|
||||
->where('type')->eq('line')
|
||||
->beginIF($programID)->andWhere('root')->eq($programID)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the summary of product's stories.
|
||||
*
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
<th class='w-140px'><?php echo $lang->program->PGMCommon;?></th>
|
||||
<td><?php echo html::select('program', $programs, '', "class='form-control chosen' required");?></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->line;?></th>
|
||||
<td><?php echo html::select('line', '', '', "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->product->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control input-product-title' required");?></td><td></td>
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
<th class='w-140px'><?php echo $lang->product->program;?></th>
|
||||
<td><?php echo html::select('program', $programs, $product->program, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->line;?></th>
|
||||
<td><?php echo html::select('line', $lines, $product->line, "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->name;?></th>
|
||||
<td class='w-p40-f'><?php echo html::input('name', $product->name, "class='form-control' required");?></td><td></td>
|
||||
|
||||
@@ -204,23 +204,6 @@ class treeModel extends model
|
||||
return $modulePairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line pairs.
|
||||
*
|
||||
* @param bool $useShort
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLinePairs($useShort = false)
|
||||
{
|
||||
$lines = $this->dao->select('id,name,short')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->fetchAll('id');
|
||||
|
||||
$linePairs = array();
|
||||
foreach($lines as $lineID => $line) $linePairs[$lineID] = ($useShort and !empty($line->short)) ? $line->short : $line->name;
|
||||
|
||||
return $linePairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an option menu of task in html.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user