Skip to content
Snippets Groups Projects
Commit ed81b1ca authored by Tim Steiner's avatar Tim Steiner
Browse files

On the view request screen, when a user can make a decision, show the role(s)...

On the view request screen, when a user can make a decision, show the role(s) that is making the decision.
parent 6d143a8f
Branches
Tags
No related merge requests found
...@@ -54,6 +54,7 @@ class Courses_ViewController extends App_Controller_Action ...@@ -54,6 +54,7 @@ class Courses_ViewController extends App_Controller_Action
$canEdit = false; $canEdit = false;
if ($request->getId()) { if ($request->getId()) {
$possibleAction = Requests_ApprovalActionModel::findByRequest($request); $possibleAction = Requests_ApprovalActionModel::findByRequest($request);
if ($possibleAction) {
if ($possibleAction instanceof Requests_ApprovalActionSubmitterApprovalModel && $request->getOwner() == $user->getId()) { if ($possibleAction instanceof Requests_ApprovalActionSubmitterApprovalModel && $request->getOwner() == $user->getId()) {
$action = $possibleAction; $action = $possibleAction;
} }
...@@ -63,11 +64,16 @@ class Courses_ViewController extends App_Controller_Action ...@@ -63,11 +64,16 @@ class Courses_ViewController extends App_Controller_Action
$allowedRoles = array_intersect(array(1) + $possibleAction->getParticipatingRoleIds(), $userRoles->getId()); $allowedRoles = array_intersect(array(1) + $possibleAction->getParticipatingRoleIds(), $userRoles->getId());
if (count($allowedRoles) > 0) { if (count($allowedRoles) > 0) {
$action = $possibleAction; $action = $possibleAction;
foreach ($allowedRoles as $allowedRole) {
$actionRoleNames[] = $userRoles[$allowedRole]->getName();
}
} }
$editAllowedRoles = array_intersect(array(1) + $possibleAction->getEditingRoleIds(), $userRoles->getId()); $editAllowedRoles = array_intersect(array(1) + $possibleAction->getEditingRoleIds(), $userRoles->getId());
if (count($editAllowedRoles) > 0) { if (count($editAllowedRoles) > 0) {
$canEdit = true; $canEdit = true;
} }
}
if ($action) { if ($action) {
$selectedDecision = '_null'; $selectedDecision = '_null';
...@@ -103,6 +109,7 @@ class Courses_ViewController extends App_Controller_Action ...@@ -103,6 +109,7 @@ class Courses_ViewController extends App_Controller_Action
$this->view->lastList = $list; $this->view->lastList = $list;
$this->view->lastRoleId = $roleId; $this->view->lastRoleId = $roleId;
$this->view->action = $action; $this->view->action = $action;
$this->view->actionRoleNames = $actionRoleNames;
$decisionSession = new Zend_Session_Namespace('decidePostAction'); $decisionSession = new Zend_Session_Namespace('decidePostAction');
$this->view->decisionMessage = $decisionSession->message; $this->view->decisionMessage = $decisionSession->message;
......
...@@ -167,9 +167,11 @@ $this->layout()->breadcrumbs = array($breadcrumb . ': ' . $this->course->getCour ...@@ -167,9 +167,11 @@ $this->layout()->breadcrumbs = array($breadcrumb . ': ' . $this->course->getCour
<?php if ($this->action) { ?> <?php if ($this->action) { ?>
<form id="decisionForm" action="<?php echo $this->baseUrl(); ?>/requests/index/decide.post"> <form id="decisionForm" action="<?php echo $this->baseUrl(); ?>/requests/index/decide.post">
Action: <?php echo $this->action->getName(); ?><br />
<?php echo $this->formHidden('returnUrl', '/courses/view/index/id/' . $this->request->getId()); ?> <?php echo $this->formHidden('returnUrl', '/courses/view/index/id/' . $this->request->getId()); ?>
<?php echo $this->formSelect('decisions[' . $this->request->getId() . ']', $this->selectedDecision, null, array('_null' => $this->defaultDecision) + $this->action->getResultStatusStrings($this->user)); ?> <?php echo $this->formSelect('decisions[' . $this->request->getId() . ']', $this->selectedDecision, null, array('_null' => $this->defaultDecision) + $this->action->getResultStatusStrings($this->user)); ?>
<?php echo $this->formSubmit('submit', 'Submit Decision'); ?> <?php echo $this->formSubmit('submit', 'Submit Decision'); ?>
as <?php echo implode(', ', $this->actionRoleNames); ?>
</form> </form>
<?php } ?> <?php } ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment