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

Add through-date iACE report.

parent 393c4b4f
No related branches found
No related tags found
No related merge requests found
......@@ -94,4 +94,87 @@ class Iace_ReportsController extends App_Controller_Action
$this->view->endDate = $endDate->subDay(1);
}
public function throughDateAction()
{
$filters = array();
$validators = array(
'year' => 'Digits',
'month' => 'Digits',
'day' => 'Digits',
'sort' => 'Alpha'
);
$in = new Zend_Filter_Input($filters, $validators, $this->_getAllParams());
if ($in->isValid()) {
$endDate = new Zend_Date();
$endDate->setYear($in->year);
$endDate->setMonth($in->month);
$endDate->setDay($in->day);
$endDate->setHour(0);
$endDate->setMinute(0);
$endDate->setSecond(0);
$endDate->addDay(1);
} else {
$endDate = new Zend_Date(0);
}
$db = Zend_Registry::get('db');
$select = new Zend_Db_Select($db);
$select->from(array('h' => 'creqApprovalHistories'), array('time'));
$select->join(array('r' => 'creqRequests'), 'h.request = r.requestId', array('r.requestId'));
$select->where('h.approvalActionName = ?', 'Make Official');
$select->where('r.type = 7');
$select->where('h.time < ?', $endDate->getTimestamp());
$data = $select->query()->fetchAll();
$requestIds = array();
$finalizeTimes = array();
foreach ($data as $row) {
$requestIds[] = $row['requestId'];
$finalizeTimes[$row['requestId']] = $row['time'];
}
$requests = Requests_RequestModel::find($requestIds);
$courses = Courses_CourseModel::findLatestOfRequest($requests);
$courses->orderBy('getCourseCode');
$data = new Unl_Model_Collection('Unl_Model_Array');
foreach ($courses as $requestId => $course) {
$request = $requests[$requestId];
$finalizeTime = $finalizeTimes[$request->getId()];
foreach ($course->getAceOutcomes() as $aceOutcome) {
$data[] = new Unl_Model_Array(array(
'slo' => substr($aceOutcome['slo'], 3),
'courseCode' => $course->getCourseCode(),
'college' => $course->getCollege(),
'title' => $course->getTitle(),
'finalizeTime' => $finalizeTime,
'requestId' => $request->getId()
));
}
}
$session = new Zend_Session_Namespace(__CLASS__);
$sortBy = $session->sortBy;
if (!Unl_Util::isArray($sortBy)) {
$sortBy = array();
}
if ($in->sort) {
if (($key = array_search($in->sort, $sortBy)) !== FALSE) {
unset($sortBy[$key]);
}
$sortBy[] = $in->sort;
}
$session->sortBy = $sortBy;
foreach ($sortBy as $sortKey) {
$data->orderBy('get' . $sortKey);
}
$this->_helper->layout->setLayout('naked-layout');
$this->view->data = $data;
$this->view->endDate = $endDate->subDay(1);
}
}
\ No newline at end of file
<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/iace/reports/weekly.css', 'all'); ?>
<?php $this->layout()->tagline = ''; ?>
<?php $this->layout()->hideMenu = true; ?>
<h2>
ACE Certified Courses<br />
Interim ACE Committee<br />
Updated <?php echo date('F j, Y', $this->endDate->getTimestamp()); ?>
</h2>
<table>
<tr>
<th><a href="<?php echo $this->url(array('sort' => 'slo')); ?>">SLO</a></th>
<th><a href="<?php echo $this->url(array('sort' => 'course')); ?>">Course</a></th>
<th><a href="<?php echo $this->url(array('sort' => 'college')); ?>">College</a></th>
<th><a href="<?php echo $this->url(array('sort' => 'title')); ?>">Title</a></th>
</tr>
<?php foreach ($this->data as $record) { ?>
<tr <?php if ($rowCount++ % 2) { ?>class="even"<?php } ?>>
<td>
<a href="<?php echo $this->baseUrl(); ?>/courses/view/print/id/<?php echo $record->getRequestId(); ?>">
<?php echo $record->getSlo(); ?></td>
</a>
<td>
<a href="<?php echo $this->baseUrl(); ?>/courses/view/print/id/<?php echo $record->getRequestId(); ?>">
<?php echo $record->getCourseCode(); ?>
</a>
</td>
<td>
<a href="<?php echo $this->baseUrl(); ?>/courses/view/print/id/<?php echo $record->getRequestId(); ?>">
<?php echo $record->getCollege(); ?>
</a>
</td>
<td>
<a href="<?php echo $this->baseUrl(); ?>/courses/view/print/id/<?php echo $record->getRequestId(); ?>">
<?php echo $record->getTitle(); ?>
</a>
</td>
</tr>
<? } ?>
</table>
\ 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