* Conflict resolution.
This commit is contained in:
@@ -198,6 +198,7 @@ if(!defined('TABLE_STAGE')) define('TABLE_STAGE', '`' . $config->db->prefix
|
||||
if(!defined('TABLE_DESIGN')) define('TABLE_DESIGN', '`' . $config->db->prefix . 'design`');
|
||||
if(!defined('TABLE_DESIGNSPEC')) define('TABLE_DESIGNSPEC', '`' . $config->db->prefix . 'designspec`');
|
||||
if(!defined('TABLE_ISSUE')) define('TABLE_ISSUE', '`' . $config->db->prefix . 'issue`');
|
||||
if(!defined('TABLE_RISK')) define('TABLE_RISK', '`' . $config->db->prefix . 'risk`');
|
||||
|
||||
$config->objectTables['product'] = TABLE_PRODUCT;
|
||||
$config->objectTables['story'] = TABLE_STORY;
|
||||
|
||||
@@ -95,6 +95,7 @@ CREATE TABLE `zt_designspec` (
|
||||
UNIQUE KEY `design` (`design`,`version`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
<<<<<<< HEAD
|
||||
-- DROP TABLE IF EXISTS `zt_issue`;
|
||||
CREATE TABLE `zt_issue` (
|
||||
`id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
@@ -165,26 +166,27 @@ CREATE TABLE `zt_issue` (
|
||||
`deleted` enum('0','1') NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
`resolvedBy` varchar(30) NOT NULL,
|
||||
|
||||
CREATE TABLE `zt_risk` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`program` varchar(255) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`desc` text NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`source` char(30) NOT NULL,
|
||||
`category` char(30) NOT NULL,
|
||||
`strategy` char(30) NOT NULL,
|
||||
`status` varchar(30) NOT NULL DEFAULT 'active',
|
||||
`impact` char(30) NOT NULL,
|
||||
`probability` char(30) NOT NULL,
|
||||
`riskindex` char(30) NOT NULL,
|
||||
`pri` char(30) NOT NULL,
|
||||
`severity` char(30) NOT NULL,
|
||||
`type` char(30) NOT NULL,
|
||||
`activity` varchar(255) NOT NULL,
|
||||
`effectedArea` varchar(255) NOT NULL,
|
||||
`deadline` date NOT NULL,
|
||||
`resolution` char(30) NOT NULL,
|
||||
`resolutionComment` text NOT NULL,
|
||||
`objectID` varchar(255) NOT NULL,
|
||||
`resolvedDate` date NOT NULL,
|
||||
`status` varchar(30) NOT NULL,
|
||||
`owner` varchar(255) NOT NULL,
|
||||
`createdBy` varchar(30) NOT NULL,
|
||||
`createdDate` datetime NOT NULL,
|
||||
`editedBy` varchar(30) NOT NULL,
|
||||
`editedDate` datetime NOT NULL,
|
||||
`identifiedDate` date NOT NULL,
|
||||
`prevention` text NOT NULL,
|
||||
`remedy` text NOT NULL,
|
||||
`plannedClosedDate` date NOT NULL,
|
||||
`actualClosedDate` date NOT NULL,
|
||||
`addedDate` date NOT NULL,
|
||||
`resolution` text NOT NULL,
|
||||
`resolvedBy` varchar(30) NOT NULL,
|
||||
`activateBy` varchar(30) NOT NULL,
|
||||
`activateDate` date NOT NULL,
|
||||
`closeBy` varchar(30) NOT NULL,
|
||||
|
||||
6
module/risk/config.php
Normal file
6
module/risk/config.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$config->risk->editor = new stdclass();
|
||||
$config->risk->editor->create = array('id' => 'prevention,remedy', 'tools' => 'simpleTools');
|
||||
|
||||
$config->risk->create = new stdclass();
|
||||
$config->risk->create->requiredFields = 'name';
|
||||
47
module/risk/control.php
Normal file
47
module/risk/control.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
class risk extends control
|
||||
{
|
||||
public function browse($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse;
|
||||
$this->view->position[] = $this->lang->risk->browse;
|
||||
$this->view->risks = $this->risk->getList($orderBy, $pager);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$riskID = $this->risk->create();
|
||||
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
if(!$riskID)
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
$this->send($response);
|
||||
}
|
||||
|
||||
$this->loadModel('action')->create('risk', $riskID, 'Opened');
|
||||
$response['locate'] = inlink('browse');
|
||||
$this->send($response);
|
||||
}
|
||||
|
||||
$this->view->users = $this->loadModel('user')->getPairs();
|
||||
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create;
|
||||
$this->view->position[] = $this->lang->risk->create;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
7
module/risk/ext/lang/zh-cn/cmmi.php
Normal file
7
module/risk/ext/lang/zh-cn/cmmi.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$lang->risk->comment = '备注';
|
||||
$lang->risk->isChanged = '风险是否有变化';
|
||||
|
||||
$lang->risk->changedList[''] = '';
|
||||
$lang->risk->changedList['1'] = '是';
|
||||
$lang->risk->changedList['2'] = '否';
|
||||
14
module/risk/ext/view/assign.cmmi.html.hook.php
Normal file
14
module/risk/ext/view/assign.cmmi.html.hook.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include $this->app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php';
|
||||
$html = "<tr>";
|
||||
$html .= "<th>{$lang->risk->comment}</th>";
|
||||
$html .= "<td>";
|
||||
$html .= html::textarea('comment', '', 'class="form-control" rows="5"');
|
||||
$html .= "</td></tr>";
|
||||
?>
|
||||
|
||||
<script>
|
||||
$('#assignedTo').closest('tr').after(<?php echo json_encode($html);?>);
|
||||
</script>
|
||||
|
||||
<?php include '../../../common/view/kindeditor.html.php';?>
|
||||
14
module/risk/ext/view/cancel.cmmi.html.hook.php
Normal file
14
module/risk/ext/view/cancel.cmmi.html.hook.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include $this->app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php';
|
||||
$html = "<tr>";
|
||||
$html .= "<th>{$lang->risk->comment}</th>";
|
||||
$html .= "<td>";
|
||||
$html .= html::textarea('comment', '', 'class="form-control" rows="5"');
|
||||
$html .= "</td></tr>";
|
||||
?>
|
||||
|
||||
<script>
|
||||
$('#cancelReason').closest('tr').after(<?php echo json_encode($html);?>);
|
||||
</script>
|
||||
|
||||
<?php include '../../../common/view/kindeditor.html.php';?>
|
||||
28
module/risk/ext/view/check.cmmi.html.hook.php
Normal file
28
module/risk/ext/view/check.cmmi.html.hook.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#riskindex').attr('readonly', true);
|
||||
$('#pri').attr('disabled', true);
|
||||
computeIndex();
|
||||
function computeIndex()
|
||||
{
|
||||
var impact = $('#impact').val();
|
||||
var probability = $('#probability').val();
|
||||
var riskindex = parseInt(impact * probability);
|
||||
var pri = '';
|
||||
if(0 < riskindex && riskindex <= 5) pri = 'low';
|
||||
if(5 < riskindex && riskindex <= 12) pri = 'middle';
|
||||
if(15 <= riskindex && riskindex <= 25) pri = 'high';
|
||||
|
||||
$('#riskindex').val(riskindex);
|
||||
$('#pri').val(pri);
|
||||
$('#pri').trigger("chosen:updated")
|
||||
$('#pri').chosen();
|
||||
$('#pri').attr('disabled', true);
|
||||
$('input[name="pri"]').remove();
|
||||
$('#pri').after("<input type='hidden' name='pri' value='" + pri + "'/>");
|
||||
}
|
||||
|
||||
$('#impact, #chance').change(function(){computeIndex()});
|
||||
})
|
||||
</script>
|
||||
28
module/risk/ext/view/create.cmmi.html.hook.php
Normal file
28
module/risk/ext/view/create.cmmi.html.hook.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#riskindex').attr('readonly', true);
|
||||
$('#pri').attr('disabled', true);
|
||||
computeIndex();
|
||||
function computeIndex()
|
||||
{
|
||||
var impact = $('#impact').val();
|
||||
var probability = $('#probability').val();
|
||||
var riskindex = parseInt(impact * probability);
|
||||
var pri = '';
|
||||
if(0 < riskindex && riskindex <= 5) pri = 'low';
|
||||
if(5 < riskindex && riskindex <= 12) pri = 'middle';
|
||||
if(15 <= riskindex && riskindex <= 25) pri = 'high';
|
||||
|
||||
$('#riskindex').val(riskindex);
|
||||
$('#pri').val(pri);
|
||||
$('#pri').trigger("chosen:updated")
|
||||
$('#pri').chosen();
|
||||
$('#pri').attr('disabled', true);
|
||||
$('input[name="pri"]').remove();
|
||||
$('#pri').after("<input type='hidden' name='pri' value='" + pri + "'/>");
|
||||
}
|
||||
|
||||
$('#impact, #probability').change(function(){computeIndex()});
|
||||
})
|
||||
</script>
|
||||
28
module/risk/ext/view/edit.cmmi.html.hook.php
Normal file
28
module/risk/ext/view/edit.cmmi.html.hook.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#riskindex').attr('readonly', true);
|
||||
$('#pri').attr('disabled', true);
|
||||
computeIndex();
|
||||
function computeIndex()
|
||||
{
|
||||
var impact = $('#impact').val();
|
||||
var probability = $('#probability').val();
|
||||
var riskindex = parseInt(impact * probability);
|
||||
var pri = '';
|
||||
if(0 < riskindex && riskindex <= 5) pri = 'low';
|
||||
if(5 < riskindex && riskindex <= 12) pri = 'middle';
|
||||
if(15 <= riskindex && riskindex <= 25) pri = 'high';
|
||||
|
||||
$('#riskindex').val(riskindex);
|
||||
$('#pri').val(pri);
|
||||
$('#pri').trigger("chosen:updated")
|
||||
$('#pri').chosen();
|
||||
$('#pri').attr('disabled', true);
|
||||
$('input[name="pri"]').remove();
|
||||
$('#pri').after("<input type='hidden' name='pri' value='" + pri + "'/>");
|
||||
}
|
||||
|
||||
$('#impact, #chance').change(function(){computeIndex()});
|
||||
})
|
||||
</script>
|
||||
70
module/risk/lang/zh-cn.php
Normal file
70
module/risk/lang/zh-cn.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/* Actions */
|
||||
$lang->risk->batchCreate = '批量添加';
|
||||
$lang->risk->create = '添加风险';
|
||||
$lang->risk->browse = '浏览列表';
|
||||
|
||||
/* Fields */
|
||||
$lang->risk->common = '风险';
|
||||
$lang->risk->source = '来源';
|
||||
$lang->risk->id = '编号';
|
||||
$lang->risk->name = '风险名称';
|
||||
$lang->risk->category = '类型';
|
||||
$lang->risk->strategy = '策略';
|
||||
$lang->risk->status = '状态';
|
||||
$lang->risk->impact = '影响程度';
|
||||
$lang->risk->probability = '发生概率';
|
||||
$lang->risk->riskindex = '风险系数';
|
||||
$lang->risk->pri = '优先级';
|
||||
$lang->risk->prevention = '处理措施';
|
||||
$lang->risk->remedy = '应急措施';
|
||||
$lang->risk->identifiedDate = '识别日期';
|
||||
$lang->risk->plannedClosedDate = '计划关闭日期';
|
||||
$lang->risk->assignedTo = '指派给';
|
||||
$lang->risk->createdBy = '由谁创建';
|
||||
$lang->risk->createdDate = '创建日期';
|
||||
|
||||
$lang->risk->sourceList[''] = '';
|
||||
$lang->risk->sourceList['business'] = '业务部门';
|
||||
$lang->risk->sourceList['team'] = '项目组';
|
||||
$lang->risk->sourceList['logistic'] = '项目保障科室';
|
||||
$lang->risk->sourceList['manage'] = '管理层';
|
||||
$lang->risk->sourceList['sourcing'] = '供应商-采购';
|
||||
$lang->risk->sourceList['outsourcing'] = '供应商-外包';
|
||||
$lang->risk->sourceList['customer'] = '外部客户';
|
||||
$lang->risk->sourceList['others'] = '其他';
|
||||
|
||||
$lang->risk->categoryList[''] = '';
|
||||
$lang->risk->categoryList['technical'] = '技术类';
|
||||
$lang->risk->categoryList['manage'] = '管理类';
|
||||
$lang->risk->categoryList['business'] = '业务类';
|
||||
$lang->risk->categoryList['requirement'] = '需求类';
|
||||
$lang->risk->categoryList['resource'] = '资源类';
|
||||
$lang->risk->categoryList['others'] = '其他';
|
||||
|
||||
$lang->risk->impactList[1] = 1;
|
||||
$lang->risk->impactList[2] = 2;
|
||||
$lang->risk->impactList[3] = 3;
|
||||
$lang->risk->impactList[4] = 4;
|
||||
$lang->risk->impactList[5] = 5;
|
||||
|
||||
$lang->risk->probabilityList[1] = 1;
|
||||
$lang->risk->probabilityList[2] = 2;
|
||||
$lang->risk->probabilityList[3] = 3;
|
||||
$lang->risk->probabilityList[4] = 4;
|
||||
$lang->risk->probabilityList[5] = 5;
|
||||
|
||||
$lang->risk->priList['high'] = '高';
|
||||
$lang->risk->priList['middle'] = '中';
|
||||
$lang->risk->priList['low'] = '低';
|
||||
|
||||
$lang->risk->statusList['active'] = '开放';
|
||||
$lang->risk->statusList['closed'] = '关闭';
|
||||
$lang->risk->statusList['hangup'] = '挂起';
|
||||
$lang->risk->statusList['canceled'] = '取消';
|
||||
|
||||
$lang->risk->strategyList[''] = '';
|
||||
$lang->risk->strategyList['avoidance'] = '规避';
|
||||
$lang->risk->strategyList['mitigation'] = '缓解';
|
||||
$lang->risk->strategyList['transference'] = '转移';
|
||||
$lang->risk->strategyList['acceptance'] = '接受';
|
||||
83
module/risk/model.php
Normal file
83
module/risk/model.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
class riskModel extends model
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
$risk = fixer::input('post')
|
||||
->add('program', $this->session->program)
|
||||
->add('createdBy', $this->app->user->account)
|
||||
->add('createdDate', helper::today())
|
||||
->stripTags($this->config->risk->editor->create['id'], $this->config->allowedTags)
|
||||
->remove('uid')
|
||||
->get();
|
||||
|
||||
$risk = $this->loadModel('file')->processImgURL($risk, $this->config->risk->editor->create['id'], $this->post->uid);
|
||||
$this->dao->insert(TABLE_RISK)->data($risk)->autoCheck()->batchCheck($this->config->risk->create->requiredFields, 'notempty')->exec();
|
||||
|
||||
if(!dao::isError()) return $this->dao->lastInsertID();
|
||||
return false;
|
||||
}
|
||||
|
||||
public function batchCreate()
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
|
||||
$this->loadModel('action');
|
||||
foreach($data->name as $i => $name)
|
||||
{
|
||||
if(!$name) continue;
|
||||
|
||||
$risk = new stdclass();
|
||||
$risk->name = $name;
|
||||
$risk->percent = $data->percent[$i];
|
||||
$risk->type = $data->type[$i];
|
||||
$risk->createdBy = $this->app->user->account;
|
||||
$risk->createdDate = helper::today();
|
||||
|
||||
$this->dao->insert(TABLE_RISK)->data($risk)->autoCheck()->exec();
|
||||
|
||||
$riskID = $this->dao->lastInsertID();
|
||||
$this->action->create('risk', $riskID, 'Opened');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($riskID)
|
||||
{
|
||||
$oldStage = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
|
||||
|
||||
$risk = fixer::input('post')
|
||||
->add('editedBy', $this->app->user->account)
|
||||
->add('editedDate', helper::today())
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldStage, $risk);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getList($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_RISK)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('program')->eq($this->session->program)
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
public function getPairs()
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_RISK)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('program')->eq($this->session->program)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
public function getByID($riskID)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
|
||||
}
|
||||
}
|
||||
60
module/risk/view/browse.html.php
Normal file
60
module/risk/view/browse.html.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php include "../../common/view/header.html.php"?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toobar pull-left">
|
||||
<a href="" class="btn btn-link btn-active-text">
|
||||
<span class="text"><?php echo $lang->risk->browse;?></span>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php common::printLink('risk', 'batchCreate', "", "<i class='icon icon-plus'></i>" . $lang->risk->batchCreate, '', "class='btn btn-primary'");?>
|
||||
<?php common::printLink('risk', 'create', "", "<i class='icon icon-plus'></i>" . $lang->risk->create, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainContent" class="main-table">
|
||||
<?php if(empty($risks)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->noData;?></span>
|
||||
<?php if(common::hasPriv('risk', 'create')):?>
|
||||
<?php echo html::a($this->createLink('risk', 'create'), "<i class='icon icon-plus'></i> " . $lang->risk->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<table class="table has-sort-head" id='riskList'>
|
||||
<?php $vars = "orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='text-left w-60px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->risk->id);?></th>
|
||||
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->risk->name);?></th>
|
||||
<th class='w-100px'><?php common::printOrderLink('strategy', $orderBy, $vars, $lang->risk->strategy);?></th>
|
||||
<th class='w-120px'><?php common::printOrderLink('status', $orderBy, $vars, $lang->risk->status);?></th>
|
||||
<th class='w-120px'><?php common::printOrderLink('identifiedDate', $orderBy, $vars, $lang->risk->identifiedDate);?></th>
|
||||
<th class='w-100px'><?php common::printOrderLink('riskindex', $orderBy, $vars, $lang->risk->riskindex);?></th>
|
||||
<th class='w-100px'><?php common::printOrderLink('pri', $orderBy, $vars, $lang->risk->pri);?></th>
|
||||
<th class='w-120px'><?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->risk->assignedTo);?></th>
|
||||
<th class='w-120px'><?php common::printOrderLink('category', $orderBy, $vars, $lang->risk->category);?></th>
|
||||
<th class='w-120px'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($risks as $risk):?>
|
||||
<tr>
|
||||
<td><?php echo printf('%03d', $risk->id);?></td>
|
||||
<td><?php echo $risk->name;?></td>
|
||||
<td><?php echo zget($lang->risk->strategyList, $risk->strategy);?></td>
|
||||
<td><?php echo zget($lang->risk->statusList, $risk->status);?></td>
|
||||
<td><?php echo $risk->identifiedDate;?></td>
|
||||
<td><?php echo $risk->riskindex;?></td>
|
||||
<td><?php echo zget($lang->risk->priList, $risk->pri)?></td>
|
||||
<td><?php echo zget($users, $risk->assignedTo);?></td>
|
||||
<td><?php echo zget($lang->risk->categoryList, $risk->category);?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='table-footer'>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include "../../common/view/footer.html.php"?>
|
||||
70
module/risk/view/create.html.php
Normal file
70
module/risk/view/create.html.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<div id="mainContent" class="main-content fade">
|
||||
<div class="center-block">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->risk->create;?></h2>
|
||||
</div>
|
||||
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
|
||||
<table class="table table-form">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->source;?></th>
|
||||
<td><?php echo html::select('source', $lang->risk->sourceList, '', "class='form-control chosen'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->category;?></th>
|
||||
<td><?php echo html::select('category', $lang->risk->categoryList, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->strategy;?></th>
|
||||
<td><?php echo html::select('strategy', $lang->risk->strategyList, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->impact;?></th>
|
||||
<td><?php echo html::select('impact', $lang->risk->impactList, 3, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->probability;?></th>
|
||||
<td><?php echo html::select('probability', $lang->risk->probabilityList, 3, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->riskindex;?></th>
|
||||
<td><?php echo html::input('riskindex', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->pri;?></th>
|
||||
<td><?php echo html::select('pri', $lang->risk->priList, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->plannedClosedDate;?></th>
|
||||
<td><?php echo html::input('plannedClosedDate', '', "class='form-control form-date'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->assignedTo;?></th>
|
||||
<td><?php echo html::select('assignedTo', $users, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->prevention;?></th>
|
||||
<td colspan='2'><?php echo html::textarea('prevention', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->risk->remedy;?></th>
|
||||
<td colspan='2'><?php echo html::textarea('remedy', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='form-actions text-center'>
|
||||
<?php echo html::submitButton() . html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -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;
|
||||
@@ -38,6 +39,32 @@ class stage extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function batchCreate()
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->stage->batchCreate();
|
||||
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
if(dao::isError())
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
$this->send($response);
|
||||
}
|
||||
|
||||
$response['locate'] = inlink('browse');
|
||||
$this->send($response);
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->stage->common . $this->lang->colon . $this->lang->stage->batchCreate;
|
||||
$this->view->position[] = $this->lang->stage->common;
|
||||
$this->view->position[] = $this->lang->stage->batchCreate;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function edit($stageID = 0)
|
||||
{
|
||||
$stage = $this->stage->getByID($stageID);
|
||||
@@ -56,7 +83,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 +116,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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ $lang->stage->edit = '编辑';
|
||||
$lang->stage->delete = '删除';
|
||||
$lang->stage->view = '阶段详情';
|
||||
|
||||
|
||||
/* Fields. */
|
||||
$lang->stage->common = '阶段';
|
||||
$lang->stage->id = '编号';
|
||||
$lang->stage->name = '阶段名称';
|
||||
$lang->stage->type = '阶段分类';
|
||||
$lang->stage->percent = '工作量比例';
|
||||
@@ -22,3 +22,7 @@ $lang->stage->typeList['qa'] = '测试';
|
||||
$lang->stage->typeList['release'] = '发布';
|
||||
$lang->stage->typeList['review'] = '总结评审';
|
||||
$lang->stage->typeList['other'] = '其他';
|
||||
|
||||
$lang->stage->viewList = '浏览列表';
|
||||
$lang->stage->noStage = '暂时没有阶段';
|
||||
$lang->stage->confirmDelete = '您确定要执行删除操作吗?';
|
||||
|
||||
@@ -14,6 +14,31 @@ class stageModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
public function batchCreate()
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
|
||||
$this->loadModel('action');
|
||||
foreach($data->name as $i => $name)
|
||||
{
|
||||
if(!$name) continue;
|
||||
|
||||
$stage = new stdclass();
|
||||
$stage->name = $name;
|
||||
$stage->percent = $data->percent[$i];
|
||||
$stage->type = $data->type[$i];
|
||||
$stage->createdBy = $this->app->user->account;
|
||||
$stage->createdDate = helper::today();
|
||||
|
||||
$this->dao->insert(TABLE_STAGE)->data($stage)->autoCheck()->exec();
|
||||
|
||||
$stageID = $this->dao->lastInsertID();
|
||||
$this->action->create('stage', $stageID, 'Opened');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($stageID)
|
||||
{
|
||||
$oldStage = $this->dao->select('*')->from(TABLE_STAGE)->where('id')->eq((int)$stageID)->fetch();
|
||||
@@ -29,9 +54,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 +71,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();
|
||||
}
|
||||
}
|
||||
|
||||
34
module/stage/view/batchcreate.html.php
Normal file
34
module/stage/view/batchcreate.html.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainContent" class="main-content fade">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->stage->batchCreate;?></h2>
|
||||
</div>
|
||||
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
|
||||
<table class="table table-form">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-50px'><?php echo $lang->stage->id;?></th>
|
||||
<th><?php echo $lang->stage->name;?></th>
|
||||
<th class='w-200px'><?php echo $lang->stage->percent;?></th>
|
||||
<th class='w-200px'><?php echo $lang->stage->type;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for($i = 1; $i <= 10; $i ++):?>
|
||||
<tr>
|
||||
<td><?php echo $i;?></td>
|
||||
<td><?php echo html::input("name[$i]", '', "class='form-control'");?></td>
|
||||
<td><?php echo html::input("percent[$i]", '', "class='form-control'");?></td>
|
||||
<td><?php echo html::select("type[$i]", $lang->stage->typeList, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<?php endfor;?>
|
||||
<tr>
|
||||
<td colspan='4' class='form-actions text-center'>
|
||||
<?php echo html::submitButton() . html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -1,8 +1,53 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toobar pull-left">
|
||||
<a href="" class="btn btn-link btn-active-text">
|
||||
<span class="text"><?php echo $lang->stage->viewList;?></span>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php common::printLink('stage', 'batchCreate', "", "<i class='icon icon-plus'></i>" . $lang->stage->batchCreate, '', "class='btn btn-primary'");?>
|
||||
<?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
|
||||
common::printIcon('stage', 'edit', "stageID=$stage->id", "", "list");
|
||||
common::printIcon('stage', 'delete', "stageID=$stage->id", "", "list", '', 'hiddenwin');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -36,4 +36,5 @@
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user