diff --git a/application/modules/courses/views/scripts/view/index.phtml b/application/modules/courses/views/scripts/view/index.phtml index cf22be73ca21a7cc5c70194079274a3d0627e165..dcfd144123a7abf3e2377b705d77fc971fb89f9a 100644 --- a/application/modules/courses/views/scripts/view/index.phtml +++ b/application/modules/courses/views/scripts/view/index.phtml @@ -20,13 +20,13 @@ $this->layout()->tagline = $tagline . ': ' . $this->course->getCourseCode() . ' <div class="current"> <h2>Current</h2> <div class="bulletinEntry"> - <?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request); ?> + <?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request, 'current'); ?> </div> </div> <div class="proposed"> <h2>Proposed</h2> <div class="bulletinEntry"> - <?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request); ?> + <?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request, 'proposed'); ?> </div> </div> <div class="clear"></div> diff --git a/library/App/View/Helper/BulletinEntryDiff.php b/library/App/View/Helper/BulletinEntryDiff.php index b2c780e8b9cf9ebca205c5bc67d4457aabe76f46..510b43e889cb502fbe74244620d178782f8a13dd 100644 --- a/library/App/View/Helper/BulletinEntryDiff.php +++ b/library/App/View/Helper/BulletinEntryDiff.php @@ -4,7 +4,7 @@ class App_View_Helper_BulletinEntryDiff { static protected $_diffRenderer; - public function bulletinEntryDiff(Courses_CourseModel $currentCourse, Courses_CourseModel $proposedCourse, $request) + public function bulletinEntryDiff(Courses_CourseModel $currentCourse, Courses_CourseModel $proposedCourse, $request, $parts = 'both') { // ES and IS $currentES = ($currentCourse->isEssentialStudies() ? '[ES]' : ''); @@ -130,6 +130,24 @@ class App_View_Helper_BulletinEntryDiff $tidyConfig = array('show-body-only' => true); $html = ob_get_clean(); + + if ($parts == 'current') { + for ($start = strpos($html, '<ins>'); $start != FALSE; $start = strpos($html, '<ins>', $start)) { + $end = strpos($html, '</ins>', $start); + if ($end > $start) { + $html = substr($html, 0, $start) . substr($html, $end + 6); + } + } + } + if ($parts == 'proposed') { + for ($start = strpos($html, '<del>'); $start != FALSE; $start = strpos($html, '<del>', $start)) { + $end = strpos($html, '</del>', $start); + if ($end > $start) { + $html = substr($html, 0, $start) . substr($html, $end + 6); + } + } + } + $html = tidy_repair_string($html, $tidyConfig, 'utf8'); return $html; }