summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-01-26 17:42:04 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-01-26 17:42:04 +0000
commit84b373623106fa682615780bd445d9e0a4a44c53 (patch)
treedafa7ca3062b5077c67ae787150ad75b5e87a0be
parent2eed66a30cf84ced05bc81c122b483da0073ff02 (diff)
downloadwebtrees-84b373623106fa682615780bd445d9e0a4a44c53.tar.gz
webtrees-84b373623106fa682615780bd445d9e0a4a44c53.tar.bz2
webtrees-84b373623106fa682615780bd445d9e0a4a44c53.zip
Do not generate links to relationships chart when it is disabled
-rw-r--r--app/Http/Controllers/BranchesController.php19
-rw-r--r--resources/views/lists/individuals-table.phtml12
2 files changed, 18 insertions, 13 deletions
diff --git a/app/Http/Controllers/BranchesController.php b/app/Http/Controllers/BranchesController.php
index ccccdbac03..29be475550 100644
--- a/app/Http/Controllers/BranchesController.php
+++ b/app/Http/Controllers/BranchesController.php
@@ -22,6 +22,8 @@ use Fisharebest\Webtrees\GedcomCode\GedcomCodePedi;
use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
+use Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Module\RelationshipsChartModule;
use Fisharebest\Webtrees\Soundex;
use Fisharebest\Webtrees\Tree;
use Fisharebest\Webtrees\User;
@@ -232,6 +234,8 @@ class BranchesController extends AbstractBaseController
*/
private function getDescendantsHtml(array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std, Individual $individual, Family $parents = null)
{
+ $module = Module::findByInterface(RelationshipsChartModule::class)->first();
+
// A person has many names. Select the one that matches the searched surname
$person_name = '';
foreach ($individual->getAllNames() as $name) {
@@ -255,13 +259,9 @@ class BranchesController extends AbstractBaseController
// Is this individual one of our ancestors?
$sosa = array_search($individual, $ancestors, true);
- if (is_int($sosa)) {
+ if (is_int($sosa) && $module instanceof RelationshipsChartModule) {
$sosa_class = 'search_hit';
- $sosa_html = ' <a class="details1 ' . $individual->getBoxStyle() . '" title="' . I18N::translate('Sosa') . '" href="' . e(route('relationships', [
- 'xref1' => $individual->xref(),
- 'xref2' => $ancestors[1]->xref(),
- 'ged' => $individual->tree()->name(),
- ])) . '" rel="nofollow">' . $sosa . '</a>' . self::sosaGeneration($sosa);
+ $sosa_html = '<a class="details1 ' . $individual->getBoxStyle() . '" href="' . e($module->chartUrl($individual, ['xref2' => $individuals[1]->xref()])) . '" rel="nofollow" title="' . I18N::translate('Relationships') . '">' . I18N::number($sosa) . '</a>' . self::sosaGeneration($sosa);
} else {
$sosa_class = '';
$sosa_html = '';
@@ -295,12 +295,9 @@ class BranchesController extends AbstractBaseController
$spouse = $family->getSpouse($individual);
if ($spouse instanceof Individual) {
$sosa = array_search($spouse, $ancestors, true);
- if (is_int($sosa)) {
+ if (is_int($sosa) && $module instanceof RelationshipsChartModule) {
$sosa_class = 'search_hit';
- $sosa_html = ' <a class="details1 ' . $spouse->getBoxStyle() . '" title="' . I18N::translate('Sosa') . '" href="' . e(route('relationships', [
- 'xref2' => $ancestors[1]->xref(),
- 'ged' => $individual->tree()->name(),
- ])) . '" rel="nofollow"> ' . $sosa . ' </a>' . self::sosaGeneration($sosa);
+ $sosa_html = '<a class="details1 ' . $spouse->getBoxStyle() . '" href="' . e($module->chartUrl($individual, ['xref2' => $individuals[1]->xref()])) . '" rel="nofollow" title="' . I18N::translate('Relationships') . '">' . I18N::number($sosa) . '</a>' . self::sosaGeneration($sosa);
} else {
$sosa_class = '';
$sosa_html = '';
diff --git a/resources/views/lists/individuals-table.phtml b/resources/views/lists/individuals-table.phtml
index ba59a82904..1cf1696b08 100644
--- a/resources/views/lists/individuals-table.phtml
+++ b/resources/views/lists/individuals-table.phtml
@@ -2,6 +2,8 @@
<?php use Fisharebest\Webtrees\GedcomTag; ?>
<?php use Fisharebest\Webtrees\I18N; ?>
<?php use Fisharebest\Webtrees\Individual; ?>
+<?php use Fisharebest\Webtrees\Module; ?>
+<?php use Fisharebest\Webtrees\Module\RelationshipsChartModule; ?>
<?php use Fisharebest\Webtrees\View; ?>
<?php use Ramsey\Uuid\Uuid; ?>
@@ -12,6 +14,8 @@ $table_id = 'table-indi-' . Uuid::uuid4()->toString();
$hundred_years_ago = new Date(date('Y') - 100);
$unique_indis = []; // Don't double-count indis with multiple names.
+
+$module = Module::findByInterface(RelationshipsChartModule::class)->first();
?>
<?php View::push('javascript') ?>
@@ -256,9 +260,13 @@ for ($year = 1550; $year < 2030; $year += 10) {
<td class="center" data-sort="<?= $key ?>">
<?php if ($sosa) : ?>
- <a href="<?= e(route('relationships', ['xref1' => $individuals[1]->xref(), 'xref2' => $individual->xref(), 'ged' => $individual->tree()->name()])) ?>" title="<?= I18N::translate('Relationships') ?>" rel="nofollow">
+ <?php if ($module instanceof RelationshipsChartModule) : ?>
+ <a href="<?= e($module->chartUrl($individuals[1], ['xref2' => $individual->xref()])) ?>" rel="nofollow" title="<?= I18N::translate('Relationships') ?>" rel="nofollow">
+ <?= I18N::number($key) ?>
+ </a>
+ <?php else : ?>
<?= I18N::number($key) ?>
- </a>
+ <?php endif ?>
<?php endif ?>
</td>