original_string: public function output_html($data, $query='') {
          global $OUTPUT;
  
          $default = $this->get_defaultsetting();
          if (is_number($default)) {
              $defaultinfo = self::get_duration_text($default);
          } else if (is_array($default)) {
              $defaultinfo = self::get_duration_text($default['v']*$default['u']);
          } else {
              $defaultinfo = null;
          }
  
          $inputid = $this->get_id() . 'v';
          $units = self::get_units();
          $defaultunit = $this->defaultunit;
  
          $context = (object) [
              'id' => $this->get_id(),
              'name' => $this->get_full_name(),
              'value' => $data['v'],
              'options' => array_map(function($unit) use ($units, $data, $defaultunit) {
                  return [
                      'value' => $unit,
                      'name' => $units[$unit],
                      'selected' => ($data['v'] == 0 && $unit == $defaultunit) || $unit == $data['u']
                  ];
              }, array_keys($units))
          ];
  
          $element = $OUTPUT->render_from_template('core_admin/setting_configduration', $context);
  
          return format_admin_setting($this, $this->visiblename, $element, $this->description, $inputid, '', $defaultinfo, $query);
      }
code: public function output_html($data, $query='') {
          global $OUTPUT;
  
          $default = $this->get_defaultsetting();
          if (is_number($default)) {
              $defaultinfo = self::get_duration_text($default);
          } else if (is_array($default)) {
              $defaultinfo = self::get_duration_text($default['v']*$default['u']);
          } else {
              $defaultinfo = null;
          }
  
          $inputid = $this->get_id() . 'v';
          $units = self::get_units();
          $defaultunit = $this->defaultunit;
  
          $context = (object) [
              'id' => $this->get_id(),
              'name' => $this->get_full_name(),
              'value' => $data['v'],
              'options' => array_map(function($unit) use ($units, $data, $defaultunit) {
                  return [
                      'value' => $unit,
                      'name' => $units[$unit],
                      'selected' => ($data['v'] == 0 && $unit == $defaultunit) || $unit == $data['u']
                  ];
              }, array_keys($units))
          ];
  
          $element = $OUTPUT->render_from_template('core_admin/setting_configduration', $context);
  
          return format_admin_setting($this, $this->visiblename, $element, $this->description, $inputid, '', $defaultinfo, $query);
      }
code_tokens: public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ default = $ this -> get_defaultsetting ( ) ; if ( is_number ( $ default ) ) { $ defaultinfo = self :: get_duration_text ( $ default ) ; } else if ( is_array ( $ default ) ) { $ defaultinfo = self :: get_duration_text ( $ default [ 'v' ] * $ default [ 'u' ] ) ; } else { $ defaultinfo = null ; } $ inputid = $ this -> get_id ( ) . 'v' ; $ units = self :: get_units ( ) ; $ defaultunit = $ this -> defaultunit ; $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) , 'value' => $ data [ 'v' ] , 'options' => array_map ( function ( $ unit ) use ( $ units , $ data , $ defaultunit ) { return [ 'value' => $ unit , 'name' => $ units [ $ unit ] , 'selected' => ( $ data [ 'v' ] == 0 && $ unit == $ defaultunit ) || $ unit == $ data [ 'u' ] ] ; } , array_keys ( $ units ) ) ] ; $ element = $ OUTPUT -> render_from_template ( 'core_admin/setting_configduration' , $ context ) ; return format_admin_setting ( $ this , $ this -> visiblename , $ element , $ this -> description , $ inputid , '' , $ defaultinfo , $ query ) ; }
docstring: Returns duration text+select fields.
  
  @param array $data Must be form 'v'=>xx, 'u'=>xx
  @param string $query
  @return string duration text+select fields and wrapping div(s)
docstring_tokens: Returns duration text + select fields .