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


PHP Tree::FindById方法代碼示例

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


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

示例1: updateRecord

 /**
  * update a record in the database
  *
  * @param string $gedrec
  * @param int $ged_id
  * @param bool $delete
  */
 public static function updateRecord($gedrec, $ged_id, $delete)
 {
     if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedrec, $match)) {
         list(, $gid, $type) = $match;
     } else {
         echo "ERROR: Invalid gedcom record.";
         return;
     }
     // TODO deleting unlinked places can be done more efficiently in a single query
     $placeids = Database::prepare("SELECT pl_p_id FROM `##placelinks` WHERE pl_gid=? AND pl_file=?")->execute(array($gid, $ged_id))->fetchOneColumn();
     Database::prepare("DELETE FROM `##placelinks` WHERE pl_gid=? AND pl_file=?")->execute(array($gid, $ged_id));
     Database::prepare("DELETE FROM `##dates`      WHERE d_gid =? AND d_file =?")->execute(array($gid, $ged_id));
     //-- delete any unlinked places
     foreach ($placeids as $p_id) {
         $num = Database::prepare("SELECT count(pl_p_id) FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")->execute(array($p_id, $ged_id))->fetchOne();
         if ($num == 0) {
             Database::prepare("DELETE FROM `##places` WHERE p_id=? AND p_file=?")->execute(array($p_id, $ged_id));
         }
     }
     Database::prepare("DELETE FROM `##name` WHERE n_id=? AND n_file=?")->execute(array($gid, $ged_id));
     Database::prepare("DELETE FROM `##link` WHERE l_from=? AND l_file=?")->execute(array($gid, $ged_id));
     switch ($type) {
         case 'INDI':
             Database::prepare("DELETE FROM `##individuals` WHERE i_id=? AND i_file=?")->execute(array($gid, $ged_id));
             break;
         case 'FAM':
             Database::prepare("DELETE FROM `##families` WHERE f_id=? AND f_file=?")->execute(array($gid, $ged_id));
             break;
         case 'SOUR':
             Database::prepare("DELETE FROM `##sources` WHERE s_id=? AND s_file=?")->execute(array($gid, $ged_id));
             break;
         case 'OBJE':
             Database::prepare("DELETE FROM `##media` WHERE m_id=? AND m_file=?")->execute(array($gid, $ged_id));
             break;
         default:
             Database::prepare("DELETE FROM `##other` WHERE o_id=? AND o_file=?")->execute(array($gid, $ged_id));
             break;
     }
     if (!$delete) {
         self::importRecord($gedrec, Tree::FindById($ged_id), true);
     }
 }
開發者ID:AlexSnet,項目名稱:webtrees,代碼行數:49,代碼來源:FunctionsImport.php


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