本文整理汇总了PHP中Fisharebest\Webtrees\GedcomTag::getLabelValue方法的典型用法代码示例。如果您正苦于以下问题:PHP GedcomTag::getLabelValue方法的具体用法?PHP GedcomTag::getLabelValue怎么用?PHP GedcomTag::getLabelValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\GedcomTag
的用法示例。
在下文中一共展示了GedcomTag::getLabelValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printNoteRecord
/**
* print a note record
*
* @param string $text
* @param int $nlevel the level of the note record
* @param string $nrec the note record to print
* @param bool $textOnly Don't print the "Note: " introduction
*
* @return string
*/
public static function printNoteRecord($text, $nlevel, $nrec, $textOnly = false)
{
global $WT_TREE;
$text .= Functions::getCont($nlevel, $nrec);
// Check if shared note (we have already checked that it exists)
if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ NOTE/', $nrec, $match)) {
$note = Note::getInstance($match[1], $WT_TREE);
$label = 'SHARED_NOTE';
// If Census assistant installed, allow it to format the note
if (Module::getModuleByName('GEDFact_assistant')) {
$html = CensusAssistantModule::formatCensusNote($note);
} else {
$html = Filter::formatText($note->getNote(), $WT_TREE);
}
} else {
$note = null;
$label = 'NOTE';
$html = Filter::formatText($text, $WT_TREE);
}
if ($textOnly) {
return strip_tags($text);
}
if (strpos($text, "\n") === false) {
// A one-line note? strip the block-level tags, so it displays inline
return GedcomTag::getLabelValue($label, strip_tags($html, '<a><strong><em>'));
} elseif ($WT_TREE->getPreference('EXPAND_NOTES')) {
// A multi-line note, and we're expanding notes by default
return GedcomTag::getLabelValue($label, $html);
} else {
// A multi-line note, with an expand/collapse option
$element_id = Uuid::uuid4();
// NOTE: class "note-details" is (currently) used only by some third-party themes
if ($note) {
$first_line = '<a href="' . $note->getHtmlUrl() . '">' . $note->getFullName() . '</a>';
} else {
list($text) = explode("\n", strip_tags($html));
$first_line = strlen($text) > 100 ? mb_substr($text, 0, 100) . I18N::translate('…') : $text;
}
return '<div class="fact_NOTE"><span class="label">' . '<a href="#" onclick="expand_layer(\'' . $element_id . '\'); return false;"><i id="' . $element_id . '_img" class="icon-plus"></i></a> ' . GedcomTag::getLabel($label) . ':</span> ' . '<span id="' . $element_id . '-alt">' . $first_line . '</span>' . '</div>' . '<div class="note-details" id="' . $element_id . '" style="display:none">' . $html . '</div>';
}
}
示例2: foreach
if ($type === 'media') {
$medialist = QueryMedia::mediaList('', 'include', 'title', $filter, '');
echo '<div id="find-output">';
if ($medialist) {
foreach ($medialist as $media) {
echo '<div class="find-media-media">';
echo '<div class="find-media-thumb">', $media->displayImage(), '</div>';
echo '<div class="find-media-details">', $media->getFullName(), '</div>';
if (!$embed) {
echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\');">', $media->getFilename(), '</a></p>';
} else {
echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\', \'', '\', \'', Filter::escapeJs($media->getFilename()), '\');">', Filter::escapeHtml($media->getFilename()), '</a></p> ';
}
if ($media->fileExists()) {
$imgsize = $media->getImageAttributes();
echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
}
echo '<ul>';
$found = false;
foreach ($media->linkedIndividuals('OBJE') as $indindividual) {
echo '<li>', $indindividual->getFullName(), '</li>';
$found = true;
}
foreach ($media->linkedFamilies('OBJE') as $family) {
echo '<li>', $family->getFullName(), '</li>';
$found = true;
}
foreach ($media->linkedSources('OBJE') as $source) {
echo '<li>', $source->getFullName(), '</li>';
$found = true;
}
示例3: keep_chan
/**
* Show an option to preserve the existing CHAN record when editing.
*
* @param GedcomRecord $record
*
* @return string
*/
function keep_chan(GedcomRecord $record = null)
{
global $WT_TREE;
if (Auth::isAdmin()) {
if ($record) {
$details = GedcomTag::getLabelValue('DATE', $record->lastChangeTimestamp()) . GedcomTag::getLabelValue('_WT_USER', Filter::escapeHtml($record->lastChangeUser()));
} else {
$details = '';
}
return '<tr><td class="descriptionbox wrap width25">' . GedcomTag::getLabel('CHAN') . '</td><td class="optionbox wrap">' . '<input type="checkbox" name="keep_chan" value="1" ' . ($WT_TREE->getPreference('NO_UPDATE_CHAN') ? 'checked' : '') . '>' . I18N::translate('Keep the existing “last change” information') . $details . '</td></tr>';
} else {
return '';
}
}
示例4: printMainMedia
/**
* Print a row for the media tab on the individual page.
*
* @param Fact $fact
* @param int $level
*/
public static function printMainMedia(Fact $fact, $level)
{
$factrec = $fact->getGedcom();
$parent = $fact->getParent();
if ($fact->isPendingAddition()) {
$styleadd = 'new';
$can_edit = $level == 1 && $fact->canEdit();
} elseif ($fact->isPendingDeletion()) {
$styleadd = 'old';
$can_edit = false;
} else {
$styleadd = '';
$can_edit = $level == 1 && $fact->canEdit();
}
// -- find source for each fact
preg_match_all('/(?:^|\\n)' . $level . ' OBJE @(.*)@/', $factrec, $matches);
foreach ($matches[1] as $xref) {
$media = Media::getInstance($xref, $fact->getParent()->getTree());
// Allow access to "1 OBJE @non_existent_source@", so it can be corrected/deleted
if (!$media || $media->canShow()) {
if ($level > 1) {
echo '<tr class="row_obje2">';
} else {
echo '<tr>';
}
echo '<td class="descriptionbox';
if ($level > 1) {
echo ' rela';
}
echo ' ', $styleadd, ' width20">';
preg_match("/^\\d (\\w*)/", $factrec, $factname);
$factlines = explode("\n", $factrec);
// 1 BIRT Y\n2 SOUR ...
$factwords = explode(" ", $factlines[0]);
// 1 BIRT Y
$factname = $factwords[1];
// BIRT
if ($factname == 'EVEN' || $factname == 'FACT') {
// Add ' EVEN' to provide sensible output for an event with an empty TYPE record
$ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch);
if ($ct > 0) {
$factname = $ematch[1];
echo $factname;
} else {
echo GedcomTag::getLabel($factname, $parent);
}
} elseif ($can_edit) {
echo '<a onclick="window.open(\'addmedia.php?action=editmedia&pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', I18N::translate('Edit'), '">';
echo GedcomTag::getLabel($factname, $parent), '</a>';
echo '<div class="editfacts">';
echo '<div class="editlink"><a class="editicon" onclick="window.open(\'addmedia.php?action=editmedia&pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', I18N::translate('Edit'), '"><span class="link_text">', I18N::translate('Edit'), '</span></a></div>';
echo '<div class="copylink"><a class="copyicon" href="#" onclick="jQuery.post(\'action.php\',{action:\'copy-fact\', type:\'\', factgedcom:\'' . rawurlencode($factrec) . '\'},function(){location.reload();})" title="' . I18N::translate('Copy') . '"><span class="link_text">' . I18N::translate('Copy') . '</span></a></div>';
echo '<div class="deletelink"><a class="deleteicon" onclick="return delete_fact(\'', I18N::translate('Are you sure you want to delete this fact?'), '\', \'', $parent->getXref(), '\', \'', $fact->getFactId(), '\');" href="#" title="', I18N::translate('Delete'), '"><span class="link_text">', I18N::translate('Delete'), '</span></a></div>';
echo '</div>';
} else {
echo GedcomTag::getLabel($factname, $parent);
}
echo '</td>';
echo '<td class="optionbox ', $styleadd, ' wrap">';
if ($media) {
echo '<span class="field">';
echo $media->displayImage();
echo '<a href="' . $media->getHtmlUrl() . '">';
echo '<em>';
foreach ($media->getAllNames() as $name) {
if ($name['type'] != 'TITL') {
echo '<br>';
}
echo $name['full'];
}
echo '</em>';
echo '</a>';
echo '</span>';
echo GedcomTag::getLabelValue('FORM', $media->mimeType());
$imgsize = $media->getImageAttributes('main');
if (!empty($imgsize['WxH'])) {
echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
}
if ($media->getFilesizeraw() > 0) {
echo GedcomTag::getLabelValue('__FILE_SIZE__', $media->getFilesize());
}
$mediatype = $media->getMediaType();
if ($mediatype) {
echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($mediatype));
}
switch ($media->isPrimary()) {
case 'Y':
echo GedcomTag::getLabelValue('_PRIM', I18N::translate('yes'));
break;
case 'N':
echo GedcomTag::getLabelValue('_PRIM', I18N::translate('no'));
break;
}
echo FunctionsPrint::printFactNotes($media->getGedcom(), 1);
//.........这里部分代码省略.........
示例5: elseif
if ($controller->record->canShow()) {
// Highlight image or silhouette
echo '<div id="indi_mainimage">', $controller->record->displayImage(), '</div>';
echo '<div id="header_accordion1">';
// contain accordions for names
echo '<h3 class="name_one ', $controller->getPersonStyle($controller->record), '"><span>', $controller->record->getFullName(), '</span>';
// First name accordion header
$bdate = $controller->record->getBirthDate();
$ddate = $controller->record->getDeathDate();
echo '<span class="header_age">';
if ($bdate->isOK() && !$controller->record->isDead()) {
// If living display age
echo GedcomTag::getLabelValue('AGE', FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($bdate), true), $controller->record, 'span');
} elseif ($bdate->isOK() && $ddate->isOK()) {
// If dead, show age at death
echo GedcomTag::getLabelValue('AGE', FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($bdate, $ddate), false), $controller->record, 'span');
}
echo '</span>';
// Display summary birth/death info.
echo '<span id="dates">', $controller->record->getLifeSpan(), '</span>';
// Display gender icon
foreach ($controller->record->getFacts() as $fact) {
if ($fact->getTag() == 'SEX') {
$controller->printSexRecord($fact);
}
}
echo '</h3>';
// close first name accordion header
// Display name details
foreach ($controller->record->getFacts() as $fact) {
if ($fact->getTag() == 'NAME') {
示例6: printFamily
//.........这里部分代码省略.........
<tr>
<td class="facts_label"></td>
<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php
echo $family->getXref();
?>
', 'WIFE');"><?php
echo I18N::translate('Add a wife to this family');
?>
</a></td>
</tr>
<?php
}
///// MARR /////
$found = false;
$prev = new Date('');
foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) {
$found |= !$fact->isPendingDeletion();
if ($fact->isPendingAddition()) {
$class = ' new';
} elseif ($fact->isPendingDeletion()) {
$class = ' old';
} else {
$class = '';
}
?>
<tr>
<td class="facts_label">
</td>
<td class="facts_value<?php
echo $class;
?>
">
<?php
echo GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName());
?>
</td>
</tr>
<?php
if (!$prev->isOK() && $fact->getDate()->isOK()) {
$prev = $fact->getDate();
}
}
if (!$found && $family->canShow() && $family->canEdit()) {
// Add a new marriage
?>
<tr>
<td class="facts_label">
</td>
<td class="facts_value">
<a href="#" onclick="return add_new_record('<?php
echo $family->getXref();
?>
', 'MARR');">
<?php
echo I18N::translate('Add marriage details');
?>
</a>
</td>
</tr>
<?php
}
///// CHIL /////
$child_number = 0;
foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
$person = $fact->getTarget();
if ($person instanceof Individual) {
示例7: array
} else {
$SELECT1 = " 1 ASC";
}
if ($length > 0) {
$SELECT1 .= " LIMIT :length OFFSET :start";
$ARGS1['length'] = $length;
$ARGS1['start'] = $start;
}
$rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll();
// Total filtered/unfiltered rows
$recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne();
$recordsTotal = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne();
$data = array();
foreach ($rows as $row) {
$media = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom);
$data[] = array(GedcomTag::getLabelValue('URL', $row->m_filename), $media->displayImage(), mediaObjectInfo($media));
}
break;
case 'unused':
// Which trees use this media folder?
$media_trees = Database::prepare("SELECT gedcom_name, gedcom_name" . " FROM `##gedcom`" . " JOIN `##gedcom_setting` USING (gedcom_id)" . " WHERE setting_name='MEDIA_DIRECTORY' AND setting_value = :media_folder AND gedcom_id > 0")->execute(array('media_folder' => $media_folder))->fetchAssoc();
$disk_files = all_disk_files($media_folder, $media_path, $subfolders, $search);
$db_files = all_media_files($media_folder, $media_path, $subfolders, $search);
// All unused files
$unused_files = array_diff($disk_files, $db_files);
$recordsTotal = count($unused_files);
// Filter unused files
if ($search) {
$unused_files = array_filter($unused_files, function ($x) use($search) {
return strpos($x, $search) !== false;
});