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;
|
||||
$date = date('Y-m-d');
|
||||
return $this->render('today/index.html.twig', [
|
||||
"date" => $date,
|
||||
"species" => $this->recorded_species_by_date($date),
|
||||
]);
|
||||
}
|
||||
@ -33,6 +34,7 @@ class TodayController extends AbstractController
|
||||
$this->connection = $connection;
|
||||
$date = date('Y-m-d');
|
||||
return $this->render('today/index.html.twig', [
|
||||
"date" => $date,
|
||||
"species" => $this->recorded_species_by_date($date)
|
||||
]);
|
||||
}
|
||||
@ -45,6 +47,7 @@ class TodayController extends AbstractController
|
||||
$this->connection = $connection;
|
||||
$date = date('Y-m-d');
|
||||
return $this->render('today/species.html.twig', [
|
||||
"date" => $date,
|
||||
"results" => $this->recorded_species_by_id_and_date($id, $date)
|
||||
]);
|
||||
}
|
||||
|
@ -1,14 +1,24 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{{ "Today's Detected Species" | trans }}</h2>
|
||||
<h2>
|
||||
{% set today = "now" | date("Y-m-d") %}
|
||||
{% if today == date %}
|
||||
{{ "Today's detected species" | trans }}
|
||||
{% else %}
|
||||
{{ "Detected species on" | trans }}
|
||||
{{ date | format_datetime("full", "none") }}
|
||||
{% endif %}
|
||||
</h2>
|
||||
{# Display a list of records if any, else, print message #}
|
||||
{% if results[0] is defined and results[0] | length > 0 %}
|
||||
<ul>
|
||||
{% for sp in results %}
|
||||
<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>)
|
||||
<span class="scientific-name">{{ sp["scientific_name"] }}
|
||||
(</span>
|
||||
<span class="common-name">{{ sp["common_name"] }}</span>)
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user