original_string: public function progress_bar(lesson $lesson, $progress = null) {
          $context = context_module::instance($this->page->cm->id);
  
          // lesson setting to turn progress bar on or off
          if (!$lesson->progressbar) {
              return '';
          }
  
          // catch teachers
          if (has_capability('mod/lesson:manage', $context)) {
              return $this->output->notification(get_string('progressbarteacherwarning2', 'lesson'));
          }
  
          if ($progress === null) {
              $progress = $lesson->calculate_progress();
          }
  
          $content = html_writer::start_tag('div');
          $content .= html_writer::start_tag('div', array('class' => 'progress'));
          $content .= html_writer::start_tag('div', array('class' => 'progress-bar bar', 'role' => 'progressbar',
              'style' => 'width: ' . $progress .'%', 'aria-valuenow' => $progress, 'aria-valuemin' => 0, 'aria-valuemax' => 100));
          $content .= $progress . "%";
          $content .= html_writer::end_tag('div');
          $content .= html_writer::end_tag('div');
          $printprogress = html_writer::tag('div', get_string('progresscompleted', 'lesson', $progress) . $content);
          return $this->output->box($printprogress, 'progress_bar');
      }
code: public function progress_bar(lesson $lesson, $progress = null) {
          $context = context_module::instance($this->page->cm->id);
  
          // lesson setting to turn progress bar on or off
          if (!$lesson->progressbar) {
              return '';
          }
  
          // catch teachers
          if (has_capability('mod/lesson:manage', $context)) {
              return $this->output->notification(get_string('progressbarteacherwarning2', 'lesson'));
          }
  
          if ($progress === null) {
              $progress = $lesson->calculate_progress();
          }
  
          $content = html_writer::start_tag('div');
          $content .= html_writer::start_tag('div', array('class' => 'progress'));
          $content .= html_writer::start_tag('div', array('class' => 'progress-bar bar', 'role' => 'progressbar',
              'style' => 'width: ' . $progress .'%', 'aria-valuenow' => $progress, 'aria-valuemin' => 0, 'aria-valuemax' => 100));
          $content .= $progress . "%";
          $content .= html_writer::end_tag('div');
          $content .= html_writer::end_tag('div');
          $printprogress = html_writer::tag('div', get_string('progresscompleted', 'lesson', $progress) . $content);
          return $this->output->box($printprogress, 'progress_bar');
      }
code_tokens: public function progress_bar ( lesson $ lesson , $ progress = null ) { $ context = context_module :: instance ( $ this -> page -> cm -> id ) ; // lesson setting to turn progress bar on or off if ( ! $ lesson -> progressbar ) { return '' ; } // catch teachers if ( has_capability ( 'mod/lesson:manage' , $ context ) ) { return $ this -> output -> notification ( get_string ( 'progressbarteacherwarning2' , 'lesson' ) ) ; } if ( $ progress === null ) { $ progress = $ lesson -> calculate_progress ( ) ; } $ content = html_writer :: start_tag ( 'div' ) ; $ content .= html_writer :: start_tag ( 'div' , array ( 'class' => 'progress' ) ) ; $ content .= html_writer :: start_tag ( 'div' , array ( 'class' => 'progress-bar bar' , 'role' => 'progressbar' , 'style' => 'width: ' . $ progress . '%' , 'aria-valuenow' => $ progress , 'aria-valuemin' => 0 , 'aria-valuemax' => 100 ) ) ; $ content .= $ progress . "%" ; $ content .= html_writer :: end_tag ( 'div' ) ; $ content .= html_writer :: end_tag ( 'div' ) ; $ printprogress = html_writer :: tag ( 'div' , get_string ( 'progresscompleted' , 'lesson' , $ progress ) . $ content ) ; return $ this -> output -> box ( $ printprogress , 'progress_bar' ) ; }
docstring: Returns HTML to display a progress bar of progression through a lesson
  
  @param lesson $lesson
  @param int $progress optional, if empty it will be calculated
  @return string
docstring_tokens: Returns HTML to display a progress bar of progression through a lesson