From f8742de040146752f5142a836b3d685bb864fd19 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Thu, 25 Jun 2009 21:03:38 +0000
Subject: [PATCH] Modifyied the way the effective semester is displayed ie:
 20091 => Fall 2008 (091)

---
 application/modules/courses/models/CourseModel.php  | 13 +++++++++++++
 .../courses/views/scripts/view/course-info.phtml    |  2 +-
 .../modules/iace/controllers/IndexController.php    |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/application/modules/courses/models/CourseModel.php b/application/modules/courses/models/CourseModel.php
index 475d9664..139732c0 100644
--- a/application/modules/courses/models/CourseModel.php
+++ b/application/modules/courses/models/CourseModel.php
@@ -2465,6 +2465,19 @@ class Courses_CourseModel extends Unl_Model
     {
         return $this->_data['effectiveSemester'];
     }
+    
+    public function getEffectiveSemesterDescription()
+    {
+    	$year = substr($this->_data['effectiveSemester'], 0, 4);
+    	$term = substr($this->_data['effectiveSemester'], 4);
+    	$termDescriptions = array(1 => 'Fall', 'Spring', 'Summer');
+    	if ($term == 1) {
+    		$year--;
+    	}
+    	$term = $termDescriptions[$term];
+    	
+    	return $term . ' ' . $year . ' (' . substr($this->_data['effectiveSemester'], 2) . ')';
+    }
 
     public function setEffectiveSemester($semester)
     {
diff --git a/application/modules/courses/views/scripts/view/course-info.phtml b/application/modules/courses/views/scripts/view/course-info.phtml
index 3e24b4ed..6ca84afa 100644
--- a/application/modules/courses/views/scripts/view/course-info.phtml
+++ b/application/modules/courses/views/scripts/view/course-info.phtml
@@ -124,7 +124,7 @@
     </tr>
     <tr>
         <th>Effective Term</th>
-        <td><?php echo $course->getEffectiveSemester(); ?></td>
+        <td><?php echo $course->getEffectiveSemesterDescription(); ?></td>
     </tr>
     <tr>
         <th>Most Recent Action</th>
diff --git a/application/modules/iace/controllers/IndexController.php b/application/modules/iace/controllers/IndexController.php
index 30135a37..17b1f8c2 100644
--- a/application/modules/iace/controllers/IndexController.php
+++ b/application/modules/iace/controllers/IndexController.php
@@ -69,7 +69,7 @@ class Iace_IndexController extends App_Controller_Action
 	    	   . implode(', ', $course->getCampuses()) . "\t"
 	    	   . implode(', ', $course->getDeliveryMethods()) . "\t"
 	    	   . implode(', ', $course->getTermsOffered()) . "\t"
-	    	   . $course->getEffectiveSemester() . "\t"
+	    	   . $course->getEffectiveSemesterDescription() . "\t"
 	    	   . $course->getPrerequisite() . "\t"
 	    	   . $course->getNotes() . "\t"
 	    	   . $course->getDescription() . "\t"
-- 
GitLab