Add date info on todays list
This commit is contained in:
parent
128e3f33bb
commit
8f5388c6f2
|
@ -21,6 +21,7 @@ class TodayController extends AbstractController
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$date = date('Y-m-d');
|
$date = date('Y-m-d');
|
||||||
return $this->render('today/index.html.twig', [
|
return $this->render('today/index.html.twig', [
|
||||||
|
"date" => $date,
|
||||||
"species" => $this->recorded_species_by_date($date),
|
"species" => $this->recorded_species_by_date($date),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +34,7 @@ class TodayController extends AbstractController
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$date = date('Y-m-d');
|
$date = date('Y-m-d');
|
||||||
return $this->render('today/index.html.twig', [
|
return $this->render('today/index.html.twig', [
|
||||||
|
"date" => $date,
|
||||||
"species" => $this->recorded_species_by_date($date)
|
"species" => $this->recorded_species_by_date($date)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +47,7 @@ class TodayController extends AbstractController
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$date = date('Y-m-d');
|
$date = date('Y-m-d');
|
||||||
return $this->render('today/species.html.twig', [
|
return $this->render('today/species.html.twig', [
|
||||||
|
"date" => $date,
|
||||||
"results" => $this->recorded_species_by_id_and_date($id, $date)
|
"results" => $this->recorded_species_by_id_and_date($id, $date)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
{% extends "base.html.twig" %}
|
{% extends "base.html.twig" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{{ "Today's Detected Species" | trans }}</h2>
|
<h2>
|
||||||
{# Display a list of records if any, else, print message #}
|
{% set today = "now" | date("Y-m-d") %}
|
||||||
{% if results[0] is defined and results[0] | length > 0 %}
|
{% if today == date %}
|
||||||
<ul>
|
{{ "Today's detected species" | trans }}
|
||||||
{% for sp in results %}
|
{% else %}
|
||||||
<li class="species">
|
{{ "Detected species on" | trans }}
|
||||||
<a href="./species/{{ sp['taxon_id'] }}">
|
{{ date | format_datetime("full", "none") }}
|
||||||
<span class="scientific-name">{{ sp["scientific_name"] }} (</span><span class="common-name">{{ sp["common_name"] }}</span>)
|
{% endif %}
|
||||||
</a>
|
</h2>
|
||||||
</li>
|
{# Display a list of records if any, else, print message #}
|
||||||
{% endfor %}
|
{% if results[0] is defined and results[0] | length > 0 %}
|
||||||
</ul>
|
<ul>
|
||||||
{% endif %}
|
{% for sp in results %}
|
||||||
{% endblock %}
|
<li class="species">
|
||||||
|
<a href="./species/{{ sp['taxon_id'] }}">
|
||||||
|
<span class="scientific-name">{{ sp["scientific_name"] }}
|
||||||
|
(</span>
|
||||||
|
<span class="common-name">{{ sp["common_name"] }}</span>)
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue