original_string: protected function load_groups() {
          global $DB;
  
          $groupids = [];
          foreach ($this->events as $event) {
              if ($group = $event->get_group()) {
                  $id = $group->get('id');
                  $groupids[$id] = true;
              }
          }
  
          if (empty($groupids)) {
              $this->groups = [];
              return;
          }
  
          list($idsql, $params) = $DB->get_in_or_equal(array_keys($groupids));
          $sql = "SELECT * FROM {groups} WHERE id {$idsql}";
  
          $this->groups = $DB->get_records_sql($sql, $params);
      }
code: protected function load_groups() {
          global $DB;
  
          $groupids = [];
          foreach ($this->events as $event) {
              if ($group = $event->get_group()) {
                  $id = $group->get('id');
                  $groupids[$id] = true;
              }
          }
  
          if (empty($groupids)) {
              $this->groups = [];
              return;
          }
  
          list($idsql, $params) = $DB->get_in_or_equal(array_keys($groupids));
          $sql = "SELECT * FROM {groups} WHERE id {$idsql}";
  
          $this->groups = $DB->get_records_sql($sql, $params);
      }
code_tokens: protected function load_groups ( ) { global $ DB ; $ groupids = [ ] ; foreach ( $ this -> events as $ event ) { if ( $ group = $ event -> get_group ( ) ) { $ id = $ group -> get ( 'id' ) ; $ groupids [ $ id ] = true ; } } if ( empty ( $ groupids ) ) { $ this -> groups = [ ] ; return ; } list ( $ idsql , $ params ) = $ DB -> get_in_or_equal ( array_keys ( $ groupids ) ) ; $ sql = "SELECT * FROM {groups} WHERE id {$idsql}" ; $ this -> groups = $ DB -> get_records_sql ( $ sql , $ params ) ; }
docstring: Load the list of all of the distinct groups required for the
  list of provided events and save the result in memory.
docstring_tokens: Load the list of all of the distinct groups required for the list of provided events and save the result in memory .