本文整理汇总了PHP中Fisharebest\Webtrees\Family::getSpouses方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::getSpouses方法的具体用法?PHP Family::getSpouses怎么用?PHP Family::getSpouses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Family
的用法示例。
在下文中一共展示了Family::getSpouses方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_navigator_family
/**
* Display family members with clickable links
*
* @param Family $family
* @param Individual $individual
*/
function print_navigator_family(Family $family, Individual $individual)
{
foreach ($family->getSpouses() as $spouse) {
?>
<tr class="fact_value">
<td class="facts_value">
<a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?php
echo $spouse->getXref();
?>
&gedcom=<?php
echo $spouse->getTree()->getNameUrl();
?>
">
<i class="headimg vmiddle icon-button_head"></i>
</a>
</td>
<td class="facts_value" >
<a href="#" onclick="opener.insertRowToTable('<?php
echo $spouse->getXref();
?>
', '<?php
echo Filter::escapeJs($spouse->getFullName());
?>
', '', '', '', '', '', '', '', '');">
<?php
echo $spouse === $individual ? '<b>' : '';
?>
<?php
echo $spouse->getFullName();
?>
<?php
echo $spouse->getLifeSpan();
?>
<?php
echo $spouse === $individual ? '</b>' : '';
?>
</a>
</td>
<tr>
<?php
}
foreach ($family->getChildren() as $child) {
?>
<tr>
<td class="facts_value" >
<a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?php
echo $child->getXref();
?>
&gedcom=<?php
echo $child->getTree()->getNameUrl();
?>
">
<i class="headimg vmiddle icon-button_head"></i>
</a>
</td>
<td class="facts_value">
<a href="#" onclick="opener.insertRowToTable('<?php
echo $child->getXref();
?>
', '<?php
echo Filter::escapeJs($child->getFullName());
?>
', '', '', '', '', '', '', '', '');">
<?php
echo $child === $individual ? '<b>' : '';
?>
<?php
echo $child->getFullName();
?>
<?php
echo $child->getLifeSpan();
?>
<?php
echo $child === $individual ? '</b>' : '';
?>
</a>
</td>
</tr>
<?php
}
}
示例2: getStepFamilyLabel
/**
* Create a label for a step family
*
* @param Family $step_family
*
* @return string
*/
public function getStepFamilyLabel(Family $step_family)
{
foreach ($this->getChildFamilies() as $family) {
if ($family !== $step_family) {
// Must be a step-family
foreach ($family->getSpouses() as $parent) {
foreach ($step_family->getSpouses() as $step_parent) {
if ($parent === $step_parent) {
// One common parent - must be a step family
if ($parent->getSex() == 'M') {
// Father’s family with someone else
if ($step_family->getSpouse($step_parent)) {
return I18N::translate('Father’s family with %s', $step_family->getSpouse($step_parent)->getFullName());
} else {
return I18N::translate('Father’s family with an unknown individual');
}
} else {
// Mother’s family with someone else
if ($step_family->getSpouse($step_parent)) {
return I18N::translate('Mother’s family with %s', $step_family->getSpouse($step_parent)->getFullName());
} else {
return I18N::translate('Mother’s family with an unknown individual');
}
}
}
}
}
}
}
// Perahps same parents - but a different family record?
return I18N::translate('Family with parents');
}
示例3: drawFamily
/**
* Format a family.
*
* @param Family $family
* @param string $title
*/
private function drawFamily(Family $family, $title)
{
global $controller;
?>
<tr>
<td class="center" colspan="2">
<a class="famnav_title" href="<?php
echo $family->getHtmlUrl();
?>
">
<?php
echo $title;
?>
</a>
</td>
</tr>
<?php
foreach ($family->getSpouses() as $spouse) {
$menu = new Menu(Functions::getCloseRelationshipName($controller->record, $spouse));
$menu->addClass('', 'submenu flyout');
$menu->addSubmenu(new Menu($this->getParents($spouse)));
?>
<tr>
<td class="facts_label">
<?php
echo $menu->getMenu();
?>
</td>
<td class="center <?php
echo $controller->getPersonStyle($spouse);
?>
nam">
<a class="famnav_link" href="<?php
echo $spouse->getHtmlUrl();
?>
">
<?php
echo $spouse->getFullName();
?>
</a>
<div class="font9">
<?php
echo $spouse->getLifeSpan();
?>
</div>
</td>
</tr>
<?php
}
foreach ($family->getChildren() as $child) {
$menu = new Menu(Functions::getCloseRelationshipName($controller->record, $child));
$menu->addClass('', 'submenu flyout');
$menu->addSubmenu(new Menu($this->getFamily($child)));
?>
<tr>
<td class="facts_label">
<?php
echo $menu->getMenu();
?>
</td>
<td class="center <?php
echo $controller->getPersonStyle($child);
?>
nam">
<a class="famnav_link" href="<?php
echo $child->getHtmlUrl();
?>
">
<?php
echo $child->getFullName();
?>
</a>
<div class="font9">
<?php
echo $child->getLifeSpan();
?>
</div>
</td>
</tr>
<?php
}
}
示例4: censusNavigatorFamily
/**
* Create a family on the census navigator.
*
* @param CensusInterface $census
* @param Family $family
* @param Individual $head
*
* @return string
*/
public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head)
{
$headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>';
foreach ($family->getSpouses() as $spouse) {
$menu = new Menu(Functions::getCloseRelationshipName($head, $spouse));
foreach ($spouse->getChildFamilies() as $grandparents) {
foreach ($grandparents->getSpouses() as $grandparent) {
$submenu = new Menu(Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");'));
$submenu->addClass('submenuitem', '');
$menu->addSubmenu($submenu);
$menu->addClass('', 'submenu');
}
}
?>
<tr>
<td class="optionbox">
<?php
echo $menu->getMenu();
?>
</td>
<td class="facts_value nowrap">
<a href="#" onclick="return appendCensusRow('<?php
echo Filter::escapeJs(self::censusTableRow($census, $spouse, $head));
?>
');">
<?php
echo $spouse->getFullName();
?>
</a>
</td>
<td class="facts_value">
<?php
if ($head !== $spouse) {
?>
<a href="edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=<?php
echo $spouse->getXref();
?>
&gedcom=<?php
echo $spouse->getTree()->getNameUrl();
?>
&census=<?php
echo get_class($census);
?>
">
<?php
echo $headImg2;
?>
</a>
<?php
}
?>
</td>
</tr>
<?php
}
foreach ($family->getChildren() as $child) {
$menu = new Menu(Functions::getCloseRelationshipName($head, $child));
foreach ($child->getSpouseFamilies() as $spouse_family) {
foreach ($spouse_family->getSpouses() as $spouse_family_spouse) {
if ($spouse_family_spouse != $child) {
$submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");'));
$submenu->addClass('submenuitem', '');
$menu->addSubmenu($submenu);
$menu->addClass('', 'submenu');
}
}
foreach ($spouse_family->getChildren() as $spouse_family_child) {
$submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");'));
$submenu->addClass('submenuitem', '');
$menu->addSubmenu($submenu);
$menu->addClass('', 'submenu');
}
}
?>
<tr>
<td class="optionbox">
<?php
echo $menu->getMenu();
?>
</td>
<td class="facts_value">
<a href="#" onclick="return appendCensusRow('<?php
echo Filter::escapeJs(self::censusTableRow($census, $child, $head));
?>
');">
<?php
echo $child->getFullName();
?>
</a>
</td>
<td class="facts_value">
//.........这里部分代码省略.........
示例5: addFamilyDescendancy
/**
* Recursive function to traverse the tree
*
* @param Family|null $family
* @param int $level
*/
public function addFamilyDescendancy(Family $family = null, $level = PHP_INT_MAX)
{
if (!$family) {
return;
}
foreach ($family->getSpouses() as $spouse) {
$this->addClipping($spouse);
}
foreach ($family->getChildren() as $child) {
$this->addClipping($child);
foreach ($child->getSpouseFamilies() as $child_family) {
$this->addClipping($child_family);
if ($level > 0) {
$this->addFamilyDescendancy($child_family, $level - 1);
// recurse on the childs family
}
}
}
}