//  GNU General Public License for more details.
//  http://www.gnu.org/licenses/
//
//
// Can be changed to another data connector class
require_once 'TME_MySQL_DataConnector.php';
// Check if a task is specified
if (isset($_REQUEST['task'])) {
    // 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;