summaryrefslogtreecommitdiff
path: root/app/Module/RelationshipsChartModule.php
diff options
context:
space:
mode:
authorric2016 <ric@richard-cissee.de>2016-03-31 20:49:59 +0200
committerGreg Roach <fisharebest@gmail.com>2016-04-11 19:41:58 +0100
commit168ff6f357afa9bbd5aa14c12670d19e51ee770c (patch)
tree359eb97b96f124e4a6f9431d91254becd85ab59f /app/Module/RelationshipsChartModule.php
parentebac970f8cc2f9fb6cca1e49d322d284c17f5229 (diff)
downloadwebtrees-168ff6f357afa9bbd5aa14c12670d19e51ee770c.tar.gz
webtrees-168ff6f357afa9bbd5aa14c12670d19e51ee770c.tar.bz2
webtrees-168ff6f357afa9bbd5aa14c12670d19e51ee770c.zip
Charts As Modules
Diffstat (limited to 'app/Module/RelationshipsChartModule.php')
-rw-r--r--app/Module/RelationshipsChartModule.php86
1 files changed, 86 insertions, 0 deletions
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 . '&amp;pid2=' . $individual->getXref() . '&amp;ged=' . $WT_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',
+ array('rel' => 'nofollow')
+ );
+ }
+ }
+
+ public function getBoxChartMenu(Individual $individual) {
+ return $this->getChartMenu($individual);
+ }
+}