本文整理汇总了PHP中Family::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::getTitle方法的具体用法?PHP Family::getTitle怎么用?PHP Family::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Family
的用法示例。
在下文中一共展示了Family::getTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readPersonData
public static function readPersonData($pfx, $titleString, &$data, &$gedcomData, $includeRelativeData = false, $saveParentTitle = false, $saveSpouseTitle = false, $includeNonCompareData = false, $revid = 0, $timestamp = '')
{
$data[$pfx . 'Title'][] = $titleString;
if (GedcomUtil::isGedcomTitle($titleString)) {
$title = null;
$data[$pfx . 'Exists'] = true;
$xml = GedcomUtil::getGedcomXml($gedcomData, $titleString);
$data[$pfx . 'GedcomMatchTitle'] = (string) $xml['match'];
$contents = GedcomUtil::getGedcomContents($gedcomData, $titleString);
} else {
$title = Title::newFromText($titleString, NS_PERSON);
$data[$pfx . 'Exists'] = $title->exists();
$p = new Person($titleString);
$p->loadPage($revid);
if ($revid) {
$data[$pfx . 'Revid'][] = $revid;
}
// !!! this function can get called multiple times with the same pfx from SpecialReviewMerge
$xml = $p->getPageXml();
$contents = $p->getPageContents();
}
if (isset($xml)) {
$found = true;
// add match string
$v = (string) @$xml->name['given'];
if ($v) {
$data[$pfx . 'Given'][] = $v;
}
$v = (string) @$xml->name['surname'];
if ($v) {
$data[$pfx . 'Surname'][] = $v;
}
$v = (string) @$xml->name['title_prefix'];
if ($v) {
$data[$pfx . 'Prefix'][] = $v;
}
$v = (string) @$xml->name['title_suffix'];
if ($v) {
$data[$pfx . 'Suffix'][] = $v;
}
if (!$pfx || $pfx == 'child') {
$gender = (string) $xml->gender;
$data[$pfx . 'Gender'][] = $gender;
}
foreach ($xml->alt_name as $an) {
$v = (string) @$an['given'];
if ($v) {
$data[$pfx . 'Given'][] = $v;
}
$v = (string) @$an['surname'];
if ($v) {
$data[$pfx . 'Surname'][] = $v;
}
$v = (string) @$an['title_prefix'];
if ($v) {
$data[$pfx . 'Prefix'][] = $v;
}
$v = (string) @$an['title_suffix'];
if ($v) {
$data[$pfx . 'Suffix'][] = $v;
}
}
foreach ($xml->event_fact as $ef) {
$type = (string) $ef['type'];
if ($type == Person::$BIRTH_TAG || $type == PERSON::$ALT_BIRTH_TAG) {
CompareForm::getDatePlace($ef, $pfx . 'Birthdate', $pfx . 'Birthplace', $data);
} else {
if ($type == Person::$CHR_TAG || $type == PERSON::$ALT_CHR_TAG) {
CompareForm::getDatePlace($ef, $pfx . 'Christeningdate', $pfx . 'Christeningplace', $data);
} else {
if ($type == Person::$DEATH_TAG || $type == PERSON::$ALT_DEATH_TAG) {
CompareForm::getDatePlace($ef, $pfx . 'Deathdate', $pfx . 'Deathplace', $data);
} else {
if ($type == Person::$BUR_TAG || $type == PERSON::$ALT_BUR_TAG) {
CompareForm::getDatePlace($ef, $pfx . 'Burialdate', $pfx . 'Burialplace', $data);
} else {
if ($includeNonCompareData) {
CompareForm::getOtherEvent($ef, $pfx, $data);
}
}
}
}
}
}
if ($includeNonCompareData) {
CompareForm::getSINContents($xml, $contents, $pfx, $data);
}
if ($includeRelativeData) {
CompareForm::initPersonData('father', $data);
CompareForm::initPersonData('mother', $data);
}
foreach ($xml->child_of_family as $f) {
$familyTitle = (string) $f['title'];
if ($familyTitle && $includeRelativeData) {
$f = new Family($familyTitle);
$familyRevid = $timestamp ? StructuredData::getRevidForTimestamp($f->getTitle(), $timestamp) : 0;
$f->loadPage($familyRevid);
$famXml = $f->getPageXml();
$fatherFound = $motherFound = false;
if (isset($famXml)) {
//.........这里部分代码省略.........
示例2: getFamilyData
public function getFamilyData($titleString, $orn, $numDescLevels, $numAncLevels)
{
global $wgServer, $wgStylePath;
$family = new Family($titleString);
$xml = $family->getPageXml(true);
$obj = array();
if (isset($xml)) {
$obj['name'] = 'Family';
$obj['id'] = $family->getTitle()->getPrefixedDBkey();
// populate data
list($marriageYear, $marriageDate, $marriagePlace, $eventTypeIndex) = $this->getEventData($xml, array('Marriage'));
$thumbURL = $this->getPrimaryImage($xml, false);
$data = array();
$data['url'] = $family->getTitle()->getFullURL();
$found = false;
list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($titleString);
foreach ($xml->husband as $p) {
$person = $this->getPersonSummary($p);
if ($person['name']) {
$data['husbandname'] = $person['name'];
}
if ($person['url']) {
$data['husbandurl'] = $person['url'];
}
if ($person['yearrange']) {
$data['husbandyearrange'] = $person['yearrange'];
}
$found = true;
break;
}
if (!$found) {
$data['husbandname'] = "{$hg} {$hs}";
}
$found = false;
foreach ($xml->wife as $p) {
$person = $this->getPersonSummary($p);
if ($person['name']) {
$data['wifename'] = $person['name'];
}
if ($person['url']) {
$data['wifeurl'] = $person['url'];
}
if ($person['yearrange']) {
$data['wifeyearrange'] = $person['yearrange'];
}
$found = true;
break;
}
if (!$found) {
$data['wifename'] = "{$wg} {$ws}";
}
$children = array();
// sort by birth date -- use sort for fetching children as well
$sort = array();
$ix = 0;
$prevKey = 0;
foreach ($xml->child as $p) {
$person = $this->getPersonSummary($p);
$key = StructuredData::getDateKey($person['birthdate'], true);
if ($key) {
$prevKey = $key;
} else {
$key = $prevKey;
}
$sort[$key * 50 + $ix] = $person;
$ix++;
}
ksort($sort, SORT_NUMERIC);
$ix = 0;
foreach ($sort as $key => $person) {
if ($ix++ == 12) {
$data['morechildren'] = 'true';
break;
}
$child = array();
if ($person['name']) {
$child['name'] = $person['name'];
}
if ($person['url']) {
$child['url'] = $person['url'];
}
if ($person['yearrange']) {
$child['yearrange'] = $person['yearrange'];
}
$children[] = $child;
}
$data['children'] = $children;
if ($marriageDate) {
$data['marriagedate'] = $marriageDate;
}
if ($marriagePlace) {
$data['marriageplace'] = $marriagePlace;
}
// if ($marriagePlaceUrl) $data['marriageplaceurl'] = $marriagePlaceUrl;
$data['type'] = 'Family';
$data['$orn'] = $orn;
if ($thumbURL) {
$data['thumb'] = $this->makeImgTag($thumbURL, $titleString);
}
// $data['icon'] = $this->makeImgTag($wgServer.$wgStylePath.TreeData::FAMILY_ICON, 'Family', TreeData::FAMILY_ICON_WIDTH, TreeData::FAMILY_ICON_HEIGHT);
//.........这里部分代码省略.........