diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/Module/AncestorsChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/CompactTreeChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/DescendancyChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/FamilyBookChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/FanChartModule.php | 81 | ||||
| -rw-r--r-- | app/Module/GoogleMapsModule.php | 23 | ||||
| -rw-r--r-- | app/Module/HourglassChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/InteractiveTreeModule.php | 25 | ||||
| -rw-r--r-- | app/Module/LifespansChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/ModuleChartInterface.php | 18 | ||||
| -rw-r--r-- | app/Module/PedigreeChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/RelationshipsChartModule.php | 86 | ||||
| -rw-r--r-- | app/Module/StatisticsChartModule.php | 75 | ||||
| -rw-r--r-- | app/Module/TimelineChartModule.php | 75 | ||||
| -rw-r--r-- | app/Schema/Migration34.php | 33 | ||||
| -rw-r--r-- | app/Theme/AbstractTheme.php | 220 | ||||
| -rw-r--r-- | app/Theme/AdministrationTheme.php | 1 |
17 files changed, 1023 insertions, 139 deletions
diff --git a/app/Module/AncestorsChartModule.php b/app/Module/AncestorsChartModule.php new file mode 100644 index 0000000000..58dacde50f --- /dev/null +++ b/app/Module/AncestorsChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class AncestorsChartModule + */ +class AncestorsChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Ancestors'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “AncestorsChart” module */ I18N::translate('A chart of an individual’s ancestors.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'ancestry.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-ancestry', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/CompactTreeChartModule.php b/app/Module/CompactTreeChartModule.php new file mode 100644 index 0000000000..6b5499af63 --- /dev/null +++ b/app/Module/CompactTreeChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class CompactTreeChartModule + */ +class CompactTreeChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Compact tree'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “CompactTreeChart” module */ I18N::translate('A chart of an individual’s ancestors, as a compact tree.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'compact.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-compact', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/DescendancyChartModule.php b/app/Module/DescendancyChartModule.php new file mode 100644 index 0000000000..cb218cbad2 --- /dev/null +++ b/app/Module/DescendancyChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class DescendancyChartModule + */ +class DescendancyChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Descendants'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “DescendancyChart” module */ I18N::translate('A chart of an individual’s descendants.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'descendancy.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-descendants', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/FamilyBookChartModule.php b/app/Module/FamilyBookChartModule.php new file mode 100644 index 0000000000..05b1c471c2 --- /dev/null +++ b/app/Module/FamilyBookChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class FamilyBookChartModule + */ +class FamilyBookChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Family book'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A chart of an individual’s ancestors and descendants, as a family book.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-familybook', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/FanChartModule.php b/app/Module/FanChartModule.php new file mode 100644 index 0000000000..117d9c2b13 --- /dev/null +++ b/app/Module/FanChartModule.php @@ -0,0 +1,81 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class FanChartModule + */ +class FanChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Fan chart'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A fan chart of an individual’s ancestors.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * We can only do this if the GD2 library is installed with TrueType support. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + if (function_exists('imagettftext')) { + return new Menu( + $this->getTitle(), + 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-fanchart', + array('rel' => 'nofollow') + ); + } else { + return null; + } + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php index dbb8e27afc..be926d2023 100644 --- a/app/Module/GoogleMapsModule.php +++ b/app/Module/GoogleMapsModule.php @@ -34,6 +34,7 @@ use Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Stats; use Fisharebest\Webtrees\Theme; use Fisharebest\Webtrees\Tree; +use Fisharebest\Webtrees\Menu; use PDO; /** @@ -53,7 +54,7 @@ use PDO; * * Hence, use "Google Maps™ mapping service" where appropriate. */ -class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, ModuleTabInterface { +class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, ModuleTabInterface, ModuleChartInterface { // How to update the database schema for this module const SCHEMA_TARGET_VERSION = 6; const SCHEMA_SETTING_NAME = 'GM_SCHEMA_VERSION'; @@ -212,6 +213,26 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + I18N::translate('Pedigree map'), + 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-pedigree_map', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } + + /** * A form to edit the module configuration. */ private function config() { diff --git a/app/Module/HourglassChartModule.php b/app/Module/HourglassChartModule.php new file mode 100644 index 0000000000..e6797c06c2 --- /dev/null +++ b/app/Module/HourglassChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class HourglassChartModule + */ +class HourglassChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Hourglass chart'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “HourglassChart” module */ I18N::translate('An hourglass chart of an individual’s ancestors and descendants.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'hourglass.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-hourglass', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/InteractiveTreeModule.php b/app/Module/InteractiveTreeModule.php index dc461efb16..c7de450c6b 100644 --- a/app/Module/InteractiveTreeModule.php +++ b/app/Module/InteractiveTreeModule.php @@ -21,12 +21,13 @@ use Fisharebest\Webtrees\Filter; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\InteractiveTree\TreeView; +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 { +class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface,ModuleChartInterface { /** {@inheritdoc} */ public function getTitle() { return /* I18N: Name of a module */ I18N::translate('Interactive tree'); @@ -70,7 +71,27 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface public function canLoadAjax() { return true; } - + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-tree', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } + /** {@inheritdoc} */ public function getPreLoadContent() { // We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php new file mode 100644 index 0000000000..29dd3d3bf5 --- /dev/null +++ b/app/Module/LifespansChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class LifespansChartModule + */ +class LifespansChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Lifespans'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “LifespansChart” module */ I18N::translate('A chart of individuals’ lifespans.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'lifespan.php', + 'menu-chart-lifespan', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return null; + } +} diff --git a/app/Module/ModuleChartInterface.php b/app/Module/ModuleChartInterface.php index 6a11e7bbcb..2c278a1831 100644 --- a/app/Module/ModuleChartInterface.php +++ b/app/Module/ModuleChartInterface.php @@ -15,10 +15,24 @@ */ namespace Fisharebest\Webtrees\Module; +use Fisharebest\Webtrees\Individual; + /** * Interface ModuleChartInterface - Classes and libraries for module system - * - * This class is not currently used. */ interface ModuleChartInterface { + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + 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 + */ + public function getBoxChartMenu(Individual $individual); } diff --git a/app/Module/PedigreeChartModule.php b/app/Module/PedigreeChartModule.php new file mode 100644 index 0000000000..8bc657f824 --- /dev/null +++ b/app/Module/PedigreeChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class PedigreeChartModule + */ +class PedigreeChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Pedigree'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “PedigreeChart” module */ I18N::translate('A chart of an individual’s ancestors, formatted as a tree.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'pedigree.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-pedigree', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php new file mode 100644 index 0000000000..79c1c3f7ad --- /dev/null +++ b/app/Module/RelationshipsChartModule.php @@ -0,0 +1,86 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class RelationshipsChartModule + */ +class RelationshipsChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Relationships'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “RelationshipsChart” module */ I18N::translate('A chart displaying relationships between two individuals.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); + + if ($gedcomid && $individual->getXref()) { + return new Menu( + I18N::translate('Relationship to me'), + 'relationship.php?pid1=' . $gedcomid . '&pid2=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-relationship', + array('rel' => 'nofollow') + ); + } else { + return new Menu( + I18N::translate('Relationships'), + 'relationship.php?pid1=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-relationship', + array('rel' => 'nofollow') + ); + } + } + + public function getBoxChartMenu(Individual $individual) { + return $this->getChartMenu($individual); + } +} diff --git a/app/Module/StatisticsChartModule.php b/app/Module/StatisticsChartModule.php new file mode 100644 index 0000000000..d3e9c3c3ca --- /dev/null +++ b/app/Module/StatisticsChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class StatisticsChartModule + */ +class StatisticsChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Statistics'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “StatisticsChart” module */ I18N::translate('Various statistics charts.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'statistics.php?ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-statistics', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return null; + } +} diff --git a/app/Module/TimelineChartModule.php b/app/Module/TimelineChartModule.php new file mode 100644 index 0000000000..286704ddf3 --- /dev/null +++ b/app/Module/TimelineChartModule.php @@ -0,0 +1,75 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Module; + +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Individual; + +/** + * Class TimelineChartModule + */ +class TimelineChartModule extends AbstractModule implements ModuleChartInterface { + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function getTitle() { + return /* I18N: Name of a module/chart */ I18N::translate('Timeline'); + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function getDescription() { + return /* I18N: Description of the “TimelineChart” module */ I18N::translate('A timeline displaying individual events.'); + } + + /** + * What is the default access level for this module? + * + * Some modules are aimed at admins or managers, and are not generally shown to users. + * + * @return int + */ + public function defaultAccessLevel() { + return Auth::PRIV_PRIVATE; + } + + /** + * Return a menu item for this chart. + * + * @return Menu + */ + public function getChartMenu(Individual $individual) { + global $controller, $WT_TREE; + + return new Menu( + $this->getTitle(), + 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'menu-chart-timeline', + array('rel' => 'nofollow') + ); + } + + public function getBoxChartMenu(Individual $individual) { + return null; + } +} diff --git a/app/Schema/Migration34.php b/app/Schema/Migration34.php new file mode 100644 index 0000000000..d41dc48c16 --- /dev/null +++ b/app/Schema/Migration34.php @@ -0,0 +1,33 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Schema; + +use Fisharebest\Webtrees\Database; +use Fisharebest\Webtrees\Module; +use Fisharebest\Webtrees\I18N; + +/** + * Upgrade the database schema from version 33 to version 34. + */ +class Migration34 implements MigrationInterface { + + /** + * Upgrade to to the next version (for 'Charts as modules', the respective modules should be enabled by default) + */ + public function upgrade() { + Module::getInstalledModules('enabled'); + } +} diff --git a/app/Theme/AbstractTheme.php b/app/Theme/AbstractTheme.php index 814c7792ac..213adc2462 100644 --- a/app/Theme/AbstractTheme.php +++ b/app/Theme/AbstractTheme.php @@ -35,6 +35,20 @@ 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\FanChartModule; +use Fisharebest\Webtrees\Module\InteractiveTreeModule; +use Fisharebest\Webtrees\Module\HourglassChartModule; +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; + /** * Common functions for all themes. @@ -951,24 +965,23 @@ abstract class AbstractTheme { * @return Menu[] */ protected function individualBoxMenuCharts(Individual $individual) { - $menus = array_filter(array( - $this->menuChartAncestors($individual), - $this->menuChartCompact($individual), - $this->menuChartDescendants($individual), - $this->menuChartFanChart($individual), - $this->menuChartHourglass($individual), - $this->menuChartInteractiveTree($individual), - $this->menuChartPedigree($individual), - $this->menuChartPedigreeMap($individual), - $this->menuChartRelationship($individual), - $this->menuChartTimeline($individual), - )); - - usort($menus, function (Menu $x, Menu $y) { - return I18N::strcasecmp($x->getLabel(), $y->getLabel()); - }); + $menus = array(); + foreach (Module::getActiveCharts($this->tree) as $chart) { + $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; + return $menus; + } else { + return null; + } } /** @@ -1082,190 +1095,129 @@ abstract class AbstractTheme { * @return Menu */ protected function menuChart(Individual $individual) { - $submenus = array_filter(array( - $this->menuChartAncestors($individual), - $this->menuChartCompact($individual), - $this->menuChartDescendants($individual), - $this->menuChartFamilyBook($individual), - $this->menuChartFanChart($individual), - $this->menuChartHourglass($individual), - $this->menuChartInteractiveTree($individual), - $this->menuChartLifespan($individual), - $this->menuChartPedigree($individual), - $this->menuChartPedigreeMap($individual), - $this->menuChartRelationship($individual), - $this->menuChartStatistics(), - $this->menuChartTimeline($individual), - )); - - usort($submenus, function (Menu $x, Menu $y) { - return I18N::strcasecmp($x->getLabel(), $y->getLabel()); - }); + $submenus = array(); + foreach (Module::getActiveCharts($this->tree) as $chart) { + $menu = $chart->getChartMenu($individual); + if ($menu) { + $submenus[] = $menu; + } + } + + if ($submenus) { + usort($submenus, function (Menu $x, Menu $y) { + return I18N::strcasecmp($x->getLabel(), $y->getLabel()); + }); - return new Menu(I18N::translate('Charts'), '#', 'menu-chart', array('rel' => 'nofollow'), $submenus); + return new Menu(I18N::translate('Charts'), '#', 'menu-chart', array('rel' => 'nofollow'), $submenus); + } else { + return null; + } } /** - * Generate a menu item for the ancestors chart (ancestry.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartAncestors(Individual $individual) { - return new Menu(I18N::translate('Ancestors'), 'ancestry.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-ancestry', array('rel' => 'nofollow')); + $chart = new AncestorsChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the compact tree (compact.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartCompact(Individual $individual) { - return new Menu(I18N::translate('Compact tree'), 'compact.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-compact', array('rel' => 'nofollow')); + $chart = new CompactTreeChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the descendants chart (descendancy.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartDescendants(Individual $individual) { - return new Menu(I18N::translate('Descendants'), 'descendancy.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-descendants', array('rel' => 'nofollow')); + $chart = new DescendancyChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the family-book chart (familybook.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartFamilyBook(Individual $individual) { - return new Menu(I18N::translate('Family book'), 'familybook.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-familybook', array('rel' => 'nofollow')); + $chart = new FamilyBookChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the fan chart (fanchart.php). - * - * 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) { - if (function_exists('imagettftext')) { - return new Menu(I18N::translate('Fan chart'), 'fanchart.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-fanchart', array('rel' => 'nofollow')); - } else { - return null; - } + $chart = new FanChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the interactive tree (tree module). - * - * @param Individual $individual - * - * @return Menu|null + * @deprecated */ protected function menuChartInteractiveTree(Individual $individual) { - if (Module::getModuleByName('tree')) { - return new Menu(I18N::translate('Interactive tree'), 'module.php?mod=tree&mod_action=treeview&' . $this->tree_url . '&rootid=' . $individual->getXref(), 'menu-chart-tree', array('rel' => 'nofollow')); - } else { - return null; - } + $chart = new InteractiveTreeModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the hourglass chart (hourglass.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartHourglass(Individual $individual) { - return new Menu(I18N::translate('Hourglass chart'), 'hourglass.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-hourglass', array('rel' => 'nofollow')); + $chart = new HourglassChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the lifepsan chart (lifespan.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartLifespan(Individual $individual) { - return new Menu(I18N::translate('Lifespans'), 'lifespan.php', 'menu-chart-lifespan', array('rel' => 'nofollow')); + $chart = new LifespansChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the pedigree chart (pedigree.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartPedigree(Individual $individual) { - return new Menu(I18N::translate('Pedigree'), 'pedigree.php?rootid=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-pedigree', array('rel' => 'nofollow')); + $chart = new PedigreeChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the pedigree map (googlemap module). - * - * @param Individual $individual - * - * @return Menu|null + * @deprecated */ protected function menuChartPedigreeMap(Individual $individual) { - if (Module::getModuleByName('googlemap')) { - return new Menu(I18N::translate('Pedigree map'), 'module.php?' . $this->tree_url . '&mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref(), 'menu-chart-pedigree_map', array('rel' => 'nofollow')); - } else { - return null; - } + $chart = new GoogleMapsModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the relationship chart (relationship.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartRelationship(Individual $individual) { - $gedcomid = $this->tree->getUserPreference(Auth::user(), 'gedcomid'); - - if ($gedcomid && $individual->getXref()) { - return new Menu(I18N::translate('Relationship to me'), 'relationship.php?pid1=' . $gedcomid . '&pid2=' . $individual->getXref() . '&ged=' . $this->tree_url, 'menu-chart-relationship', array('rel' => 'nofollow')); - } else { - return new Menu(I18N::translate('Relationships'), 'relationship.php?pid1=' . $individual->getXref() . '&ged=' . $this->tree_url, 'menu-chart-relationship', array('rel' => 'nofollow')); - } + $chart = new RelationshipsChartModule(__DIR__); + return $chart->getChartMenu($individual); } /** - * Generate a menu item for the statistics charts (statistics.php). - * - * @return Menu + * @deprecated */ protected function menuChartStatistics() { - return new Menu(I18N::translate('Statistics'), 'statistics.php?' . $this->tree_url, 'menu-chart-statistics', array('rel' => 'nofollow')); + $chart = new StatisticsChartModule(__DIR__); + return $chart->getChartMenu(null); } /** - * Generate a menu item for the timeline chart (timeline.php). - * - * @param Individual $individual - * - * @return Menu + * @deprecated */ protected function menuChartTimeline(Individual $individual) { - return new Menu(I18N::translate('Timeline'), 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&' . $this->tree_url, 'menu-chart-timeline', array('rel' => 'nofollow')); + $chart = new TimelineChartModule(__DIR__); + return $chart->getChartMenu($individual); } - + /** * Generate a menu item for the control panel (admin.php). * diff --git a/app/Theme/AdministrationTheme.php b/app/Theme/AdministrationTheme.php index 5ff5b126dd..1544d15997 100644 --- a/app/Theme/AdministrationTheme.php +++ b/app/Theme/AdministrationTheme.php @@ -192,6 +192,7 @@ class AdministrationTheme extends AbstractTheme implements ThemeInterface { new Menu(/* I18N: Menu entry */ I18N::translate('Tabs'), 'admin_module_tabs.php'), new Menu(/* I18N: Menu entry */ I18N::translate('Blocks'), 'admin_module_blocks.php'), new Menu(/* I18N: Menu entry */ I18N::translate('Sidebars'), 'admin_module_sidebar.php'), + new Menu(/* I18N: Menu entry */ I18N::translate('Charts'), 'admin_module_charts.php'), new Menu(/* I18N: Menu entry */ I18N::translate('Reports'), 'admin_module_reports.php'), )); } |
