当前位置: 首页>>代码示例>>PHP>>正文


PHP GedcomRecord::getFacts方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\GedcomRecord::getFacts方法的典型用法代码示例。如果您正苦于以下问题:PHP GedcomRecord::getFacts方法的具体用法?PHP GedcomRecord::getFacts怎么用?PHP GedcomRecord::getFacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\GedcomRecord的用法示例。


在下文中一共展示了GedcomRecord::getFacts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:49,代码来源:GedcomRecordController.php

示例2: foreach

     $prev_gedcom_id = $change->gedcom_id;
     $output .= '<tr><td class="list_value">';
     $output .= '<b><a href="#" onclick="return show_diff(\'' . $record->getHtmlUrl() . '\');"> ' . $record->getFullName() . '</a></b>';
     $output .= '<div class="indent">';
     $output .= '<table class="list_table"><tr>';
     $output .= '<td class="list_label">' . I18N::translate('Accept') . '</td>';
     $output .= '<td class="list_label">' . I18N::translate('Changes') . '</td>';
     $output .= '<td class="list_label">' . I18N::translate('User') . '</td>';
     $output .= '<td class="list_label">' . I18N::translate('Date') . '</td>';
     $output .= '<td class="list_label">' . I18N::translate('Family tree') . '</td>';
     $output .= '<td class="list_label">' . I18N::translate('Undo') . '</td>';
     $output .= '</tr>';
 }
 $output .= '<td class="list_value"><a href="edit_changes.php?action=accept&amp;change_id=' . $change->change_id . '">' . I18N::translate('Accept') . '</a></td>';
 $output .= '<td class="list_value">';
 foreach ($record->getFacts() as $fact) {
     if ($fact->getTag() != 'CHAN') {
         if ($fact->isPendingAddition()) {
             $output .= '<div class="new" title="' . strip_tags($fact->summary()) . '">' . $fact->getLabel() . '</div>';
         } elseif ($fact->isPendingDeletion()) {
             $output .= '<div class="old" title="' . strip_tags($fact->summary()) . '">' . $fact->getLabel() . '</div>';
         }
     }
 }
 echo '</td>';
 $output .= "<td class=\"list_value\"><a href=\"#\" onclick=\"return reply('" . $change->user_name . "', '" . I18N::translate('Moderate pending changes') . "')\" alt=\"" . I18N::translate('Send a message') . "\">";
 $output .= Filter::escapeHtml($change->real_name);
 $output .= ' - ' . Filter::escapeHtml($change->user_name) . '</a></td>';
 $output .= '<td class="list_value">' . $change->change_time . '</td>';
 $output .= '<td class="list_value">' . $change->gedcom_name . '</td>';
 $output .= '<td class="list_value"><a href="edit_changes.php?action=undo&amp;change_id=' . $change->change_id . '">' . I18N::translate('Undo') . '</a></td>';
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:edit_changes.php


注:本文中的Fisharebest\Webtrees\GedcomRecord::getFacts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。