diff --git a/application/modules/courses/views/scripts/queue-manager/request-table.phtml b/application/modules/courses/views/scripts/queue-manager/request-table.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c0d8772d4c8eac1959ffe68b965cd5ad7420e7ca --- /dev/null +++ b/application/modules/courses/views/scripts/queue-manager/request-table.phtml @@ -0,0 +1,53 @@ +<?php + +$requestCourses = Courses_CourseModel::findLatestOfRequest($this->requests); +$requestCourses->orderBy('getCourseCode'); +$requestVotes = Requests_ApproverVoteModel::findVotesForRequests($this->requests); + +$cutoffDate = new Zend_Date(); +$cutoffDate->subDay(50); + +$requestUserVotes = array(); +$userIds = array(); +foreach ($requestVotes as $requestId => $votes) { + foreach ($votes as $voteId => $vote) { + if ($vote->getApprovalAction() != $this->action->getId()) { + continue; + } + if ($vote->getTime()->isEarlier($cutoffDate)) { + continue; + } + $userIds[$vote->getUser()] = $vote->getUser(); + $requestUserVotes[$requestId][$vote->getUser()] = $vote->getVote(); + } +} + +$users = Auth_UserModel::find($userIds); +$users->orderBy('getLastName'); + +?> + + + +<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/courses/queue-manager/request-table.css', 'all'); ?> +<table class="zentable primary" id="courseRequestTable"> + <tr> + <th>Course Code</th> + <?php foreach ($users as $user) { ?> + <th><?php echo $user->getFirstName() . ' ' . $user->getLastName(); ?></th> + <?php } ?> + </tr> + +<?php foreach ($requestCourses as $course) { + $request = $this->requests[$course->getRequest()]; + $userVotes = $requestUserVotes[$request->getId()]; ?> + <tr> + <td><?php echo $course->getCourseCode(); ?></td> + <?php foreach ($users as $user) { + $vote = $userVotes[$user->getId()]; ?> + <td><?php echo $vote; ?></td> + <?php } ?> + </tr> + +<?php } ?> +</table> \ No newline at end of file diff --git a/application/modules/requests/controllers/QueueManagerController.php b/application/modules/requests/controllers/QueueManagerController.php index b6312b63e49be828273a367459302f2ccf6344d1..544a41c782befca7ffca247c3239005cf2bc1913 100644 --- a/application/modules/requests/controllers/QueueManagerController.php +++ b/application/modules/requests/controllers/QueueManagerController.php @@ -22,10 +22,18 @@ class Requests_QueueManagerController extends App_Controller_Action { $in = $this->_getAllParams(); $queue = Requests_ApprovalActionModel::find($in['id']); - $requests = Requests_RequestModel::findWithCurrentApprovalAction($queue); + $allRequests = Requests_RequestModel::findWithCurrentApprovalAction($queue); + $moduleRequests = array(); + foreach ($allRequests as $request) { + $module = $request->getModule(); + if (!$moduleRequests[$module]) { + $moduleRequests[$module] = new Unl_Model_Collection('Requests_RequestModel'); + } + $moduleRequests[$module][$request->getId()] = $request; + } $this->view->queue = $queue; - $this->view->requests = $requests; + $this->view->moduleRequests = $moduleRequests; } public function editPostAction() diff --git a/application/modules/requests/views/scripts/queue-manager/view.phtml b/application/modules/requests/views/scripts/queue-manager/view.phtml index aa45df692fd5473a19222654091822bb28197290..fd2f29934812c1d21237dd0c4fa35e3ebc207f1e 100644 --- a/application/modules/requests/views/scripts/queue-manager/view.phtml +++ b/application/modules/requests/views/scripts/queue-manager/view.phtml @@ -1,8 +1,8 @@ <?php $this->layout()->breadcrumbs = array('Queue Manager: ' . $this->queue->getName()); ?> <h3>Requests:</h3> -<ul> -<?php foreach ($this->requests as $request) { ?> - <li><a href="<?php echo $this->baseUrl(); ?>/requests/view/index/id/<?php echo $request->getId(); ?>"><?php echo $request->getId(); ?></a></li> -<?php } ?> -</ul> +<?php +foreach ($this->moduleRequests as $module => $requests) { + echo $this->partial('queue-manager/request-table.phtml', $module, array('requests' => $requests, 'action' => $this->queue)); +} +?> diff --git a/document_root/css/courses/queue-manager/request-table.css b/document_root/css/courses/queue-manager/request-table.css new file mode 100644 index 0000000000000000000000000000000000000000..f892601b64d0550a2394295d3e126e0c67ef1725 --- /dev/null +++ b/document_root/css/courses/queue-manager/request-table.css @@ -0,0 +1,4 @@ +@CHARSET "UTF-8"; + +#courseRequestTable {overflow: scroll;} +#courseRequestTable td {text-align: center; white-space:nowrap;} \ No newline at end of file