From 503c1cb177d35c5eab932341e5b98db8bcd9bafd Mon Sep 17 00:00:00 2001 From: Brett Bieber <brett.bieber@gmail.com> Date: Fri, 14 Dec 2012 13:48:25 -0600 Subject: [PATCH] Disable subsequent courses search for grad bulletin course listings --- www/templates/Course.tpl.php | 167 +++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 www/templates/Course.tpl.php diff --git a/www/templates/Course.tpl.php b/www/templates/Course.tpl.php new file mode 100644 index 0000000..2d84499 --- /dev/null +++ b/www/templates/Course.tpl.php @@ -0,0 +1,167 @@ +<?php + $url = $controller->getURL(); + /* example code for isArchvied and getNewestURL(); + if(UNL_UndergraduateBulletin_Controller::isArchived()){ + echo "This version may be out of date. ".UNL_UndergraduateBulletin_Controller::getNewestURL(); + } + */ + + $class = 'course'; + if (isset($parent->context->subjectArea)) { + $subject = $parent->context->subjectArea; + } elseif (isset($parent->context->subject)) { + $subject = $parent->context->subject; + } else { + $subject = $context->getHomeListing()->subjectArea; + } + $listings = array(); + $crosslistings = array(); + $groups = array(); + + foreach ($context->codes as $listing) { + if ((string)$listing->subjectArea == (string)$subject) { + + if (!isset($permalink)) { + $permalink = $url.'courses/'.$subject.'/'.$listing->courseNumber; + } + + $listings[] = $listing->courseNumber; + if ($listing->hasGroups()) { + foreach ($listing->groups as $group) { + $groups[] = (string)$group; + $class .= ' grp_'.md5($group); + } + } + } else { + if (!isset($crosslistings[(string)$listing->subjectArea])) { + $crosslistings[(string)$listing->subjectArea] = array(); + } + $crosslistings[(string)$listing->subjectArea][] = $listing->courseNumber; + } + } + $groups = implode(', ', array_unique($groups)); + $cltext = ''; + foreach ($crosslistings as $cl_subject => $cl_numbers) { + $cltext .= ', '.$cl_subject.' '.implode('/', $cl_numbers); + } + $number_class = 'l'.count($listings); + sort($listings); + $listings = implode('/', $listings); + if (!empty($cltext)) { + $crosslistings = '<span class="crosslisting">'.trim($cltext, ', ').'</span>'; + } + + $format = ''; + foreach ($context->activities as $type => $activity) { + $class .= ' '.$type; + $format .= UNL_Services_CourseApproval_Course_Activities::getFullDescription($type); + if (isset($activity->hours)) { + $format .= ' '.$activity->hours; + } + $format .= ', '; + } + $format = trim($format, ', '); + + if (!empty($context->aceOutcomes)) { + $class .= ' ace'; + foreach ($context->aceOutcomes as $outcome) { + $class .= ' ace_'.$outcome; + } + } + + if (isset($parent->parent->context->options) + && $parent->parent->context->options['view'] == 'course') { + UNL_UndergraduateBulletin_Controller::setReplacementData('head', ' + <link rel="alternate" type="text/xml" href="'.$permalink.'?format=xml" /> + <link rel="alternate" type="text/javascript" href="'.$permalink.'?format=json" /> + <link rel="alternate" type="text/html" href="'.$permalink.'?format=partial" />'); + UNL_UndergraduateBulletin_Controller::setReplacementData('doctitle', $subject.' '.$listings.': '.$context->title.' | Undergraduate Bulletin | University of Nebraska-Lincoln'); + UNL_UndergraduateBulletin_Controller::setReplacementData('breadcrumbs', ' + <ul> + <li><a href="http://www.unl.edu/">UNL</a></li> + <li><a href="'.$url.'">Undergraduate Bulletin</a></li> + <li>'.$subject.' '.$listings.': '.$context->title.'</li> + </ul> + '); + echo '<dl>'; + } + + echo " + <dt class='$class'> + <div class='courseID'> + <span class='subjectCode'>".$subject."</span> + <span class='number $number_class'>$listings</span> + </div> + <span class='title'>" . $context->title . " <a href='" . $permalink . "' title='A permalink to " . $context->title . "'>LINK</a></span>"; + if (!empty($crosslistings)) { + echo '<span class="crosslistings">Crosslisted as '.$crosslistings.'</span>'; + } + echo "</dt> + <dd class='$class'>"; + echo '<div class="zentable cool details">'; + echo '<table class="zentable cool details">'; + echo $savvy->render($context, 'Course/Credits.tpl.php'); + if (!empty($format)) { + echo '<tr class="format"> + <td class="label">Course Format:</td> + <td class="value">'.$format.'</td> + </tr>'; + } + if (count($context->campuses) + && (count($context->campuses) > 1 + || $context->campuses[0] != 'UNL')) { + $campuses = ''; + foreach ($context->campuses as $campus) { + $campuses .= $campus . ','; + } + $campuses = trim($campuses, ','); + echo '<tr class="campus"> + <td class="label">Campus:</td> + <td class="value">'.$campus.'</td> + </tr>'; + } + $methods = ''; + foreach ($context->deliveryMethods as $method) { + $methods .= $method . ', '; + } + $methods = trim($methods, ', '); + echo '<tr class="deliveryMethods"> + <td class="label">Course Delivery:</td> + <td class="value">'.$methods.'</td> + </tr>'; + $ace = ''; + if (!empty($context->aceOutcomes)) { + $ace = ''; + foreach($context->aceOutcomes as $outcome) { + $ace .= '<abbr title="'.UNL_UndergraduateBulletin_ACE::$descriptions[$outcome].'">'.$outcome.'</abbr>, '; + } + $ace = trim($ace, ', '); + echo '<tr class="aceOutcomes"> + <td class="label">ACE Outcomes:</td> + <td class="value">'.$ace.'</td> + </tr>'; + } + if (!empty($groups)) { + echo '<tr class="groups"> + <td class="label">Groups:</td> + <td class="value">'.$groups.'</td> + </tr>'; + } + echo '</table>'.PHP_EOL; + ?> + <?php + echo '</div>'; + if (!empty($context->prerequisite)) { + echo "<div class='prereqs'>Prereqs: ".UNL_UndergraduateBulletin_EPUB_Utilities::addCourseLinks($context->getRaw('prerequisite'), $controller->getURL())."</div>\n"; + } + if (!empty($context->notes)) { + echo "<div class='notes'>".UNL_UndergraduateBulletin_EPUB_Utilities::addCourseLinks($context->getRaw('notes'), $controller->getURL())."</div>\n"; + } + if (!empty($context->description)) { + echo "<div class='description'>".UNL_UndergraduateBulletin_EPUB_Utilities::addCourseLinks($context->getRaw('description'), $controller->getURL())."</div>\n"; + } + echo "</dd>"; + if (isset($parent->parent->context->options) + && $parent->parent->context->options['view'] == 'course') { + echo '</dl>'; + } -- GitLab