You are here

public function Course::getNavigation in Course 6

Same name and namespace in other branches
  1. 7.2 includes/Course.inc \Course::getNavigation()
  2. 7 includes/Course.inc \Course::getNavigation()

Generate navigation links.

File

includes/course.core.inc, line 507
course.core.inc File for main Course class.

Class

Course
An object that holds CourseObjects and tracker functions?

Code

public function getNavigation() {

  // Initialize the active Course.
  $this
    ->setActive();
  $prev = $this
    ->getPrev();
  $next = $this
    ->getNext();
  $links = array();
  if ($prev) {
    $links['prev'] = l('Previous', $prev
      ->getUrl(), array(
      'html' => TRUE,
    ));
  }
  $links['back'] = l('Back to course', $this
    ->getUrl());
  if ($next && $next
    ->access('take')) {
    $links['next'] = l('Next', $next
      ->getUrl(), array(
      'html' => TRUE,
    ));
  }

  // Ask course objects if they want to override the navigation.
  if ($active = $this
    ->getActive()) {
    foreach ($active
      ->overrideNavigation() as $key => $link) {
      $links[$key] = $link;
    }
  }
  return $links;
}