<?php

/* $Id: cities.php 8 2011-01-11 Alex $ */
$page = "providers/gameprovider";
include "header.php";
include 'include/providers/class_gameprovider.php';
include 'include/providers/class_game.php';
include 'include/providers/class_gamecommand.php';
include 'include/class_city.php';
$provider_id = (int) $_GET['provider_id'];
$user_id = $user->user_info['user_id'];
// Модель поставщика
$gameprovider = new se_gameprovider();
$game_model = new se_game();
$city_model = new se_city();
$command_model = new se_gamecommand();
$provider_info = $gameprovider->get_gameprovider($provider_id);
$games = $game_model->get_current_games($provider_id);
$city = $city_model->get_city($provider_info['city_id']);
$commands = $command_model->get_available_commands($user_id);
foreach ($games as &$game) {
    $game['game_sdate'] = date('d-m-Y, h:m', $game['game_sdate']);
}
$smarty->assign_by_ref('provider_info', $provider_info);
$smarty->assign_by_ref('games', $games);
$smarty->assign('city', $city['name']);
$smarty->assign('user_id', $user_id);
include "footer.php";
<?php

$page = "adm/adm_game_setting";
include "adm_header.php";
include 'include/providers/class_gameprovider.php';
//include 'include/providers/class_game.php';
//include 'include/providers/class_gamequestion.php';
$gameprovider = new se_gameprovider();
$provider_id = $provider->provider_info['provider_id'];
//$game_model = new se_game;
//$question_model = new se_gamequestion;
$error = '';
if (isset($_POST['submit'])) {
    $game_start_time = isset($_POST['game_start_time']) ? $_POST['game_start_time'] : null;
    $answers_symbols = isset($_POST['answers_symbols']) ? trim($_POST['answers_symbols']) : null;
    if ($game_start_time && $answers_symbols) {
        $provider_info['game_start_time'] = $game_start_time;
        $provider_info['answers_symbols'] = $answers_symbols;
        $gameprovider->update_gameprovider($provider_info, $provider_id);
    } else {
        $error = 'Одно из полей незаполнено!';
    }
}
$tmp_provider = $gameprovider->get_gameprovider($provider_id);
$game_start_time = $tmp_provider['game_start_time'];
$answers_symbols = $tmp_provider['answers_symbols'];
$smarty->assign('game_start_time', $game_start_time);
$smarty->assign('answers_symbols', $answers_symbols);
$smarty->assign('error', $error);
include "adm_footer.php";