diff options
| author | ric2016 <ric@richard-cissee.de> | 2016-03-31 20:49:59 +0200 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2016-04-11 19:41:58 +0100 |
| commit | 168ff6f357afa9bbd5aa14c12670d19e51ee770c (patch) | |
| tree | 359eb97b96f124e4a6f9431d91254becd85ab59f /app/Module/FanChartModule.php | |
| parent | ebac970f8cc2f9fb6cca1e49d322d284c17f5229 (diff) | |
| download | webtrees-168ff6f357afa9bbd5aa14c12670d19e51ee770c.tar.gz webtrees-168ff6f357afa9bbd5aa14c12670d19e51ee770c.tar.bz2 webtrees-168ff6f357afa9bbd5aa14c12670d19e51ee770c.zip | |
Charts As Modules
Diffstat (limited to 'app/Module/FanChartModule.php')
| -rw-r--r-- | app/Module/FanChartModule.php | 81 |
1 files changed, 81 insertions, 0 deletions
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); + } +} |
