original_string: public function header($lesson, $cm, $currenttab = '', $extraeditbuttons = false, $lessonpageid = null, $extrapagetitle = null) {
          global $CFG;
  
          $activityname = format_string($lesson->name, true, $lesson->course);
          if (empty($extrapagetitle)) {
              $title = $this->page->course->shortname.": ".$activityname;
          } else {
              $title = $this->page->course->shortname.": ".$activityname.": ".$extrapagetitle;
          }
  
          // Build the buttons
          $context = context_module::instance($cm->id);
  
      /// Header setup
          $this->page->set_title($title);
          $this->page->set_heading($this->page->course->fullname);
          lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid);
          $output = $this->output->header();
  
          if (has_capability('mod/lesson:manage', $context)) {
              $output .= $this->output->heading_with_help($activityname, 'overview', 'lesson');
  
              if (!empty($currenttab)) {
                  ob_start();
                  include($CFG->dirroot.'/mod/lesson/tabs.php');
                  $output .= ob_get_contents();
                  ob_end_clean();
              }
          } else {
              $output .= $this->output->heading($activityname);
          }
  
          foreach ($lesson->messages as $message) {
              $output .= $this->output->notification($message[0], $message[1], $message[2]);
          }
  
          return $output;
      }
code: public function header($lesson, $cm, $currenttab = '', $extraeditbuttons = false, $lessonpageid = null, $extrapagetitle = null) {
          global $CFG;
  
          $activityname = format_string($lesson->name, true, $lesson->course);
          if (empty($extrapagetitle)) {
              $title = $this->page->course->shortname.": ".$activityname;
          } else {
              $title = $this->page->course->shortname.": ".$activityname.": ".$extrapagetitle;
          }
  
          // Build the buttons
          $context = context_module::instance($cm->id);
  
      /// Header setup
          $this->page->set_title($title);
          $this->page->set_heading($this->page->course->fullname);
          lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid);
          $output = $this->output->header();
  
          if (has_capability('mod/lesson:manage', $context)) {
              $output .= $this->output->heading_with_help($activityname, 'overview', 'lesson');
  
              if (!empty($currenttab)) {
                  ob_start();
                  include($CFG->dirroot.'/mod/lesson/tabs.php');
                  $output .= ob_get_contents();
                  ob_end_clean();
              }
          } else {
              $output .= $this->output->heading($activityname);
          }
  
          foreach ($lesson->messages as $message) {
              $output .= $this->output->notification($message[0], $message[1], $message[2]);
          }
  
          return $output;
      }
code_tokens: public function header ( $ lesson , $ cm , $ currenttab = '' , $ extraeditbuttons = false , $ lessonpageid = null , $ extrapagetitle = null ) { global $ CFG ; $ activityname = format_string ( $ lesson -> name , true , $ lesson -> course ) ; if ( empty ( $ extrapagetitle ) ) { $ title = $ this -> page -> course -> shortname . ": " . $ activityname ; } else { $ title = $ this -> page -> course -> shortname . ": " . $ activityname . ": " . $ extrapagetitle ; } // Build the buttons $ context = context_module :: instance ( $ cm -> id ) ; /// Header setup $ this -> page -> set_title ( $ title ) ; $ this -> page -> set_heading ( $ this -> page -> course -> fullname ) ; lesson_add_header_buttons ( $ cm , $ context , $ extraeditbuttons , $ lessonpageid ) ; $ output = $ this -> output -> header ( ) ; if ( has_capability ( 'mod/lesson:manage' , $ context ) ) { $ output .= $ this -> output -> heading_with_help ( $ activityname , 'overview' , 'lesson' ) ; if ( ! empty ( $ currenttab ) ) { ob_start ( ) ; include ( $ CFG -> dirroot . '/mod/lesson/tabs.php' ) ; $ output .= ob_get_contents ( ) ; ob_end_clean ( ) ; } } else { $ output .= $ this -> output -> heading ( $ activityname ) ; } foreach ( $ lesson -> messages as $ message ) { $ output .= $ this -> output -> notification ( $ message [ 0 ] , $ message [ 1 ] , $ message [ 2 ] ) ; } return $ output ; }
docstring: Returns the header for the lesson module
  
  @param lesson $lesson a lesson object.
  @param string $currenttab current tab that is shown.
  @param bool   $extraeditbuttons if extra edit buttons should be displayed.
  @param int    $lessonpageid id of the lesson page that needs to be displayed.
  @param string $extrapagetitle String to appent to the page title.
  @return string
docstring_tokens: Returns the header for the lesson module