summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/FanchartController.php50
-rw-r--r--app/Module.php12
-rw-r--r--app/Module/AncestorsChartModule.php11
-rw-r--r--app/Module/CompactTreeChartModule.php11
-rw-r--r--app/Module/DescendancyChartModule.php11
-rw-r--r--app/Module/FamilyBookChartModule.php11
-rw-r--r--app/Module/FamilyTreeStatisticsModule.php3
-rw-r--r--app/Module/FanChartModule.php11
-rw-r--r--app/Module/GoogleMapsModule.php11
-rw-r--r--app/Module/HourglassChartModule.php11
-rw-r--r--app/Module/InteractiveTreeModule.php13
-rw-r--r--app/Module/LifespansChartModule.php9
-rw-r--r--app/Module/ModuleChartInterface.php7
-rw-r--r--app/Module/PedigreeChartModule.php11
-rw-r--r--app/Module/RelationshipsChartModule.php30
-rw-r--r--app/Module/StatisticsChartModule.php11
-rw-r--r--app/Module/TimelineChartModule.php19
-rw-r--r--app/Module/UserWelcomeModule.php3
-rw-r--r--app/Module/WelcomeBlockModule.php5
-rw-r--r--app/Theme/AbstractTheme.php237
-rw-r--r--app/Theme/ThemeInterface.php9
21 files changed, 304 insertions, 192 deletions
diff --git a/app/Controller/FanchartController.php b/app/Controller/FanchartController.php
index a26c7802d5..2744e07d8d 100644
--- a/app/Controller/FanchartController.php
+++ b/app/Controller/FanchartController.php
@@ -341,7 +341,6 @@ class FanchartController extends ChartController {
// add action url
$pid = $person->getXref();
$imagemap .= '" href="#' . $pid . '"';
- $tempURL = 'fanchart.php?rootid=' . $pid . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&fan_style=' . $this->fan_style . '&ged=' . $person->getTree()->getNameUrl();
$html .= '<div id="' . $pid . '" class="fan_chart_menu">';
$html .= '<div class="person_box"><div class="details1">';
$html .= '<a href="' . $person->getHtmlUrl() . '" class="name1">' . $name;
@@ -350,55 +349,10 @@ class FanchartController extends ChartController {
}
$html .= '</a>';
$html .= '<ul class="charts">';
- $html .= '<li><a href="pedigree.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '" >' . I18N::translate('Pedigree') . '</a></li>';
- if (Module::getModuleByName('googlemap')) {
- $html .= '<li><a href="module.php?mod=googlemap&amp;mod_action=pedigree_map&amp;rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Pedigree map') . '</a></li>';
- }
- $gedcomid = $person->getTree()->getUserPreference(Auth::user(), 'gedcomid');
- if ($gedcomid && $gedcomid != $pid) {
- $html .= '<li><a href="relationship.php?pid1=' . $gedcomid . '&amp;pid2=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Relationship to me') . '</a></li>';
- }
- $html .= '<li><a href="descendancy.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '" >' . I18N::translate('Descendants') . '</a></li>';
- $html .= '<li><a href="ancestry.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Ancestors') . '</a></li>';
- $html .= '<li><a href="compact.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Compact tree') . '</a></li>';
- $html .= '<li><a href="' . $tempURL . '">' . I18N::translate('Fan chart') . '</a></li>';
- $html .= '<li><a href="hourglass.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Hourglass chart') . '</a></li>';
- if (Module::getModuleByName('tree')) {
- $html .= '<li><a href="module.php?mod=tree&amp;mod_action=treeview&amp;ged=' . $person->getTree()->getNameUrl() . '&amp;rootid=' . $pid . '">' . I18N::translate('Interactive tree') . '</a></li>';
+ foreach (Theme::theme()->individualBoxMenu($person) as $menu) {
+ $html .= '<li><a href="' . $menu->getLink() . '">' . $menu->getLabel() . '</a></li>';
}
$html .= '</ul>';
- // spouse(s) and children
- foreach ($person->getSpouseFamilies() as $family) {
- $spouse = $family->getSpouse($person);
- if ($spouse) {
- $html .= '<a href="' . $spouse->getHtmlUrl() . '" class="name1">' . $spouse->getFullName() . '</a>';
- $kids = $family->getChildren();
- if ($kids) {
- $html .= '<ul class="children">';
- foreach ($kids as $child) {
- $html .= '<li><a href="' . $child->getHtmlUrl() . '" class="name1">' . $child->getFullName() . '</a></li>';
- }
- $html .= '</ul>';
- }
- }
- }
- // siblings
- foreach ($person->getChildFamilies() as $family) {
- $children = $family->getChildren();
- if ($children) {
- $html .= '<div class="name1">';
- // With two children in a family, you have only one sibling.
- $html .= count($children) > 2 ? I18N::translate('Siblings') : I18N::translate('Sibling');
- $html .= '</div>';
- $html .= '<ul class="siblings">';
- foreach ($children as $sibling) {
- if ($sibling !== $person) {
- $html .= '<li><a href="' . $sibling->getHtmlUrl() . '" class="name1"> ' . $sibling->getFullName() . '</a></li>';
- }
- }
- $html .= '</ul>';
- }
- }
$html .= '</div></div>';
$html .= '</div>';
$imagemap .= ' alt="' . strip_tags($person->getFullName()) . '" title="' . strip_tags($person->getFullName()) . '">';
diff --git a/app/Module.php b/app/Module.php
index bd8725cdd1..22a17f81b4 100644
--- a/app/Module.php
+++ b/app/Module.php
@@ -170,6 +170,18 @@ class Module {
}
/**
+ * Get a list of modules which (a) provide a chart and (b) we have permission to see.
+ *
+ * @param Tree $tree
+ * @param string $module
+ *
+ * @return bool
+ */
+ public static function isActiveChart(Tree $tree, $module) {
+ return array_key_exists($module, self::getActiveModulesByComponent($tree, 'chart'));
+ }
+
+ /**
* Get a list of modules which (a) provide a menu and (b) we have permission to see.
*
* @param Tree $tree
diff --git a/app/Module/AncestorsChartModule.php b/app/Module/AncestorsChartModule.php
index 58dacde50f..c75b4073b5 100644
--- a/app/Module/AncestorsChartModule.php
+++ b/app/Module/AncestorsChartModule.php
@@ -56,19 +56,22 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'ancestry.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'ancestry.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-ancestry',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/CompactTreeChartModule.php b/app/Module/CompactTreeChartModule.php
index 6b5499af63..f8328ee0ff 100644
--- a/app/Module/CompactTreeChartModule.php
+++ b/app/Module/CompactTreeChartModule.php
@@ -56,19 +56,22 @@ class CompactTreeChartModule extends AbstractModule implements ModuleChartInterf
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'compact.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'compact.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-compact',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/DescendancyChartModule.php b/app/Module/DescendancyChartModule.php
index cb218cbad2..7412d1047f 100644
--- a/app/Module/DescendancyChartModule.php
+++ b/app/Module/DescendancyChartModule.php
@@ -56,19 +56,22 @@ class DescendancyChartModule extends AbstractModule implements ModuleChartInterf
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'descendancy.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'descendancy.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-descendants',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/FamilyBookChartModule.php b/app/Module/FamilyBookChartModule.php
index 05b1c471c2..fd44a668b1 100644
--- a/app/Module/FamilyBookChartModule.php
+++ b/app/Module/FamilyBookChartModule.php
@@ -56,19 +56,22 @@ class FamilyBookChartModule extends AbstractModule implements ModuleChartInterfa
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'familybook.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'familybook.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-familybook',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/FamilyTreeStatisticsModule.php b/app/Module/FamilyTreeStatisticsModule.php
index 76ce7b9bd3..67a19980f9 100644
--- a/app/Module/FamilyTreeStatisticsModule.php
+++ b/app/Module/FamilyTreeStatisticsModule.php
@@ -20,6 +20,7 @@ use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\Functions\FunctionsDb;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\I18N;
+use Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Stats;
use Fisharebest\Webtrees\Theme;
@@ -192,7 +193,7 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn
$content .= '</div>';
}
$content .= '</div>';
- if ($stat_link) {
+ if ($stat_link && Module::isActiveChart($WT_TREE, 'statistics_chart')) {
$content .= '<div class="clearfloat"><a href="statistics.php?ged=' . $WT_TREE->getNameUrl() . '" rel="nofollow"><b>' . I18N::translate('View statistics as graphs') . '</b></a></div>';
}
diff --git a/app/Module/FanChartModule.php b/app/Module/FanChartModule.php
index 117d9c2b13..2eb6f6a2d7 100644
--- a/app/Module/FanChartModule.php
+++ b/app/Module/FanChartModule.php
@@ -58,15 +58,13 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface {
*
* We can only do this if the GD2 library is installed with TrueType support.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
if (function_exists('imagettftext')) {
return new Menu(
$this->getTitle(),
- 'fanchart.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'fanchart.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-fanchart',
array('rel' => 'nofollow')
);
@@ -75,6 +73,11 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface {
}
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php
index be926d2023..07ffb76f07 100644
--- a/app/Module/GoogleMapsModule.php
+++ b/app/Module/GoogleMapsModule.php
@@ -215,19 +215,22 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface,
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
I18N::translate('Pedigree map'),
- 'module.php?mod=googlemap&amp;mod_action=pedigree_map&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'module.php?mod=googlemap&amp;mod_action=pedigree_map&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-pedigree_map',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/HourglassChartModule.php b/app/Module/HourglassChartModule.php
index e6797c06c2..ffcc026235 100644
--- a/app/Module/HourglassChartModule.php
+++ b/app/Module/HourglassChartModule.php
@@ -56,19 +56,22 @@ class HourglassChartModule extends AbstractModule implements ModuleChartInterfac
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'hourglass.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'hourglass.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-hourglass',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/InteractiveTreeModule.php b/app/Module/InteractiveTreeModule.php
index c7de450c6b..e0676ca79d 100644
--- a/app/Module/InteractiveTreeModule.php
+++ b/app/Module/InteractiveTreeModule.php
@@ -27,7 +27,7 @@ use Fisharebest\Webtrees\Menu;
* Class InteractiveTreeModule
* Tip : you could change the number of generations loaded before ajax calls both in individual page and in treeview page to optimize speed and server load
*/
-class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface,ModuleChartInterface {
+class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface, ModuleChartInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Interactive tree');
@@ -75,19 +75,22 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-tree',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php
index 29dd3d3bf5..938f98d598 100644
--- a/app/Module/LifespansChartModule.php
+++ b/app/Module/LifespansChartModule.php
@@ -56,11 +56,9 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
'lifespan.php',
@@ -69,6 +67,11 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return null;
}
diff --git a/app/Module/ModuleChartInterface.php b/app/Module/ModuleChartInterface.php
index 2c278a1831..ab7a84ad3f 100644
--- a/app/Module/ModuleChartInterface.php
+++ b/app/Module/ModuleChartInterface.php
@@ -16,6 +16,7 @@
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Individual;
+use Fisharebest\Webtrees\Menu;
/**
* Interface ModuleChartInterface - Classes and libraries for module system
@@ -25,14 +26,14 @@ interface ModuleChartInterface {
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual);
-
+
/**
* Return a menu item for this chart (for menu in individual box).
*
- * @return Menu or null if not applicable in box
+ * @return Menu|null
*/
public function getBoxChartMenu(Individual $individual);
}
diff --git a/app/Module/PedigreeChartModule.php b/app/Module/PedigreeChartModule.php
index 8bc657f824..4cb86985be 100644
--- a/app/Module/PedigreeChartModule.php
+++ b/app/Module/PedigreeChartModule.php
@@ -56,19 +56,22 @@ class PedigreeChartModule extends AbstractModule implements ModuleChartInterface
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'pedigree.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
+ 'pedigree.php?rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-pedigree',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php
index 79c1c3f7ad..590aef19ac 100644
--- a/app/Module/RelationshipsChartModule.php
+++ b/app/Module/RelationshipsChartModule.php
@@ -52,34 +52,38 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte
public function defaultAccessLevel() {
return Auth::PRIV_PRIVATE;
}
-
+
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
- $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
+ $tree = $individual->getTree();
+ $gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid');
- if ($gedcomid && $individual->getXref()) {
+ if ($gedcomid) {
return new Menu(
- I18N::translate('Relationship to me'),
- 'relationship.php?pid1=' . $gedcomid . '&amp;pid2=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
- 'menu-chart-relationship',
+ I18N::translate('Relationship to me'),
+ 'relationship.php?pid1=' . $gedcomid . '&amp;pid2=' . $individual->getXref() . '&amp;ged=' . $tree->getNameUrl(),
+ 'menu-chart-relationship',
array('rel' => 'nofollow')
);
} else {
return new Menu(
- I18N::translate('Relationships'),
- 'relationship.php?pid1=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
- 'menu-chart-relationship',
+ I18N::translate('Relationships'),
+ 'relationship.php?pid1=' . $individual->getXref() . '&amp;ged=' . $tree->getNameUrl(),
+ 'menu-chart-relationship',
array('rel' => 'nofollow')
);
}
}
-
+
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return $this->getChartMenu($individual);
}
diff --git a/app/Module/StatisticsChartModule.php b/app/Module/StatisticsChartModule.php
index d3e9c3c3ca..6e8777b794 100644
--- a/app/Module/StatisticsChartModule.php
+++ b/app/Module/StatisticsChartModule.php
@@ -56,19 +56,22 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
$this->getTitle(),
- 'statistics.php?ged=' . $WT_TREE->getNameUrl(),
+ 'statistics.php?ged=' . $individual->getTree()->getNameUrl(),
'menu-chart-statistics',
array('rel' => 'nofollow')
);
}
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return null;
}
diff --git a/app/Module/TimelineChartModule.php b/app/Module/TimelineChartModule.php
index 286704ddf3..60ef02a9a2 100644
--- a/app/Module/TimelineChartModule.php
+++ b/app/Module/TimelineChartModule.php
@@ -52,23 +52,26 @@ class TimelineChartModule extends AbstractModule implements ModuleChartInterface
public function defaultAccessLevel() {
return Auth::PRIV_PRIVATE;
}
-
+
/**
* Return a menu item for this chart.
*
- * @return Menu
+ * @return Menu|null
*/
public function getChartMenu(Individual $individual) {
- global $controller, $WT_TREE;
-
return new Menu(
- $this->getTitle(),
- 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
- 'menu-chart-timeline',
+ $this->getTitle(),
+ 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
+ 'menu-chart-timeline',
array('rel' => 'nofollow')
);
}
-
+
+ /**
+ * Return a menu item for this chart - for use in individual boxes.
+ *
+ * @return Menu|null
+ */
public function getBoxChartMenu(Individual $individual) {
return null;
}
diff --git a/app/Module/UserWelcomeModule.php b/app/Module/UserWelcomeModule.php
index 1135445ada..92613b485e 100644
--- a/app/Module/UserWelcomeModule.php
+++ b/app/Module/UserWelcomeModule.php
@@ -17,6 +17,7 @@ namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\I18N;
+use Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Theme;
/**
@@ -52,7 +53,7 @@ class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface {
$content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>';
$gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
- if ($gedcomid) {
+ if ($gedcomid && Module::isActiveChart($WT_TREE, 'pedigree_chart')) {
$content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>';
$content .= '<td><a href="individual.php?pid=' . $gedcomid . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>';
}
diff --git a/app/Module/WelcomeBlockModule.php b/app/Module/WelcomeBlockModule.php
index 909ee1710e..684a6f2049 100644
--- a/app/Module/WelcomeBlockModule.php
+++ b/app/Module/WelcomeBlockModule.php
@@ -17,6 +17,7 @@ namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\I18N;
+use Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\Theme;
@@ -51,7 +52,9 @@ class WelcomeBlockModule extends AbstractModule implements ModuleBlockInterface
$class = $this->getName() . '_block';
$title = $WT_TREE->getTitleHtml();
$content = '<table><tr>';
- $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>';
+ if (Module::isActiveChart($WT_TREE, 'pedigree_chart')) {
+ $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>';
+ }
$content .= '<td><a href="individual.php?pid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>';
if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) {
$content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . I18N::translate('Request new user account') . '</a></td>';
diff --git a/app/Theme/AbstractTheme.php b/app/Theme/AbstractTheme.php
index 213adc2462..50cc9dde5f 100644
--- a/app/Theme/AbstractTheme.php
+++ b/app/Theme/AbstractTheme.php
@@ -29,26 +29,25 @@ use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Menu;
use Fisharebest\Webtrees\Module;
-use Fisharebest\Webtrees\Module\FamilyTreeFavoritesModule;
-use Fisharebest\Webtrees\Module\UserFavoritesModule;
-use Fisharebest\Webtrees\Site;
-use Fisharebest\Webtrees\Theme;
-use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Fisharebest\Webtrees\Module\AncestorsChartModule;
use Fisharebest\Webtrees\Module\CompactTreeChartModule;
use Fisharebest\Webtrees\Module\DescendancyChartModule;
use Fisharebest\Webtrees\Module\FamilyBookChartModule;
+use Fisharebest\Webtrees\Module\FamilyTreeFavoritesModule;
use Fisharebest\Webtrees\Module\FanChartModule;
-use Fisharebest\Webtrees\Module\InteractiveTreeModule;
+use Fisharebest\Webtrees\Module\GoogleMapsModule;
use Fisharebest\Webtrees\Module\HourglassChartModule;
+use Fisharebest\Webtrees\Module\InteractiveTreeModule;
use Fisharebest\Webtrees\Module\LifespansChartModule;
use Fisharebest\Webtrees\Module\PedigreeChartModule;
-use Fisharebest\Webtrees\Module\GoogleMapsModule;
use Fisharebest\Webtrees\Module\RelationshipsChartModule;
use Fisharebest\Webtrees\Module\StatisticsChartModule;
use Fisharebest\Webtrees\Module\TimelineChartModule;
-
+use Fisharebest\Webtrees\Module\UserFavoritesModule;
+use Fisharebest\Webtrees\Site;
+use Fisharebest\Webtrees\Theme;
+use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\User;
/**
* Common functions for all themes.
@@ -339,7 +338,8 @@ abstract class AbstractTheme {
if (
empty($_SERVER['HTTP_DNT']) &&
empty($_COOKIE['cookie']) &&
- (Site::getPreference('GOOGLE_ANALYTICS_ID') || Site::getPreference('PIWIK_SITE_ID') || Site::getPreference('STATCOUNTER_PROJECT_ID'))) {
+ (Site::getPreference('GOOGLE_ANALYTICS_ID') || Site::getPreference('PIWIK_SITE_ID') || Site::getPreference('STATCOUNTER_PROJECT_ID'))
+ ) {
return
'<div class="cookie-warning">' .
I18N::translate('Cookies') . ' - ' .
@@ -480,7 +480,7 @@ abstract class AbstractTheme {
return
'<div class="page-views">' .
I18N::plural('This page has been viewed %s time.', 'This page has been viewed %s times.', $count,
- '<span class="odometer">' . I18N::digits($count) . '</span>') .
+ '<span class="odometer">' . I18N::digits($count) . '</span>') .
'</div>';
} else {
return '';
@@ -746,12 +746,12 @@ abstract class AbstractTheme {
}
$content = '<span class="namedef name1">' . $individual->getFullName() . '</span>';
- $icons = '';
+ $icons = '';
if ($individual->canShowName()) {
$content =
'<a href="' . $individual->getHtmlUrl() . '">' . $content . '</a>' .
'<div class="namedef name1">' . $individual->getAddName() . '</div>';
- $icons =
+ $icons =
'<div class="noprint icons">' .
'<span class="iconz icon-zoomin" title="' . I18N::translate('Zoom in/out on this box.') . '"></span>' .
'<div class="itr"><i class="icon-pedigree"></i><div class="popup">' .
@@ -803,7 +803,7 @@ abstract class AbstractTheme {
$content =
'<a href="' . $individual->getHtmlUrl() . '">' . $content . '</a>' .
'<div class="namedef name2">' . $individual->getAddName() . '</div>';
- $icons =
+ $icons =
'<div class="noprint icons">' .
'<span class="iconz icon-zoomin" title="' . I18N::translate('Zoom in/out on this box.') . '"></span>' .
'<div class="itr"><i class="icon-pedigree"></i><div class="popup">' .
@@ -948,7 +948,7 @@ abstract class AbstractTheme {
*
* @return Menu[]
*/
- protected function individualBoxMenu(Individual $individual) {
+ public function individualBoxMenu(Individual $individual) {
$menus = array_merge(
$this->individualBoxMenuCharts($individual),
$this->individualBoxMenuFamilyLinks($individual)
@@ -970,18 +970,14 @@ abstract class AbstractTheme {
$menu = $chart->getBoxChartMenu($individual);
if ($menu) {
$menus[] = $menu;
- }
+ }
}
-
- if ($menus) {
- usort($menus, function (Menu $x, Menu $y) {
- return I18N::strcasecmp($x->getLabel(), $y->getLabel());
- });
- return $menus;
- } else {
- return null;
- }
+ usort($menus, function (Menu $x, Menu $y) {
+ return I18N::strcasecmp($x->getLabel(), $y->getLabel());
+ });
+
+ return $menus;
}
/**
@@ -1092,7 +1088,7 @@ abstract class AbstractTheme {
*
* @param Individual $individual
*
- * @return Menu
+ * @return Menu|null
*/
protected function menuChart(Individual $individual) {
$submenus = array();
@@ -1102,7 +1098,7 @@ abstract class AbstractTheme {
$submenus[] = $menu;
}
}
-
+
if ($submenus) {
usort($submenus, function (Menu $x, Menu $y) {
return I18N::strcasecmp($x->getLabel(), $y->getLabel());
@@ -1111,115 +1107,206 @@ abstract class AbstractTheme {
return new Menu(I18N::translate('Charts'), '#', 'menu-chart', array('rel' => 'nofollow'), $submenus);
} else {
return null;
- }
+ }
}
/**
- * @deprecated
+ * Generate a menu item for the ancestors chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartAncestors(Individual $individual) {
- $chart = new AncestorsChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new AncestorsChartModule(WT_ROOT . WT_MODULES_DIR . 'ancestors_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the compact tree.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartCompact(Individual $individual) {
- $chart = new CompactTreeChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new CompactTreeChartModule(WT_ROOT . WT_MODULES_DIR . 'compact_tree_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the descendants chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartDescendants(Individual $individual) {
- $chart = new DescendancyChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new DescendancyChartModule(WT_ROOT . WT_MODULES_DIR . 'descendancy_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the family-book chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartFamilyBook(Individual $individual) {
- $chart = new FamilyBookChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new FamilyBookChartModule(WT_ROOT . WT_MODULES_DIR . 'family_book_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the fan chart.
+ *
+ * We can only do this if the GD2 library is installed with TrueType support.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartFanChart(Individual $individual) {
- $chart = new FanChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new FanChartModule(WT_ROOT . WT_MODULES_DIR . 'fan_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the interactive tree.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartInteractiveTree(Individual $individual) {
- $chart = new InteractiveTreeModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new InteractiveTreeModule(WT_ROOT . WT_MODULES_DIR . 'tree');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the hourglass chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartHourglass(Individual $individual) {
- $chart = new HourglassChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new HourglassChartModule(WT_ROOT . WT_MODULES_DIR . 'hourglass_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the lifepsan chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartLifespan(Individual $individual) {
- $chart = new LifespansChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new LifespansChartModule(WT_ROOT . WT_MODULES_DIR . 'lifespans_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the pedigree chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartPedigree(Individual $individual) {
- $chart = new PedigreeChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new PedigreeChartModule(WT_ROOT . WT_MODULES_DIR . 'pedigree_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the pedigree map.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartPedigreeMap(Individual $individual) {
- $chart = new GoogleMapsModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new GoogleMapsModule(WT_ROOT . WT_MODULES_DIR . 'googlemap');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the relationship chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartRelationship(Individual $individual) {
- $chart = new RelationshipsChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new RelationshipsChartModule(WT_ROOT . WT_MODULES_DIR . 'relationships_chart');
+
+ return $chart->getChartMenu($individual);
}
/**
- * @deprecated
+ * Generate a menu item for the statistics charts.
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartStatistics() {
- $chart = new StatisticsChartModule(__DIR__);
- return $chart->getChartMenu(null);
+ $chart = new StatisticsChartModule(WT_ROOT . WT_MODULES_DIR . 'statistics_chart');
+
+ return $chart->getChartMenu(null);
}
/**
- * @deprecated
+ * Generate a menu item for the timeline chart.
+ *
+ * @param Individual $individual
+ *
+ * @return Menu|null
+ *
+ * @deprecated
*/
protected function menuChartTimeline(Individual $individual) {
- $chart = new TimelineChartModule(__DIR__);
- return $chart->getChartMenu($individual);
+ $chart = new TimelineChartModule(WT_ROOT . WT_MODULES_DIR . 'timeline_chart');
+
+ return $chart->getChartMenu($individual);
}
-
+
/**
- * Generate a menu item for the control panel (admin.php).
+ * Generate a menu item for the control panel.
*
* @return Menu|null
*/
@@ -1556,14 +1643,14 @@ abstract class AbstractTheme {
}
/**
- * A link to the user's individual record (pedigree.php).
+ * A link to the user's individual record.
*
* @return Menu|null
*/
protected function menuMyPedigree() {
$gedcomid = $this->tree->getUserPreference(Auth::user(), 'gedcomid');
- if ($gedcomid) {
+ if ($gedcomid && Module::isActiveChart($this->tree, 'pedigree_chart')) {
$showFull = $this->tree->getPreference('PEDIGREE_FULL_DETAILS') ? 1 : 0;
$showLayout = $this->tree->getPreference('PEDIGREE_LAYOUT') ? 1 : 0;
@@ -1883,7 +1970,9 @@ abstract class AbstractTheme {
* @return string
*/
protected function primaryMenuContent(array $menus) {
- return implode('', array_map(function (Menu $menu) { return $menu->getMenuAsList(); }, $menus));
+ return implode('', array_map(function (Menu $menu) {
+ return $menu->getMenuAsList();
+ }, $menus));
}
/**
@@ -1922,7 +2011,9 @@ abstract class AbstractTheme {
* @return string
*/
protected function secondaryMenuContent(array $menus) {
- return implode('', array_map(function (Menu $menu) { return $menu->getMenuAsList(); }, $menus));
+ return implode('', array_map(function (Menu $menu) {
+ return $menu->getMenuAsList();
+ }, $menus));
}
/**
diff --git a/app/Theme/ThemeInterface.php b/app/Theme/ThemeInterface.php
index c228ab2bc5..d0e096424e 100644
--- a/app/Theme/ThemeInterface.php
+++ b/app/Theme/ThemeInterface.php
@@ -197,6 +197,15 @@ interface ThemeInterface {
public function init(Tree $tree = null);
/**
+ * Links, to show in chart boxes;
+ *
+ * @param Individual $individual
+ *
+ * @return Menu[]
+ */
+ public function individualBoxMenu(Individual $individual);
+
+ /**
* Themes menu.
*
* @return Menu|null