* finish task #1586.

This commit is contained in:
wyd621
2013-07-22 15:25:09 +08:00
parent 995d7a3088
commit d1c69f8217
2 changed files with 33 additions and 3 deletions
+31 -3
View File
@@ -150,19 +150,47 @@ class productplan extends control
* @access public
* @return void
*/
public function linkStory($planID = 0)
public function linkStory($planID = 0, $browseType = '', $param = 0)
{
$this->session->set('storyList', $this->app->getURI(true));
if(!empty($_POST['stories'])) $this->productplan->linkStory($planID);
$this->loadModel('story');
$plan = $this->productplan->getByID($planID);
$this->commonAction($plan->product);
$products = $this->product->getPairs();
/* Build search form. */
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
unset($this->config->product->search['fields']['module']);
unset($this->config->product->search['fields']['product']);
$this->config->product->search['actionURL'] = $this->createLink('productplan', 'linkStory', "planID=$planID&browseType=bySearch&queryID=myQueryID");
$this->config->product->search['queryID'] = $queryID;
$this->config->product->search['params']['product']['values'] = $products + array('all' => $this->lang->product->allProductsOfProject);
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts($products);
unset($this->lang->story->statusList['closed']);
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
$this->loadModel('search')->setSearchParams($this->config->product->search);
if($browseType == 'bySearch')
{
$allStories = $this->story->getBySearch($plan->product, $queryID, 'id');
foreach($allStories as $key => $story)
{
if($story->status == 'closed') unset($allStories[$key]);
}
}
else
{
$allStories = $this->story->getProductStories($this->view->product->id, $moduleID = '0', $status = 'draft,active,changed');
}
$this->view->title = $this->lang->productplan->linkStory;
$this->view->position[] = $this->lang->productplan->linkStory;
$this->view->allStories = $this->loadModel('story')->getProductStories($this->view->product->id, $moduleID = '0', $status = 'draft,active,changed');
$this->view->allStories = $allStories;
$this->view->planStories= $this->story->getPlanStories($planID);
$this->view->products = $this->product->getPairs();
$this->view->products = $products;
$this->view->plan = $plan;
$this->view->plans = $this->dao->select('id, end')->from(TABLE_PRODUCTPLAN)->fetchPairs();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<div id='querybox'></div>
<form method='post' id='unlinkedStoriesForm'>
<table class='table-1 tablesorter a-center fixed'>
<caption class='caption-tl'><?php echo $plan->title .$lang->colon . $lang->productplan->unlinkedStories;?></caption>
@@ -111,4 +112,5 @@
</tbody>
</table>
</form>
<script>$(function(){ajaxGetSearchForm()})</script>
<?php include '../../common/view/footer.html.php';?>