1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
<?php
// Controller for the compact chart
//
// webtrees: Web based Family History software
// Copyright (C) 2013 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
//
// 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 2 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, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
class WT_Controller_Compact extends WT_Controller_Chart {
// Data for the view
public $show_thumbs=false;
// Date for the controller
private $treeid=array();
public function __construct() {
parent::__construct();
// Extract the request parameters
$this->show_thumbs = WT_Filter::getBool('show_thumbs');
if ($this->root && $this->root->canShowName()) {
$this->setPageTitle(
/* I18N: %s is an individual’s name */
WT_I18N::translate('Compact tree of %s', $this->root->getFullName())
);
} else {
$this->setPageTitle(WT_I18N::translate('Compact tree'));
}
$this->treeid=ancestry_array($this->rootid, 5);
}
function sosa_person($n) {
global $SHOW_HIGHLIGHT_IMAGES;
$indi=WT_Individual::getInstance($this->treeid[$n]);
if ($indi && $indi->canShowName()) {
$name=$indi->getFullName();
$addname=$indi->getAddName();
if ($this->show_thumbs && $SHOW_HIGHLIGHT_IMAGES) {
$html=$indi->displayImage();
} else {
$html='';
}
$html .= '<a class="name1" href="'.$indi->getHtmlUrl().'">';
$html .= $name;
if ($addname) $html .= '<br>' . $addname;
$html .= '</a>';
$html .= '<br>';
if ($indi->canShow()) {
$html.='<div class="details1">'.$indi->getLifeSpan().'</div>';
}
} else {
// Empty box
$html = ' ';
}
// -- box color
$isF='';
if ($n==1) {
if ($indi && $indi->getSex()=='F') {
$isF='F';
}
} elseif ($n%2) {
$isF='F';
}
// -- box size
if ($n==1) {
return '<td class="person_box'.$isF.' person_box_template" style="text-align:center; vertical-align:top;">'.$html.'</td>';
} else {
return '<td class="person_box'.$isF.' person_box_template" style="text-align:center; vertical-align:top;" width="15%">'.$html.'</td>';
}
}
function sosa_arrow($n, $arrow_dir) {
global $TEXT_DIRECTION;
$pid = $this->treeid[$n];
$arrow_swap = array("l"=>"0", "r"=>"1", "u"=>"2", "d"=>"3");
$arrow_dir = substr($arrow_dir,0,1);
if ($TEXT_DIRECTION=="rtl") {
if ($arrow_dir=="l") {
$arrow_dir="r";
} elseif ($arrow_dir=="r") {
$arrow_dir="l";
}
}
$indi=WT_Individual::getInstance($pid);
if ($indi) {
$title=WT_I18N::translate('Compact tree of %s', $indi->getFullName());
$text = '<a class="icon-'.$arrow_dir.'arrow" title="'.strip_tags($title).'" href="?rootid='.$pid;
if ($this->show_thumbs) $text .= "&show_thumbs=".$this->show_thumbs;
$text .= "\"></a>";
} else {
$text = '<i class="icon-'.$arrow_dir.'arrow"></i>';
}
return $text;
}
}
|