Completed
Push — develop ( 6a0ab2...965bce )
by Greg
11:38
created

hourglass.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * webtrees: online genealogy
4
 * Copyright (C) 2016 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
 */
16
namespace Fisharebest\Webtrees;
17
18
use Fisharebest\Webtrees\Controller\HourglassController;
19
use Fisharebest\Webtrees\Functions\FunctionsEdit;
20
use Fisharebest\Webtrees\Functions\FunctionsPrint;
21
22
/**
23
 * Defined in session.php
24
 *
25
 * @global Tree $WT_TREE
26
 */
27
global $WT_TREE;
28
29
define('WT_SCRIPT_NAME', 'hourglass.php');
30
require './includes/session.php';
31
32
$controller = new HourglassController;
33
$controller
34
	->restrictAccess(Module::isActiveChart($WT_TREE, 'hourglass_chart'))
35
	->pageHeader()
36
	->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
37
	->addInlineJavascript('autocomplete();')
38
	->setupJavascript();
39
40
?>
41
<div id="hourglass-page">
42
	<h2><?php echo $controller->getPageTitle(); ?></h2>
43
	<form method="get" name="people" action="?">
44
		<input type="hidden" name="ged" value="<?php echo $WT_TREE->getNameHtml(); ?>">
45
		<table class="list_table">
46
			<tbody>
47
				<tr>
48
					<td class="descriptionbox">
49
						<?php echo I18N::translate('Individual'); ?>
50
					</td>
51
					<td class="optionbox">
52
						<input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->root->getXref(); ?>">
53
						<?php echo FunctionsPrint::printFindIndividualLink('pid'); ?>
54
					</td>
55
					<td class="descriptionbox">
56
						<?php echo I18N::translate('Show details'); ?>
57
					</td>
58
					<td class="optionbox">
59
						<?php echo FunctionsEdit::twoStateCheckbox('show_full', $controller->showFull()); ?>
0 ignored issues
show
$controller->showFull() is of type boolean, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
60
					</td>
61
					<td rowspan="3" class="topbottombar vmiddle">
62
						<input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('view'); ?>">
63
					</td>
64
				</tr>
65
				<tr>
66
					<td class="descriptionbox" >
67
						<?php echo I18N::translate('Generations'); ?>
68
					</td>
69
					<td class="optionbox">
70
						<?php echo FunctionsEdit::editFieldInteger('generations', $controller->generations, 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS')); ?>
71
					</td>
72
					<td class="descriptionbox">
73
						<?php echo I18N::translate('Show spouses'); ?>
74
					</td>
75
					<td class="optionbox">
76
						<input type="checkbox" value="1" name="show_spouse" <?php echo $controller->show_spouse ? 'checked' : ''; ?>>
77
					</td>
78
				</tr>
79
			</tbody>
80
		</table>
81
	</form>
82
83
	<div id="hourglass_chart" style="width:98%; z-index:1;">
84
		<table>
85
			<tr>
86
				<td style="vertical-align:middle">
87
					<?php $controller->printDescendency($controller->root, 1); ?>
88
				</td>
89
				<td style="vertical-align:middle">
90
					<?php $controller->printPersonPedigree($controller->root, 1); ?>
91
				</td>
92
			</tr>
93
		</table>
94
	</div>
95
</div>
96