$help_status = (int) $help_statuses[$i]; $x = $xs[$i]; if ($help) { $question_model->add_help($question_id, $help, $help_status, $x); } } } } else { if ($action == 'add_portion') { $command_id = isset($_POST['command_id']) ? (int) $_POST['command_id'] : 0; $game_id = isset($_POST['game_id']) ? (int) $_POST['game_id'] : null; $portion_status = isset($_POST['portion_status']) ? (int) $_POST['portion_status'] : null; $X = isset($_POST['x']) ? (int) $_POST['x'] : 0; $Y = isset($_POST['y']) ? (int) $_POST['y'] : 0; if ($game_id && $portion_status && $game_model->is_provider_game($provider_id, $game_id)) { $question_model->add_portion($command_id, $game_id, $portion_status, $X, $Y); } } } } } } } } 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']);