<?php

define('SE_PAGE_AJAX', TRUE);
$page = "adm/adm_game_seasons_ajax";
include "adm_header.php";
include 'include/providers/class_gameprovider.php';
include 'include/providers/class_game.php';
// Get info (post only)
$action = isset($_POST['action']) ? $_POST['action'] : null;
// Must be logged in to use tasks below this section
if (!$provider->provider_exists) {
    $result = array('success' => false, 'error' => 'access denied');
    echo json_encode($result);
    die;
}
$provider_id = $provider->provider_info['provider_id'];
$game_model = new se_game();
if ($action == 'get_season') {
    header("Content-Type: application/json");
    $season_id = isset($_POST['season_id']) ? (int) $_POST['season_id'] : null;
    if ($season_id && $game_model->is_provider_season($provider_id, $season_id)) {
        $season = $game_model->get_season($season_id);
        $result = array('success' => true, 'season' => $season);
    } else {
        $result = array('success' => false, 'error' => 'season_id is null');
    }
    echo json_encode($result);
    die;
}