本文整理匯總了PHP中Fisharebest\Webtrees\Tree::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tree::getName方法的具體用法?PHP Tree::getName怎麽用?PHP Tree::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Fisharebest\Webtrees\Tree
的用法示例。
在下文中一共展示了Tree::getName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: gedcomHeader
/**
* Create a header for a (newly-created or already-imported) gedcom file.
*
* @param Tree $tree
*
* @return string
*/
public static function gedcomHeader(Tree $tree)
{
// Default values for a new header
$HEAD = "0 HEAD";
$SOUR = "\n1 SOUR " . WT_WEBTREES . "\n2 NAME " . WT_WEBTREES . "\n2 VERS " . WT_VERSION;
$DEST = "\n1 DEST DISKETTE";
$DATE = "\n1 DATE " . strtoupper(date("d M Y")) . "\n2 TIME " . date("H:i:s");
$GEDC = "\n1 GEDC\n2 VERS 5.5.1\n2 FORM Lineage-Linked";
$CHAR = "\n1 CHAR UTF-8";
$FILE = "\n1 FILE " . $tree->getName();
$LANG = "";
$PLAC = "\n1 PLAC\n2 FORM City, County, State/Province, Country";
$COPR = "";
$SUBN = "";
$SUBM = "\n1 SUBM @SUBM@\n0 @SUBM@ SUBM\n1 NAME " . Auth::user()->getUserName();
// The SUBM record is mandatory
// Preserve some values from the original header
$record = GedcomRecord::getInstance('HEAD', $tree);
if ($fact = $record->getFirstFact('PLAC')) {
$PLAC = "\n1 PLAC\n2 FORM " . $fact->getAttribute('FORM');
}
if ($fact = $record->getFirstFact('LANG')) {
$LANG = $fact->getValue();
}
if ($fact = $record->getFirstFact('SUBN')) {
$SUBN = $fact->getValue();
}
if ($fact = $record->getFirstFact('COPR')) {
$COPR = $fact->getValue();
}
// Link to actual SUBM/SUBN records, if they exist
$subn = Database::prepare("SELECT o_id FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBN', $tree->getTreeId()))->fetchOne();
if ($subn) {
$SUBN = "\n1 SUBN @{$subn}@";
}
$subm = Database::prepare("SELECT o_id FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBM', $tree->getTreeId()))->fetchOne();
if ($subm) {
$SUBM = "\n1 SUBM @{$subm}@";
}
return $HEAD . $SOUR . $DEST . $DATE . $GEDC . $CHAR . $FILE . $COPR . $LANG . $PLAC . $SUBN . $SUBM . "\n";
}