本文整理汇总了PHP中Fisharebest\Webtrees\Family::getFacts方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::getFacts方法的具体用法?PHP Family::getFacts怎么用?PHP Family::getFacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Family
的用法示例。
在下文中一共展示了Family::getFacts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Startup activity
*
* @param GedcomRecord|null $record
*/
public function __construct(GedcomRecord $record = null)
{
$this->record = $record;
// Automatically fix broken links
if ($this->record && $this->record->canEdit()) {
$broken_links = 0;
foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
if (!$fact->isPendingDeletion() && $fact->getTarget() === null) {
$this->record->deleteFact($fact->getFactId(), false);
FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
$broken_links = true;
}
}
foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
// These can be links or inline. Only delete links.
if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
$this->record->deleteFact($fact->getFactId(), false);
FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
$broken_links = true;
}
}
if ($broken_links) {
// Reload the updated family
$this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree());
}
}
parent::__construct();
// We want robots to index this page
$this->setMetaRobots('index,follow');
// Set a page title
if ($this->record) {
if ($this->record->canShowName()) {
// e.g. "John Doe" or "1881 Census of Wales"
$this->setPageTitle($this->record->getFullName());
} else {
// e.g. "Individual" or "Source"
$record = $this->record;
$this->setPageTitle(GedcomTag::getLabel($record::RECORD_TYPE));
}
} else {
// No such record
$this->setPageTitle(I18N::translate('Private'));
}
}
示例2: printFamilyParents
//.........这里部分代码省略.........
}
echo "</td>";
}
if ($hfam && $sosa != -1) {
echo '<td valign="middle" rowspan="2">';
self::printUrlArrow($sosa == 0 ? '?famid=' . $hfam->getXref() . '&ged=' . $hfam->getTree()->getNameUrl() : '#' . $hfam->getXref(), $hfam->getXref(), 1);
echo '</td>';
}
if ($hfam) {
// husband’s mother
echo "</tr><tr><td><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>";
if ($hfam && $hfam->getWife()) {
echo "<table border='0'><tr>";
if ($sosa > 0) {
self::printSosaNumber($sosa * 4 + 1, $hfam->getWife()->getXref(), "down");
}
if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) {
self::printSosaNumber(trim(substr($label, 0, -3), ".") . ".");
}
echo '<td valign="top">';
FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full);
echo '</td></tr></table>';
} elseif ($hfam && !$hfam->getWife()) {
// Empty box for grandmother
echo "<table border='0'><tr>";
echo '<td valign="top">';
FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full);
echo '</td></tr></table>';
}
echo '</td>';
}
echo '</tr></table>';
if ($sosa && $family->canShow()) {
foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
echo '<a href="', $family->getHtmlUrl(), '" class="details1">';
echo str_repeat(' ', 10);
echo $fact->summary();
echo '</a>';
}
} else {
echo '<br>';
}
/**
* wife side
*/
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">";
echo "<table><tr>";
if ($parid) {
if ($wife->getXref() == $parid) {
self::printSosaNumber($label);
} else {
self::printSosaNumber($label, "", "blank");
}
} elseif ($sosa) {
self::printSosaNumber($sosa * 2 + 1);
}
if ($wife->isPendingAddtion()) {
echo '<td valign="top" class="facts_value new">';
} elseif ($wife->isPendingDeletion()) {
echo '<td valign="top" class="facts_value old">';
} else {
echo '<td valign="top">';
}
FunctionsPrint::printPedigreePerson($wife, $show_full);
echo "</td></tr></table>";
echo "</td>";
示例3: getPersonDetails
/**
* Return the details for a person
*
* @param Individual $individual
* @param Family $family
*
* @return string
*/
private function getPersonDetails(Individual $individual, Family $family = null)
{
$hmtl = $this->getThumbnail($individual);
$hmtl .= '<a class="tv_link" href="' . $individual->getHtmlUrl() . '">' . $individual->getFullName() . '</a> <a href="module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '" title="' . I18N::translate('Interactive tree of %s', strip_tags($individual->getFullName())) . '" class="icon-button_indi tv_link tv_treelink"></a>';
foreach ($individual->getFacts(WT_EVENTS_BIRT, true) as $fact) {
$hmtl .= $fact->summary();
}
if ($family) {
foreach ($family->getFacts(WT_EVENTS_MARR, true) as $fact) {
$hmtl .= $fact->summary();
}
}
foreach ($individual->getFacts(WT_EVENTS_DEAT, true) as $fact) {
$hmtl .= $fact->summary();
}
return '<div class="tv' . $individual->getSex() . ' tv_person_expanded">' . $hmtl . '</div>';
}
示例4: printFamily
/**
* Print a family group.
*
* @param Family $family
* @param string $type
* @param string $label
*/
private function printFamily(Family $family, $type, $label)
{
global $controller;
if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) {
$access_level = Auth::PRIV_HIDE;
} else {
$access_level = Auth::accessLevel($family->getTree());
}
?>
<table>
<tr>
<td>
<i class="icon-cfamily"></i>
</td>
<td>
<span class="subheaders"> <?php
echo $label;
?>
</span>
<a class="noprint" href="<?php
echo $family->getHtmlUrl();
?>
"> - <?php
echo I18N::translate('View this family');
?>
</a>
</td>
</tr>
</table>
<table class="facts_table">
<?php
///// HUSB /////
$found = false;
foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
$found |= !$fact->isPendingDeletion();
$person = $fact->getTarget();
if ($person instanceof Individual) {
if ($fact->isPendingAddition()) {
$class = 'facts_label new';
} elseif ($fact->isPendingDeletion()) {
$class = 'facts_label old';
} else {
$class = 'facts_label';
}
?>
<tr>
<td class="<?php
echo $class;
?>
">
<?php
echo Functions::getCloseRelationshipName($controller->record, $person);
?>
</td>
<td class="<?php
echo $controller->getPersonStyle($person);
?>
">
<?php
echo Theme::theme()->individualBoxLarge($person);
?>
</td>
</tr>
<?php
}
}
if (!$found && $family->canEdit()) {
?>
<tr>
<td class="facts_label"></td>
<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php
echo $family->getXref();
?>
', 'HUSB');"><?php
echo I18N::translate('Add a husband to this family');
?>
</a></td>
</tr>
<?php
}
///// WIFE /////
$found = false;
foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
$person = $fact->getTarget();
if ($person instanceof Individual) {
$found |= !$fact->isPendingDeletion();
if ($fact->isPendingAddition()) {
$class = 'facts_label new';
} elseif ($fact->isPendingDeletion()) {
$class = 'facts_label old';
} else {
$class = 'facts_label';
}
//.........这里部分代码省略.........
示例5: printFamilyDescendancy
/**
* print a family descendancy
*
* @param Individual $person
* @param Family $family
* @param int $depth the descendancy depth to show
*/
private function printFamilyDescendancy(Individual $person, Family $family, $depth)
{
$uid = Uuid::uuid4();
// create a unique ID
// print marriage info
echo '<li>';
echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent') + 4, '">';
echo '<span class="details1">';
echo "<a href=\"#\" onclick=\"expand_layer('" . $uid . "'); return false;\" class=\"top\"><i id=\"" . $uid . "_img\" class=\"icon-minus\" title=\"" . I18N::translate('View this family') . "\"></i></a>";
if ($family->canShow()) {
foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>';
}
}
echo '</span>';
// print spouse
$spouse = $family->getSpouse($person);
echo '<ul id="' . $uid . '" class="generation">';
echo '<li>';
echo '<table><tr><td>';
FunctionsPrint::printPedigreePerson($spouse, $this->showFull());
echo '</td>';
// check if spouse has parents and add an arrow
echo '<td></td>';
echo '<td>';
if ($spouse) {
foreach ($spouse->getChildFamilies() as $cfamily) {
foreach ($cfamily->getSpouses() as $parent) {
FunctionsCharts::printUrlArrow('?rootid=' . $parent->getXref() . '&generations=' . $this->generations . '&chart_style=' . $this->chart_style . '&show_full=' . $this->showFull() . '&ged=' . $parent->getTree()->getNameUrl(), I18N::translate('Start at parents'), 2);
// only show the arrow for one of the parents
break;
}
}
}
if ($this->showFull()) {
echo '<br><br> ';
}
echo '</td></tr>';
// children
$children = $family->getChildren();
echo '<tr><td colspan="3" class="details1" > ';
if ($children) {
echo GedcomTag::getLabel('NCHI') . ': ' . count($children);
} else {
// Distinguish between no children (NCHI 0) and no recorded
// children (no CHIL records)
if (strpos($family->getGedcom(), '\\n1 NCHI 0')) {
echo GedcomTag::getLabel('NCHI') . ': ' . count($children);
} else {
echo I18N::translate('No children');
}
}
echo '</td></tr></table>';
echo '</li>';
if ($depth > 1) {
foreach ($children as $child) {
$this->printChildDescendancy($child, $depth - 1);
}
}
echo '</ul>';
echo '</li>';
}