當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GedcomRecord::canShowName方法代碼示例

本文整理匯總了PHP中Fisharebest\Webtrees\GedcomRecord::canShowName方法的典型用法代碼示例。如果您正苦於以下問題:PHP GedcomRecord::canShowName方法的具體用法?PHP GedcomRecord::canShowName怎麽用?PHP GedcomRecord::canShowName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fisharebest\Webtrees\GedcomRecord的用法示例。


在下文中一共展示了GedcomRecord::canShowName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: compare

 /**
  * Static helper function to sort an array of objects by name
  * Records whose names cannot be displayed are sorted at the end.
  *
  * @param GedcomRecord $x
  * @param GedcomRecord $y
  *
  * @return int
  */
 public static function compare(GedcomRecord $x, GedcomRecord $y)
 {
     if ($x->canShowName()) {
         if ($y->canShowName()) {
             return I18N::strcasecmp($x->getSortName(), $y->getSortName());
         } else {
             return -1;
             // only $y is private
         }
     } else {
         if ($y->canShowName()) {
             return 1;
             // only $x is private
         } else {
             return 0;
             // both $x and $y private
         }
     }
 }
開發者ID:AlexSnet,項目名稱:webtrees,代碼行數:28,代碼來源:GedcomRecord.php

示例3: addClipping

 /**
  * Inserts a clipping into the clipping cart
  *
  * @param GedcomRecord $record
  */
 public function addClipping(GedcomRecord $record)
 {
     if ($record->canShowName()) {
         $this->cart[$record->getTree()->getTreeId()][$record->getXref()] = true;
         // Add directly linked records
         preg_match_all('/\\n\\d (?:OBJE|NOTE|SOUR|REPO) @(' . WT_REGEX_XREF . ')@/', $record->getGedcom(), $matches);
         foreach ($matches[1] as $match) {
             $this->cart[$record->getTree()->getTreeId()][$match] = true;
         }
     }
 }
開發者ID:tunandras,項目名稱:webtrees,代碼行數:16,代碼來源:ClippingsCartController.php


注:本文中的Fisharebest\Webtrees\GedcomRecord::canShowName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。