本文整理汇总了PHP中Fisharebest\Webtrees\Individual::getFacts方法的典型用法代码示例。如果您正苦于以下问题:PHP Individual::getFacts方法的具体用法?PHP Individual::getFacts怎么用?PHP Individual::getFacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Individual
的用法示例。
在下文中一共展示了Individual::getFacts方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generate the likely value of this census column, based on available information.
*
* @param Individual $individual
* @param Individual|null $head
*
* @return string
*/
public function generate(Individual $individual, Individual $head = null)
{
foreach ($individual->getFacts('OCCU') as $fact) {
return $fact->getValue();
}
return '';
}
示例2: __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'));
}
}
示例3: generate
/**
* Generate the likely value of this census column, based on available information.
*
* @param Individual $individual
* @param Individual|null $head
*
* @return string
*/
public function generate(Individual $individual, Individual $head = null)
{
$place = $individual->getBirthPlace();
// Did we emigrate or naturalise?
foreach ($individual->getFacts('IMMI|EMIG|NATU', true) as $fact) {
if (Date::compare($fact->getDate(), $this->date()) <= 0) {
$place = $fact->getPlace()->getGedcomName();
}
}
$place = explode(', ', $place);
$place = end($place);
if ($place === 'England' || $place === 'Scotland' || $place === 'Wales') {
return 'British';
} else {
return $place;
}
}
示例4: getLdsSummary
/**
* Summary of LDS ordinances.
*
* @param Individual $individual
*
* @return string
*/
public static function getLdsSummary(Individual $individual)
{
$BAPL = $individual->getFacts('BAPL') ? 'B' : '_';
$ENDL = $individual->getFacts('ENDL') ? 'E' : '_';
$SLGC = $individual->getFacts('SLGC') ? 'C' : '_';
$SLGS = '_';
foreach ($individual->getSpouseFamilies() as $family) {
if ($family->getFacts('SLGS')) {
$SLGS = '';
}
}
return $BAPL . $ENDL . $SLGS . $SLGC;
}
示例5: buildIndividualMap
/**
* Build a map for an individual.
*
* @param Individual $indi
*/
private function buildIndividualMap(Individual $indi)
{
$GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
$indifacts = $indi->getFacts();
foreach ($indi->getSpouseFamilies() as $family) {
$indifacts = array_merge($indifacts, $family->getFacts());
}
Functions::sortFacts($indifacts);
// Create the markers list array
$gmarks = array();
$i = 0;
foreach ($indifacts as $fact) {
if (!$fact->getPlace()->isEmpty()) {
$ctla = preg_match("/\\d LATI (.*)/", $fact->getGedcom(), $match1);
$ctlo = preg_match("/\\d LONG (.*)/", $fact->getGedcom(), $match2);
if ($fact->getParent() instanceof Family) {
$spouse = $fact->getParent()->getSpouse($indi);
} else {
$spouse = null;
}
if ($ctla && $ctlo) {
$i++;
$gmarks[$i] = array('class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => '', 'place' => $fact->getPlace()->getFullName(), 'sv_bearing' => '0', 'sv_elevation' => '0', 'sv_lati' => '0', 'sv_long' => '0', 'sv_zoom' => '0', 'tooltip' => $fact->getPlace()->getGedcomName());
} else {
$latlongval = $this->getLatitudeAndLongitudeFromPlaceLocation($fact->getPlace()->getGedcomName());
if ($latlongval && $latlongval->pl_lati && $latlongval->pl_long) {
$i++;
$gmarks[$i] = array('class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => $latlongval->pl_icon, 'place' => $fact->getPlace()->getFullName(), 'sv_bearing' => $latlongval->sv_bearing, 'sv_elevation' => $latlongval->sv_elevation, 'sv_lati' => $latlongval->sv_lati, 'sv_long' => $latlongval->sv_long, 'sv_zoom' => $latlongval->sv_zoom, 'tooltip' => $fact->getPlace()->getGedcomName());
if ($GM_MAX_ZOOM > $latlongval->pl_zoom) {
$GM_MAX_ZOOM = $latlongval->pl_zoom;
}
}
}
}
}
// Add children to the markers list array
foreach ($indi->getSpouseFamilies() as $family) {
foreach ($family->getChildren() as $child) {
$birth = $child->getFirstFact('BIRT');
if ($birth) {
$birthrec = $birth->getGedcom();
if (!$birth->getPlace()->isEmpty()) {
$ctla = preg_match('/\\n4 LATI (.+)/', $birthrec, $match1);
$ctlo = preg_match('/\\n4 LONG (.+)/', $birthrec, $match2);
if ($ctla && $ctlo) {
$i++;
$gmarks[$i] = array('date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => '<a href="' . $child->getHtmlUrl() . '"' . $child->getFullName() . '</a>', 'pl_icon' => '', 'place' => $birth->getPlace()->getFullName(), 'sv_bearing' => '0', 'sv_elevation' => '0', 'sv_lati' => '0', 'sv_long' => '0', 'sv_zoom' => '0', 'tooltip' => $birth->getPlace()->getGedcomName());
switch ($child->getSex()) {
case 'F':
$gmarks[$i]['fact_label'] = I18N::translate('daughter');
$gmarks[$i]['class'] = 'person_boxF';
break;
case 'M':
$gmarks[$i]['fact_label'] = I18N::translate('son');
$gmarks[$i]['class'] = 'person_box';
break;
default:
$gmarks[$i]['fact_label'] = I18N::translate('child');
$gmarks[$i]['class'] = 'person_boxNN';
break;
}
} else {
$latlongval = $this->getLatitudeAndLongitudeFromPlaceLocation($birth->getPlace()->getGedcomName());
if ($latlongval && $latlongval->pl_lati && $latlongval->pl_long) {
$i++;
$gmarks[$i] = array('date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long), 'name' => '<a href="' . $child->getHtmlUrl() . '"' . $child->getFullName() . '</a>', 'pl_icon' => $latlongval->pl_icon, 'place' => $birth->getPlace()->getFullName(), 'sv_bearing' => $latlongval->sv_bearing, 'sv_elevation' => $latlongval->sv_elevation, 'sv_lati' => $latlongval->sv_lati, 'sv_long' => $latlongval->sv_long, 'sv_zoom' => $latlongval->sv_zoom, 'tooltip' => $birth->getPlace()->getGedcomName());
switch ($child->getSex()) {
case 'M':
$gmarks[$i]['fact_label'] = I18N::translate('son');
$gmarks[$i]['class'] = 'person_box';
break;
case 'F':
$gmarks[$i]['fact_label'] = I18N::translate('daughter');
$gmarks[$i]['class'] = 'person_boxF';
break;
default:
$gmarks[$i]['fact_label'] = I18N::translate('child');
$gmarks[$i]['class'] = 'option_boxNN';
break;
}
if ($GM_MAX_ZOOM > $latlongval->pl_zoom) {
$GM_MAX_ZOOM = $latlongval->pl_zoom;
}
}
}
}
}
}
}
// *** ENABLE STREETVIEW ***
$STREETVIEW = $this->getSetting('GM_USE_STREETVIEW');
?>
<script>
// this variable will collect the html which will eventually be placed in the side_bar
//.........这里部分代码省略.........
示例6: spouseFacts
/**
* Spouse facts that are shown on an individual’s page.
*
* @param Individual $individual Show events that occured during the lifetime of this individual
* @param Individual $spouse Show events of this individual
*
* @return Fact[]
*/
private static function spouseFacts(Individual $individual, Individual $spouse)
{
$SHOW_RELATIVES_EVENTS = $individual->getTree()->getPreference('SHOW_RELATIVES_EVENTS');
$facts = array();
if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT_SPOU')) {
// Only include events between birth and death
$birt_date = $individual->getEstimatedBirthDate();
$deat_date = $individual->getEstimatedDeathDate();
foreach ($spouse->getFacts(WT_EVENTS_DEAT) as $fact) {
$fact_date = $fact->getDate();
if ($fact_date->isOK() && Date::compare($birt_date, $fact_date) <= 0 && Date::compare($fact_date, $deat_date) <= 0) {
// Convert the event to a close relatives event.
$rela_fact = clone $fact;
$rela_fact->setTag('_' . $fact->getTag() . '_SPOU');
$facts[] = $rela_fact;
}
}
}
return $facts;
}
示例7: individualBoxLdsSummary
/**
* Generate the LDS summary, for display in charts.
*
* @param Individual $individual
*
* @return string
*/
protected function individualBoxLdsSummary(Individual $individual)
{
if ($individual->getTree()->getPreference('SHOW_LDS_AT_GLANCE')) {
$BAPL = $individual->getFacts('BAPL') ? 'B' : '_';
$ENDL = $individual->getFacts('ENDL') ? 'E' : '_';
$SLGC = $individual->getFacts('SLGC') ? 'C' : '_';
$SLGS = '_';
foreach ($individual->getSpouseFamilies() as $family) {
if ($family->getFacts('SLGS')) {
$SLGS = '';
}
}
return $BAPL . $ENDL . $SLGS . $SLGC;
} else {
return '';
}
}
示例8: buildIndividualMap
/**
* Build a map for an individual.
*
* @param Individual $indi
*/
private function buildIndividualMap(Individual $indi)
{
$GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
$facts = $indi->getFacts();
foreach ($indi->getSpouseFamilies() as $family) {
$facts = array_merge($facts, $family->getFacts());
// Add birth of children from this family to the facts array
foreach ($family->getChildren() as $child) {
$facts[] = $child->getFirstFact('BIRT');
}
}
$facts = array_values(array_filter($facts, function ($item) {
// remove null facts (child without birth event) and
// facts without places
return !is_null($item) && !$item->getPlace()->isEmpty();
}));
Functions::sortFacts($facts);
// At this point we have an array of valid sorted facts
// so now build the data structures needed for the map display
$events = array();
$unique_places = array();
foreach ($facts as $fact) {
$place_data = $this->getPlaceData($fact);
if (!empty($place_data)) {
$index = $place_data['index'];
if ($place_data['mapdata']['pl_zoom']) {
$GM_MAX_ZOOM = min($GM_MAX_ZOOM, $place_data['mapdata']['pl_zoom']);
}
// Produce the html for the sidebar
$parent = $fact->getParent();
if ($parent instanceof Individual && $parent->getXref() !== $indi->getXref()) {
// Childs birth
$name = '<a href="' . $parent->getHtmlUrl() . '">' . $parent->getFullName() . '</a>';
$label = strtr($parent->getSex(), array('F' => I18N::translate('Birth of a daughter'), 'M' => I18N::translate('Birth of a son'), 'U' => I18N::translate('Birth of a child')));
$class = 'person_box' . strtr($parent->getSex(), array('F' => 'F', 'M' => '', 'U' => 'NN'));
$evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>';
} else {
$spouse = $parent instanceof Family ? $parent->getSpouse($indi) : null;
$name = $spouse ? '<a href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a>' : '';
$label = $fact->getLabel();
$class = 'optionbox';
if ($fact->getValue() && $spouse) {
$evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getValue() . '</div><strong>' . $name . '</strong>' . $fact->getDate()->display(true) . '</div>';
} elseif ($spouse) {
$evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>';
} elseif ($fact->getValue()) {
$evtStr = '<div class="gm-event">' . $label . '<div> ' . $fact->getValue() . '</div>' . $fact->getDate()->display(true) . '</div>';
} else {
$evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getDate()->display(true) . '</div></div>';
}
}
if (empty($unique_places[$index])) {
$unique_places[$index] = $place_data['mapdata'];
}
$unique_places[$index]['events'] .= $evtStr;
$events[] = array('class' => $class, 'fact_label' => $label, 'date' => $fact->getDate()->display(true), 'info' => $fact->getValue(), 'name' => $name, 'place' => '<a href="' . $fact->getPlace()->getURL() . '">' . $fact->getPlace()->getFullName() . '</a>', 'placeid' => $index);
}
}
if (!empty($events)) {
$places = array_keys($unique_places);
ob_start();
// Create the normal googlemap sidebar of events and children
echo '<div class="gm-events"><table class="facts_table">';
foreach ($events as $event) {
$index = array_search($event['placeid'], $places);
echo '<tr>';
echo '<td class="facts_label">';
echo '<a href="#" onclick="return openInfowindow(\'', $index, '\')">', $event['fact_label'], '</a></td>';
echo '<td class="', $event['class'], '">';
if ($event['info']) {
echo '<div><span class="field">', Filter::escapeHtml($event['info']), '</span></div>';
}
if ($event['name']) {
echo '<div>', $event['name'], '</div>';
}
echo '<div>', $event['place'], '</div>';
if ($event['date']) {
echo '<div>', $event['date'], '</div>';
}
echo '</td>';
echo '</tr>';
}
echo '</table></div>';
// *** ENABLE STREETVIEW ***
$STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW');
?>
<script>
var map_center = new google.maps.LatLng(0, 0);
var gmarkers = [];
var gicons = [];
var map = null;
var head = '';
var dir = '';
var svzoom = '';
//.........这里部分代码省略.........