From 424090059b87777f6723ce4b51af2e604fa0aaf2 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Wed, 22 Aug 2007 16:21:13 +0000
Subject: [PATCH] Add notification if a course found in a search is actually a
 crosslist of another.

---
 application/controllers/RequestController.php | 13 ++++++++++
 application/views/request/course_found.xhtml  | 25 +++++++++++++------
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/application/controllers/RequestController.php b/application/controllers/RequestController.php
index 08c9b5ce..9c7b0894 100755
--- a/application/controllers/RequestController.php
+++ b/application/controllers/RequestController.php
@@ -50,12 +50,25 @@ class RequestController extends Nmc_Controller_Action
             Nmc_Registry_Session::getInstance()->erase('course');
         } else {
             // course found
+
             Nmc_Registry_Session::getInstance()->erase('course');
             $out->page = 'request/course_found';
             $parentCourse = $course->getParentCourse();
 
             $course = clone $parentCourse;
 
+            if ($course->subject != $subject ||
+                $course->courseNumber != $courseNumber ||
+                $course->courseLetter != $courseLetter)
+            {
+                $out->crosslisting = true;
+                $out->homeSubject = $course->subject;
+                $out->homeCourseLetter = $course->courseLetter;
+                $out->homeCourseNumber = $course->courseNumber;
+            } else {
+                $out->crosslisting = false;
+            }
+
             Nmc_Registry_Session::getInstance()->course = $course;
         }
 
diff --git a/application/views/request/course_found.xhtml b/application/views/request/course_found.xhtml
index 51abbc96..5f13122b 100644
--- a/application/views/request/course_found.xhtml
+++ b/application/views/request/course_found.xhtml
@@ -1,29 +1,38 @@
 
         <h2>
-            The Course <?php echo $this->subject , ' '
+            The course <?php echo $this->subject , ' '
                                 , $this->courseNumber
-                                , $this->courseLetter; ?> Already Exists.
+                                , $this->courseLetter; ?>
+            <?php if(!$this->crosslisting) { ?>
+            currently exists.
+            <?php } else { ?>
+            currently exists as a crosslisting of
+            <?php echo trim($this->homeSubject . ' '
+                          . $this->homeCourseNumber . ' '
+                          . $this->homeCourseLetter) . '.'; ?>
+            <?php } ?>
+            <br />
             You may:
         </h2>
         <ul>
             <li>
                 <a href="/Request/Create/ChangeCourse/<?php echo $this->subject
-                                                            . '/' . $this->courseNumber
-                                                            . '/' . $this->courseLetter; ?>">
+                                                               . '/' . $this->courseNumber
+                                                               . '/' . $this->courseLetter; ?>">
                     Request a <b>change</b> to this course
                 </a>
             </li>
             <li>
                 <a href="/Request/Create/AddISToCourse/<?php echo $this->subject
-                                                             . '/' . $this->courseNumber
-                                                             . '/' . $this->courseLetter; ?>">
+                                                                . '/' . $this->courseNumber
+                                                                . '/' . $this->courseLetter; ?>">
                     Request <b>Integrated Studies</b> status for this course
                 </a>
             </li>
             <li>
                 <a href="/Request/Create/RemoveCourse/<?php echo $this->subject
-                                                            . '/' . $this->courseNumber
-                                                            . '/' . $this->courseLetter; ?>">
+                                                               . '/' . $this->courseNumber
+                                                               . '/' . $this->courseLetter; ?>">
                     Request that this course be <b>removed</b>
                 </a>
             </li>
-- 
GitLab