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

Colleges listed correctly in list of requests on home page.

parent 11d9034b
No related branches found
Tags
No related merge requests found
......@@ -8,6 +8,11 @@
*/
class CourseGeneration extends Asset
{
/**
* Home crosslisting
*
* @var CourseCrosslisting
*/
protected $_homeCrosslisting;
public function _init()
......@@ -146,7 +151,8 @@ class CourseGeneration extends Asset
}
$parentGeneration = CourseGenerations::getInstance()->findOne($this->parent);
while($offical && $parentGeneration && $parentGeneration->type != 'official') {
$foo = $parentGeneration->type;
while($official && $parentGeneration && $parentGeneration->type != 'official') {
$parentGeneration = CourseGenerations::getInstance()->findOne($parentGeneration->parent);
}
return $parentGeneration;
......@@ -168,6 +174,15 @@ class CourseGeneration extends Asset
return CourseEsDesignations::getInstance()->isCourseCodeEssentialStudies($courseCode, $college);
}
public function getHomeCollege()
{
$subject = Subjects::getInstance()->fetchSubject($this->subject);
$department = $subject->department;
$college = $department->college;
return $college;
}
/**
* Returns a reference to the home crosslist
*
......
<?php
class Department extends Nmc_Db_Table_Row
{
public function _init()
{
parent::_init();
$subjectsRelation = new Nmc_Db_Table_Relation_HasMany(
Subjects::getInstance(),
$this,
'department',
'subjects'
);
$this->_registerRelation($subjectsRelation);
$collegeRelation = new Nmc_Db_Table_Relation_HasOne(
Colleges::getInstance(),
$this,
'college',
'college',
true
);
$this->_registerRelation($collegeRelation);
}
}
\ No newline at end of file
<?php
class Subject extends Nmc_Db_Table_Row
{
protected function _init()
{
parent::_init();
$departmentRelation = new Nmc_Db_Table_Relation_HasOne(
Departments::getInstance(),
$this,
'department',
'department',
true
);
$this->_registerRelation($departmentRelation);
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
class Departments extends Nmc_Db_Table
{
protected $_primary = 'departmentId';
//protected $_rowClass = 'Department';
protected $_rowClass = 'Department';
/**
* The one true instance
......
<?php
class Subjects extends Nmc_Db_Table
{
protected $_primary = 'subjectId';
protected $_rowClass = 'Subject';
/**
* The one true instance
*
* @var Subjects
*/
static protected $_instance;
/**
* Return the one true instance
*
* @return Subjects
*/
static public function getInstance($config = array())
{
if (!self::$_instance) {
self::$_instance = new Subjects($config);
}
return self::$_instance;
}
public function getSubjectList()
{
$allRows = $this->fetchAll();
$subjects = array();
foreach($allRows as $row) {
$subjects[] = $row->name;
}
sort($subjects);
return $subjects;
}
/**
* Return the db row for the given subject, if it exists.
*
* @param string $subject
* @return Subject
*/
public function fetchSubject($subject)
{
$db = $this->getAdapter();
$where = $db->quoteInto('name = ?', $subject);
$row = $this->fetchRow($where);
return $row;
}
}
......@@ -51,7 +51,7 @@
<td><?php echo $originalCourse->subject . ' '
. $originalCourse->courseNumber
. $originalCourse->courseLetter; ?></td>
<td>NONC</td>
<td><?php echo $originalCourse->getHomeCollege()->name; ?></td>
<td><?php echo $request->type->name; ?></td>
<td>
<td>
......@@ -105,7 +105,7 @@
<td><?php echo $originalCourse->subject . ' '
. $originalCourse->courseNumber
. $originalCourse->courseLetter; ?></td>
<td><?php echo get_class($course->subject); ?></td>
<td><?php echo $originalCourse->getHomeCollege()->name; ?></td>
<td><?php echo $request->type->name; ?></td>
<td><?php echo $request->getCurrentApprovalBody()->name; ?></td>
<td>
......@@ -181,7 +181,7 @@
<td><?php echo $originalCourse->subject . ' '
. $originalCourse->courseNumber
. $originalCourse->courseLetter; ?></td>
<td>NONC</td>
<td><?php echo $originalCourse->getHomeCollege()->name; ?></td>
<td><?php echo $request->type->name; ?></td>
<td><?php echo $request->getCurrentAction()->name; ?></td>
<td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment