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

Reporting of approved courses.

parent 85d9a11c
No related branches found
No related tags found
No related merge requests found
<?php
class ReportsController extends Nmc_Controller_Action
{
public function indexAction()
{
header('Location: /Reports/ApprovedCourses/');
}
public function approvedCoursesAction()
{
$in = $this->getRequest();
$requests = Requests::getInstance()->fetchAllSorted('state = "approved"', Requests::COMPLETED_REQUESTS_ONLY);
$uccVote = ApprovalActionsAbstract::getInstance()->fetchRow('name = "UCC Vote"');
$requestData = array();
foreach ($requests as $request) {
$votes = ApproverVotes::getInstance()->fetchByRequestAndAction(
$request,
$uccVote
);
$requestData[] = array('request' => $request,
'voteTally' => $votes->getTally());
}
$view = new Application_View();
$view->page = 'approvedCourses';
$view->requestData = $requestData;
$out = $this->getResponse();
$out->setBody($view->render('unlModernWrapper.xhtml'));
}
}
<?php
class ApproverVoteRowset extends Nmc_Db_Table_Rowset
{
public function getTally()
{
$tally = array();
foreach($this as $vote)
{
if (!array_key_exists($vote->vote, $tally)) {
$tally[$vote->vote] = 0;
}
$tally[$vote->vote]++;
}
return $tally;
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ class ApproverVotes extends Nmc_Db_Table
{
protected $_primary = 'approverVoteId';
protected $_rowClass = 'ApproverVote';
protected $_rowsetClass = 'ApproverVoteRowset';
/**
* The one true instance
......
<?php
foreach ($this->requestData as $requestDatum) {
$request = $requestDatum['request'];
$voteTally = $requestDatum['voteTally'];
?>
<div class="request clear">
<h2>Request Type: <?php echo $request->type->name; ?></h2>
<?php
//$newCourse = $request->course;
$course = $request->getCourseGeneration();
if ($request->type->name == 'ChangeCourse') {
$newCourse = $course;
$oldCourse = $course->getParentGeneration(true);
?>
<div class="old">
<h2>Previous</h2>
<?php echo $this->bulletinEntryDiff($oldCourse, $newCourse); ?>
</div>
<div class="new">
<h2>Current</h2>
<?php echo $this->bulletinEntryDiff($oldCourse, $newCourse); ?>
</div>
<?php
} else {
?>
<?php echo $this->bulletinEntry($course); ?>
<?php
}
?>
<div class="justification clear">
<h2>Justification</h2>
<?php echo $request->justification; ?>
</div>
<?php
$syllabus = $request->getFileByType(RequestFile::SYLLABUS_TYPE);
if ($syllabus) {
?>
<div id="syllabus">
<h2>Syllabus:</h2>
<a href="/Request/GetFile/<?php echo $syllabus->file; ?>">
<?php echo $syllabus->title; ?>
</a>
</div>
<?php } ?>
<?php
$crosslistMemo = $request->getFileByType(RequestFile::CROSSLIST_MEMO_TYPE);
if ($crosslistMemo) {
?>
<div id="crosslistMemo">
<h2>Crosslist Memo</h2>
<a href="/Request/GetFile/<?php echo $crosslistMemo->file; ?>">
<?php echo $crosslistMemo->title; ?>
</a>
</div>
<?php } ?>
<?php
$ISNarrative = $request->getFileByType(RequestFile::IS_NARRATIVE_TYPE);
if ($ISNarrative) {
?>
<div id="isNarrative">
<h2>IS Narrative</h2>
<a href="/Request/GetFile/<?php echo $ISNarrative->file; ?>">
<?php echo $ISNarrative->title; ?>
</a>
</div>
<?php } ?>
<?php
$additionalDocumentation = $request->getFileByType(RequestFile::OTHER_TYPE);
if ($additionalDocumentation) {
?>
<div id="additionalDocumentation">
<h2>Additional Documentation</h2>
<a href="/Request/GetFile/<?php echo $additionalDocumentation->file; ?>">
<?php echo $additionalDocumentation->title; ?>
</a>
</div>
<?php } ?>
<div>
<?php foreach ($voteTally as $voteName => $voteCount) { ?>
<?php echo $voteName; ?>: <?php echo $voteCount; ?>
<?php } ?>
</div>
</div>
<?php
}
.old {
float: left;
width: 345px;
}
.new {
float: right;
width: 345px;
}
.new del {
display: none;
}
.new ins {
color: #0c0;
text-decoration: none;
font-weight: normal;
}
.old del {
color: #c00;
}
.old ins {
display: none;
}
.new h2, .old h2 {
border: 2px solid #888;
background-color: #444;
color: #fff;
margin-bottom: 2px;
padding-left: 5px;
}
#container #maincontent #creqMain div.request {
border-bottom: 3px dotted #a00;
margin-bottom: 10px;
}
div.bulletinEntry {
border: 2px solid #888;
background-color: #ddd;
margin-bottom: 2px;
}
div.justification {
border: 2px solid #ccc;
}
#container div.justification h2 {
font-size: 14px;
}
\ No newline at end of file
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