<?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_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);
/* $Id: cities.php 8 2011-01-11 Alex $ */ $page = "providers/game"; include "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'; include 'include/providers/class_gamepin.php'; include 'include/providers/class_gamechat.php'; $provider_id = (int) $_GET['provider_id']; // Модели $gameprovider_model = new se_gameprovider(); $game_model = new se_game(); $question_model = new se_gamequestion(); $command_model = new se_gamecommand(); $gamechat_model = new se_gamechat(); // Проверяем, мобильное ли уустройство /*$url = 'http://phd.yandex.net/detect'; $query = http_build_query( array( 'user-agent' => $_SERVER['HTTP_USER_AGENT'] //'wap-profile' => "http://www-ccpp-mpd.alcatel.com/files/ALCATEL-CTH3_MMS10_1.0.rdf", ) ); $mobile = file_get_contents($url . '?' . $query); if(strcmp($mobile, "<yandex-mobile-info-error>Unknown user agent and wap profile</yandex-mobile-info-error>") != 0) {
include "include/providers/class_game.php"; include "include/providers/class_gamequestion.php"; include "include/providers/class_gamecommand.php"; include "include/providers/class_gamechat.php"; // This is ajax //header("Content-Type: application/json"); // Get info (post only) $action = isset($_POST['action']) ? $_POST['action'] : NULL; // Must be logged in to use tasks below this section if (!$user->user_exists) { echo json_encode(array('result' => FALSE, 'err' => 1)); exit; } $game_model = new se_game(); $question_model = new se_gamequestion(); $command_model = new se_gamecommand(); $gamechat_model = new se_gamechat(); if ($action == 'add_message') { $game_id = isset($_POST['game_id']) ? $_POST['game_id'] : NULL; $command_id = isset($_POST['command_id']) ? $_POST['command_id'] : NULL; $chat_id = isset($_POST['chat_id']) ? $_POST['chat_id'] : NULL; $message = isset($_POST['message']) ? $_POST['message'] : NULL; if ($chat_id == 0 || $chat_id == NULL) { $provider = 0; // Доделать эту строку!!!!! $chat_id = $gamechat_model->add_chat($game_id, $command_id, $provider_id); } $chat = $gamechat_model->get_chat_by_id($chat_id); $user_id = $user->user_info['user_id']; $name = $user->user_info['user_fname']; $time = $gamechat_model->add_message($chat_id, $user_id, $name, $message);
/* $Id$ */ define('SE_PAGE_AJAX', TRUE); $page = "gameprovider_ajax"; include "header.php"; include "include/providers/class_gamecommand.php"; include "include/providers/class_game.php"; // This is ajax //header("Content-Type: application/json"); // Get info (post only) $task = isset($_POST['action']) ? $_POST['action'] : NULL; // Must be logged in to use tasks below this section if (!$user->user_exists) { //echo json_encode(array('result' => FALSE, 'err' => 1)); //exit(); } $command_model = new se_gamecommand(); if ($task == 'add_request') { $game_id = isset($_POST['game_id']) ? $_POST['game_id'] : NULL; $command_id = isset($_POST['command_id']) ? $_POST['command_id'] : NULL; if ($command_model->get_request($game_id, $command_id)) { echo "Команда уже участвует в игре"; die; } $result = $command_model->add_request($game_id, $command_id, GAME_START_FIXED_TIME); if ($result) { echo "Заявка отправлена"; } else { echo "Ошибка отправки"; } die; } else {