} } } } } } } foreach ($games['games'] as $game) { $commands_tmp = $command_model->get_game_commands($game['game_id']); $game_id = $game['game_id']; foreach ($commands_tmp as $command_tmp) { $commands[$game_id]['commands'][] = $command_tmp; } $commands[$game_id]['print_count'] = count($commands[$game_id]['commands']); foreach ($commands[$game_id]['commands'] as &$command) { $command['group_game_sstatus'] = $game_model->get_command_game_sstatus($command['group_id'], $game['game_id']); $command['group_game_sdate'] = $game_model->get_command_game_sdate($command['group_id'], $game['game_id']); $command['group_game_count_active_users'] = $command_model->get_count_active_users($command['group_id'], $game['game_id']); $command['group_game_count_all_users'] = $command_model->get_count_all_users($command['group_id']); $command['group_main_questions'] = $question_model->get_command_main_questions($command['group_id'], $game['game_id']); $command['group_penalty_questions'] = $question_model->get_command_penalty_questions($command['group_id'], $game['game_id']); $command['group_portions'] = $question_model->get_command_portions($command['group_id'], $game_id); // Формируем массив добавленных в порции вопросов $portions_tmp = array(); foreach ($command['group_portions'] as $portion) { foreach ($portion['questions_id'] as $question_id_array) { if ($question_id_array['question_id']) { $portions_tmp[] = $question_id_array['question_id']; } } }