original_string: public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
          global $DB;
  
          // Prepare query conditions.
          $where = 'timemodified >= ? AND deleted = ? AND confirmed = ?';
          $params = [$modifiedfrom, 0, 1];
  
          // Handle context types.
          if (!$context) {
              $context = \context_system::instance();
          }
          switch ($context->contextlevel) {
              case CONTEXT_MODULE:
              case CONTEXT_BLOCK:
              case CONTEXT_COURSE:
              case CONTEXT_COURSECAT:
                  // These contexts cannot contain any users.
                  return null;
  
              case CONTEXT_USER:
                  // Restrict to specific user.
                  $where .= ' AND id = ?';
                  $params[] = $context->instanceid;
                  break;
  
              case CONTEXT_SYSTEM:
                  break;
  
              default:
                  throw new \coding_exception('Unexpected contextlevel: ' . $context->contextlevel);
          }
  
          return $DB->get_recordset_select('user', $where, $params);
      }
code: public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
          global $DB;
  
          // Prepare query conditions.
          $where = 'timemodified >= ? AND deleted = ? AND confirmed = ?';
          $params = [$modifiedfrom, 0, 1];
  
          // Handle context types.
          if (!$context) {
              $context = \context_system::instance();
          }
          switch ($context->contextlevel) {
              case CONTEXT_MODULE:
              case CONTEXT_BLOCK:
              case CONTEXT_COURSE:
              case CONTEXT_COURSECAT:
                  // These contexts cannot contain any users.
                  return null;
  
              case CONTEXT_USER:
                  // Restrict to specific user.
                  $where .= ' AND id = ?';
                  $params[] = $context->instanceid;
                  break;
  
              case CONTEXT_SYSTEM:
                  break;
  
              default:
                  throw new \coding_exception('Unexpected contextlevel: ' . $context->contextlevel);
          }
  
          return $DB->get_recordset_select('user', $where, $params);
      }
code_tokens: public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; // Prepare query conditions. $ where = 'timemodified >= ? AND deleted = ? AND confirmed = ?' ; $ params = [ $ modifiedfrom , 0 , 1 ] ; // Handle context types. if ( ! $ context ) { $ context = \ context_system :: instance ( ) ; } switch ( $ context -> contextlevel ) { case CONTEXT_MODULE : case CONTEXT_BLOCK : case CONTEXT_COURSE : case CONTEXT_COURSECAT : // These contexts cannot contain any users. return null ; case CONTEXT_USER : // Restrict to specific user. $ where .= ' AND id = ?' ; $ params [ ] = $ context -> instanceid ; break ; case CONTEXT_SYSTEM : break ; default : throw new \ coding_exception ( 'Unexpected contextlevel: ' . $ context -> contextlevel ) ; } return $ DB -> get_recordset_select ( 'user' , $ where , $ params ) ; }
docstring: Returns recordset containing required data attributes for indexing.
  
  @param number $modifiedfrom
  @param \context|null $context Optional context to restrict scope of returned results
  @return \moodle_recordset|null Recordset (or null if no results)
docstring_tokens: Returns recordset containing required data attributes for indexing .