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-pairgoth.tour"'); $output = fopen('php://output', 'w'); fwrite($output,'{"id":1,"type":"INDIVIDUAL","name":"Template","shortName":"20251111-Template","startDate":"2025-11-11","endDate":"2025-11-11","director":"","country":"si","location":"Template","online":false,"komi":6.5,"rules":"JAPANESE","gobanSize":19,"timeSystem":{"type":"CANADIAN","mainTime":2400,"byoyomi":300,"stones":15},"rounds":5,"pairing":{"type":"MAC_MAHON","base":{"nx1":0.5,"dupWeight":5.0E14,"random":0.0,"deterministic":true,"colorBalanceWeight":1000000.0},"main":{"catWeight":2.0E13,"scoreWeight":1.0E11,"upDownWeight":1.0E8,"upDownCompensate":true,"upDownLowerMode":"MIDDLE","upDownUpperMode":"MIDDLE","maximizeSeeding":5000000.0,"firstSeedLastRound":2,"firstSeed":"SPLIT_AND_RANDOM","secondSeed":"SPLIT_AND_FOLD","firstSeedAddCrit":"RATING","secondSeedAddCrit":"NONE","mmsValueAbsent":0.5,"roundDownScore":true,"sosValueAbsentUseBase":true},"secondary":{"barThreshold":true,"rankThreshold":0,"winsThreshold":true,"secWeight":1.0E11},"geo":{"weight":1.0E11,"mmsDiffCountry":1,"mmsDiffClubGroup":3,"mmsDiffClub":3},"handicap":{"weight":0.0,"useMMS":false,"threshold":8,"correction":2,"ceiling":9},"placement":["MMS","SOSM","SOSOSM"],"mmFloor":-20,"mmBar":0},"players":['); $count = count($entries); foreach ($entries as $i => $e) { $rank = $e->rank - 30; $id = ($i + 1) * 2; $out = "{\"id\":$id,\"name\":\"$e->first_name\",\"firstname\":\"$e->last_name\",\"rating\":$e->rating,\"rank\":$rank,\"country\":\"$e->country\",\"club\":\"$e->club\",\"final\":false,\"egf\":\"$e->egd_number\"}"; if ($i + 1 < $count) { $out .= ","; } fwrite($output, $out); } fwrite($output,'],"games":[[]]}'); fclose($output);