original_string: public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
          global $DB;
  
          list ($contextjoin, $contextparams) = $this->get_course_level_context_restriction_sql($context, 'c', SQL_PARAMS_NAMED);
          if ($contextjoin === null) {
              return null;
          }
  
          $fields = course_handler::create()->get_fields();
          if (!$fields) {
              $fields = array();
          }
          list($fieldsql, $fieldparam) = $DB->get_in_or_equal(array_keys($fields), SQL_PARAMS_NAMED, 'fld', true, true);
  
          // Restrict recordset to CONTEXT_COURSE (since we are implementing it to core_course\search).
          $sql = "SELECT d.*
                    FROM {customfield_data} d
                    JOIN {course} c ON c.id = d.instanceid
                    JOIN {context} cnt ON cnt.instanceid = c.id
             $contextjoin
                   WHERE d.timemodified >= :modifiedfrom
                     AND cnt.contextlevel = :contextlevel
                     AND d.fieldid $fieldsql
                ORDER BY d.timemodified ASC";
          return $DB->get_recordset_sql($sql , array_merge($contextparams,
              ['modifiedfrom' => $modifiedfrom, 'contextlevel' => CONTEXT_COURSE], $fieldparam));
      }
code: public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
          global $DB;
  
          list ($contextjoin, $contextparams) = $this->get_course_level_context_restriction_sql($context, 'c', SQL_PARAMS_NAMED);
          if ($contextjoin === null) {
              return null;
          }
  
          $fields = course_handler::create()->get_fields();
          if (!$fields) {
              $fields = array();
          }
          list($fieldsql, $fieldparam) = $DB->get_in_or_equal(array_keys($fields), SQL_PARAMS_NAMED, 'fld', true, true);
  
          // Restrict recordset to CONTEXT_COURSE (since we are implementing it to core_course\search).
          $sql = "SELECT d.*
                    FROM {customfield_data} d
                    JOIN {course} c ON c.id = d.instanceid
                    JOIN {context} cnt ON cnt.instanceid = c.id
             $contextjoin
                   WHERE d.timemodified >= :modifiedfrom
                     AND cnt.contextlevel = :contextlevel
                     AND d.fieldid $fieldsql
                ORDER BY d.timemodified ASC";
          return $DB->get_recordset_sql($sql , array_merge($contextparams,
              ['modifiedfrom' => $modifiedfrom, 'contextlevel' => CONTEXT_COURSE], $fieldparam));
      }
code_tokens: public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; list ( $ contextjoin , $ contextparams ) = $ this -> get_course_level_context_restriction_sql ( $ context , 'c' , SQL_PARAMS_NAMED ) ; if ( $ contextjoin === null ) { return null ; } $ fields = course_handler :: create ( ) -> get_fields ( ) ; if ( ! $ fields ) { $ fields = array ( ) ; } list ( $ fieldsql , $ fieldparam ) = $ DB -> get_in_or_equal ( array_keys ( $ fields ) , SQL_PARAMS_NAMED , 'fld' , true , true ) ; // Restrict recordset to CONTEXT_COURSE (since we are implementing it to core_course\search). $ sql = "SELECT d.*
                    FROM {customfield_data} d
                    JOIN {course} c ON c.id = d.instanceid
                    JOIN {context} cnt ON cnt.instanceid = c.id
             $contextjoin
                   WHERE d.timemodified >= :modifiedfrom
                     AND cnt.contextlevel = :contextlevel
                     AND d.fieldid $fieldsql
                ORDER BY d.timemodified ASC" ; return $ DB -> get_recordset_sql ( $ sql , array_merge ( $ contextparams , [ 'modifiedfrom' => $ modifiedfrom , 'contextlevel' => CONTEXT_COURSE ] , $ fieldparam ) ) ; }
docstring: Returns recordset containing required data for indexing
  course custom fields.
  
  @param int $modifiedfrom timestamp
  @param \context|null $context Restriction context
  @return \moodle_recordset|null Recordset or null if no change possible
docstring_tokens: Returns recordset containing required data for indexing course custom fields .