1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2019 webtrees development team 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16namespace Fisharebest\Webtrees; 17 18use Fisharebest\Webtrees\Controller\FanchartController; 19use Fisharebest\Webtrees\Functions\FunctionsEdit; 20use Fisharebest\Webtrees\Functions\FunctionsPrint; 21 22define('WT_SCRIPT_NAME', 'fanchart.php'); 23require './includes/session.php'; 24 25$controller = new FanchartController; 26global $WT_TREE; 27 28if (Filter::getBool('img')) { 29 header('Content-Type: image/png'); 30 echo $controller->generateFanChart('png'); 31 32 return; 33} 34 35$controller 36 ->restrictAccess(Module::isActiveChart($WT_TREE, 'fan_chart')) 37 ->pageHeader() 38 ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) 39 ->addInlineJavascript(' 40 autocomplete(); 41 var WT_FANCHART = (function() { 42 jQuery("area") 43 .click(function (e) { 44 e.stopPropagation(); 45 e.preventDefault(); 46 var target = jQuery(this.hash); 47 target 48 // position the menu centered immediately above the mouse click position and 49 // make sure it doesn’t end up off the screen 50 .css({ 51 left: Math.max(0 ,e.pageX - (target.outerWidth()/2)), 52 top: Math.max(0, e.pageY - target.outerHeight()) 53 }) 54 .toggle() 55 .siblings(".fan_chart_menu").hide(); 56 }); 57 jQuery(".fan_chart_menu") 58 .on("click", "a", function(e) { 59 e.stopPropagation(); 60 }); 61 jQuery("#fan_chart") 62 .click(function(e) { 63 jQuery(".fan_chart_menu").hide(); 64 }); 65 return "' . strip_tags($controller->root->getFullName()) . '"; 66 })(); 67 '); 68 69?> 70<div id="page-fan"> 71 <h2><?php echo $controller->getPageTitle(); ?></h2> 72 <form name="people" method="get" action="?"> 73 <input type="hidden" name="ged" value="<?php echo $WT_TREE->getNameHtml(); ?>"> 74 <table class="list_table"> 75 <tbody> 76 <tr> 77 <td class="descriptionbox"> 78 <label for="rootid"> 79 <?php echo I18N::translate('Individual'); ?> 80 </label> 81 </td> 82 <td class="optionbox"> 83 <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->root->getXref(); ?>"> 84 <?php echo FunctionsPrint::printFindIndividualLink('rootid'); ?> 85 </td> 86 <td class="descriptionbox"> 87 <label for="fan_style"> 88 <?php echo I18N::translate('Layout'); ?> 89 </label> 90 </td> 91 <td class="optionbox"> 92 <?php echo FunctionsEdit::selectEditControl('fan_style', $controller->getFanStyles(), null, $controller->fan_style); ?> 93 </td> 94 <td rowspan="2" class="topbottombar vmiddle"> 95 <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('view'); ?>"> 96 </td> 97 </tr> 98 <tr> 99 <td class="descriptionbox"> 100 <label for="generations"> 101 <?php echo I18N::translate('Generations'); ?> 102 </label> 103 </td> 104 <td class="optionbox"> 105 <?php echo FunctionsEdit::editFieldInteger('generations', $controller->generations, 2, 9); ?> 106 </td> 107 <td class="descriptionbox"> 108 <label for="fan_width"> 109 <?php echo I18N::translate('Zoom'); ?> 110 </label> 111 </td> 112 <td class="optionbox"> 113 <input type="text" size="3" id="fan_width" name="fan_width" value="<?php echo $controller->fan_width; ?>"> % 114 </td> 115 </tr> 116 </tbody> 117 </table> 118 </form> 119<?php 120 121if ($controller->error_message) { 122 echo '<p class="ui-state-error">', $controller->error_message, '</p>'; 123 124 return; 125} 126 127if ($controller->root) { 128 echo '<div id="fan_chart">', $controller->generateFanChart('html'), '</div>'; 129} 130echo '</div>'; 131