.
*/
namespace Fisharebest\Webtrees\Controller;
use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\I18N;
/**
* Controller for the compact chart
*/
class CompactController extends ChartController {
/** @var bool Data for the view .*/
public $show_thumbs = false;
/** int[] Data for the controller. */
private $treeid = array();
/**
* Startup activity
*/
public function __construct() {
parent::__construct();
// Extract the request parameters
$this->show_thumbs = Filter::getBool('show_thumbs');
if ($this->root && $this->root->canShowName()) {
$this->setPageTitle(
/* I18N: %s is an individual’s name */
I18N::translate('Compact tree of %s', $this->root->getFullName())
);
} else {
$this->setPageTitle(I18N::translate('Compact tree'));
}
$this->treeid = $this->sosaAncestors(5);
}
/**
* Get an individual by their SOSA number.
*
* @param int $n
*
* @return string
*/
public function sosaIndividual($n) {
$indi = $this->treeid[$n];
if ($indi && $indi->canShowName()) {
$name = $indi->getFullName();
$addname = $indi->getAddName();
if ($this->show_thumbs && $indi->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
$html = $indi->displayImage();
} else {
$html = '';
}
$html .= '';
$html .= $name;
if ($addname) {
$html .= '
' . $addname;
}
$html .= '';
$html .= '
';
if ($indi->canShow()) {
$html .= '