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
No related branches found
No related tags found
No related merge requests found
......@@ -54,20 +54,26 @@ class Courses_ViewController extends App_Controller_Action
$canEdit = false;
if ($request->getId()) {
$possibleAction = Requests_ApprovalActionModel::findByRequest($request);
if ($possibleAction instanceof Requests_ApprovalActionSubmitterApprovalModel && $request->getOwner() == $user->getId()) {
$action = $possibleAction;
if ($possibleAction) {
if ($possibleAction instanceof Requests_ApprovalActionSubmitterApprovalModel && $request->getOwner() == $user->getId()) {
$action = $possibleAction;
}
$userRoles = Requests_ApprovalRoleModel::findByUser($user);
$allowedRoles = array_intersect(array(1) + $possibleAction->getParticipatingRoleIds(), $userRoles->getId());
if (count($allowedRoles) > 0) {
$action = $possibleAction;
foreach ($allowedRoles as $allowedRole) {
$actionRoleNames[] = $userRoles[$allowedRole]->getName();
}
}
$editAllowedRoles = array_intersect(array(1) + $possibleAction->getEditingRoleIds(), $userRoles->getId());
if (count($editAllowedRoles) > 0) {
$canEdit = true;
}
}
$userRoles = Requests_ApprovalRoleModel::findByUser($user);
$allowedRoles = array_intersect(array(1) + $possibleAction->getParticipatingRoleIds(), $userRoles->getId());
if (count($allowedRoles) > 0) {
$action = $possibleAction;
}
$editAllowedRoles = array_intersect(array(1) + $possibleAction->getEditingRoleIds(), $userRoles->getId());
if (count($editAllowedRoles) > 0) {
$canEdit = true;
}
if ($action) {
$selectedDecision = '_null';
......@@ -103,6 +109,7 @@ class Courses_ViewController extends App_Controller_Action
$this->view->lastList = $list;
$this->view->lastRoleId = $roleId;
$this->view->action = $action;
$this->view->actionRoleNames = $actionRoleNames;
$decisionSession = new Zend_Session_Namespace('decidePostAction');
$this->view->decisionMessage = $decisionSession->message;
......
......@@ -167,9 +167,11 @@ $this->layout()->breadcrumbs = array($breadcrumb . ': ' . $this->course->getCour
<?php if ($this->action) { ?>
<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->formSelect('decisions[' . $this->request->getId() . ']', $this->selectedDecision, null, array('_null' => $this->defaultDecision) + $this->action->getResultStatusStrings($this->user)); ?>
<?php echo $this->formSubmit('submit', 'Submit Decision'); ?>
as <?php echo implode(', ', $this->actionRoleNames); ?>
</form>
<?php } ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment