本文整理汇总了PHP中Fisharebest\Webtrees\Individual::getChildFamilies方法的典型用法代码示例。如果您正苦于以下问题:PHP Individual::getChildFamilies方法的具体用法?PHP Individual::getChildFamilies怎么用?PHP Individual::getChildFamilies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Individual
的用法示例。
在下文中一共展示了Individual::getChildFamilies方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatParentsAges
/**
* Format age of parents in HTML
*
* @param Individual $person child
* @param Date $birth_date
*
* @return string HTML
*/
public static function formatParentsAges(Individual $person, Date $birth_date)
{
$html = '';
$families = $person->getChildFamilies();
// Multiple sets of parents (e.g. adoption) cause complications, so ignore.
if ($birth_date->isOK() && count($families) == 1) {
$family = current($families);
foreach ($family->getSpouses() as $parent) {
if ($parent->getBirthDate()->isOK()) {
$sex = $parent->getSexImage();
$age = Date::getAge($parent->getBirthDate(), $birth_date, 2);
$deatdate = $parent->getDeathDate();
switch ($parent->getSex()) {
case 'F':
// Highlight mothers who die in childbirth or shortly afterwards
if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
} else {
$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
}
break;
case 'M':
// Highlight fathers who die before the birth
if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
} else {
$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
}
break;
default:
$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
break;
}
}
}
if ($html) {
$html = '<span class="age">' . $html . '</span>';
}
}
return $html;
}
示例2: loadAncestors
/**
* Load the ancestors of an individual, so we can highlight them in the list
*
* @param Individual $ancestor
* @param int $sosa
*/
private function loadAncestors(Individual $ancestor, $sosa)
{
if ($ancestor) {
$this->ancestors[$sosa] = $ancestor;
foreach ($ancestor->getChildFamilies() as $family) {
foreach ($family->getSpouses() as $parent) {
$this->loadAncestors($parent, $sosa * 2 + ($parent->getSex() == 'F' ? 1 : 0));
}
}
}
}
示例3: printPersonPedigree
/**
* Prints pedigree of the person passed in
*
* @param Individual $person
* @param int $count
*/
private function printPersonPedigree($person, $count)
{
if ($count >= $this->generations) {
return;
}
$genoffset = $this->generations;
// handle pedigree n generations lines
//-- calculate how tall the lines should be
$lh = ($this->bhalfheight + 4) * pow(2, $genoffset - $count - 1);
//
//Prints empty table columns for children w/o parents up to the max generation
//This allows vertical line spacing to be consistent
if (count($person->getChildFamilies()) == 0) {
echo '<table>';
$this->printEmptyBox($this->getBoxDimensions()->width, $this->getBoxDimensions()->height);
//-- recursively get the father’s family
$this->printPersonPedigree($person, $count + 1);
echo '</td><td></tr>';
$this->printEmptyBox($this->getBoxDimensions()->width, $this->getBoxDimensions()->height);
//-- recursively get the mother’s family
$this->printPersonPedigree($person, $count + 1);
echo '</td><td></tr></table>';
}
// Empty box section done, now for regular pedigree
foreach ($person->getChildFamilies() as $family) {
echo '<table><tr><td class="tdbot">';
// Determine line height for two or more spouces
// And then adjust the vertical line for the root person only
$famcount = 0;
if ($this->show_spouse) {
// count number of spouses
$famcount += count($person->getSpouseFamilies());
}
$savlh = $lh;
// Save current line height
if ($count == 1 && $genoffset <= $famcount) {
$linefactor = 0;
// genoffset of 2 needs no adjustment
if ($genoffset > 2) {
$tblheight = $this->getBoxDimensions()->height + 8;
if ($genoffset == 3) {
if ($famcount == 3) {
$linefactor = $tblheight / 2;
} elseif ($famcount > 3) {
$linefactor = $tblheight;
}
}
if ($genoffset == 4) {
if ($famcount == 4) {
$linefactor = $tblheight;
} elseif ($famcount > 4) {
$linefactor = ($famcount - $genoffset) * ($tblheight * 1.5);
}
}
if ($genoffset == 5) {
if ($famcount == 5) {
$linefactor = 0;
} elseif ($famcount > 5) {
$linefactor = $tblheight * ($famcount - $genoffset);
}
}
}
$lh = ($famcount - 1) * ($this->getBoxDimensions()->height + 8) - $linefactor;
if ($genoffset > 5) {
$lh = $savlh;
}
}
echo '<img class="line3 pvline" src="', Theme::theme()->parameter('image-vline'), '" height="', $lh - 1, '" alt=""></td>', '<td>', '<img class="line4" src="', Theme::theme()->parameter('image-hline'), '" height="3" alt=""></td>', '<td>';
$lh = $savlh;
// restore original line height
//-- print the father box
FunctionsPrint::printPedigreePerson($family->getHusband(), $this->showFull());
echo '</td>';
if ($family->getHusband()) {
echo '<td>';
//-- recursively get the father’s family
$this->printPersonPedigree($family->getHusband(), $count + 1);
echo '</td>';
} else {
echo '<td>';
if ($genoffset > $count) {
echo '<table>';
for ($i = 1; $i < pow(2, $genoffset - $count) / 2; $i++) {
$this->printEmptyBox($this->getBoxDimensions()->width, $this->getBoxDimensions()->height);
echo '</tr>';
}
echo '</table>';
}
}
echo '</tr><tr>', '<td class="tdtop"><img class="pvline" src="', Theme::theme()->parameter('image-vline'), '" height="', $lh + 1, '"></td>', '<td><img class="line4" src="', Theme::theme()->parameter('image-hline'), '" height="3"></td>', '<td>';
//-- print the mother box
FunctionsPrint::printPedigreePerson($family->getWife(), $this->showFull());
echo '</td>';
if ($family->getWife()) {
//.........这里部分代码省略.........
示例4: printPersonPedigree
/**
* Prints pedigree of the person passed in. Which is the descendancy
*
* @param Individual $person ID of person to print the pedigree for
* @param int $count generation count, so it recursively calls itself
*/
public function printPersonPedigree(Individual $person, $count)
{
if ($count >= $this->generations) {
return;
}
$genoffset = $this->generations;
// handle pedigree n generations lines
//
//Prints empty table columns for children w/o parents up to the max generation
//This allows vertical line spacing to be consistent
//
if (count($person->getChildFamilies()) == 0) {
echo '<table class="xyz"><tr><td>' . $this->printEmptyBox() . '</td>';
echo '<td>';
//-- recursively get the father’s family
$this->printPersonPedigree($person, $count + 1);
echo '</td></tr>';
echo '<tr><td>' . $this->printEmptyBox() . '</td>';
echo '<td>';
//-- recursively get the father’s family
$this->printPersonPedigree($person, $count + 1);
echo '</td><td></tr></table>';
}
foreach ($person->getChildFamilies() as $family) {
echo '<table class="hourglassChart">';
echo '<tr>';
echo '<td style="vertical-align:bottom"><img class="line3 pvline" src="' . Theme::theme()->parameter('image-vline') . '" width="3"></td>';
echo '<td><img class="line4" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3"></td>';
echo '<td>';
//-- print the father box
FunctionsPrint::printPedigreePerson($family->getHusband(), $this->showFull());
echo "</td>";
if ($family->getHusband()) {
$ARID = $family->getHusband()->getXref();
echo "<td id=\"td_" . $ARID . "\">";
//-- print an Ajax arrow on the last generation of the adult male
if ($count == $this->generations - 1 && $family->getHusband()->getChildFamilies()) {
printf(self::LINK, $this->right_arrow, $ARID, 'asc', $this->showFull(), $this->show_spouse);
}
//-- recursively get the father’s family
$this->printPersonPedigree($family->getHusband(), $count + 1);
echo "</td>";
} else {
echo '<td>';
if ($count < $genoffset - 1) {
echo '<table>';
for ($i = $count; $i < pow(2, $genoffset - 1 - $count) / 2 + 2; $i++) {
$this->printEmptyBox();
echo '</tr>';
$this->printEmptyBox();
echo '</tr>';
}
echo '</table>';
}
}
echo '</tr><tr>', "<td style='vertical-align:top'><img class='pvline' src='" . Theme::theme()->parameter('image-vline') . "' width='3' alt=''></td>", '<td><img class="line4" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3" alt=""></td>', '<td>';
//-- print the mother box
FunctionsPrint::printPedigreePerson($family->getWife(), $this->showFull());
echo '</td>';
if ($family->getWife()) {
$ARID = $family->getWife()->getXref();
echo '<td id="td_' . $ARID . '">';
//-- print an ajax arrow on the last generation of the adult female
if ($count == $this->generations - 1 && $family->getWife()->getChildFamilies()) {
printf(self::LINK, $this->right_arrow, $ARID, 'asc', $this->showFull(), $this->show_spouse);
}
//-- recursively print the mother’s family
$this->printPersonPedigree($family->getWife(), $count + 1);
echo '</td>';
}
echo '</tr></table>';
break;
}
}
示例5: parentFacts
/**
* Get the events of parents and grandparents.
*
* @param Individual $person
* @param int $sosa
*
* @return Fact[]
*/
private static function parentFacts(Individual $person, $sosa)
{
global $controller;
$SHOW_RELATIVES_EVENTS = $person->getTree()->getPreference('SHOW_RELATIVES_EVENTS');
$facts = array();
// Only include events between birth and death
$birt_date = $controller->record->getEstimatedBirthDate();
$deat_date = $controller->record->getEstimatedDeathDate();
if ($sosa == 1) {
foreach ($person->getChildFamilies() as $family) {
// Add siblings
foreach (self::childFacts($person, $family, '_SIBL', '') as $fact) {
$facts[] = $fact;
}
foreach ($family->getSpouses() as $spouse) {
foreach ($spouse->getSpouseFamilies() as $sfamily) {
if ($family !== $sfamily) {
// Add half-siblings
foreach (self::childFacts($person, $sfamily, '_HSIB', '') as $fact) {
$facts[] = $fact;
}
}
}
// Add grandparents
foreach (self::parentFacts($spouse, $spouse->getSex() == 'F' ? 3 : 2) as $fact) {
$facts[] = $fact;
}
}
}
if (strstr($SHOW_RELATIVES_EVENTS, '_MARR_PARE')) {
// add father/mother marriages
foreach ($person->getChildFamilies() as $sfamily) {
foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
if ($fact->getDate()->isOK() && Date::compare($birt_date, $fact->getDate()) <= 0 && Date::compare($fact->getDate(), $deat_date) <= 0) {
// marriage of parents (to each other)
$rela_fact = clone $fact;
$rela_fact->setTag('_' . $fact->getTag() . '_FAMC');
$facts[] = $rela_fact;
}
}
}
foreach ($person->getChildStepFamilies() as $sfamily) {
foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
if ($fact->getDate()->isOK() && Date::compare($birt_date, $fact->getDate()) <= 0 && Date::compare($fact->getDate(), $deat_date) <= 0) {
// marriage of a parent (to another spouse)
// Convert the event to a close relatives event
$rela_fact = clone $fact;
$rela_fact->setTag('_' . $fact->getTag() . '_PARE');
$facts[] = $rela_fact;
}
}
}
}
}
foreach ($person->getChildFamilies() as $family) {
foreach ($family->getSpouses() as $parent) {
if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT' . ($sosa == 1 ? '_PARE' : '_GPAR'))) {
foreach ($parent->getFacts(WT_EVENTS_DEAT) as $fact) {
if ($fact->getDate()->isOK() && Date::compare($birt_date, $fact->getDate()) <= 0 && Date::compare($fact->getDate(), $deat_date) <= 0) {
switch ($sosa) {
case 1:
// Convert the event to a close relatives event.
$rela_fact = clone $fact;
$rela_fact->setTag('_' . $fact->getTag() . '_PARE');
$facts[] = $rela_fact;
break;
case 2:
// Convert the event to a close relatives event
$rela_fact = clone $fact;
$rela_fact->setTag('_' . $fact->getTag() . '_GPA1');
$facts[] = $rela_fact;
break;
case 3:
// Convert the event to a close relatives event
$rela_fact = clone $fact;
$rela_fact->setTag('_' . $fact->getTag() . '_GPA2');
$facts[] = $rela_fact;
break;
}
}
}
}
}
}
return $facts;
}
示例6: addAncestorsToCartFamilies
/**
* Recursively adds direct-line ancestors and their families to the cart
*
* @param Individual|null $person
* @param int $level
*/
public function addAncestorsToCartFamilies(Individual $person = null, $level = 0)
{
if (!$person) {
return;
}
if ($level > 0) {
foreach ($person->getChildFamilies() as $family) {
$this->addFamilyMembers($family);
$this->addAncestorsToCartFamilies($family->getHusband(), $level - 1);
$this->addAncestorsToCartFamilies($family->getWife(), $level - 1);
}
}
}