+ add delete feature to productplan.
+ log actions of productplan. * adjust the UI.
This commit is contained in:
@@ -37,8 +37,9 @@ class productplan extends control
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->productplan->create();
|
||||
$planID = $this->productplan->create();
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
$this->loadModel('action')->create('productplan', $planID, 'opened');
|
||||
die(js::locate($this->createLink('productplan', 'browse', "product=$product"), 'parent'));
|
||||
}
|
||||
|
||||
@@ -53,9 +54,11 @@ class productplan extends control
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->productplan->update($planID);
|
||||
$changes = $this->productplan->update($planID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
die(js::locate($this->createLink('productplan', 'browse', "product={$this->post->product}"), 'parent'));
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, 'edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
die(js::locate(inlink('view', "planID=$planID"), 'parent'));
|
||||
}
|
||||
|
||||
$plan = $this->productplan->getByID($planID);
|
||||
@@ -76,16 +79,16 @@ class productplan extends control
|
||||
else
|
||||
{
|
||||
$plan = $this->productplan->getById($planID);
|
||||
$this->productplan->delete($planID);
|
||||
die(js::locate($this->createLink('productplan', 'browse', "productID=$plan->product"), 'parent'));
|
||||
$this->productplan->delete(TABLE_PRODUCTPLAN, $planID);
|
||||
die(js::locate(inlink('browse', "productID=$plan->product"), 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
/* 浏览计划列表。*/
|
||||
public function browse($product = 0)
|
||||
{
|
||||
$this->session->set('productPlanList', $this->app->getURI(true));
|
||||
$this->commonAction($product);
|
||||
|
||||
$this->view->header->title = $this->lang->productplan->browse;
|
||||
$this->view->position[] = $this->lang->productplan->browse;
|
||||
$this->view->plans = $this->productplan->getList($product);
|
||||
@@ -97,12 +100,15 @@ class productplan extends control
|
||||
{
|
||||
$this->session->set('storyList', $this->app->getURI(true));
|
||||
$plan = $this->productplan->getByID($planID);
|
||||
if(!$plan) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
$this->commonAction($plan->product);
|
||||
$this->view->header->title = $this->lang->productplan->view;
|
||||
$this->view->position[] = $this->lang->productplan->view;
|
||||
$this->view->planStories= $this->loadModel('story')->getPlanStories($planID);
|
||||
$this->view->products = $this->product->getPairs();
|
||||
$this->view->plan = $plan;
|
||||
$this->view->actions = $this->loadModel('action')->getList('productplan', $planID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,18 @@ class productplanModel extends model
|
||||
/* 获取列表。*/
|
||||
public function getList($product = 0)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product)->orderBy('begin')->fetchAll();
|
||||
return $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('begin')->fetchAll();
|
||||
}
|
||||
|
||||
/* 获取name=>value的键值对。*/
|
||||
public function getPairs($product = 0)
|
||||
{
|
||||
return array('' => '') + $this->dao->select('id,title')->from(TABLE_PRODUCTPLAN)->where('product')->eq((int)$product)->orderBy('begin')->fetchPairs();
|
||||
return array('' => '') + $this->dao->select('id,title')->from(TABLE_PRODUCTPLAN)
|
||||
->where('product')->eq((int)$product)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('begin')->fetchPairs();
|
||||
}
|
||||
|
||||
/* 创建。*/
|
||||
@@ -57,17 +62,14 @@ class productplanModel extends model
|
||||
/* 编辑。*/
|
||||
public function update($planID)
|
||||
{
|
||||
$oldPlan = $this->getById($planID);
|
||||
$plan = fixer::input('post')
|
||||
->stripTags('title')
|
||||
->specialChars('desc')
|
||||
->get();
|
||||
$this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->batchCheck($this->config->productplan->edit->requiredFields, 'notempty')->where('id')->eq((int)$planID)->exec();
|
||||
}
|
||||
if(!dao::isError()) return common::createChanges($oldPlan, $plan);
|
||||
|
||||
/* 删除计划。*/
|
||||
public function delete($planID)
|
||||
{
|
||||
return $this->dao->delete()->from(TABLE_PRODUCTPLAN)->where('id')->eq((int)$planID)->exec();
|
||||
}
|
||||
|
||||
/* 关联需求。*/
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-p20'><?php echo $lang->productplan->title;?></th>
|
||||
<th><?php echo $lang->productplan->title;?></th>
|
||||
<th><?php echo $lang->productplan->begin;?></th>
|
||||
<th><?php echo $lang->productplan->end;?></th>
|
||||
<th><?php echo $lang->productplan->desc;?></th>
|
||||
<th class='w-p20'><?php echo $lang->actions;?></th>
|
||||
<th class="{sorter: false}"><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -48,9 +48,9 @@
|
||||
<td class='a-left'><?php echo nl2br($plan->desc);?></td>
|
||||
<td class='nobr'>
|
||||
<?php
|
||||
common::printLink('productplan', 'edit', "planID=$plan->id", $lang->productplan->edit);
|
||||
common::printLink('productplan', 'edit', "planID=$plan->id", $lang->edit);
|
||||
common::printLink('productplan', 'linkstory', "planID=$plan->id", $lang->productplan->linkStory);
|
||||
common::printLink('productplan', 'delete', "planID=$plan->id", $lang->productplan->delete, 'hiddenwin');
|
||||
common::printLink('productplan', 'delete', "planID=$plan->id", $lang->delete, 'hiddenwin');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -27,13 +27,9 @@
|
||||
<div class='yui-d0'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $plan->title . $lang->colon . $lang->productplan->view;?></caption>
|
||||
<tr>
|
||||
<th class='rowhead w-100px'><?php echo $lang->productplan->id;?></th>
|
||||
<td><?php echo $plan->id;?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->productplan->title;?></th>
|
||||
<td><?php echo $plan->title;?></th>
|
||||
<td <?php if($plan->deleted) echo "class='deleted'";?>><?php echo $plan->title;?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->productplan->begin;?></th>
|
||||
@@ -48,6 +44,19 @@
|
||||
<td><?php echo nl2br($plan->desc);?></th>
|
||||
</tr>
|
||||
</table>
|
||||
<div class='a-center f-16px strong'>
|
||||
<?php
|
||||
$browseLink = $this->session->productPlanList ? $this->session->productPlanList : inlink('browse', "planID=$plan->id");
|
||||
if(!$plan->deleted)
|
||||
{
|
||||
common::printLink('productplan', 'edit', "planID=$plan->id", $lang->edit);
|
||||
common::printLink('productplan', 'delete', "planID=$plan->id", $lang->delete, 'hiddenwin');
|
||||
}
|
||||
echo html::a($browseLink, $lang->goback);
|
||||
?>
|
||||
</div>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
|
||||
<table align='center' class='table-1 tablesorter a-center'>
|
||||
<caption><?php echo $plan->title .$lang->colon . $lang->productplan->linkedStories;?></caption>
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user