templates/game/research.html.twig
{% extends 'game.html.twig' %}
{% block title %}Ultimate Warfare - Research{% endblock title %}
{% block content %}
<p class="text-center">
<a class="B" href="{{ path('Game/Research/History') }}">Research History</a>
</p>
<table class="table text-center">
<tr class="tabletop">
<td colspan="4"><b>Researching</b></td>
</tr>
<tr>
<td><b>Name</b></td>
<td><b>Time left</b></td>
<td><b>Finished at</b></td>
<td><b>Option</b></td>
</tr>
{% for researchPlayer in ongoingResearch %}
{% set finish = researchPlayer.timestamp + researchPlayer.research.timestamp %}
<tr>
<td>{{ researchPlayer.research.name }}</td>
<td><span class="timer">timestamp_left</span></td>
<td>{{ finish|date }}</td>
<td><a class="B" href="{{ path('Game/Research/Cancel', {'researchId': researchPlayer.research.id}) }}">Cancel</a></td>
</tr>
{% else %}
<tr>
<td colspan="4">You are not researching anything right now!</td>
</tr>
{% endfor %}
</table>
<br />
<br />
<table class="table text-center">
<tr class="tabletop">
<td colspan="3"><b>Research</b></td>
</tr>
{% for researchData in researchDataArray %}
<tr>
<td width="150" rowspan="2">
<img src="{{ asset('images/research/' ~ researchData.research.image ) }}" alt="{{ researchData.research.name }}" width="150" height="130">
</td>
<td class="text-start" width="550" colspan="2">{{ researchData.research.description }}</td>
</tr>
<tr>
<td class="text-start" valign="top">
<div><b>Name:</b> {{ researchData.research.name }}</div>
<div><b>Costs:</b> ${{ researchData.research.cost }}</div>
<div><b>Duration:</b>
{% set days = (researchData.research.timestamp / (24 * 60 * 60))|round(0, 'floor') %}
{% set hours = ((researchData.research.timestamp - (days * 24 * 60 * 60)) / (60 * 60))|round(0, 'floor') %}
{% set minutes = ((researchData.research.timestamp - (days * 24 * 60 * 60) - (hours * 60 * 60)) / 60)| round(0, 'floor') %}
{% if days > 0 %}{{ days }} days {% endif %}
{% if hours > 0 %}{{ hours }} hours {% endif %}
{% if minutes > 0 %}{{ minutes }} minutes{% endif %}
</div>
<a class="btn btn-primary" href="{{ path('Game/Research/Perform', {'researchId': researchData.research.id}) }}"><b>Research</b></a>
</td>
<td valign="top">
<b>Requirements:</b><br />
{% for researchNeed in researchData.needs.notDone %}
<div class="bad">{{ researchNeed.requiredResearch.name }}</div>
{% endfor %}
{% for researchNeed in researchData.needs.done %}
<div class="good">{{ researchNeed.requiredResearch.name }}</div>
{% endfor %}
</td>
</tr>
{% else %}
<tr>
<td>No research options available for you right now!</td>
</tr>
{% endfor %}
</table>
{% endblock %}