From 5b413ef5fa77deb7458c1543b961999778a75a38 Mon Sep 17 00:00:00 2001
From: Brett Bieber <brett.bieber@gmail.com>
Date: Tue, 24 Sep 2013 14:10:20 -0500
Subject: [PATCH] Add routes and models for individual course listings

---
 data/routes.php                                |  2 +-
 src/UNL/Catalog/Listing.php                    | 17 +++++++++++++++++
 www/templates/html/UNL/Catalog/Listing.tpl.php |  4 ++++
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 src/UNL/Catalog/Listing.php
 create mode 100644 www/templates/html/UNL/Catalog/Listing.tpl.php

diff --git a/data/routes.php b/data/routes.php
index 87e4d09..e25686b 100644
--- a/data/routes.php
+++ b/data/routes.php
@@ -13,6 +13,6 @@ $courseNumber = '(?P<courseNumber>[\d]?[\d]{2,3}[A-Za-z]?)'; // Course number, e
 
 $routes['/^'.$base.'\/$/']                                            = 'UNL\Catalog\SubjectAreas';
 $routes['/^'.$base.'\/'.$subjectArea.$format.'$/']                    = 'UNL\Catalog\SubjectArea';
-$routes['/^'.$base.'\/'.$subjectArea.'\/'.$courseNumber.$format.'$/'] = 'UNL\Catalog\Course';
+$routes['/^'.$base.'\/'.$subjectArea.'\/'.$courseNumber.$format.'$/'] = 'UNL\Catalog\Listing';
 
 return $routes;
\ No newline at end of file
diff --git a/src/UNL/Catalog/Listing.php b/src/UNL/Catalog/Listing.php
new file mode 100644
index 0000000..82386c2
--- /dev/null
+++ b/src/UNL/Catalog/Listing.php
@@ -0,0 +1,17 @@
+<?php
+namespace UNL\Catalog;
+
+class Listing
+{
+    protected $internal;
+    
+    function __construct($options = array())
+    {
+        $this->internal = new \UNL_Services_CourseApproval_Listing($options['subjectArea'], $options['courseNumber']);
+    }
+    
+    function __get($var)
+    {
+        return $this->internal->$var;
+    }
+}
\ No newline at end of file
diff --git a/www/templates/html/UNL/Catalog/Listing.tpl.php b/www/templates/html/UNL/Catalog/Listing.tpl.php
new file mode 100644
index 0000000..5dae6f1
--- /dev/null
+++ b/www/templates/html/UNL/Catalog/Listing.tpl.php
@@ -0,0 +1,4 @@
+<?php
+    $context->subject = $context->subjectArea;
+    echo $savvy->render($context->course);
+?>
-- 
GitLab