diff --git a/application/modules/courses/controllers/ViewController.php b/application/modules/courses/controllers/ViewController.php index 0ac3aeb20261ba8935ea661f5ed0e2cb44304ae4..c86808f312447e035159d322c1cde53c39fd03a1 100644 --- a/application/modules/courses/controllers/ViewController.php +++ b/application/modules/courses/controllers/ViewController.php @@ -68,6 +68,24 @@ class Courses_ViewController extends App_Controller_Action if (count($editAllowedRoles) > 0) { $canEdit = true; } + + if ($action) { + $selectedDecision = '_null'; + $defaultDecision = '--Decision--'; + + $votes = Requests_ApproverVoteModel::findUsersVotesForRequests($user, $request); + $vote = $votes[$request->getId()]; + + if ($vote) { + if ($vote->getApprovalAction() == $action->getId() && $request->getLastApprovalTime()->isEarlier($vote->getTime())) { + $selectedDecision = $vote->getVote(); + } else { + $defaultDecision = 'PREVOTE: ' . $vote->getVote(); + } + } + $this->view->selectedDecision = $selectedDecision; + $this->view->defaultDecision = $defaultDecision; + } } $this->view->request = $request; diff --git a/application/modules/courses/views/scripts/view/index.phtml b/application/modules/courses/views/scripts/view/index.phtml index a88b1b6633089df156f8cef92cfba5727c17bab3..0319f764745f76737df594f974bf08688e7ac57c 100644 --- a/application/modules/courses/views/scripts/view/index.phtml +++ b/application/modules/courses/views/scripts/view/index.phtml @@ -164,7 +164,7 @@ $this->layout()->breadcrumbs = array($breadcrumb . ': ' . $this->course->getCour <?php if ($this->action) { ?> <form id="decisionForm" action="<?php echo $this->baseUrl(); ?>/requests/index/decide.post"> <?php echo $this->formHidden('returnUrl', '/courses/view/index/id/' . $this->request->getId()); ?> - <?php echo $this->formSelect('decisions[' . $this->request->getId() . ']', null, null, array('_null' => '--Decision--') + $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'); ?> </form> <?php } ?>