// Make connection object $dataConnector = new DataConnector(); // Check which task switch ($_REQUEST['task']) { // Fetch all statistical indicators in database case 'indicators': // Returns JSON encoded array of indicators echo $dataConnector->getIndicators(); break; // Fetch available years for one indicator // Fetch available years for one indicator case 'indYears': $indicatorID = (int) $_REQUEST['id']; // Avoid exploitation // Returns JSON encoded array of available years for one indicator echo $dataConnector->getIndicatorYears($indicatorID); break; case 'makeKMZ': // Include engine class require_once 'TME_Engine.php'; $year = 0; // 0 = All years $region = 0; // 0 = All regions // Get indicator ID $indicatorID = (int) $_REQUEST['indicator']; // Check if one year or time series if ($_REQUEST['timeType'] == 'year') { $year = $_REQUEST['year']; } // Create data store