player_on_field_counter < 10) { Notification::make()->title('Needs a calculation first ') ->info() ->send(); return; } $copystring = "Part 1\n"; foreach ($this->calculationVariables as $k => $part) { foreach ($part as $row) { if ($copystring == '') { $keys = array_keys($row); $copystring .= implode(';', $keys)."\n"; } $copystring .= implode(';', $row)."\n"; } if ($k == 0) { $copystring .= "\nPart 2\n"; } } $this->js("navigator.clipboard.writeText(`$copystring`)"); Notification::make() ->title('Calculation variables copied') ->success() ->send(); } public function copyResult() { if ($this->player_on_field_counter < 10) { Notification::make()->title('Needs a calculation first ') ->info() ->send(); return; } $header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; $copystring = implode(';', $header)."\n"; foreach ($this->players as $row) { $tmp = []; $tmp[] = $row['name']; $tmp[] = $row['foot']; $tmp[] = $row['tot_evt']; $tmp[] = $row['ave_min']; if ($row['pos']) { $tmp[] = $row['pos']; } else { $tmp[] = $row['pos_ori']; } $tmp[] = $row['active']; $tmp[] = $row['gls']; $tmp[] = $row['fls']; $tmp[] = $row['ofs']; $tmp[] = $row['crd']; $tmp[] = $row['snt']; $tmp[] = $row['tsh']; $tmp[] = $row['wfl']; $copystring .= implode(';', $tmp)."\n"; } $this->js("navigator.clipboard.writeText(`$copystring`)"); Notification::make() ->title('Results copied') ->success() ->send(); } }