zoomLevel = $zoom;
$this->rootPerson = Person::getInstance($rootid);
if (is_null($this->rootPerson)) $this->rootPerson = new Person('');
}
$this->name = $name;
//-- handle AJAX requests
if (!empty($_REQUEST['navAjax'])) {
//-- embedded tree for mashups
if ($_REQUEST['navAjax']=='embed') {
global $SERVER_URL;
global $stylesheet;
?>
document.writeln('');
document.writeln('');
drawViewport($rootid, $w, $h);
$output = ob_get_clean();
$lines = preg_split("/\r?\n/", $output);
foreach($lines as $line)
print "document.writeln('".str_replace("'", "\\'", $line)."');\n";
exit;
}
if (isset($_REQUEST['allSpouses'])) {
if ($_REQUEST['allSpouses']=='false' || $_REQUEST['allSpouses']==false) $this->allSpouses = false;
else $this->allSpouses = true;
}
if (!empty($_REQUEST['details'])) {
header('Content-type: text/html; charset=UTF-8');
$this->getDetails($this->rootPerson);
}
else if (!empty($_REQUEST['newroot'])) {
if (!empty($_REQUEST['drawport'])) $this->drawViewport('', "", "150px");
else {
$fam = null;
if ($this->allSpouses) $this->drawPersonAllSpouses($this->rootPerson, 4, 0);
else $this->drawPerson($this->rootPerson, 4, 0, $fam);
}
}
else if (!empty($_REQUEST['parent'])) {
$person = $this->rootPerson;
if ($_REQUEST['parent']=='f') {
$cfamily = $person->getPrimaryChildFamily();
if (!empty($cfamily)) {
$father = $cfamily->getHusband();
if (!empty($father)) {
$fam = null;
$this->drawPerson($father, 2, 1, $fam);
}
else print "
\n";
}
else print "
\n";
}
else {
$spouse = $person->getCurrentSpouse();
if (!empty($spouse)) {
$cfamily = $spouse->getPrimaryChildFamily();
if (!empty($cfamily)) {
$mother = $cfamily->getHusband();
if (!empty($mother)) {
$fam = null;
$this->drawPerson($mother, 2, 1, $fam);
}
else print "
\n";
}
else print "
\n";
}
else print "
\n";
}
}
else {
$fams = $this->rootPerson->getSpouseFamilies();
$family = end($fams);
if (!$this->allSpouses) $this->drawChildren($family, 2);
else $this->drawAllChildren($this->rootPerson, 2);
}
exit;
}
}
/**
* Draw the view port which creates the draggable/zoomable framework
* @param string $id an id to use for the starting HTML elements
* @param string $width the width parameter for the outer style
* @param string $height the height parameter for the outer style
*/
function drawViewport($id='', $width='', $height='') {
global $WT_IMAGE_DIR, $WT_IMAGES, $GEDCOM, $CONTACT_EMAIL, $SERVER_URL;
if (empty($id)) $id = $this->rootPerson->getXref();
$widthS = "";
$heightS = "";
if (!empty($width)) $widthS = "width: $width; ";
if (!empty($height)) $heightS = "height: $height; ";
?>
setupJS(); ?>
rootPerson!=null && !$this->rootPerson->canDisplayDetails()) print_privacy_error($CONTACT_EMAIL);
if (!$this->allSpouses) $this->drawPerson($this->rootPerson, $this->generations, 0, $parent);
else $this->drawPersonAllSpouses($this->rootPerson, $this->generations, 0);?>
rootPerson;
//if (!$person->canDisplayDetails()) return;
$families = array();
if (!empty($_REQUEST['famid'])) {
$famid = $_REQUEST['famid'];
if ($famid!='all') {
$family = Family::getInstance($_REQUEST['famid']);
if (!empty($family)) $families[] = $family;
}
else {
$fams = $person->getSpouseFamilies();
foreach($fams as $fam) {
$families[] = $fam;
}
}
}
else {
if ($this->allSpouses) {
$fams = $person->getSpouseFamilies();
foreach($fams as $fam) {
$families[] = $fam;
}
}
else {
$fams = $person->getSpouseFamilies();
$families[] = end($fams);
}
}
$name = $person->getFullName();
if ($SHOW_ID_NUMBERS)
$name.=" (".$person->getXref().")";
?>
getThumbnail($person);
if (!empty($thumb)) {
echo $thumb;
} else if ($USE_SILHOUETTE && isset($WT_IMAGES["default_image_U"]["other"])) {
$class = "pedigree_image_portrait";
if ($TEXT_DIRECTION == "rtl") $class .= "_rtl";
$sex = $person->getSex();
$thumbnail = "
";
echo $thumbnail;
} ?>
getSexImage().PrintReady($name); ?>
" border="0" width="15" onclick="name;?>.newRoot('getXref();?>', name;?>.innerPort, '');" />
', abbreviate_fact('BIRT'), ' ', $person->getBirthDate()->Display(), ' ', PrintReady($person->getBirthPlace()), '
';
if ($person->isDead()) {
echo '', abbreviate_fact('DEAT'), ' ', $person->getDeathDate()->Display(), ' ', PrintReady($person->getDeathPlace());
}
?>
getSpouse($person);
if (!empty($spouse)) {
$name = $spouse->getFullName();
if ($SHOW_ID_NUMBERS)
$name.=" (".$spouse->getXref().")";
?>
getThumbnail($spouse);
if (!empty($thumb)) {
echo $thumb;
} else if ($USE_SILHOUETTE && isset($WT_IMAGES["default_image_U"]["other"])) {
$class = "pedigree_image_portrait";
if ($TEXT_DIRECTION == "rtl") $class .= "_rtl";
$sex = $spouse->getSex();
$thumbnail = "
";
echo $thumbnail;
} ?>
getSexImage().PrintReady($name); ?>
" border="0" width="15" onclick="name;?>.newRoot('getXref();?>', name;?>.innerPort, '');" />
', abbreviate_fact('BIRT'), ' ', $spouse->getBirthDate()->Display(), ' ', PrintReady($spouse->getBirthPlace()), '
';
echo '
', abbreviate_fact('MARR'), ' ', $family->getMarriageDate()->Display(), ' ', $family->getMarriagePlace();
?>
" border="0" />
isDead()) {
echo '
', abbreviate_fact('DEAT'), ' ', $spouse->getDeathDate()->Display(), ' ', PrintReady($spouse->getDeathPlace()), '
';
} ?>
0) {
$children = $family->getChildren();
foreach($children as $ci=>$child) {
$fam = null;
$this->drawPerson($child, $gen-1, -1, $fam);
}
}
}
/**
* Draw all of the children for a person
* @param Person $person The person to draw the children for
* @param int $gen The number of generations of descendents to draw
*/
function drawAllChildren(&$person, $gen=2) {
if (!empty($person) && $gen>0) {
$fams = $person->getSpouseFamilies();
foreach($fams as $famid=>$family) {
$children = $family->getChildren();
foreach($children as $ci=>$child) {
$fam = null;
$this->drawPersonAllSpouses($child, $gen-1, -1);
}
}
}
}
/**
* Get the thumbnail image for the given person
*
* @param Person $person
* @return string
*/
function getThumbnail(&$person) {
global $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $TEXT_DIRECTION, $USE_MEDIA_VIEWER, $SERVER_URL;
$thumbnail = "";
if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES && showFact("OBJE", $person->getXref())) {
$object = $person->findHighlightedMedia();
if (!empty($object)) {
$whichFile = thumb_or_main($object); // Do we send the main image or a thumbnail?
$size = findImageSize($whichFile);
$class = "pedigree_image_portrait";
if ($size[0]>$size[1]) $class = "pedigree_image_landscape";
if ($TEXT_DIRECTION == "rtl") $class .= "_rtl";
// NOTE: IMG ID
$imgsize = findImageSize($object["file"]);
$imgwidth = $imgsize[0]+50;
$imgheight = $imgsize[1]+150;
if (!empty($object['mid']) && $USE_MEDIA_VIEWER) {
$thumbnail .= "";
} else {
$thumbnail .= "";
}
$thumbnail .= "
zoomLevel < -2) $style = "display: none;";
else $style = "width: ".(10+$this->zoomLevel)."; height: ".(10+$this->zoomLevel).";";
if (empty($person)) $person = $this->rootPerson;
if (empty($person)) return;
$mother = null;
$father = null;
if ($state>=0) {
$cfamily = $person->getPrimaryChildFamily();
if (!empty($cfamily)) {
$father = $cfamily->getHusband();
if (empty($father)) $father = $cfamily->getWife();
}
$fams = $person->getSpouseFamilies();
$fams = array_reverse($fams);
//-- find the last spouse family that has a known spouse
foreach($fams as $family) {
if (!empty($family)) $spouse = $family->getSpouse($person);
if (!empty($spouse)) {
$mcfamily = $spouse->getPrimaryChildFamily();
if (!empty($mcfamily)) {
$mother = $mcfamily->getHusband();
//-- a mother's father was found so break out
break;
}
}
}
}
?>
getNumberOfChildren()>0) $hasChildren = true;
?>
| name.'_cload" name="'.$this->name.'_cload" onclick="'.$this->name.'.loadChild(this, \''.$person->getXref().'\');"'; ?>>
drawAllChildren($person, $gen);
?>
|
getNumberOfChildren()>1) { ?> " width="3" alt="" /> | " width="3" alt=""/> | 0) {
?> " width="8" height="3" alt="" /> |
; cursor: pointer; font-size: zoomLevel;?>px; width: bwidth+($this->zoomLevel*18));?>px; margin-left: 3px; direction: " onclick="name; ?>.expandBox(this, 'getXref(); ?>', 'all');">
getFullName();
print PrintReady($person->getSexImage('small', $style)." ".$name);
?>
getSpouseFamilies();
foreach($fams as $famid=>$family) {
$spouse = $family->getSpouse($person);
if (!is_null($spouse)) {
$name = $spouse->getFullName();
print PrintReady($spouse->getSexImage('small', $style)." ".$name);
print " \n";
} else print " \n";
}
?>
|
" width="8" height="3" alt="" /> | =0 && (!empty($father) || !empty($mother))) {
$lineid = "pline_";
if (!empty($father)) $lineid.=$father->getXref();
$lineid.="_";
if (!empty($mother)) $lineid.=$mother->getXref();
?>
" width="3" alt="" /> |
name.'_pload" name="'.$this->name.'_pload" onclick="'.$this->name.'.loadParent(this, \''.$person->getXref().'\', \'f\');"'; ?>>
drawPerson($father, $gen-1, 1, $cfamily); else print " \n";?>
|
getSpouseFamilies();
foreach($fams as $famid=>$family) {
$spouse = $family->getSpouse($person);
$mother = null;
if ($spouse!=null) {
$mcfamily = $spouse->getPrimaryChildFamily();
if (!empty($mcfamily)) {
$mother = $mcfamily->getHusband();
}
}
if (!is_null($mother)) {
?>
name.'_pload" name="'.$this->name.'_pload" onclick="'.$this->name.'.loadParent(this, \''.$person->getXref().'\', \'m\');"'; ?>>
drawPerson($mother, $gen-1, 1, $mcfamily); else print" \n";?>
|
|
zoomLevel < -2) $style = "display: none;";
else $style = "width: ".(10+$this->zoomLevel)."; height: ".(10+$this->zoomLevel).";";
if (empty($person)) $person = $this->rootPerson;
if (empty($person)) return;
$mother = null;
$father = null;
if (!empty($pfamily)) $spouse = $pfamily->getSpouse($person);
else {
$spouse = $person->getCurrentSpouse();
$fams = $person->getSpouseFamilies();
$pfamily = end($fams);
}
if ($state<=0) {
$fams = $person->getSpouseFamilies();
$family = end($fams);
}
if ($state>=0) {
$cfamily = $person->getPrimaryChildFamily();
if (!empty($cfamily)) {
$father = $cfamily->getHusband();
}
if (!empty($spouse)) {
$mcfamily = $spouse->getPrimaryChildFamily();
if (!empty($mcfamily)) {
$mother = $mcfamily->getHusband();
}
}
}
?>
getNumberOfChildren()>0) $hasChildren = true;
?>
| name.'_cload" name="'.$this->name.'_cload" onclick="'.$this->name.'.loadChild(this, \''.$person->getXref().'\');"'; ?>>
drawChildren($family, $gen);
?>
|
getNumberOfChildren()>1) { ?> " width="3" alt="" /> | 0) {
?> " width="8" height="3" alt="" /> |
; cursor: pointer; font-size: zoomLevel;?>px; width: bwidth+($this->zoomLevel*18));?>px; direction: " onclick="name; ?>.expandBox(this, 'getXref(); ?>', 'getXref(); ?>');">
getFullName();
print PrintReady($person->getSexImage('small', $style)." ".$name);
?>
getFullName();
print PrintReady($spouse->getSexImage('small', $style)." ".$name);
} else print " \n"; ?>
|
" width="8" height="3" alt="" /> | =0 && (!empty($father) || !empty($mother))) {
$lineid = "pline_";
if (!empty($father)) $lineid.=$father->getXref();
$lineid.="_";
if (!empty($mother)) $lineid.=$mother->getXref();
?>
" width="3" alt="" /> |
name.'_pload" name="'.$this->name.'_pload" onclick="'.$this->name.'.loadParent(this, \''.$person->getXref().'\', \'f\');"'; ?>>
drawPerson($father, $gen-1, 1, $cfamily); else print " \n";?>
|
name.'_pload" name="'.$this->name.'_pload" onclick="'.$this->name.'.loadParent(this, \''.$person->getXref().'\', \'m\');"'; ?>>
drawPerson($mother, $gen-1, 1, $mcfamily); else print" \n";?>
|
|