本文整理汇总了PHP中Fisharebest\Webtrees\Individual::setPrimaryName方法的典型用法代码示例。如果您正苦于以下问题:PHP Individual::setPrimaryName方法的具体用法?PHP Individual::setPrimaryName怎么用?PHP Individual::setPrimaryName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Individual
的用法示例。
在下文中一共展示了Individual::setPrimaryName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printNameRecord
/**
* print information for a name record
*
* @param Fact $event the event object
*/
public function printNameRecord(Fact $event)
{
$factrec = $event->getGedcom();
// Create a dummy record, so we can extract the formatted NAME value from the event.
$dummy = new Individual('xref', "0 @xref@ INDI\n1 DEAT Y\n" . $factrec, null, $event->getParent()->getTree());
$all_names = $dummy->getAllNames();
$primary_name = $all_names[0];
$this->name_count++;
if ($this->name_count > 1) {
echo '<h3 class="name_two">', $dummy->getFullName(), '</h3>';
}
//Other names accordion element
echo '<div class="indi_name_details';
if ($event->isPendingDeletion()) {
echo ' old';
}
if ($event->isPendingAddition()) {
echo ' new';
}
echo '">';
echo '<div class="name1">';
echo '<dl><dt class="label">', I18N::translate('Name'), '</dt>';
$dummy->setPrimaryName(0);
echo '<dd class="field">', $dummy->getFullName();
if ($this->name_count == 1) {
if (Auth::isAdmin()) {
$user = User::findByGenealogyRecord($this->record);
if ($user) {
echo '<span> - <a class="warning" href="admin_users.php?filter=' . Filter::escapeHtml($user->getUserName()) . '">' . Filter::escapeHtml($user->getUserName()) . '</a></span>';
}
}
}
if ($this->record->canEdit() && !$event->isPendingDeletion()) {
echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('" . I18N::translate('Are you sure you want to delete this fact?') . "', '" . $this->record->getXref() . "', '" . $event->getFactId() . "');\" title=\"" . I18N::translate('Delete this name') . "\"><span class=\"link_text\">" . I18N::translate('Delete this name') . "</span></a></div>";
echo "<div class=\"editlink\"><a href=\"#\" class=\"editicon\" onclick=\"edit_name('" . $this->record->getXref() . "', '" . $event->getFactId() . "'); return false;\" title=\"" . I18N::translate('Edit name') . "\"><span class=\"link_text\">" . I18N::translate('Edit name') . "</span></a></div>";
}
echo '</dd>';
echo '</dl>';
echo '</div>';
$ct = preg_match_all('/\\n2 (\\w+) (.*)/', $factrec, $nmatch, PREG_SET_ORDER);
for ($i = 0; $i < $ct; $i++) {
echo '<div>';
$fact = $nmatch[$i][1];
if ($fact != 'SOUR' && $fact != 'NOTE' && $fact != 'SPFX') {
echo '<dl><dt class="label">', GedcomTag::getLabel($fact, $this->record), '</dt>';
echo '<dd class="field">';
// Before using dir="auto" on this field, note that Gecko treats this as an inline element but WebKit treats it as a block element
if (isset($nmatch[$i][2])) {
$name = Filter::escapeHtml($nmatch[$i][2]);
$name = str_replace('/', '', $name);
$name = preg_replace('/(\\S*)\\*/', '<span class="starredname">\\1</span>', $name);
switch ($fact) {
case 'TYPE':
echo GedcomCodeName::getValue($name, $this->record);
break;
case 'SURN':
// The SURN field is not necessarily the surname.
// Where it is not a substring of the real surname, show it after the real surname.
$surname = Filter::escapeHtml($primary_name['surname']);
if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
echo '<span dir="auto">' . $surname . '</span>';
} else {
echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>');
}
break;
default:
echo '<span dir="auto">' . $name . '</span>';
break;
}
}
echo '</dd>';
echo '</dl>';
}
echo '</div>';
}
if (preg_match("/\n2 SOUR/", $factrec)) {
echo '<div id="indi_sour" class="clearfloat">', FunctionsPrintFacts::printFactSources($factrec, 2), '</div>';
}
if (preg_match("/\n2 NOTE/", $factrec)) {
echo '<div id="indi_note" class="clearfloat">', FunctionsPrint::printFactNotes($factrec, 2), '</div>';
}
echo '</div>';
}