original_string: public function set_users(array $users) {
          $this->users = $users;
          $hasbulkops = !empty($this->bulkoperations);
          foreach ($users as $userid=>$user) {
              $user = (array)$user;
              $row = new html_table_row();
              $row->attributes = array('class' => 'userinforow');
              $row->id = 'user_'.$userid;
              $row->cells = array();
              if ($hasbulkops) {
                  // Add a checkbox into the first column.
                  $input = html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'bulkuser[]', 'value' => $userid));
                  $row->cells[] = new html_table_cell($input);
              }
              foreach ($this->fields as $field => $label) {
                  if (is_array($label)) {
                      $bits = array();
                      foreach (array_keys($label) as $subfield) {
                          if (array_key_exists($subfield, $user)) {
                              $bits[] = html_writer::tag('div', $user[$subfield], array('class'=>'subfield subfield_'.$subfield));
                          }
                      }
                      if (empty($bits)) {
                          $bits[] = '&nbsp;';
                      }
                      $row->cells[] = new html_table_cell(join(' ', $bits));
                  } else {
                      if (!array_key_exists($field, $user)) {
                          $user[$field] = '&nbsp;';
                      }
                      $row->cells[] = new html_table_cell($user[$field]);
                  }
              }
              $this->data[] = $row;
          }
      }
code: public function set_users(array $users) {
          $this->users = $users;
          $hasbulkops = !empty($this->bulkoperations);
          foreach ($users as $userid=>$user) {
              $user = (array)$user;
              $row = new html_table_row();
              $row->attributes = array('class' => 'userinforow');
              $row->id = 'user_'.$userid;
              $row->cells = array();
              if ($hasbulkops) {
                  // Add a checkbox into the first column.
                  $input = html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'bulkuser[]', 'value' => $userid));
                  $row->cells[] = new html_table_cell($input);
              }
              foreach ($this->fields as $field => $label) {
                  if (is_array($label)) {
                      $bits = array();
                      foreach (array_keys($label) as $subfield) {
                          if (array_key_exists($subfield, $user)) {
                              $bits[] = html_writer::tag('div', $user[$subfield], array('class'=>'subfield subfield_'.$subfield));
                          }
                      }
                      if (empty($bits)) {
                          $bits[] = '&nbsp;';
                      }
                      $row->cells[] = new html_table_cell(join(' ', $bits));
                  } else {
                      if (!array_key_exists($field, $user)) {
                          $user[$field] = '&nbsp;';
                      }
                      $row->cells[] = new html_table_cell($user[$field]);
                  }
              }
              $this->data[] = $row;
          }
      }
code_tokens: public function set_users ( array $ users ) { $ this -> users = $ users ; $ hasbulkops = ! empty ( $ this -> bulkoperations ) ; foreach ( $ users as $ userid => $ user ) { $ user = ( array ) $ user ; $ row = new html_table_row ( ) ; $ row -> attributes = array ( 'class' => 'userinforow' ) ; $ row -> id = 'user_' . $ userid ; $ row -> cells = array ( ) ; if ( $ hasbulkops ) { // Add a checkbox into the first column. $ input = html_writer :: empty_tag ( 'input' , array ( 'type' => 'checkbox' , 'name' => 'bulkuser[]' , 'value' => $ userid ) ) ; $ row -> cells [ ] = new html_table_cell ( $ input ) ; } foreach ( $ this -> fields as $ field => $ label ) { if ( is_array ( $ label ) ) { $ bits = array ( ) ; foreach ( array_keys ( $ label ) as $ subfield ) { if ( array_key_exists ( $ subfield , $ user ) ) { $ bits [ ] = html_writer :: tag ( 'div' , $ user [ $ subfield ] , array ( 'class' => 'subfield subfield_' . $ subfield ) ) ; } } if ( empty ( $ bits ) ) { $ bits [ ] = '&nbsp;' ; } $ row -> cells [ ] = new html_table_cell ( join ( ' ' , $ bits ) ) ; } else { if ( ! array_key_exists ( $ field , $ user ) ) { $ user [ $ field ] = '&nbsp;' ; } $ row -> cells [ ] = new html_table_cell ( $ user [ $ field ] ) ; } } $ this -> data [ ] = $ row ; } }
docstring: Sets the users for this table
  
  @param array $users
  @return void
docstring_tokens: Sets the users for this table