summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2022-03-19 10:15:27 +0000
committerGreg Roach <greg@subaqua.co.uk>2022-03-19 10:27:54 +0000
commitc908635b89a84d0a06f38a4d07640639e838703f (patch)
treedd82f42b81e2cbda254358ad4215312fabf947ea
parentbd055353fafed0c5380d9d8c58326ea55d6ad2e4 (diff)
downloadwebtrees-c908635b89a84d0a06f38a4d07640639e838703f.tar.gz
webtrees-c908635b89a84d0a06f38a4d07640639e838703f.tar.bz2
webtrees-c908635b89a84d0a06f38a4d07640639e838703f.zip
Use placeholders to generate statistics pages
-rw-r--r--app/Statistics/Repository/PlaceRepository.php2
-rw-r--r--resources/views/modules/statistics-chart/chart-distribution.phtml1
-rw-r--r--resources/views/modules/statistics-chart/chart-objects.phtml (renamed from resources/views/statistics/other/chart-objects.phtml)4
-rw-r--r--resources/views/modules/statistics-chart/chart-sources.phtml (renamed from resources/views/statistics/other/chart-sources.phtml)10
-rw-r--r--resources/views/modules/statistics-chart/individual-events.phtml (renamed from resources/views/modules/statistics-chart/total-events.phtml)0
-rw-r--r--resources/views/modules/statistics-chart/individuals.phtml2
-rw-r--r--resources/views/modules/statistics-chart/other-events.phtml36
-rw-r--r--resources/views/modules/statistics-chart/other-records.phtml (renamed from resources/views/statistics/other/total-records.phtml)12
-rw-r--r--resources/views/modules/statistics-chart/other.phtml12
-rw-r--r--resources/views/modules/statistics-chart/places.phtml (renamed from resources/views/statistics/other/places.phtml)19
-rw-r--r--resources/views/statistics/other/chart-distribution.phtml11
-rw-r--r--resources/views/statistics/other/total-events.phtml48
12 files changed, 60 insertions, 97 deletions
diff --git a/app/Statistics/Repository/PlaceRepository.php b/app/Statistics/Repository/PlaceRepository.php
index cb7ee52889..972626499b 100644
--- a/app/Statistics/Repository/PlaceRepository.php
+++ b/app/Statistics/Repository/PlaceRepository.php
@@ -273,7 +273,7 @@ class PlaceRepository implements PlaceRepositoryInterface
$countries = $this->statsPlaces();
if ($countries === []) {
- return '';
+ return I18N::translate('This information is not available.');
}
$top10 = [];
diff --git a/resources/views/modules/statistics-chart/chart-distribution.phtml b/resources/views/modules/statistics-chart/chart-distribution.phtml
new file mode 100644
index 0000000000..9a343c3d2a
--- /dev/null
+++ b/resources/views/modules/statistics-chart/chart-distribution.phtml
@@ -0,0 +1 @@
+#chartDistribution#
diff --git a/resources/views/statistics/other/chart-objects.phtml b/resources/views/modules/statistics-chart/chart-objects.phtml
index 1c75a9f230..075bffd17c 100644
--- a/resources/views/statistics/other/chart-objects.phtml
+++ b/resources/views/modules/statistics-chart/chart-objects.phtml
@@ -3,9 +3,7 @@
declare(strict_types=1);
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Statistics;
-/** @var Statistics $stats */
?>
<h4 class="border-bottom p-2 mb-4">
@@ -16,7 +14,7 @@ use Fisharebest\Webtrees\Statistics;
<div class="col">
<div class="card">
<div class="card-body">
- <?= $stats->chartMedia() ?>
+ #chartMedia#
</div>
</div>
</div>
diff --git a/resources/views/statistics/other/chart-sources.phtml b/resources/views/modules/statistics-chart/chart-sources.phtml
index e3b915dc4f..51eef8a7e6 100644
--- a/resources/views/statistics/other/chart-sources.phtml
+++ b/resources/views/modules/statistics-chart/chart-sources.phtml
@@ -3,9 +3,7 @@
declare(strict_types=1);
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Statistics;
-/** @var Statistics $stats */
?>
<h4 class="border-bottom p-2 mb-4">
@@ -17,10 +15,10 @@ use Fisharebest\Webtrees\Statistics;
<div class="card">
<h5 class="card-header">
<?= I18N::translate('Individuals with sources') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalIndisWithSources() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalIndisWithSources#</span>
</h5>
<div class="card-body">
- <?= $stats->chartIndisWithSources() ?>
+ #chartIndisWithSources#
</div>
</div>
</div>
@@ -29,10 +27,10 @@ use Fisharebest\Webtrees\Statistics;
<div class="card">
<h5 class="card-header">
<?= I18N::translate('Families with sources') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalFamsWithSources() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalFamsWithSources#</span>
</h5>
<div class="card-body">
- <?= $stats->chartFamsWithSources() ?>
+ #chartFamsWithSources#
</div>
</div>
</div>
diff --git a/resources/views/modules/statistics-chart/total-events.phtml b/resources/views/modules/statistics-chart/individual-events.phtml
index 89c86853e2..89c86853e2 100644
--- a/resources/views/modules/statistics-chart/total-events.phtml
+++ b/resources/views/modules/statistics-chart/individual-events.phtml
diff --git a/resources/views/modules/statistics-chart/individuals.phtml b/resources/views/modules/statistics-chart/individuals.phtml
index a0e617656a..faf36b001e 100644
--- a/resources/views/modules/statistics-chart/individuals.phtml
+++ b/resources/views/modules/statistics-chart/individuals.phtml
@@ -10,7 +10,7 @@ use Fisharebest\Webtrees\Statistics;
<div class="container pt-3">
<?= $stats->embedTags(view('modules/statistics-chart/total-individuals')) ?>
- <?= $stats->embedTags(view('modules/statistics-chart/total-events')) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/individual-events')) ?>
<?= $stats->embedTags(view('modules/statistics-chart/lifespan')) ?>
<?= $stats->embedTags(view('modules/statistics-chart/greatest-age')) ?>
<?= $stats->embedTags(view('modules/statistics-chart/oldest-living')) ?>
diff --git a/resources/views/modules/statistics-chart/other-events.phtml b/resources/views/modules/statistics-chart/other-events.phtml
new file mode 100644
index 0000000000..374c995e01
--- /dev/null
+++ b/resources/views/modules/statistics-chart/other-events.phtml
@@ -0,0 +1,36 @@
+<?php
+
+declare(strict_types=1);
+
+use Fisharebest\Webtrees\I18N;
+
+?>
+
+<h4 class="border-bottom p-2 mb-4">
+ <?= I18N::translate('Total events') ?>
+ <span class="badge bg-secondary rounded-pill float-end">#totalEvents#</span>
+</h4>
+
+<div class="row row-cols-1 row-cols-md-2 g-3 mb-3">
+ <div class="col">
+ <div class="card">
+ <h5 class="card-header">
+ <?= I18N::translate('First event') ?> — #firstEventType#
+ </h5>
+ <div class="card-body">
+ #firstEvent#
+ </div>
+ </div>
+ </div>
+
+ <div class="col">
+ <div class="card">
+ <h5 class="card-header">
+ <?= I18N::translate('Last event') ?> — #lastEventType#
+ </h5>
+ <div class="card-body">
+ #lastEvent#
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/resources/views/statistics/other/total-records.phtml b/resources/views/modules/statistics-chart/other-records.phtml
index 978497d97d..757ef43ed3 100644
--- a/resources/views/statistics/other/total-records.phtml
+++ b/resources/views/modules/statistics-chart/other-records.phtml
@@ -3,14 +3,12 @@
declare(strict_types=1);
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Statistics;
-/** @var Statistics $stats */
?>
<h4 class="border-bottom p-2 mb-4">
<?= I18N::translate('Records') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalRecords() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalRecords#</span>
</h4>
<div class="row row-cols-1 row-cols-lg-2 g-3 mb-3">
@@ -18,7 +16,7 @@ use Fisharebest\Webtrees\Statistics;
<div class="card">
<h5 class="card-header border-bottom-0">
<?= I18N::translate('Media objects') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalMedia() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalMedia#</span>
</h5>
</div>
</div>
@@ -27,7 +25,7 @@ use Fisharebest\Webtrees\Statistics;
<div class="card">
<h5 class="card-header border-bottom-0">
<?= I18N::translate('Sources') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalSources() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalSources#</span>
</h5>
</div>
</div>
@@ -36,7 +34,7 @@ use Fisharebest\Webtrees\Statistics;
<div class="card">
<h5 class="card-header border-bottom-0">
<?= I18N::translate('Notes') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalNotes() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalNotes#</span>
</h5>
</div>
</div>
@@ -45,7 +43,7 @@ use Fisharebest\Webtrees\Statistics;
<div class="card">
<h5 class="card-header border-bottom-0">
<?= I18N::translate('Repositories') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalRepositories() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalRepositories#</span>
</h5>
</div>
</div>
diff --git a/resources/views/modules/statistics-chart/other.phtml b/resources/views/modules/statistics-chart/other.phtml
index f293d5ddab..0a1c1504da 100644
--- a/resources/views/modules/statistics-chart/other.phtml
+++ b/resources/views/modules/statistics-chart/other.phtml
@@ -11,10 +11,10 @@ use Fisharebest\Webtrees\Statistics;
?>
<div class="container pt-3">
- <?= view('statistics/other/total-records', ['stats' => $stats]) ?>
- <?= view('statistics/other/total-events', ['stats' => $stats]) ?>
- <?= view('statistics/other/chart-objects', ['stats' => $stats]) ?>
- <?= view('statistics/other/chart-sources', ['stats' => $stats]) ?>
- <?= view('statistics/other/places', ['stats' => $stats]) ?>
- <?= view('statistics/other/chart-distribution', ['stats' => $stats]) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/other-records')) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/other-events')) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/chart-objects')) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/chart-sources')) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/places')) ?>
+ <?= $stats->embedTags(view('modules/statistics-chart/chart-distribution')) ?>
</div>
diff --git a/resources/views/statistics/other/places.phtml b/resources/views/modules/statistics-chart/places.phtml
index cd3f558d9c..68982aab5a 100644
--- a/resources/views/statistics/other/places.phtml
+++ b/resources/views/modules/statistics-chart/places.phtml
@@ -3,14 +3,12 @@
declare(strict_types=1);
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Statistics;
-/** @var Statistics $stats */
?>
<h4 class="border-bottom p-2 mb-4">
<?= I18N::translate('Places') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalPlaces() ?></span>
+ <span class="badge bg-secondary rounded-pill float-end">#totalPlaces#</span>
</h4>
<div class="row row-cols-1 row-cols-md-2 g-3 mb-3">
@@ -19,7 +17,7 @@ use Fisharebest\Webtrees\Statistics;
<h5 class="card-header">
<?= I18N::translate('Birth places') ?>
</h5>
- <?= $stats->commonBirthPlacesList() ?>
+ #commonBirthPlacesList#
</div>
</div>
@@ -28,7 +26,7 @@ use Fisharebest\Webtrees\Statistics;
<h5 class="card-header">
<?= I18N::translate('Death places') ?>
</h5>
- <?= $stats->commonDeathPlacesList() ?>
+ #commonDeathPlacesList#
</div>
</div>
@@ -37,7 +35,7 @@ use Fisharebest\Webtrees\Statistics;
<h5 class="card-header">
<?= I18N::translate('Marriage places') ?>
</h5>
- <?= $stats->commonMarriagePlacesList() ?>
+ #commonMarriagePlacesList#
</div>
</div>
@@ -46,14 +44,7 @@ use Fisharebest\Webtrees\Statistics;
<h5 class="card-header">
<?= I18N::translate('Events in countries') ?>
</h5>
- <?php $result = $stats->commonCountriesList(); ?>
- <?php if ($result) : ?>
- <?= $result ?>
- <?php else : ?>
- <div class="card-body">
- <?= I18N::translate('This information is not available.') ?>
- </div>
- <?php endif; ?>
+ #commonCountriesList#
</div>
</div>
</div>
diff --git a/resources/views/statistics/other/chart-distribution.phtml b/resources/views/statistics/other/chart-distribution.phtml
deleted file mode 100644
index 4ccd9f8a3f..0000000000
--- a/resources/views/statistics/other/chart-distribution.phtml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use Fisharebest\Webtrees\Statistics;
-
-/** @var Statistics $stats */
-
-?>
-
-<?= $stats->chartDistribution();
diff --git a/resources/views/statistics/other/total-events.phtml b/resources/views/statistics/other/total-events.phtml
deleted file mode 100644
index a0c77105c2..0000000000
--- a/resources/views/statistics/other/total-events.phtml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Statistics;
-
-/** @var Statistics $stats */
-?>
-
-<h4 class="border-bottom p-2 mb-4">
- <?= I18N::translate('Total events') ?>
- <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalEvents() ?></span>
-</h4>
-
-<div class="row row-cols-1 row-cols-md-2 g-3 mb-3">
- <div class="col">
- <div class="card">
- <?php $type = $stats->firstEventType() ?>
- <?php $result = $stats->firstEvent() ?>
- <h5 class="card-header">
- <?= I18N::translate('First event') ?>
- <?php if ($type) :
- ?><?= ' - ', $type ?><?php
- endif; ?>
- </h5>
- <div class="card-body">
- <?= $result ?>
- </div>
- </div>
- </div>
-
- <div class="col">
- <div class="card">
- <?php $type = $stats->lastEventType() ?>
- <?php $result = $stats->lastEvent() ?>
- <h5 class="card-header">
- <?= I18N::translate('Last event') ?>
- <?php if ($type) :
- ?><?= ' - ', $type ?><?php
- endif; ?>
- </h5>
- <div class="card-body">
- <?= $result ?>
- </div>
- </div>
- </div>
-</div>