public function Course::getNavigation in Course 7
Same name and namespace in other branches
- 6 includes/course.core.inc \Course::getNavigation()
- 7.2 includes/Course.inc \Course::getNavigation()
Generate navigation links.
File
- includes/
Course.inc, line 137
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 && $prev
->access('take')) {
$links['prev'] = l(t('Previous'), $prev
->getUrl(), array(
'html' => TRUE,
));
}
$links['back'] = l(t('Back to course'), $this
->getUrl());
if ($next && $next
->access('take')) {
$links['next'] = l(t('Next'), $next
->getUrl(), array(
'html' => TRUE,
));
}
elseif (!$next && $this
->getTracker()
->getOption('complete')) {
$links['next'] = l(t('Next'), 'node/' . $this
->getOption('nid') . '/course-complete', 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;
}