Export_Geo.php
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\AJAX; |
| 4 | |
| 5 | use IAWP\Capability_Manager; |
| 6 | use IAWP\Date_Range\Exact_Date_Range; |
| 7 | use IAWP\Rows\Countries; |
| 8 | use IAWP\Tables\Table_Geo; |
| 9 | /** @internal */ |
| 10 | class Export_Geo extends \IAWP\AJAX\AJAX |
| 11 | { |
| 12 | protected function action_name() : string |
| 13 | { |
| 14 | return 'iawp_export_geo'; |
| 15 | } |
| 16 | protected function action_callback() : void |
| 17 | { |
| 18 | if (!Capability_Manager::can_edit()) { |
| 19 | return; |
| 20 | } |
| 21 | $geos = new Countries(Exact_Date_Range::comprehensive_range()); |
| 22 | $table = new Table_Geo(); |
| 23 | $csv = $table->csv($geos->rows()); |
| 24 | echo $csv->to_string(); |
| 25 | } |
| 26 | } |
| 27 |