* Code for stage.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
class stage extends control
|
||||
{
|
||||
public function browse()
|
||||
public function browse($orderBy = "id_desc")
|
||||
{
|
||||
|
||||
$this->view->stages = $this->stage->getStages($orderBy);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->title = $this->lang->stage->common . $this->lang->colon . $this->lang->stage->browse;
|
||||
$this->view->position[] = $this->lang->stage->common;
|
||||
$this->view->position[] = $this->lang->stage->browse;
|
||||
@@ -56,7 +57,7 @@ class stage extends control
|
||||
|
||||
$actionID = $this->loadModel('action')->create('stage', $stageID, 'Edited');
|
||||
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
|
||||
$response['locate'] = inlink('view', "stageID=$stageID");
|
||||
$response['locate'] = inlink('browse');
|
||||
$this->send($response);
|
||||
}
|
||||
|
||||
@@ -89,4 +90,20 @@ class stage extends control
|
||||
$this->view->position[] = $this->lang->stage->setType;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function delete($stageID, $confirm = 'no')
|
||||
{
|
||||
$stage = $this->stage->getById($stageID);
|
||||
|
||||
if($confirm == 'no')
|
||||
{
|
||||
die(js::confirm($this->lang->stage->confirmDelete, inlink('delete', "stageID=$stageID&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->stage->delete(TABLE_STAGE, $stageID);
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ $lang->stage->view = '阶段详情';
|
||||
|
||||
/* Fields. */
|
||||
$lang->stage->common = '阶段';
|
||||
$lang->stage->id = '编号';
|
||||
$lang->stage->name = '阶段名称';
|
||||
$lang->stage->type = '阶段分类';
|
||||
$lang->stage->percent = '工作量比例';
|
||||
@@ -22,3 +23,6 @@ $lang->stage->typeList['qa'] = '测试';
|
||||
$lang->stage->typeList['release'] = '发布';
|
||||
$lang->stage->typeList['review'] = '总结评审';
|
||||
$lang->stage->typeList['other'] = '其他';
|
||||
|
||||
$lang->stage->noStage = '暂时没有阶段';
|
||||
$lang->stage->confirmDelete = '您确定要执行删除操作吗?';
|
||||
|
||||
@@ -29,9 +29,9 @@ class stageModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStages()
|
||||
public function getStages($orderBy = 'id_desc')
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_STAGE)->where('deleted')->eq(0)->fetchAll('id');
|
||||
return $this->dao->select('*')->from(TABLE_STAGE)->where('deleted')->eq(0)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
|
||||
public function getPairs()
|
||||
@@ -46,4 +46,9 @@ class stageModel extends model
|
||||
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
public function getByID($stageID)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_STAGE)->where('deleted')->eq(0)->andWhere('id')->eq((int)$stageID)->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,40 @@
|
||||
<?php common::printLink('stage', 'create', "", "<i class='icon icon-plus'></i>" . $lang->stage->create, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainContent" class='main-table'>
|
||||
<?php if(empty($stages)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->stage->noStage;?></span>
|
||||
<?php if(common::hasPriv('stage', 'create')):?>
|
||||
<?php echo html::a($this->createLink('stage', 'create'), "<i class='icon icon-plus'></i> " . $lang->stage->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<table class="table has-sort-head" id='stageList'>
|
||||
<?php $vars = "orderBy=%s";?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='text-left w-60px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->stage->id);?></th>
|
||||
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->stage->name);?></th>
|
||||
<th class='w-100px'><?php common::printOrderLink('percent', $orderBy, $vars, $lang->stage->percent);?></th>
|
||||
<th class='w-120px'><?php common::printOrderLink('type', $orderBy, $vars, $lang->stage->type);?></th>
|
||||
<th class='w-120px'<?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($stages as $stage):?>
|
||||
<tr>
|
||||
<td><?php echo $stage->id;?></td>
|
||||
<td><?php echo $stage->name;?></td>
|
||||
<td class='text-center'><?php echo $stage->percent;?></td>
|
||||
<td><?php echo zget($lang->stage->typeList, $stage->type);?></td>
|
||||
<td class="c-actions"><?php echo common::printIcon('stage', 'edit', "stageID=$stage->id", "", "list") . common::printIcon('stage', 'delete', "stageID=$stage->id", "", "list")?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user