original_string: protected static function export_user_data_in_course_contexts_settings($userid, $courseids, $path) {
          global $DB;
  
          // Fetch all the courses with associations we created or modified.
          $ccsfields = course_competency_settings::get_sql_fields('ccs', 'ccs_');
          list($insql, $inparams) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
          $sql = "
              SELECT $ccsfields
                FROM {" . course_competency_settings::TABLE . "} ccs
               WHERE ccs.usermodified = :userid
                 AND ccs.courseid $insql
            ORDER BY ccs.courseid";
          $params = array_merge($inparams, ['userid' => $userid]);
          $recordset = $DB->get_recordset_sql($sql, $params);
  
          // Export the data.
          static::recordset_loop_and_export($recordset, 'ccs_courseid', [], function($carry, $record) {
              $ccs = new course_competency_settings(null, course_competency_settings::extract_record($record, 'ccs_'));
              return [
                  'timemodified' => transform::datetime($ccs->get('timemodified')),
                  'created_or_modified_by_you' => transform::yesno(true)
              ];
          }, function($courseid, $data) use ($path, $userid, $DB) {
              $context = context_course::instance($courseid);
              writer::with_context($context)->export_related_data($path, 'settings', (object) $data);
          });
      }
code: protected static function export_user_data_in_course_contexts_settings($userid, $courseids, $path) {
          global $DB;
  
          // Fetch all the courses with associations we created or modified.
          $ccsfields = course_competency_settings::get_sql_fields('ccs', 'ccs_');
          list($insql, $inparams) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
          $sql = "
              SELECT $ccsfields
                FROM {" . course_competency_settings::TABLE . "} ccs
               WHERE ccs.usermodified = :userid
                 AND ccs.courseid $insql
            ORDER BY ccs.courseid";
          $params = array_merge($inparams, ['userid' => $userid]);
          $recordset = $DB->get_recordset_sql($sql, $params);
  
          // Export the data.
          static::recordset_loop_and_export($recordset, 'ccs_courseid', [], function($carry, $record) {
              $ccs = new course_competency_settings(null, course_competency_settings::extract_record($record, 'ccs_'));
              return [
                  'timemodified' => transform::datetime($ccs->get('timemodified')),
                  'created_or_modified_by_you' => transform::yesno(true)
              ];
          }, function($courseid, $data) use ($path, $userid, $DB) {
              $context = context_course::instance($courseid);
              writer::with_context($context)->export_related_data($path, 'settings', (object) $data);
          });
      }
code_tokens: protected static function export_user_data_in_course_contexts_settings ( $ userid , $ courseids , $ path ) { global $ DB ; // Fetch all the courses with associations we created or modified. $ ccsfields = course_competency_settings :: get_sql_fields ( 'ccs' , 'ccs_' ) ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ courseids , SQL_PARAMS_NAMED ) ; $ sql = "
              SELECT $ccsfields
                FROM {" . course_competency_settings :: TABLE . "} ccs
               WHERE ccs.usermodified = :userid
                 AND ccs.courseid $insql
            ORDER BY ccs.courseid" ; $ params = array_merge ( $ inparams , [ 'userid' => $ userid ] ) ; $ recordset = $ DB -> get_recordset_sql ( $ sql , $ params ) ; // Export the data. static :: recordset_loop_and_export ( $ recordset , 'ccs_courseid' , [ ] , function ( $ carry , $ record ) { $ ccs = new course_competency_settings ( null , course_competency_settings :: extract_record ( $ record , 'ccs_' ) ) ; return [ 'timemodified' => transform :: datetime ( $ ccs -> get ( 'timemodified' ) ) , 'created_or_modified_by_you' => transform :: yesno ( true ) ] ; } , function ( $ courseid , $ data ) use ( $ path , $ userid , $ DB ) { $ context = context_course :: instance ( $ courseid ) ; writer :: with_context ( $ context ) -> export_related_data ( $ path , 'settings' , ( object ) $ data ) ; } ) ; }
docstring: Export user data in course contexts related to course settings.
  
  @param int $userid The user ID.
  @param array $courseids The course IDs.
  @param array $path The root path to export at.
  @return void
docstring_tokens: Export user data in course contexts related to course settings .