original_string: public function get_items() {
          global $DB, $CFG;
          if (is_siteadmin()) {
              $this->sql = preg_replace('/\\%COURSEFILTER\\%/', '<>0', $this->sql);
              $this->sql = preg_replace('/\\%ITEMFILTER\\%/', '<>0', $this->sql);
              return $DB->get_records_sql($this->sql, $this->params, $this->from, $this->limit);
          }
          if ($CFG->debugdeveloper && $this->has_item_that_needs_access_check()) {
              debugging('Caller must ensure that has_item_that_needs_access_check() does not return anything '
                      . 'before calling get_items(). The item list may be incomplete', DEBUG_DEVELOPER);
          }
          $this->retrieve_items();
          $this->save_caches();
          $idx = 0;
          $items = array();
          foreach ($this->itemkeys as $id) {
              if (!array_key_exists($id, $this->accessibleitems) || !$this->accessibleitems[$id]) {
                  continue;
              }
              if ($idx >= $this->from) {
                  $items[$id] = $this->items[$id];
              }
              $idx++;
              if ($idx >= $this->from + $this->limit) {
                  break;
              }
          }
          return $items;
      }
code: public function get_items() {
          global $DB, $CFG;
          if (is_siteadmin()) {
              $this->sql = preg_replace('/\\%COURSEFILTER\\%/', '<>0', $this->sql);
              $this->sql = preg_replace('/\\%ITEMFILTER\\%/', '<>0', $this->sql);
              return $DB->get_records_sql($this->sql, $this->params, $this->from, $this->limit);
          }
          if ($CFG->debugdeveloper && $this->has_item_that_needs_access_check()) {
              debugging('Caller must ensure that has_item_that_needs_access_check() does not return anything '
                      . 'before calling get_items(). The item list may be incomplete', DEBUG_DEVELOPER);
          }
          $this->retrieve_items();
          $this->save_caches();
          $idx = 0;
          $items = array();
          foreach ($this->itemkeys as $id) {
              if (!array_key_exists($id, $this->accessibleitems) || !$this->accessibleitems[$id]) {
                  continue;
              }
              if ($idx >= $this->from) {
                  $items[$id] = $this->items[$id];
              }
              $idx++;
              if ($idx >= $this->from + $this->limit) {
                  break;
              }
          }
          return $items;
      }
code_tokens: public function get_items ( ) { global $ DB , $ CFG ; if ( is_siteadmin ( ) ) { $ this -> sql = preg_replace ( '/\\%COURSEFILTER\\%/' , '<>0' , $ this -> sql ) ; $ this -> sql = preg_replace ( '/\\%ITEMFILTER\\%/' , '<>0' , $ this -> sql ) ; return $ DB -> get_records_sql ( $ this -> sql , $ this -> params , $ this -> from , $ this -> limit ) ; } if ( $ CFG -> debugdeveloper && $ this -> has_item_that_needs_access_check ( ) ) { debugging ( 'Caller must ensure that has_item_that_needs_access_check() does not return anything ' . 'before calling get_items(). The item list may be incomplete' , DEBUG_DEVELOPER ) ; } $ this -> retrieve_items ( ) ; $ this -> save_caches ( ) ; $ idx = 0 ; $ items = array ( ) ; foreach ( $ this -> itemkeys as $ id ) { if ( ! array_key_exists ( $ id , $ this -> accessibleitems ) || ! $ this -> accessibleitems [ $ id ] ) { continue ; } if ( $ idx >= $ this -> from ) { $ items [ $ id ] = $ this -> items [ $ id ] ; } $ idx ++ ; if ( $ idx >= $ this -> from + $ this -> limit ) { break ; } } return $ items ; }
docstring: Returns the filtered records from SQL query result.
  
  This function can only be executed after $builder->has_item_that_needs_access_check() returns null
  
  
  @return array
docstring_tokens: Returns the filtered records from SQL query result .