| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage core |
| 5 |
* @author E4J s.r.l. |
| 6 |
* @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 |
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
// No direct access |
| 12 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 13 |
|
| 14 |
/** |
| 15 |
* Wizard report ISTAT Ross 1000 help instruction. |
| 16 |
* |
| 17 |
* @since 1.18.2 (J) - 1.8.2 (WP) |
| 18 |
*/ |
| 19 |
class VBOHelpWizardDriverReportsItalyRoss1000 extends VBOHelpWizardInstructionaware |
| 20 |
{ |
| 21 |
use VBOHelpWizardTraitReportConfigurable; |
| 22 |
|
| 23 |
/** |
| 24 |
* Class contructor. |
| 25 |
*/ |
| 26 |
public function __construct() |
| 27 |
{ |
| 28 |
/** |
| 29 |
* @see VBOHelpWizardTraitReportConfigurable::$reportId |
| 30 |
*/ |
| 31 |
$this->reportId = 'istat_ross1000'; |
| 32 |
|
| 33 |
/** |
| 34 |
* @see VBOHelpWizardTraitReportConfigurable::$autoExportFormat |
| 35 |
*/ |
| 36 |
$this->autoExportFormat = 'transmitRecords'; |
| 37 |
|
| 38 |
/** |
| 39 |
* @see VBOHelpWizardTraitReportConfigurable::$autoExportPayload |
| 40 |
*/ |
| 41 |
$this->autoExportPayload = [ |
| 42 |
'fromdate' => '{Y-m-d -1 day}', |
| 43 |
'todate' => '{Y-m-d -1 day}', |
| 44 |
'listings' => [], |
| 45 |
'_reportAction' => 'transmitRecords', |
| 46 |
]; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* @inheritDoc |
| 51 |
*/ |
| 52 |
public function getID() |
| 53 |
{ |
| 54 |
return 'reports.italy.ross1000'; |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* @inheritDoc |
| 59 |
*/ |
| 60 |
public function getTitle() |
| 61 |
{ |
| 62 |
return 'ISTAT - ROSS1000'; |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* @inheritDoc |
| 67 |
*/ |
| 68 |
public function getIcon() |
| 69 |
{ |
| 70 |
return VikBookingIcons::i('id-card'); |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* @inheritDoc |
| 75 |
*/ |
| 76 |
public function getPriority() |
| 77 |
{ |
| 78 |
return 998; |
| 79 |
} |
| 80 |
|
| 81 |
/** |
| 82 |
* @inheritDoc |
| 83 |
*/ |
| 84 |
public function isSupported() |
| 85 |
{ |
| 86 |
$config = VBOFactory::getConfig(); |
| 87 |
|
| 88 |
// check whether the main country is Italy and the main province is included within the list of supported cities |
| 89 |
return $config->get('maincountry') === 'IT' && in_array($config->get('mainstate'), array_keys($this->getSupportedCities())); |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* @inheritDoc |
| 94 |
* |
| 95 |
* @see VBOHelpWizardTraitReportConfigurable::checkSettingsConfigured() |
| 96 |
*/ |
| 97 |
protected function checkSettingsConfigured() |
| 98 |
{ |
| 99 |
$config = VBOFactory::getConfig(); |
| 100 |
|
| 101 |
$settings = $config->getArray('report_settings_istat_ross1000', []); |
| 102 |
|
| 103 |
if (empty($settings['endpoint'])) { |
| 104 |
$state = $config->get('mainstate'); |
| 105 |
$cities = $this->getSupportedCities(); |
| 106 |
|
| 107 |
switch ($cities[$state] ?? null) { |
| 108 |
case 'piemonte': |
| 109 |
$url = 'https://piemontedatiturismo.regione.piemonte.it/ws/checkinV2?wsdl'; |
| 110 |
break; |
| 111 |
|
| 112 |
case 'firenze': |
| 113 |
$url = 'https://turismo5firenze.regione.toscana.it/ws/checkinV2?wsdl'; |
| 114 |
break; |
| 115 |
|
| 116 |
case 'pistoia': |
| 117 |
$url = 'https://turismo5pistoia.regione.toscana.it/ws/checkinV2?wsdl'; |
| 118 |
break; |
| 119 |
|
| 120 |
case 'prato': |
| 121 |
$url = 'https://turismo5prato.regione.toscana.it/ws/checkinV2?wsdl'; |
| 122 |
break; |
| 123 |
|
| 124 |
case 'abruzzo': |
| 125 |
$url = 'https://app.regione.abruzzo.it/Turismo5/ws/checkinV2?wsdl'; |
| 126 |
break; |
| 127 |
|
| 128 |
case 'veneto': |
| 129 |
$url = 'https://flussituristici.regione.veneto.it/ws/checkinV2?wsdl'; |
| 130 |
break; |
| 131 |
|
| 132 |
case 'emilia': |
| 133 |
$url = 'https://datiturismo.regione.emilia-romagna.it/ws/checkinV2?wsdl'; |
| 134 |
break; |
| 135 |
|
| 136 |
case 'marche': |
| 137 |
$url = 'https://istrice-ross1000.turismo.marche.it/ws/checkinV2?wsdl'; |
| 138 |
break; |
| 139 |
|
| 140 |
case 'lombardia': |
| 141 |
$url = 'https://www.flussituristici.servizirl.it/Turismo5/app/ws/checkinV2?wsdl'; |
| 142 |
break; |
| 143 |
|
| 144 |
case 'calabria': |
| 145 |
$url = 'https://sirdat.regione.calabria.it/ws/checkinV2?wsdl'; |
| 146 |
break; |
| 147 |
|
| 148 |
case 'sardegna': |
| 149 |
$url = 'https://sardegnaturismo.ross1000.it/ws/checkinV2?wsdl'; |
| 150 |
break; |
| 151 |
|
| 152 |
case 'liguria': |
| 153 |
$url = 'https://turismows.regione.liguria.it/ws/checkinV2?wsdl'; |
| 154 |
break; |
| 155 |
|
| 156 |
case 'lazio': |
| 157 |
$url = 'https://lazioturismo.ross1000.it/ws/checkinV2?wsdl'; |
| 158 |
break; |
| 159 |
|
| 160 |
default: |
| 161 |
$url = null; |
| 162 |
} |
| 163 |
|
| 164 |
$settings['endpoint'] = $url; |
| 165 |
$config->set('report_settings_istat_ross1000', $settings); |
| 166 |
} |
| 167 |
|
| 168 |
return !empty($settings['codstru']) && !empty($settings['user']) && !empty($settings['pwd']); |
| 169 |
} |
| 170 |
|
| 171 |
/** |
| 172 |
* Returns a lookup holding all the supported cities. |
| 173 |
* The keys of the array include the state 2 code. |
| 174 |
* The values of the array include the parent group (region or city). |
| 175 |
* |
| 176 |
* @return array |
| 177 |
*/ |
| 178 |
protected function getSupportedCities() |
| 179 |
{ |
| 180 |
return [ |
| 181 |
// Abruzzo |
| 182 |
|
| 183 |
'CH' => 'abruzzo', // Chieti |
| 184 |
'AQ' => 'abruzzo', // L'Aquila |
| 185 |
'PR' => 'abruzzo', // Pescara |
| 186 |
'TE' => 'abruzzo', // Teramo |
| 187 |
|
| 188 |
// Calabria |
| 189 |
|
| 190 |
'CZ' => 'calabria', // Catanzaro |
| 191 |
'CS' => 'calabria', // Cosenza |
| 192 |
'KR' => 'calabria', // Crotone |
| 193 |
'RC' => 'calabria', // Reggio Calabria |
| 194 |
'VV' => 'calabria', // Vibo Valentia |
| 195 |
|
| 196 |
// Emilia-Romagna |
| 197 |
|
| 198 |
'BO' => 'emilia', // Bologna |
| 199 |
'FE' => 'emilia', // Ferrara |
| 200 |
'FC' => 'emilia', // Forlì-Cesena |
| 201 |
'MO' => 'emilia', // Modena |
| 202 |
'PR' => 'emilia', // Parma |
| 203 |
'PC' => 'emilia', // Piacenza |
| 204 |
'RA' => 'emilia', // Ravenna |
| 205 |
'RE' => 'emilia', // Reggio Emilia |
| 206 |
'RN' => 'emilia', // Rimini |
| 207 |
|
| 208 |
// Lazio |
| 209 |
|
| 210 |
'FR' => 'lazio', // Frosinone |
| 211 |
'LT' => 'lazio', // Latina |
| 212 |
'RI' => 'lazio', // Rieti |
| 213 |
'RM' => 'lazio', // Roma |
| 214 |
'VT' => 'lazio', // Viterbo |
| 215 |
|
| 216 |
// Liguria |
| 217 |
|
| 218 |
'GE' => 'liguria', // Genova |
| 219 |
'IM' => 'liguria', // Imperia |
| 220 |
'SP' => 'liguria', // La Spezia |
| 221 |
'SV' => 'liguria', // Savona |
| 222 |
|
| 223 |
// Lombardia |
| 224 |
|
| 225 |
'BG' => 'lombardia', // Bergamo |
| 226 |
'BS' => 'lombardia', // Brescia |
| 227 |
'CO' => 'lombardia', // Como |
| 228 |
'CR' => 'lombardia', // Cremona |
| 229 |
'LC' => 'lombardia', // Lecco |
| 230 |
'LO' => 'lombardia', // Lodi |
| 231 |
'MN' => 'lombardia', // Mantova |
| 232 |
'MI' => 'lombardia', // Milano |
| 233 |
'MB' => 'lombardia', // Monza e Brianza |
| 234 |
'PV' => 'lombardia', // Pavia |
| 235 |
'SO' => 'lombardia', // Sondrio |
| 236 |
'VA' => 'lombardia', // Varese |
| 237 |
|
| 238 |
// Marche |
| 239 |
|
| 240 |
'AN' => 'marche', // Ancona |
| 241 |
'AP' => 'marche', // Ascoli Piceno |
| 242 |
'FM' => 'marche', // Fermo |
| 243 |
'MC' => 'marche', // Macerata |
| 244 |
'PU' => 'marche', // Pesaro e Urbino |
| 245 |
|
| 246 |
// Piemonte |
| 247 |
|
| 248 |
'AL' => 'piemonte', // Alessandria |
| 249 |
'AT' => 'piemonte', // Asti |
| 250 |
'BI' => 'piemonte', // Biella |
| 251 |
'CN' => 'piemonte', // Cuneo |
| 252 |
'NO' => 'piemonte', // Novara |
| 253 |
'TO' => 'piemonte', // Torino |
| 254 |
'VB' => 'piemonte', // Verbano-Cusio-Ossola |
| 255 |
'VC' => 'piemonte', // Vercelli |
| 256 |
|
| 257 |
// Sardegna |
| 258 |
|
| 259 |
'CA' => 'sardegna', // Cagliari |
| 260 |
'CI' => 'sardegna', // Carbonia-Iglesias |
| 261 |
'VS' => 'sardegna', // Medio Campidano |
| 262 |
'NU' => 'sardegna', // Nuoro |
| 263 |
'OG' => 'sardegna', // Ogliastra |
| 264 |
'OR' => 'sardegna', // Oristano |
| 265 |
'OT' => 'sardegna', // Olbia-Tempio |
| 266 |
'SS' => 'sardegna', // Sassari |
| 267 |
'SU' => 'sardegna', // Sud Sardegna |
| 268 |
|
| 269 |
// Toscana |
| 270 |
|
| 271 |
'FI' => 'firenze', // Firenze |
| 272 |
'PT' => 'pistoia', // Pistoia |
| 273 |
'PO' => 'prato', // Prato |
| 274 |
|
| 275 |
// Veneto |
| 276 |
|
| 277 |
'BL' => 'veneto', // Belluno |
| 278 |
'PD' => 'veneto', // Padova |
| 279 |
'RO' => 'veneto', // Rovigo |
| 280 |
'TV' => 'veneto', // Treviso |
| 281 |
'VE' => 'veneto', // Venezia |
| 282 |
'VR' => 'veneto', // Verona |
| 283 |
'VI' => 'veneto', // Vicenza |
| 284 |
]; |
| 285 |
} |
| 286 |
} |
| 287 |
|