show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3, 0); $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... $show_full=$this->show_full; if (!isset($this->personcount)) $this->personcount = 1; // -- size of the detailed boxes based upon optional width parameter $Dbwidth = ($this->box_width*$bwidth)/100; $Dbheight = ($this->box_width*$bheight)/100; $bwidth = $Dbwidth; $bheight = $Dbheight; // -- adjust size of the compact box if (!$this->show_full) { $bwidth = $cbwidth; $bheight = $cbheight; } $pbwidth = $bwidth+12; $pbheight = $bheight+14; // Validate form variables if (strlen($this->name)<30) { $this->cellwidth=420; } else { $this->cellwidth=(strlen($this->name)*14); } if ($this->root && $this->root->canShowName()) { $this->setPageTitle( /* I18N: %s is an individual’s name */ WT_I18N::translate('Descendants of %s', $this->root->getFullName()) ); } else { $this->setPageTitle(WT_I18N::translate('Descendants')); } } /** * print a child family * * @param string $pid individual Gedcom Id * @param int $depth the descendancy depth to show */ function print_child_family($person, $depth, $label='1.', $gpid='') { global $personcount; if (is_null($person)) return; if ($depth<2) return; foreach ($person->getSpouseFamilies() as $family) { print_sosa_family($family->getXref(), '', -1, $label, $person->getXref(), $gpid, $personcount); $personcount++; $i=1; foreach ($family->getChildren() as $child) { $this->print_child_family($child, $depth-1, $label.($i++).'.', $person->getXref()); } } } /** * print a child descendancy * * @param string $pid individual Gedcom Id * @param int $depth the descendancy depth to show */ function print_child_descendancy($person, $depth) { global $WT_IMAGES, $Dindent, $personcount; if (is_null($person)) return; //print_r($person); echo "
  • "; echo "'; // check if child has parents and add an arrow echo ''; echo '"; echo "
    "; if ($depth==$this->generations) echo "\"\""; else { echo "\"\""; echo "\"\""; } print_pedigree_person($person, 1, 0, $personcount); echo ' '; foreach ($person->getChildFamilies() as $cfamily) { foreach ($cfamily->getSpouses() as $parent) { print_url_arrow($parent->getXref().$personcount.$person->getXref(), '?rootid='.$parent->getXref().'&generations='.$this->generations.'&chart_style='.$this->chart_style.'&show_full='.$this->show_full.'&box_width='.$this->box_width.'&ged='.WT_GEDURL, WT_I18N::translate('Start at parents'), 2); $personcount++; // only show the arrow for one of the parents break; } } // d'Aboville child number $level =$this->generations-$depth; if ($this->show_full) echo '

     '; echo ''; //needed so that RTL languages will display this properly if (!isset($this->dabo_num[$level])) $this->dabo_num[$level]=0; $this->dabo_num[$level]++; $this->dabo_num[$level+1]=0; $this->dabo_sex[$level]=$person->getSex(); for ($i=0; $i<=$level;$i++) { $isf=$this->dabo_sex[$i]; if ($isf=="M") $isf=""; if ($isf=="U") $isf="NN"; echo " ".$this->dabo_num[$i]." "; if ($i<$level) echo "."; } echo ""; echo "
    "; echo "
  • "; // loop for each spouse foreach ($person->getSpouseFamilies() as $family) { $personcount++; $this->print_family_descendancy($person, $family, $depth); } } /** * print a family descendancy * * @param string $pid individual Gedcom Id * @param Family $famid family record * @param int $depth the descendancy depth to show */ function print_family_descendancy($person, $family, $depth) { global $GEDCOM, $WT_IMAGES, $Dindent, $personcount; if (is_null($family)) return; if (is_null($person)) return; // print marriage info echo '
  • '; echo ''; echo ''; echo "getXref().$personcount."'); return false;\" class=\"top\">getXref().$personcount."_img\" class=\"icon-minus\" title=\"".WT_I18N::translate('View family')."\">"; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' ', $fact->summary(), ''; } } echo ''; // print spouse $spouse=$family->getSpouse($person); echo ''; echo '
  • '; } public function indi_desc($person, $n, $array) { if ($n < 1) { return $array; } $array[$person->getXref()]=$person; foreach ($person->getSpouseFamilies() as $family) { $spouse = $family->getSpouse($person); if ($spouse) { $array[$spouse->getXref()] = $spouse; } foreach ($family->getChildren() as $child) { $array = $this->indi_desc($child, $n-1, $array); } } return $array; } public function fam_desc($person, $n, $array) { if ($n < 1) { return $array; } foreach ($person->getSpouseFamilies() as $family) { $array[$family->getXref()]=$family; foreach ($family->getChildren() as $child) { $array = $this->fam_desc($child, $n-1, $array); } } return $array; } }