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


PHP GedcomRecord::getAllNames方法代碼示例

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


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

示例1: updateNames

 /**
  * Extract all the names from the given record and insert them into the database.
  *
  * @param string       $xref
  * @param int          $ged_id
  * @param GedcomRecord $record
  */
 public static function updateNames($xref, $ged_id, GedcomRecord $record)
 {
     foreach ($record->getAllNames() as $n => $name) {
         if ($record instanceof Individual) {
             if ($name['givn'] === '@P.N.') {
                 $soundex_givn_std = null;
                 $soundex_givn_dm = null;
             } else {
                 $soundex_givn_std = Soundex::russell($name['givn']);
                 $soundex_givn_dm = Soundex::daitchMokotoff($name['givn']);
             }
             if ($name['surn'] === '@N.N.') {
                 $soundex_surn_std = null;
                 $soundex_surn_dm = null;
             } else {
                 $soundex_surn_std = Soundex::russell($name['surname']);
                 $soundex_surn_dm = Soundex::daitchMokotoff($name['surname']);
             }
             Database::prepare("INSERT INTO `##name` (n_file,n_id,n_num,n_type,n_sort,n_full,n_surname,n_surn,n_givn,n_soundex_givn_std,n_soundex_surn_std,n_soundex_givn_dm,n_soundex_surn_dm) VALUES (?, ?, ?, ?, LEFT(?, 255), LEFT(?, 255), LEFT(?, 255), LEFT(?, 255), ?, ?, ?, ?, ?)")->execute(array($ged_id, $xref, $n, $name['type'], $name['sort'], $name['fullNN'], $name['surname'], $name['surn'], $name['givn'], $soundex_givn_std, $soundex_surn_std, $soundex_givn_dm, $soundex_surn_dm));
         } else {
             Database::prepare("INSERT INTO `##name` (n_file,n_id,n_num,n_type,n_sort,n_full) VALUES (?, ?, ?, ?, LEFT(?, 255), LEFT(?, 255))")->execute(array($ged_id, $xref, $n, $name['type'], $name['sort'], $name['fullNN']));
         }
     }
 }
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:31,代碼來源:FunctionsImport.php


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