original_string: public function print_badge_status_box(badge $badge) {
          if (has_capability('moodle/badges:configurecriteria', $badge->get_context())) {
  
              if (!$badge->has_criteria()) {
                  $criteriaurl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
                  $status = get_string('nocriteria', 'badges');
                  if ($this->page->url != $criteriaurl) {
                      $action = $this->output->single_button(
                          $criteriaurl,
                          get_string('addcriteria', 'badges'), 'POST', array('class' => 'activatebadge'));
                  } else {
                      $action = '';
                  }
  
                  $message = $status . $action;
              } else {
                  $status = get_string('statusmessage_' . $badge->status, 'badges');
                  if ($badge->is_active()) {
                      $action = $this->output->single_button(new moodle_url('/badges/action.php',
                                  array('id' => $badge->id, 'lock' => 1, 'sesskey' => sesskey(),
                                        'return' => $this->page->url->out_as_local_url(false))),
                              get_string('deactivate', 'badges'), 'POST', array('class' => 'activatebadge'));
                  } else {
                      $action = $this->output->single_button(new moodle_url('/badges/action.php',
                                  array('id' => $badge->id, 'activate' => 1, 'sesskey' => sesskey(),
                                        'return' => $this->page->url->out_as_local_url(false))),
                              get_string('activate', 'badges'), 'POST', array('class' => 'activatebadge'));
                  }
  
                  $message = $status . $this->output->help_icon('status', 'badges') . $action;
  
              }
  
              $style = $badge->is_active() ? 'generalbox statusbox active' : 'generalbox statusbox inactive';
              return $this->output->box($message, $style);
          }
  
          return null;
      }
code: public function print_badge_status_box(badge $badge) {
          if (has_capability('moodle/badges:configurecriteria', $badge->get_context())) {
  
              if (!$badge->has_criteria()) {
                  $criteriaurl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
                  $status = get_string('nocriteria', 'badges');
                  if ($this->page->url != $criteriaurl) {
                      $action = $this->output->single_button(
                          $criteriaurl,
                          get_string('addcriteria', 'badges'), 'POST', array('class' => 'activatebadge'));
                  } else {
                      $action = '';
                  }
  
                  $message = $status . $action;
              } else {
                  $status = get_string('statusmessage_' . $badge->status, 'badges');
                  if ($badge->is_active()) {
                      $action = $this->output->single_button(new moodle_url('/badges/action.php',
                                  array('id' => $badge->id, 'lock' => 1, 'sesskey' => sesskey(),
                                        'return' => $this->page->url->out_as_local_url(false))),
                              get_string('deactivate', 'badges'), 'POST', array('class' => 'activatebadge'));
                  } else {
                      $action = $this->output->single_button(new moodle_url('/badges/action.php',
                                  array('id' => $badge->id, 'activate' => 1, 'sesskey' => sesskey(),
                                        'return' => $this->page->url->out_as_local_url(false))),
                              get_string('activate', 'badges'), 'POST', array('class' => 'activatebadge'));
                  }
  
                  $message = $status . $this->output->help_icon('status', 'badges') . $action;
  
              }
  
              $style = $badge->is_active() ? 'generalbox statusbox active' : 'generalbox statusbox inactive';
              return $this->output->box($message, $style);
          }
  
          return null;
      }
code_tokens: public function print_badge_status_box ( badge $ badge ) { if ( has_capability ( 'moodle/badges:configurecriteria' , $ badge -> get_context ( ) ) ) { if ( ! $ badge -> has_criteria ( ) ) { $ criteriaurl = new moodle_url ( '/badges/criteria.php' , array ( 'id' => $ badge -> id ) ) ; $ status = get_string ( 'nocriteria' , 'badges' ) ; if ( $ this -> page -> url != $ criteriaurl ) { $ action = $ this -> output -> single_button ( $ criteriaurl , get_string ( 'addcriteria' , 'badges' ) , 'POST' , array ( 'class' => 'activatebadge' ) ) ; } else { $ action = '' ; } $ message = $ status . $ action ; } else { $ status = get_string ( 'statusmessage_' . $ badge -> status , 'badges' ) ; if ( $ badge -> is_active ( ) ) { $ action = $ this -> output -> single_button ( new moodle_url ( '/badges/action.php' , array ( 'id' => $ badge -> id , 'lock' => 1 , 'sesskey' => sesskey ( ) , 'return' => $ this -> page -> url -> out_as_local_url ( false ) ) ) , get_string ( 'deactivate' , 'badges' ) , 'POST' , array ( 'class' => 'activatebadge' ) ) ; } else { $ action = $ this -> output -> single_button ( new moodle_url ( '/badges/action.php' , array ( 'id' => $ badge -> id , 'activate' => 1 , 'sesskey' => sesskey ( ) , 'return' => $ this -> page -> url -> out_as_local_url ( false ) ) ) , get_string ( 'activate' , 'badges' ) , 'POST' , array ( 'class' => 'activatebadge' ) ) ; } $ message = $ status . $ this -> output -> help_icon ( 'status' , 'badges' ) . $ action ; } $ style = $ badge -> is_active ( ) ? 'generalbox statusbox active' : 'generalbox statusbox inactive' ; return $ this -> output -> box ( $ message , $ style ) ; } return null ; }
docstring: Prints badge status box.
  @return Either the status box html as a string or null
docstring_tokens: Prints badge status box .