diff --git a/go-form-plugin/export/opengoth.php b/go-form-plugin/export/opengoth.php deleted file mode 100644 index b8405b4..0000000 --- a/go-form-plugin/export/opengoth.php +++ /dev/null @@ -1,36 +0,0 @@ -name : 'Unknown Form'; -$entries = go_form_get_entries($form_id); - -header('Content-Type: text/json; charset=utf-8'); -header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export.csv"'); - -$output = fopen('php://output', 'w'); -fputcsv($output, ['ID', 'First Name', 'Last Name', 'Country', 'Club', 'Rank', 'Email', 'EGD Number', 'Comment', 'Date Added']); - -foreach ($entries as $e) { - global $ranks; - fputcsv($output, [ - $e->id, - $e->first_name, - $e->last_name, - $e->country, - $e->club, - $ranks[$e->rank] ?? '', - $e->email, - $e->egd_number, - $e->comment, - $e->created_at - ]); -} - -fclose($output); \ No newline at end of file diff --git a/go-form-plugin/export/opengotha.php b/go-form-plugin/export/opengotha.php new file mode 100644 index 0000000..dd80736 --- /dev/null +++ b/go-form-plugin/export/opengotha.php @@ -0,0 +1,60 @@ +name : 'Unknown Form'; +$entries = go_form_get_entries($form_id); + +header('Content-Type: text/xml; charset=utf-8'); +header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export-opengoth.xml"'); + +$output = fopen('php://output', 'w'); + +fwrite($output, ''); + +$count = count($entries); +foreach ($entries as $i => $e) { + $rank = $ranks[$e->rank]; + $out = "club\" country=\"$e->country\" egfPin=\"$e->egd_number\" ffgLicence=\"\" ffgLicenceStatus=\"\" firstName=\"$e->first_name\" grade=\"$rank\" name=\"$e->last_name\" participating=\"11111111111111111111\" rank=\"$rank\" rating=\"$e->rating\" ratingOrigin=\"\" registeringStatus=\"PRE\" smmsCorrection=\"0\"/>"; + fwrite($output, $out); +} + +fwrite( $output,' + + + + + + + + + +[, , , , , ] + + + + + + + + + + + + + + + + + + + +'); + +fclose($output); \ No newline at end of file diff --git a/go-form-plugin/go-form-plugin.php b/go-form-plugin/go-form-plugin.php index ae1b267..a1c4731 100644 --- a/go-form-plugin/go-form-plugin.php +++ b/go-form-plugin/go-form-plugin.php @@ -245,7 +245,8 @@ add_action('admin_post_go_form_export_pairgoth', 'go_form_export_pairgoth'); function go_form_export_opengotha() { - include_once 'export/opengoth.php'; + global $ranks; + include_once 'export/opengotha.php'; exit; } add_action('admin_post_go_form_export_opengotha', 'go_form_export_opengotha');