$time = $gamechat_model->add_message($chat_id, $user_id, $name, $message); if ($time == false) { die; } else { $temp = date('(H:i)', $time); } echo $temp; die; } else { if ($action == 'get_messages') { $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; $count_mess = isset($_POST['count_messages']) ? $_POST['count_messages'] : NULL; if ($chat_id != false) { $messages = $gamechat_model->get_messages($chat_id, $count_mess); foreach ($messages as &$message) { $message['time'] = date('H:i', $message['time']); echo "<div><h2>" . $message['name'] . " (" . $message['time'] . ")</h2>" . $message['message'] . "</div>"; } die; } } else { if ($action == 'get_command') { $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : NULL; $game_id = isset($_POST['game_id']) ? $_POST['game_id'] : NULL; $commands = $command_model->get_available_commands($user_id); if (count($commands) == 0) { echo "Нет команд. Для участия необходимо иметь команду или быть доверенным представителем команды.<br /><a href='/user_group_add.php'>Создать команду!</a>"; } else { foreach ($commands as $command) {
include "footer.php"; die; } else { $smarty->assign('off_div', "style='display: block'"); $smarty->assign('on_div', "style='display: none'"); } // Таймеры $task_end = "Aug,25,2011,13:25:00"; $help_end = "Aug,25,2011,13:25:00"; // "M,d,Y,H:i:s" $bonus_help_end = "Aug,25,2011,13:25:00"; // Чат $chat = $gamechat_model->get_chat($game_id, $command_id); $chat_id = $chat['chat_id']; if ($chat_id != false) { $messages = $gamechat_model->get_messages($chat_id, 0); foreach ($messages as &$message) { $message['time'] = date('H:i', $message['time']); } } else { $provider_id = $gameprovider_model->get_privider_id_by_game_id($game_id); $chat_id = $gamechat_model->add_chat($game_id, $command_id, $provider_id); } // Активные юзеры $active_users = $command_model->get_active_users($command_id, $game_id); //$gameStart = date("M,d,Y,h:m:i", $gameInfo['game_sdate'] + 60*60*24*62); $question_model->can_complete_game($game_id, $command_id); // Порции с вопросами $current_portions = $question_model->get_current_portions($game_id, $command_id); $next_portion = $question_model->get_next_portion($game_id, $command_id); // Если порций больше нет, то завершаем игру