本文整理汇总了PHP中Fisharebest\Webtrees\Functions\FunctionsPrint::formatFactPlace方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionsPrint::formatFactPlace方法的具体用法?PHP FunctionsPrint::formatFactPlace怎么用?PHP FunctionsPrint::formatFactPlace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Functions\FunctionsPrint
的用法示例。
在下文中一共展示了FunctionsPrint::formatFactPlace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printFact
//.........这里部分代码省略.........
// Do not display "Yes".
break;
default:
if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
$target = GedcomRecord::getInstance($match[1], $fact->getParent()->getTree());
if ($target) {
echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>';
} else {
echo '<div class="error">', Filter::escapeHtml($fact->getValue()), '</div>';
}
} else {
echo '<div class="field"><span dir="auto">', Filter::escapeHtml($fact->getValue()), '</span></div>';
}
break;
}
break;
}
// Print the type of this fact/event
if ($type) {
$utype = strtoupper($type);
// Events of close relatives, e.g. _MARR_CHIL
if (substr($fact->getTag(), 0, 6) == '_MARR_' && ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS')) {
// Translate MARR/TYPE using the code that supports MARR_CIVIL, etc. tags
$type = GedcomTag::getLabel('MARR_' . $utype);
} else {
// Allow (custom) translations for other types
$type = I18N::translate($type);
}
echo GedcomTag::getLabelValue('TYPE', Filter::escapeHtml($type));
}
// Print the date of this fact/event
echo FunctionsPrint::formatFactDate($fact, $record, true, true);
// Print the place of this fact/event
echo '<div class="place">', FunctionsPrint::formatFactPlace($fact, true, true, true), '</div>';
// A blank line between the primary attributes (value, date, place) and the secondary ones
echo '<br>';
$addr = $fact->getAttribute('ADDR');
if ($addr) {
echo GedcomTag::getLabelValue('ADDR', $addr);
}
// Print the associates of this fact/event
if ($fact->getFactId() !== 'asso') {
echo self::formatAssociateRelationship($fact);
}
// Print any other "2 XXXX" attributes, in the order in which they appear.
preg_match_all('/\\n2 (' . WT_REGEX_TAG . ') (.+)/', $fact->getGedcom(), $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
switch ($match[1]) {
case 'DATE':
case 'TIME':
case 'AGE':
case 'PLAC':
case 'ADDR':
case 'ALIA':
case 'ASSO':
case '_ASSO':
case 'DESC':
case 'RELA':
case 'STAT':
case 'TEMP':
case 'TYPE':
case 'FAMS':
case 'CONT':
// These were already shown at the beginning
break;
case 'NOTE':
示例2: eventQuery
/**
* Events
*
* @param string $type
* @param string $direction
* @param string $facts
*
* @return string
*/
private function eventQuery($type, $direction, $facts)
{
$eventTypes = array('BIRT' => I18N::translate('birth'), 'DEAT' => I18N::translate('death'), 'MARR' => I18N::translate('marriage'), 'ADOP' => I18N::translate('adoption'), 'BURI' => I18N::translate('burial'), 'CENS' => I18N::translate('census added'));
$fact_query = "IN ('" . str_replace('|', "','", $facts) . "')";
if ($direction != 'ASC') {
$direction = 'DESC';
}
$rows = $this->runSql('' . ' SELECT SQL_CACHE' . ' d_gid AS id,' . ' d_year AS year,' . ' d_fact AS fact,' . ' d_type AS type' . ' FROM' . " `##dates`" . ' WHERE' . " d_file={$this->tree->getTreeId()} AND" . " d_gid<>'HEAD' AND" . " d_fact {$fact_query} AND" . ' d_julianday1<>0' . ' ORDER BY' . " d_julianday1 {$direction}, d_type LIMIT 1");
if (!isset($rows[0])) {
return '';
}
$row = $rows[0];
$record = GedcomRecord::getInstance($row['id'], $this->tree);
switch ($type) {
default:
case 'full':
if ($record->canShow()) {
$result = $record->formatList('span', false, $record->getFullName());
} else {
$result = I18N::translate('This information is private and cannot be shown.');
}
break;
case 'year':
$date = new Date($row['type'] . ' ' . $row['year']);
$result = $date->display();
break;
case 'type':
if (isset($eventTypes[$row['fact']])) {
$result = $eventTypes[$row['fact']];
} else {
$result = GedcomTag::getLabel($row['fact']);
}
break;
case 'name':
$result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
break;
case 'place':
$fact = $record->getFirstFact($row['fact']);
if ($fact) {
$result = FunctionsPrint::formatFactPlace($fact, true, true, true);
} else {
$result = I18N::translate('Private');
}
break;
}
return $result;
}
示例3: formatFirstMajorFact
/**
* Extract/format the first fact from a list of facts.
*
* @param string $facts
* @param int $style
*
* @return string
*/
public function formatFirstMajorFact($facts, $style)
{
foreach ($this->getFacts($facts, true) as $event) {
// Only display if it has a date or place (or both)
if ($event->getDate()->isOK() || !$event->getPlace()->isEmpty()) {
switch ($style) {
case 1:
return '<br><em>' . $event->getLabel() . ' ' . FunctionsPrint::formatFactDate($event, $this, false, false) . ' ' . FunctionsPrint::formatFactPlace($event) . '</em>';
case 2:
return '<dl><dt class="label">' . $event->getLabel() . '</dt><dd class="field">' . FunctionsPrint::formatFactDate($event, $this, false, false) . ' ' . FunctionsPrint::formatFactPlace($event) . '</dd></dl>';
}
}
}
return '';
}