FrankProjects/UltimateWarfare

View on GitHub
templates/game/region/constructGameUnits.html.twig

Summary

Maintainability
Test Coverage
{% extends 'game.html.twig' %}

{% block title %}Ultimate Warfare - Build region{% endblock title %}

{% block content %}
    Go to: <a class="B" href="{{ path('Game/World/Region', {'regionId': region.id}) }}">Region</a>
    {% for gameUnitType in gameUnitTypes %}
        - <a class="B" href="{{ path('Game/World/Region/Build', {'regionId': region.id, 'gameUnitTypeId': gameUnitType.id}) }}">{{ gameUnitType.name }}</a>
    {% endfor %}

    <form method="post" action="{{ path('Game/World/Region/Build', {'regionId': region.id, 'gameUnitTypeId': gameUnitType.id}) }}">
        <table class="table text-center">
            <tr class="tabletop">
                <td colspan="4"><b>Units</b></td>
            </tr>

            {% if gameUnitType.id == 1 %}
                <tr>
                    <td colspan="4">You have <b>{{ spaceLeft }}</b> building space left on this region.</td>
                </tr>
            {% endif %}
            <tr>
                <td></td>
                <td>Costs</td>
                <td>You have</td>
                <td>Amount</td>
            </tr>
            {% for gameUnit in gameUnitType.gameUnits %}
                <tr>
                    <td width="150">
                        <img src="{{ asset('images/' ~ gameUnitType.imageDir ~ gameUnit.image) }}" alt="{{ gameUnit.name }}" width="150" height="130">
                    </td>
                    <td width="150">
                        <a class="B" href="{{ path('Guide/GameUnit', {'gameUnitId': gameUnit.id}) }}" target="_blank" title="Information about {{ gameUnit.name }}" tabIndex="-1">
                            <b>{{ gameUnit.name }}</b>
                        </a><br />
                        <img src="{{ asset('images/icons/resource_cash.jpg') }}" width="25" height="25" alt="Cash" />{{ gameUnit.cost.cash }}<br />
                        <img src="{{ asset('images/icons/resource_wood.jpg') }}" width="25" height="25" alt="Wood" />{{ gameUnit.cost.wood }}<br />
                        <img src="{{ asset('images/icons/resource_steel.jpg') }}" width="25" height="25" alt="Steel" />{{ gameUnit.cost.steel }}<br />
                        <img src="{{ asset('images/icons/time.gif') }}" width="25" height="25" alt="Construction time">{{ gameUnit.timestamp|date('H:i:s') }}
                    </td>
                    <td width="100">
                        {% if gameUnitData[gameUnit.id] is defined and gameUnitData[gameUnit.id] > 0 %}
                            {{ gameUnitData[gameUnit.id] }}
                        {% else %}
                            0
                        {% endif %}

                        {% if constructionData[gameUnit.id] is defined and constructionData[gameUnit.id] > 0 %}
                            ({{ constructionData[gameUnit.id] }})
                        {% endif %}
                    </td>
                    <td width="200">
                        <input type="text" size="12" name="construct[{{ gameUnit.id }}]" />
                    </td>
                </tr>
            {% else %}
                <tr>
                    <td colspan="4">No Units in the UW database!</td>
                </tr>
            {% endfor %}
            <tr>
                <td colspan="4">
                    <input class="btn btn-primary" type="submit" name="submit" value="Build">
                </td>
            </tr>
        </table>
    </form>
{% endblock %}