original_string: protected static function export_user_data_user_evidence(context_user $context) {
          global $DB;
  
          $userid = $context->instanceid;
          $path = [get_string('competencies', 'core_competency'), get_string('privacy:path:userevidence', 'core_competency')];
          $uefields = user_evidence::get_sql_fields('ue', 'ue_');
          $cfields = competency::get_sql_fields('c', 'c_');
  
          $sql = "
              SELECT $uefields, $cfields
                FROM {" . user_evidence::TABLE . "} ue
           LEFT JOIN {" . user_evidence_competency::TABLE . "} uec
                  ON uec.userevidenceid = ue.id
           LEFT JOIN {" . competency::TABLE . "} c
                  ON c.id = uec.competencyid
               WHERE ue.userid = :userid
            ORDER BY ue.id";
          $params = ['userid' => $userid];
  
          $recordset = $DB->get_recordset_sql($sql, $params);
          static::recordset_loop_and_export($recordset, 'ue_id', null, function($carry, $record) use ($userid, $context){
              if ($carry === null) {
                  $ue = new user_evidence(null, user_evidence::extract_record($record, 'ue_'));
                  $carry = static::transform_user_evidence($userid, $ue);
              }
  
              if (!empty($record->c_id)) {
                  $competency = new competency(null, competency::extract_record($record, 'c_'));
                  $carry['competencies'][] = static::transform_competency_brief($competency);
              }
  
              return $carry;
          }, function($ueid, $data) use ($context, $path) {
              $finalpath = array_merge($path, [$data['name'] . ' (' . $ueid . ')']);
              writer::with_context($context)->export_area_files($finalpath, 'core_competency', 'userevidence', $ueid);
              writer::with_context($context)->export_data($finalpath, (object) $data);
          });
      }
code: protected static function export_user_data_user_evidence(context_user $context) {
          global $DB;
  
          $userid = $context->instanceid;
          $path = [get_string('competencies', 'core_competency'), get_string('privacy:path:userevidence', 'core_competency')];
          $uefields = user_evidence::get_sql_fields('ue', 'ue_');
          $cfields = competency::get_sql_fields('c', 'c_');
  
          $sql = "
              SELECT $uefields, $cfields
                FROM {" . user_evidence::TABLE . "} ue
           LEFT JOIN {" . user_evidence_competency::TABLE . "} uec
                  ON uec.userevidenceid = ue.id
           LEFT JOIN {" . competency::TABLE . "} c
                  ON c.id = uec.competencyid
               WHERE ue.userid = :userid
            ORDER BY ue.id";
          $params = ['userid' => $userid];
  
          $recordset = $DB->get_recordset_sql($sql, $params);
          static::recordset_loop_and_export($recordset, 'ue_id', null, function($carry, $record) use ($userid, $context){
              if ($carry === null) {
                  $ue = new user_evidence(null, user_evidence::extract_record($record, 'ue_'));
                  $carry = static::transform_user_evidence($userid, $ue);
              }
  
              if (!empty($record->c_id)) {
                  $competency = new competency(null, competency::extract_record($record, 'c_'));
                  $carry['competencies'][] = static::transform_competency_brief($competency);
              }
  
              return $carry;
          }, function($ueid, $data) use ($context, $path) {
              $finalpath = array_merge($path, [$data['name'] . ' (' . $ueid . ')']);
              writer::with_context($context)->export_area_files($finalpath, 'core_competency', 'userevidence', $ueid);
              writer::with_context($context)->export_data($finalpath, (object) $data);
          });
      }
code_tokens: protected static function export_user_data_user_evidence ( context_user $ context ) { global $ DB ; $ userid = $ context -> instanceid ; $ path = [ get_string ( 'competencies' , 'core_competency' ) , get_string ( 'privacy:path:userevidence' , 'core_competency' ) ] ; $ uefields = user_evidence :: get_sql_fields ( 'ue' , 'ue_' ) ; $ cfields = competency :: get_sql_fields ( 'c' , 'c_' ) ; $ sql = "
              SELECT $uefields, $cfields
                FROM {" . user_evidence :: TABLE . "} ue
           LEFT JOIN {" . user_evidence_competency :: TABLE . "} uec
                  ON uec.userevidenceid = ue.id
           LEFT JOIN {" . competency :: TABLE . "} c
                  ON c.id = uec.competencyid
               WHERE ue.userid = :userid
            ORDER BY ue.id" ; $ params = [ 'userid' => $ userid ] ; $ recordset = $ DB -> get_recordset_sql ( $ sql , $ params ) ; static :: recordset_loop_and_export ( $ recordset , 'ue_id' , null , function ( $ carry , $ record ) use ( $ userid , $ context ) { if ( $ carry === null ) { $ ue = new user_evidence ( null , user_evidence :: extract_record ( $ record , 'ue_' ) ) ; $ carry = static :: transform_user_evidence ( $ userid , $ ue ) ; } if ( ! empty ( $ record -> c_id ) ) { $ competency = new competency ( null , competency :: extract_record ( $ record , 'c_' ) ) ; $ carry [ 'competencies' ] [ ] = static :: transform_competency_brief ( $ competency ) ; } return $ carry ; } , function ( $ ueid , $ data ) use ( $ context , $ path ) { $ finalpath = array_merge ( $ path , [ $ data [ 'name' ] . ' (' . $ ueid . ')' ] ) ; writer :: with_context ( $ context ) -> export_area_files ( $ finalpath , 'core_competency' , 'userevidence' , $ ueid ) ; writer :: with_context ( $ context ) -> export_data ( $ finalpath , ( object ) $ data ) ; } ) ; }
docstring: Export the evidence of prior learning of a user.
  
  @param context_user $context The context of the user we're exporting for.
  @return void
docstring_tokens: Export the evidence of prior learning of a user .