* Add risk module.

This commit is contained in:
holan20180123
2020-08-20 14:56:37 +08:00
parent fc664a5bb0
commit 1ed91ca918
19 changed files with 460 additions and 297 deletions
+1 -1
View File
@@ -60,4 +60,4 @@ $config->risk->search['params']['activateBy'] = array('operator' => '=',
$config->risk->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['cancelBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['hangupBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
+198 -59
View File
@@ -1,12 +1,23 @@
<?php
class risk extends control
{
/**
* Browse risk
*
* @param string $browseType
* @param string $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browse($browseType = 'all', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* Build the search form. */
$actionURL = $this->createLink('risk', 'browse', "browseType=bySearch&queryID=myQueryID");
$this->config->risk->search['onMenuBar'] = 'yes';
$actionURL = $this->createLink('risk', 'browse', "browseType=bysearch&queryID=myQueryID");
$this->risk->buildSearchForm($queryID, $actionURL);
/* Load pager. */
@@ -14,18 +25,24 @@ class risk extends control
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($browseType, $param, $orderBy, $pager);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$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($browseType, $param, $orderBy, $pager);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
/**
* Create risk
*
* @access public
* @return void
*/
public function create()
{
if($_POST)
@@ -46,13 +63,20 @@ class risk extends control
$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->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create;
$this->view->position[] = $this->lang->risk->create;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* Edit risk
*
* @param int $riskID
* @access public
* @return void
*/
public function edit($riskID)
{
if($_POST)
@@ -69,25 +93,38 @@ class risk extends control
}
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Edited');
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->action->create('risk', $riskID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
$response['locate'] = inlink('browse');
$response['locate'] = inlink('browse');
$this->send($response);
}
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit;
$this->view->position[] = $this->lang->risk->edit;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit;
$this->view->position[] = $this->lang->risk->edit;
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* View a risk
*
* @param int $riskID
* @access public
* @return void
*/
public function view($riskID)
{
$this->loadModel('action');
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->view;
$this->view->position[] = $this->lang->risk->view;
$this->view->risk = $this->risk->getById($riskID);
$this->view->actions = $this->action->getList('risk', $riskID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -95,6 +132,46 @@ class risk extends control
$this->display();
}
/**
* Batch create
*
* @access public
* @return void
*/
public function batchCreate()
{
if($_POST)
{
$this->risk->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->risk->common . $this->lang->colon . $this->lang->risk->batchCreate;
$this->view->position[] = $this->lang->risk->batchCreate;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* Delete a risk.
*
* @param int $riskID
* @param string $confirm
* @access public
* @return void
*/
public function delete($riskID, $confirm = 'no')
{
$risk = $this->risk->getById($riskID);
@@ -112,11 +189,19 @@ class risk extends control
}
}
/**
* Track a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function track($riskID)
{
if($_POST)
{
$changes = $this->risk->track($riskID);
$changes = array();
if($this->post->isChange == 1) $changes = $this->risk->track($riskID);
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
@@ -128,20 +213,31 @@ class risk extends control
}
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Tracked' . $this->post->commnet);
$this->action->logHistory($actionID, $changes);
if(!empty($changes) or $_POST['comment'])
{
$actionID = $this->action->create('risk', $riskID, 'Tracked', $_POST['comment']);
$this->action->logHistory($actionID, $changes);
}
$response['locate'] = inlink('browse');
$this->send($response);
}
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->track;
$this->view->position[] = $this->lang->risk->track;
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* Update assign of risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function assignTo($riskID)
{
if($_POST)
@@ -150,22 +246,32 @@ class risk extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo;
$this->view->position[] = $this->lang->risk->assignedTo;
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo;
$this->view->risk = $risk;
$this->display();
}
/**
* Cancel a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function cancel($riskID)
{
if($_POST)
@@ -174,21 +280,31 @@ class risk extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel;
$this->view->risk = $risk;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel;
$this->view->position[] = $this->lang->risk->cancel;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* Close a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function close($riskID)
{
if($_POST)
@@ -196,22 +312,32 @@ class risk extends control
$changes = $this->risk->close($riskID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close;
$this->view->position[] = $this->lang->risk->close;
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close;
$this->view->risk = $risk;
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* Hangup a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function hangup($riskID)
{
if($_POST)
@@ -219,22 +345,32 @@ class risk extends control
$changes = $this->risk->hangup($riskID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup;
$this->view->risk = $risk;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup;
$this->view->position[] = $this->lang->risk->hangup;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* Activate a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function activate($riskID)
{
if($_POST)
@@ -242,19 +378,22 @@ class risk extends control
$changes = $this->risk->activate($riskID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate;
$this->view->risk = $risk;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate;
$this->view->position[] = $this->lang->risk->activate;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
}
-7
View File
@@ -1,7 +0,0 @@
<?php
$lang->risk->comment = '备注';
$lang->risk->isChanged = '风险是否有变化';
$lang->risk->changedList[''] = '';
$lang->risk->changedList['1'] = '是';
$lang->risk->changedList['2'] = '否';
@@ -1,14 +0,0 @@
<?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';?>
@@ -1,14 +0,0 @@
<?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';?>
@@ -1,28 +0,0 @@
<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>
@@ -1,28 +0,0 @@
<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>
@@ -1,28 +0,0 @@
<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>
-5
View File
@@ -1,8 +1,3 @@
$(function()
{
$('.track').addClass('hidden');
})
function refreshPage(obj)
{
var value = obj.value;
+6 -5
View File
@@ -4,6 +4,7 @@ $lang->risk->batchCreate = '批量添加';
$lang->risk->create = '添加风险';
$lang->risk->edit = '编辑风险';
$lang->risk->browse = '浏览列表';
$lang->risk->view = '风险详情';
$lang->risk->activate = '激活';
$lang->risk->hangup = '挂起';
$lang->risk->close = '关闭';
@@ -13,10 +14,6 @@ $lang->risk->assignTo = '指派';
$lang->risk->deleted = '删除';
$lang->risk->byQuery = '搜索';
$lang->risk->legendBasicInfo = '基本信息';
$lang->risk->legendLifeTime = '风险的一生';
$lang->risk->confirmDelete = '您确认删除该风险吗?';
/* Fields */
$lang->risk->common = '风险';
$lang->risk->source = '来源';
@@ -49,12 +46,16 @@ $lang->risk->hangupBy = '由谁挂起';
$lang->risk->hangupDate = '挂起日期';
$lang->risk->activateBy = '由谁激活';
$lang->risk->activateDate = '激活日期';
$lang->risk->isChange = '是否有变化';
$lang->risk->isChange = '风险是否变化';
$lang->risk->trackedBy = '由谁跟踪';
$lang->risk->trackedDate = '跟踪日期';
$lang->risk->editedBy = '由谁编辑';
$lang->risk->editedDate = '编辑日期';
$lang->risk->legendBasicInfo = '基本信息';
$lang->risk->legendLifeTime = '风险的一生';
$lang->risk->confirmDelete = '您确认删除该风险吗?';
$lang->risk->action = new stdclass();
$lang->risk->action->hangup = '$date, 由 <strong>$actor</strong> 挂起。' . "\n";
$lang->risk->action->tracked = '$date, 由 <strong>$actor</strong> 跟踪。' . "\n";
+118 -7
View File
@@ -1,6 +1,12 @@
<?php
class riskModel extends model
{
/**
* Create a bug.
*
* @access public
* @return int|bool
*/
public function create()
{
$risk = fixer::input('post')
@@ -18,6 +24,12 @@ class riskModel extends model
return false;
}
/**
* Batch create risk.
*
* @access public
* @return bool
*/
public function batchCreate()
{
$data = fixer::input('post')->get();
@@ -29,8 +41,10 @@ class riskModel extends model
$risk = new stdclass();
$risk->name = $name;
$risk->percent = $data->percent[$i];
$risk->type = $data->type[$i];
$risk->source = $data->source[$i];
$risk->category = $data->category[$i];
$risk->strategy = $data->strategy[$i];
$risk->program = $this->session->program;
$risk->createdBy = $this->app->user->account;
$risk->createdDate = helper::today();
@@ -43,6 +57,13 @@ class riskModel extends model
return true;
}
/**
* Update a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function update($riskID)
{
$oldRisk = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
@@ -60,6 +81,13 @@ class riskModel extends model
return false;
}
/**
* Track a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function track($riskID)
{
$oldRisk = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
@@ -68,8 +96,7 @@ class riskModel extends model
->add('editedBy', $this->app->user->account)
->add('editedDate', helper::today())
->stripTags($this->config->risk->editor->track['id'], $this->config->allowedTags)
->remove('ischange,comment,uid')
->removeIF($this->post->isChange == 0, 'name,category,strategy,impact,probability,riskindex,pri,prevention,resolution' )
->remove('isChange,comment,uid,files,label')
->get();
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
@@ -78,6 +105,16 @@ class riskModel extends model
return false;
}
/**
* Get risks List.
*
* @param string $browseType
* @param string $param
* @param string $orderBy
* @param int $pager
* @access public
* @return object
*/
public function getList($browseType = '', $param = '', $orderBy = 'id_desc', $pager = null)
{
if($browseType == 'bySearch') return $this->getBySearch($param, $orderBy, $pager);
@@ -92,9 +129,18 @@ class riskModel extends model
->fetchAll('id');
}
/**
* Get risks by search
*
* @param string $queryID
* @param string $orderBy
* @param int $pager
* @access public
* @return object
*/
public function getBySearch($queryID = '', $orderBy = 'id_desc', $pager = null)
{
if($queryID)
if($queryID && $queryID != 'myQueryID')
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
@@ -112,7 +158,7 @@ class riskModel extends model
if($this->session->riskQuery == false) $this->session->set('riskQuery', ' 1 = 1');
}
$riskQuery = $this->session->riskQuery;
$riskQuery = $this->session->riskQuery;
return $this->dao->select('*')->from(TABLE_RISK)
->where($riskQuery)
@@ -123,6 +169,12 @@ class riskModel extends model
->fetchAll('id');
}
/**
* Get risks of pairs
*
* @access public
* @return object
*/
public function getPairs()
{
return $this->dao->select('id, name')->from(TABLE_RISK)
@@ -131,11 +183,26 @@ class riskModel extends model
->fetchPairs();
}
/**
* Get risk by ID
*
* @param int $riskID
* @access public
* @return object
*/
public function getByID($riskID)
{
return $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
}
/**
* Print assignedTo html
*
* @param int $risk
* @param int $users
* @access public
* @return string
*/
public function printAssignedHtml($risk, $users)
{
$btnTextClass = '';
@@ -156,6 +223,13 @@ class riskModel extends model
echo !common::hasPriv('risk', 'assignTo', $risk) ? "<span style='padding-left: 21px' class='{$btnTextClass}'>{$assignedToText}</span>" : $assignToHtml;
}
/**
* Assign a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function assign($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -165,7 +239,7 @@ class riskModel extends model
->add('editedDate', helper::today())
->setDefault('assignedDate', helper::today())
->stripTags($this->config->risk->editor->assignto['id'], $this->config->allowedTags)
->remove('uid,comment')
->remove('uid,comment,files,label')
->get();
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
@@ -174,6 +248,13 @@ class riskModel extends model
return false;
}
/**
* Cancel a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function cancel($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -192,6 +273,13 @@ class riskModel extends model
return false;
}
/**
* Close a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function close($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -210,6 +298,13 @@ class riskModel extends model
return false;
}
/**
* Hangup a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function hangup($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -226,6 +321,13 @@ class riskModel extends model
return false;
}
/**
* Activate a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function activate($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -242,6 +344,15 @@ class riskModel extends model
return false;
}
/**
* Adjust the action is clickable.
*
* @param int $risk
* @param int $action
* @static
* @access public
* @return bool
*/
public static function isClickable($risk, $action)
{
$action = strtolower($action);
+2 -1
View File
@@ -17,7 +17,8 @@
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td> </tr>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
</tbody>
+36
View File
@@ -0,0 +1,36 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainContent" class="main-content fade">
<div class="main-header">
<h2><?php echo $lang->risk->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->risk->id;?></th>
<th><?php echo $lang->risk->name;?></th>
<th class='w-200px'><?php echo $lang->risk->source;?></th>
<th class='w-200px'><?php echo $lang->risk->category;?></th>
<th class='w-200px'><?php echo $lang->risk->strategy;?></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::select("source[$i]", $lang->risk->sourceList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select("category[$i]", $lang->risk->categoryList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select("strategy[$i]", $lang->risk->strategyList, '', "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';?>
+4 -2
View File
@@ -26,9 +26,11 @@
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td> </tr>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td>
</tr>
</tbody>
</table>
</form>
+2 -1
View File
@@ -21,7 +21,8 @@
<td></td>
</tr> <tr>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td> </tr>
<td colspan='2'><?php echo html::textarea('resolution', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
</tbody>
+1
View File
@@ -12,6 +12,7 @@
<th><?php echo $lang->risk->source;?></th>
<td><?php echo html::select('source', $lang->risk->sourceList, '', "class='form-control chosen'");?></td>
<td></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->risk->name;?></th>
+74 -74
View File
@@ -8,81 +8,81 @@
<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->name;?></th>
<td><?php echo html::input('name', $risk->name, "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<tr>
<th><?php echo $lang->risk->source;?></th>
<td><?php echo html::select('source', $lang->risk->sourceList, $risk->source, "class='form-control chosen'");?></td>
</tr>
<th><?php echo $lang->risk->category;?></th>
<td><?php echo html::select('category', $lang->risk->categoryList, $risk->category, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->strategy;?></th>
<td><?php echo html::select('strategy', $lang->risk->strategyList, $risk->strategy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->status;?></th>
<td><?php echo html::select('status', $lang->risk->statusList, $risk->status, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->impact;?></th>
<td><?php echo html::select('impact', $lang->risk->impactList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->probability;?></th>
<td><?php echo html::select('probability', $lang->risk->probabilityList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->riskindex;?></th>
<td><?php echo html::input('riskindex', $risk->riskindex, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->pri;?></th>
<td><?php echo html::select('pri', $lang->risk->priList, $risk->pri, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->identifiedDate;?></th>
<td><?php echo html::input('identifiedDate', $risk->identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->prevention;?></th>
<td colspan='2'><?php echo html::textarea('prevention', $risk->prevention, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->remedy;?></th>
<td colspan='2'><?php echo html::textarea('remedy', $risk->remedy, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->plannedClosedDate;?></th>
<td><?php echo html::input('plannedClosedDate', $risk->plannedClosedDate == '0000-00-00' ? '' : $risk->plannedClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->actualClosedDate;?></th>
<td><?php echo html::input('actualClosedDate', $risk->actualClosedDate == '0000-00-00' ? '' : $risk->actualClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', $risk->resolution, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolvedBy;?></th>
<td><?php echo html::select('resolvedBy', $users, empty($risk->resolvedBy) ? $this->app->user->account : $risk->resolvedBy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, empty($risk->assignedTo) ? $this->app->user->account : $risk->assignedTo, "class='form-control chosen'");?></td>
</tr>
<tr>
<td colspan='3' class='form-actions text-center'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
<th><?php echo $lang->risk->name;?></th>
<td><?php echo html::input('name', $risk->name, "class='form-control'");?></td>
<td></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->risk->source;?></th>
<td><?php echo html::select('source', $lang->risk->sourceList, $risk->source, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->category;?></th>
<td><?php echo html::select('category', $lang->risk->categoryList, $risk->category, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->strategy;?></th>
<td><?php echo html::select('strategy', $lang->risk->strategyList, $risk->strategy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->status;?></th>
<td><?php echo html::select('status', $lang->risk->statusList, $risk->status, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->impact;?></th>
<td><?php echo html::select('impact', $lang->risk->impactList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->probability;?></th>
<td><?php echo html::select('probability', $lang->risk->probabilityList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->riskindex;?></th>
<td><?php echo html::input('riskindex', $risk->riskindex, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->pri;?></th>
<td><?php echo html::select('pri', $lang->risk->priList, $risk->pri, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->identifiedDate;?></th>
<td><?php echo html::input('identifiedDate', $risk->identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->plannedClosedDate;?></th>
<td><?php echo html::input('plannedClosedDate', $risk->plannedClosedDate == '0000-00-00' ? '' : $risk->plannedClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->actualClosedDate;?></th>
<td><?php echo html::input('actualClosedDate', $risk->actualClosedDate == '0000-00-00' ? '' : $risk->actualClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolvedBy;?></th>
<td><?php echo html::select('resolvedBy', $users, empty($risk->resolvedBy) ? $this->app->user->account : $risk->resolvedBy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, empty($risk->assignedTo) ? $this->app->user->account : $risk->assignedTo, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->prevention;?></th>
<td colspan='2'><?php echo html::textarea('prevention', $risk->prevention, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->remedy;?></th>
<td colspan='2'><?php echo html::textarea('remedy', $risk->remedy, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', $risk->resolution, "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>
-7
View File
@@ -1,7 +0,0 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
params browse.html.php /^ $params = "riskID=$risk->id";$/;" v
+18 -16
View File
@@ -12,50 +12,52 @@
<th><?php echo $lang->risk->isChange;?></th>
<td><?php echo html::radio('isChange', $lang->risk->isChangeList, 0, "onclick=refreshPage(this)");?></td>
<td></td>
<td></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->name;?></th>
<td><?php echo html::input('name', $risk->name, "class='form-control'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->category;?></th>
<td><?php echo html::select('category', $lang->risk->categoryList, $risk->category, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->strategy;?></th>
<td><?php echo html::select('strategy', $lang->risk->strategyList, $risk->strategy, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->impact;?></th>
<td><?php echo html::select('impact', $lang->risk->impactList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->probability;?></th>
<td><?php echo html::select('probability', $lang->risk->probabilityList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->riskindex;?></th>
<td><?php echo html::input('riskindex', $risk->riskindex, "class='form-control'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->pri;?></th>
<td><?php echo html::select('pri', $lang->risk->priList, $risk->pri, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->trackedBy;?></th>
<td><?php echo html::select('trackedBy', $users, $this->app->user->account, "class='form-control chosen'");?></td>
</tr>
<tr class='track hidden'>
<th><?php echo $lang->risk->trackedDate;?></th>
<td><?php echo html::input('trackedDate', $risk->trackedDate == '0000-00-00' ? helper::today() : $risk->trackedDate , "class='form-control form-date'");?></td>
</tr>
<tr class='track hidden'>
<th><?php echo $lang->risk->prevention;?></th>
<td colspan='2'><?php echo html::textarea('prevention', $risk->prevention, "class='form-control'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', $risk->resolution, "class='form-control'");?></td>
</tr>
<tr class='track'>
<th><?php echo $lang->risk->trackedBy;?></th>
<td><?php echo html::select('trackedBy', $users, $this->app->user->account, "class='form-control chosen'");?></td>
<tr class='track'>
<th><?php echo $lang->risk->trackedDate;?></th>
<td><?php echo html::input('trackedDate', $risk->trackedDate == '0000-00-00' ? $risk->trackedDate : helper::today(), "class='form-control form-date'");?></td>
</tr>
<tr class='not-track'>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "class='form-control'");?></td>