You are here

function _course_block_navigation_view in Course 7

Same name and namespace in other branches
  1. 6 includes/course.block.inc \_course_block_navigation_view()
  2. 7.2 includes/course.block.inc \_course_block_navigation_view()

Course block callback: navigation view.

File

includes/course.block.inc, line 21
course blocks

Code

function _course_block_navigation_view() {
  global $user;
  $node = course_get_context();
  if ($node) {
    $course = course_get_course($node, $user);
    $links = $course
      ->getNavigation();
    $items = array();
    foreach ($links as $key => $value) {
      $items[] = array(
        'class' => array(
          'course-nav-' . $key,
        ),
        'data' => $value,
      );
    }

    // Add javascript poller to update the next step button.
    drupal_add_js(drupal_get_path('module', 'course') . '/js/nav.js', array(
      'cache' => FALSE,
      'preprocess' => FALSE,
    ));
    return array(
      'subject' => '',
      'content' => theme('item_list', array(
        'items' => $items,
        'title' => '',
        'type' => 'ul',
        'attributes' => array(
          'id' => 'course-nav',
        ),
      )),
    );
  }
}