<?php

$page = "adm/adm_game_system";
include "adm_header.php";
include 'include/providers/class_gameprovider.php';
include 'include/providers/class_game.php';
include 'include/providers/class_gamequestion.php';
include 'include/providers/class_gamecommand.php';
$provider_id = $provider->provider_info['provider_id'];
$game_model = new se_game();
$question_model = new se_gamequestion();
$command_model = new se_gamecommand();
// Управление ли одной конкретной игрой либо всеми текущими
$games_id = array();
if (isset($_GET['game_id'])) {
    $games['games'][] = $game_model->get_game($_GET['game_id']);
    $games['print_count'] = count($games['games']);
} else {
    $games['games'] = $game_model->get_current_games($provider_id);
    $games['print_count'] = count($games['games']);
}
if (isset($_POST['action'])) {
    $action = $_POST['action'];
    if ($action == 'add_question') {
        $question = isset($_POST['question']) && trim($_POST['question']) ? trim($_POST['question']) : null;
        $question_status = isset($_POST['question_status']) ? (int) $_POST['question_status'] : null;
        $question_is_necessary = $_POST['question_is_necessary'] ? 1 : 0;
        $command_id = isset($_POST['command_id']) ? (int) $_POST['command_id'] : null;
        $game_id = isset($_POST['game_id']) ? (int) $_POST['game_id'] : null;
        if ($question && $question_status && $game_id && $game_model->is_provider_game($provider_id, $game_id)) {
            $question_model->add_question($question, $question_status, $question_is_necessary, $game_id, $command_id);
Esempio n. 2
0
{
    
}
*/
$game_id = isset($_GET['game_id']) ? (int) $_GET['game_id'] : 0;
if (!$game_id) {
    $error_message = "Игра не выбрана.";
    $smarty->assign('error_message', $error_message);
    $smarty->assign('game_id', $game_id);
    $smarty->assign('off_div', "style='display: none'");
    $smarty->assign('error_div', "style='display: block'");
    include "footer.php";
    die;
}
// Игра
$game = $game_model->get_game($game_id);
$user_id = $user->user_info['user_id'];
/*
$command_id = $command_model->get_command_id($user_id, $game_id);
$result = $game_model->can_begin_game($game, $command_id);
echo  $result ? 1 : 0;
die();  */
if ($_POST['command_id']) {
    $command_id = $_POST['command_id'];
    $avialable_commands = $command_model->get_available_commands($user_id);
    $flag = false;
    foreach ($avialable_commands as $command) {
        if ($command['groupmember_group_id'] == $command_id) {
            $flag = true;
            break;
        }