From 738e9e726bdfda0c4bea743deba68a1eebf7ee6a Mon Sep 17 00:00:00 2001
From: Brett Bieber <brett.bieber@gmail.com>
Date: Tue, 24 Sep 2013 15:34:57 -0500
Subject: [PATCH] Display the proper subject area title when requested

---
 src/UNL/Catalog/SubjectArea.php               | 19 +++++++++++++++++--
 .../html/UNL/Catalog/SubjectArea.tpl.php      |  6 +++---
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/UNL/Catalog/SubjectArea.php b/src/UNL/Catalog/SubjectArea.php
index e5493d2..7880456 100644
--- a/src/UNL/Catalog/SubjectArea.php
+++ b/src/UNL/Catalog/SubjectArea.php
@@ -3,8 +3,6 @@ namespace UNL\Catalog;
 
 class SubjectArea extends \UNL_Services_CourseApproval_SubjectArea
 {
-    public $title;
-    
     function __construct($options = array())
     {
         if (isset($options['title'])) {
@@ -31,6 +29,23 @@ class SubjectArea extends \UNL_Services_CourseApproval_SubjectArea
         }
         return false;
     }
+
+    public function __get($var)
+    {
+        if ($var == 'title') {
+            return $this->getTitle();
+        }
+    }
+
+    public function getTitle()
+    {
+        if (isset($this->title)) {
+            return $this->title;
+        }
+        $areas = new SubjectAreas();
+        $this->title = $areas[$this->subject];
+        return $this->title;
+    }
     
     function __toString()
     {
diff --git a/www/templates/html/UNL/Catalog/SubjectArea.tpl.php b/www/templates/html/UNL/Catalog/SubjectArea.tpl.php
index 16c0137..c371eb1 100644
--- a/www/templates/html/UNL/Catalog/SubjectArea.tpl.php
+++ b/www/templates/html/UNL/Catalog/SubjectArea.tpl.php
@@ -1,13 +1,13 @@
 <?php
 if ($controller->options['model'] == 'UNL\Catalog\SubjectArea') {
     $url = $controller->getURL();
-    $page->doctitle = '<title>'.$context->subject.' | Bulletin | University of Nebraska-Lincoln</title>';
-    $page->pagetitle = '<h1>'.$context->subject.'</h1>';
+    $page->doctitle = '<title>'.$context->title.' Courses | Bulletin | University of Nebraska-Lincoln</title>';
+    $page->pagetitle = '<h1>'.$context->title.' Courses</h1>';
     $page->breadcrumbs = '
     <ul>
         <li><a href="http://www.unl.edu/">UNL</a></li>
         <li><a href="'.$url.'">Undergraduate Bulletin</a></li>
-        <li>'.$context->subject.'</li>
+        <li>'.$context->title.' Courses</li>
     </ul>
     ';
 }
-- 
GitLab