本文整理汇总了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";
}