diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-07-06 07:11:38 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-07-06 07:11:38 +0000 |
| commit | ebf14414f15f7a3a8a7bfbda002214f2ceca42fc (patch) | |
| tree | 3f09647bcdd6366e40baa7832ebb0c41f239a03a | |
| parent | 4f5050e795fcd1e3ca96281d6bf894b261e5f399 (diff) | |
| download | webtrees-ebf14414f15f7a3a8a7bfbda002214f2ceca42fc.tar.gz webtrees-ebf14414f15f7a3a8a7bfbda002214f2ceca42fc.tar.bz2 webtrees-ebf14414f15f7a3a8a7bfbda002214f2ceca42fc.zip | |
Show pending families on families tab, family navigator, charts, etc.
| -rw-r--r-- | library/WT/Individual.php | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/library/WT/Individual.php b/library/WT/Individual.php index ddb1f0c79e..1a318638fa 100644 --- a/library/WT/Individual.php +++ b/library/WT/Individual.php @@ -742,30 +742,14 @@ class WT_Individual extends WT_GedcomRecord { function getSpouseFamilies($access_level=WT_USER_ACCESS_LEVEL) { global $SHOW_PRIVATE_RELATIONSHIPS; - if ($access_level==WT_PRIV_HIDE) { - // special case, (temporary - cannot make this generic as other code depends on the private cached values) - $families=array(); - preg_match_all('/\n1 FAMS @('.WT_REGEX_XREF.')@/', $this->gedcom, $match); - foreach ($match[1] as $pid) { - $family=WT_Family::getInstance($pid); - if ($family) { - $families[]=$family; - } - } - return $families; - } - - if ($this->_spouseFamilies===null) { - $this->_spouseFamilies=array(); - preg_match_all('/\n1 FAMS @('.WT_REGEX_XREF.')@/', $this->gedcom, $match); - foreach ($match[1] as $pid) { - $family=WT_Family::getInstance($pid); - if ($family && ($SHOW_PRIVATE_RELATIONSHIPS || $family->canShow($access_level))) { - $this->_spouseFamilies[]=$family; - } + $families = array(); + foreach ($this->getFacts('FAMS', $access_level) as $fact) { + $family = $fact->getTarget(); + if ($family && ($SHOW_PRIVATE_RELATIONSHIPS || $family->canShow($access_level))) { + $families[] = $family; } } - return $this->_spouseFamilies; + return $families; } /** @@ -803,30 +787,14 @@ class WT_Individual extends WT_GedcomRecord { function getChildFamilies($access_level=WT_USER_ACCESS_LEVEL) { global $SHOW_PRIVATE_RELATIONSHIPS; - if ($access_level==WT_PRIV_HIDE) { - // special case, (temporary - cannot make this generic as other code depends on the private cached values) - $families=array(); - preg_match_all('/\n1 FAMC @('.WT_REGEX_XREF.')@/', $this->gedcom, $match); - foreach ($match[1] as $pid) { - $family=WT_Family::getInstance($pid); - if ($family) { - $families[]=$family; - } - } - return $families; - } - - if ($this->_childFamilies===null) { - $this->_childFamilies=array(); - preg_match_all('/\n1 FAMC @('.WT_REGEX_XREF.')@/', $this->gedcom, $match); - foreach ($match[1] as $pid) { - $family=WT_Family::getInstance($pid); - if ($family && ($SHOW_PRIVATE_RELATIONSHIPS || $family->canShow($access_level))) { - $this->_childFamilies[]=$family; - } + $families = array(); + foreach ($this->getFacts('FAMC', $access_level) as $fact) { + $family = $fact->getTarget(); + if ($family && ($SHOW_PRIVATE_RELATIONSHIPS || $family->canShow($access_level))) { + $families[] = $family; } } - return $this->_childFamilies; + return $families; } /** |
