From 0aac23b32e47ed2cb1e115d0fb675c91e543074a Mon Sep 17 00:00:00 2001 From: Roger Feese <rfeese@unl.edu> Date: Thu, 18 Dec 2014 12:18:26 -0600 Subject: [PATCH] Check for problem finding currentGeneration of a course and display an error message. --- .../views/scripts/view/four-year-plan.phtml | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/application/modules/fouryearplans/views/scripts/view/four-year-plan.phtml b/application/modules/fouryearplans/views/scripts/view/four-year-plan.phtml index d6556db2..cc197db0 100644 --- a/application/modules/fouryearplans/views/scripts/view/four-year-plan.phtml +++ b/application/modules/fouryearplans/views/scripts/view/four-year-plan.phtml @@ -57,18 +57,28 @@ $uniqueId = ++$this->layout()->uniqueId; </tr> <?php } else if ($course['course']) { - $planCourse = $this->planCourses[$course['course']]; - ?> - <tr class="change-<?php echo $course['change']; ?>"> - <td> - <a href="<?php echo $this->baseUrl('/courses/public-view/view/id/' . $planCourse->getCourseId()); ?>"> - <?php echo $planCourse->getCourseCode(); ?> - </a> - </td> - <td><?php echo $course['hours'] ? $course['hours'] . ' cr' : substr($planCourse->getCreditsText(), 1, strpos($planCourse->getCreditsText(), 'cr') + 1); ?></td> - <td><?php echo $planCourse->getTitle(); ?></td> - </tr> - <?php }} ?> + $planCourse = $this->planCourses[$course['course']]; + if ($planCourse) { + ?> + <tr class="change-<?php echo $course['change']; ?>"> + <td> + <a href="<?php echo $this->baseUrl('/courses/public-view/view/id/' . $planCourse->getCourseId()); ?>"> + <?php echo $planCourse->getCourseCode(); ?> + </a> + </td> + <td><?php echo $course['hours'] ? $course['hours'] . ' cr' : substr($planCourse->getCreditsText(), 1, strpos($planCourse->getCreditsText(), 'cr') + 1); ?></td> + <td><?php echo $planCourse->getTitle(); ?></td> + </tr> + <?php } + else { + ?> + <tr class="change-<?php echo $course['change']; ?>"> + <td> + Error loading current course information. + </td> + <td></td> + </tr> + <?php }}} ?> </tbody> </table> </div> -- GitLab