summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-01-03 18:10:20 +0000
committerfisharebest <fisharebest@gmail.com>2011-01-03 18:10:20 +0000
commitb1507ce27f8dcfc555cf2e124caccfb183252767 (patch)
tree019147f6a59811dfae3c3724dc899186d125e2fa
parent1adcd67f2867ac0dc3ca88aeda1695d096876e4a (diff)
downloadwebtrees-b1507ce27f8dcfc555cf2e124caccfb183252767.tar.gz
webtrees-b1507ce27f8dcfc555cf2e124caccfb183252767.tar.bz2
webtrees-b1507ce27f8dcfc555cf2e124caccfb183252767.zip
Minor tidy up. Use Objects instead of XREFs and raw gedcom
-rw-r--r--branches.php2
-rw-r--r--edit_interface.php12
-rw-r--r--includes/functions/functions.php69
-rw-r--r--includes/functions/functions_print.php37
-rw-r--r--library/WT/Controller/Descendancy.php9
-rw-r--r--library/WT/Controller/Hourglass.php148
-rw-r--r--library/WT/Controller/Lifespan.php4
-rw-r--r--library/WT/Person.php41
-rw-r--r--library/WT/Report/Base.php6
-rw-r--r--library/WT/TreeNav.php9
-rw-r--r--modules/GEDFact_assistant/_CENS/census_3_find.php22
-rw-r--r--modules/GEDFact_assistant/_CENS/census_3_search_add.php70
-rw-r--r--modules/GEDFact_assistant/_MEDIA/media_3_search_add.php34
-rw-r--r--modules/descendancy/module.php3
-rw-r--r--modules/family_nav/module.php97
-rw-r--r--modules/googlemap/module.php2
-rw-r--r--modules/lightbox/module.php2
-rw-r--r--modules/media/module.php2
-rw-r--r--modules/notes/module.php2
-rw-r--r--modules/relatives/module.php7
-rw-r--r--modules/sources_tab/module.php2
-rw-r--r--pedigree.php8
22 files changed, 274 insertions, 314 deletions
diff --git a/branches.php b/branches.php
index 704d92a4cb..7d3412724f 100644
--- a/branches.php
+++ b/branches.php
@@ -158,7 +158,7 @@ function print_fams($person, $famid=null) {
if (count($person->getSpouseFamilies())<1) {
echo $current;
}
- foreach ($person->getSpouseFamilies() as $f=>$family) {
+ foreach ($person->getSpouseFamilies() as $family) {
$txt = $current;
$spouse = $family->getSpouse($person);
if ($spouse) {
diff --git a/edit_interface.php b/edit_interface.php
index 07579ba22e..4677514bc9 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -2319,15 +2319,15 @@ case 'reorder_fams':
$person = WT_Person::getInstance($pid);
$fams = $person->getSpouseFamilies();
if ((!empty($option))&&($option=="bymarriage")) {
- uasort($fams, array('Family', 'CompareMarrDate'));
+ usort($fams, array('WT_Family', 'CompareMarrDate'));
}
$i=0;
- foreach ($fams as $famid=>$family) {
- echo "<li class=\"facts_value\" style=\"cursor:move;margin-bottom:2px;\" id=\"li_$famid\" >";
- echo "<span class=\"name2\">", PrintReady($family->getFullName()), "</span><br />";
+ foreach ($fams as $family) {
+ echo '<li class="facts_value" style="cursor:move;margin-bottom:2px;" id="li_', $family->getXref(), '" >';
+ echo '<span class="name2">', $family->getFullName(), '</span><br />';
echo $family->format_first_major_fact(WT_EVENTS_MARR, 2);
- echo "<input type=\"hidden\" name=\"order[$famid]\" value=\"$i\"/>";
- echo "</li>";
+ echo '<input type="hidden" name="order[', $family->getXref(), ']" value="', $i, '"/>';
+ echo '</li>';
$i++;
}
?>
diff --git a/includes/functions/functions.php b/includes/functions/functions.php
index 09b83b0905..eab7e7ded4 100644
--- a/includes/functions/functions.php
+++ b/includes/functions/functions.php
@@ -3088,43 +3088,38 @@ function add_descendancy(&$list, $pid, $parents=false, $generations=-1) {
if (!isset($list[$pid]->generation)) {
$list[$pid]->generation = 0;
}
- $famids = $person->getSpouseFamilies();
- if (count($famids)>0) {
- foreach ($famids as $famid => $family) {
- if ($family) {
- if ($parents) {
- $husband = $family->getHusband();
- $wife = $family->getWife();
- if ($husband) {
- $list[$husband->getXref()] = $husband;
- if (isset($list[$pid]->generation))
- $list[$husband->getXref()]->generation = $list[$pid]->generation-1;
- else
- $list[$husband->getXref()]->generation = 1;
- }
- if ($wife) {
- $list[$wife->getXref()] = $wife;
- if (isset($list[$pid]->generation))
- $list[$wife->getXref()]->generation = $list[$pid]->generation-1;
- else
- $list[$wife->getXref()]->generation = 1;
- }
- }
- $children = $family->getChildren();
- foreach ($children as $child) {
- if ($child) {
- $list[$child->getXref()] = $child;
- if (isset($list[$pid]->generation))
- $list[$child->getXref()]->generation = $list[$pid]->generation+1;
- else
- $list[$child->getXref()]->generation = 2;
- }
- }
- if ($generations == -1 || $list[$pid]->generation+1 < $generations) {
- foreach ($children as $child) {
- add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family
- }
- }
+ foreach ($person->getSpouseFamilies() as $family) {
+ if ($parents) {
+ $husband = $family->getHusband();
+ $wife = $family->getWife();
+ if ($husband) {
+ $list[$husband->getXref()] = $husband;
+ if (isset($list[$pid]->generation))
+ $list[$husband->getXref()]->generation = $list[$pid]->generation-1;
+ else
+ $list[$husband->getXref()]->generation = 1;
+ }
+ if ($wife) {
+ $list[$wife->getXref()] = $wife;
+ if (isset($list[$pid]->generation))
+ $list[$wife->getXref()]->generation = $list[$pid]->generation-1;
+ else
+ $list[$wife->getXref()]->generation = 1;
+ }
+ }
+ $children = $family->getChildren();
+ foreach ($children as $child) {
+ if ($child) {
+ $list[$child->getXref()] = $child;
+ if (isset($list[$pid]->generation))
+ $list[$child->getXref()]->generation = $list[$pid]->generation+1;
+ else
+ $list[$child->getXref()]->generation = 2;
+ }
+ }
+ if ($generations == -1 || $list[$pid]->generation+1 < $generations) {
+ foreach ($children as $child) {
+ add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family
}
}
}
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index 8611adf08f..5321748383 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -134,31 +134,26 @@ function print_pedigree_person($pid, $style=1, $count=0, $personcount="1") {
$personlinks .= "<a href=\"treenav.php?rootid={$pid}&amp;ged=".rawurlencode($GEDCOM)."\" ".$mouseAction1."><b>".WT_I18N::translate('Interactive tree')."</b></a><br />";
}
- $fams = $person->getSpouseFamilies();
- /* @var $family Family */
- foreach ($fams as $famid=>$family) {
- if (!is_null($family)) {
- $spouse = $family->getSpouse($person);
+ foreach ($person->getSpouseFamilies() as $family) {
+ $spouse = $family->getSpouse($person);
- $children = $family->getChildren();
- $num = count($children);
- if ((!empty($spouse))||($num>0)) {
- $personlinks .= "<a href=\"".$family->getHtmlUrl()."&amp;show_full=1\" ".$mouseAction1."><b>".WT_I18N::translate('Family with spouse')."</b></a><br />";
- if (!empty($spouse)) {
- $personlinks .= "<a href=\"".$spouse->getHtmlUrl()."\" $mouseAction1>";
- if ($spouse->canDisplayName()) $personlinks .= PrintReady($spouse->getFullName());
- else $personlinks .= WT_I18N::translate('Private');
- $personlinks .= "</a><br />";
- }
- }
- /* @var $child Person */
- foreach ($children as $c=>$child) {
- $personlinks .= "&nbsp;&nbsp;<a href=\"".$child->getHtmlUrl()."\" $mouseAction1>";
- if ($child->canDisplayName()) $personlinks .= PrintReady($child->getFullName());
+ $children = $family->getChildren();
+ $num = count($children);
+ if ((!empty($spouse))||($num>0)) {
+ $personlinks .= "<a href=\"".$family->getHtmlUrl()."&amp;show_full=1\" ".$mouseAction1."><b>".WT_I18N::translate('Family with spouse')."</b></a><br />";
+ if (!empty($spouse)) {
+ $personlinks .= "<a href=\"".$spouse->getHtmlUrl()."\" $mouseAction1>";
+ if ($spouse->canDisplayName()) $personlinks .= PrintReady($spouse->getFullName());
else $personlinks .= WT_I18N::translate('Private');
- $personlinks .= "<br /></a>";
+ $personlinks .= "</a><br />";
}
}
+ foreach ($children as $child) {
+ $personlinks .= "&nbsp;&nbsp;<a href=\"".$child->getHtmlUrl()."\" $mouseAction1>";
+ if ($child->canDisplayName()) $personlinks .= PrintReady($child->getFullName());
+ else $personlinks .= WT_I18N::translate('Private');
+ $personlinks .= "<br /></a>";
+ }
}
$personlinks .= "</td></tr></table>";
}
diff --git a/library/WT/Controller/Descendancy.php b/library/WT/Controller/Descendancy.php
index 5afc2ff8d2..f83b331789 100644
--- a/library/WT/Controller/Descendancy.php
+++ b/library/WT/Controller/Descendancy.php
@@ -113,14 +113,12 @@ class WT_Controller_Descendancy extends WT_Controller_Base {
global $personcount;
if (is_null($person)) return;
- $families = $person->getSpouseFamilies();
if ($depth<2) return;
- foreach ($families as $famid => $family) {
+ foreach ($person->getSpouseFamilies() as $family) {
print_sosa_family($family->getXref(), "", -1, $label, $person->getXref(), $gpid, $personcount);
$personcount++;
- $children = $family->getChildren();
$i=1;
- foreach ($children as $child) {
+ foreach ($family->getChildren() as $child) {
$this->print_child_family($child, $depth-1, $label.($i++).".", $person->getXref());
}
}
@@ -182,8 +180,7 @@ function print_child_descendancy(&$person, $depth) {
echo "</li>";
// loop for each spouse
- $sfam = $person->getSpouseFamilies();
- foreach ($sfam as $famid => $family) {
+ foreach ($person->getSpouseFamilies() as $family) {
$personcount++;
$this->print_family_descendancy($person, $family, $depth);
}
diff --git a/library/WT/Controller/Hourglass.php b/library/WT/Controller/Hourglass.php
index b6adea9976..cb62b8620a 100644
--- a/library/WT/Controller/Hourglass.php
+++ b/library/WT/Controller/Hourglass.php
@@ -214,7 +214,7 @@ class WT_Controller_Hourglass extends WT_Controller_Base {
$children = array();
if ($count < $this->dgenerations) {
//-- put all of the children in a common array
- foreach ($families as $famid => $family) {
+ foreach ($families as $family) {
$famNum ++;
$chs = $family->getChildren();
foreach ($chs as $c=>$child) $children[] = $child;
@@ -271,14 +271,16 @@ class WT_Controller_Hourglass extends WT_Controller_Base {
echo "<div style=\"width: ".($tbwidth)."px;\"><br /></div></td><td width=\"$bwidth\">";
}
$kcount = 0;
- foreach ($families as $famid=>$family) $kcount+=$family->getNumberOfChildren();
+ foreach ($families as $family) {
+ $kcount+=$family->getNumberOfChildren();
+ }
if ($kcount==0) {
echo "<div style=\"width: ".($this->arrwidth)."px;\"><br /></div></td><td width=\"$bwidth\">";
} else {
echo "<div style=\"width: ".($this->arrwidth)."px;\"><a href=\"$pid\" onclick=\"return ChangeDis('td_".$pid."','".$pid."','".$this->show_full."','".$this->show_spouse."','".$this->box_width."')\"><img src=\"".$WT_IMAGES["larrow"]."\" border=\"0\" alt=\"\" /></a></div>";
//-- move the arrow up to line up with the correct box
if ($this->show_spouse) {
- foreach ($families as $famid => $family) {
+ foreach ($families as $family) {
/* @var $family Family */
if (!is_null($family)) {
$spouse = $family->getSpouse($person);
@@ -298,7 +300,7 @@ class WT_Controller_Hourglass extends WT_Controller_Base {
//----- Print the spouse
if ($this->show_spouse) {
- foreach ($families as $famid => $family) {
+ foreach ($families as $family) {
/* @var $family Family */
if (!is_null($family)) {
$spouse = $family->getSpouse($person);
@@ -331,10 +333,8 @@ class WT_Controller_Hourglass extends WT_Controller_Base {
//-- make sure there is more than 1 child in the family with parents
$cfamids = $person->getChildFamilies();
$num=0;
- foreach ($cfamids as $famid=>$family) {
- if (!is_null($family)) {
- $num += $family->getNumberOfChildren();
- }
+ foreach ($cfamids as $family) {
+ $num += $family->getNumberOfChildren();
}
// NOTE: If statement OK
if ($num>0) {
@@ -346,88 +346,82 @@ class WT_Controller_Hourglass extends WT_Controller_Base {
echo "<div id=\"childbox\" dir=\"".$TEXT_DIRECTION."\" style=\"width:".$bwidth."px; height:".$bheight."px; visibility: hidden;\">";
echo "<table class=\"person_box\"><tr><td>";
- foreach ($famids as $famid=>$family) {
- if (!is_null($family)) {
- $spouse = $family->getSpouse($person);
- if (!empty($spouse)) {
- $spid = $spouse->getXref();
- echo "<a href=\"hourglass.php?pid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
- $name = $spouse->getFullName();
+ foreach ($famids as $family) {
+ $spouse = $family->getSpouse($person);
+ if (!empty($spouse)) {
+ $spid = $spouse->getXref();
+ echo "<a href=\"hourglass.php?pid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
+ $name = $spouse->getFullName();
+ if (hasRTLText($name))
+ echo "class=\"name2\">";
+ else echo "class=\"name1\">";
+ echo PrintReady($name);
+ echo "<br /></span></a>";
+
+ }
+
+ $children = $family->getChildren();
+ foreach ($children as $id=>$child) {
+ $cid = $child->getXref();
+ echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$cid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
+ $name = $child->getFullName();
+ if (hasRTLText($name))
+ echo "class=\"name2\">&lt; ";
+ else echo "class=\"name1\">&lt; ";
+ echo PrintReady($name);
+
+ echo "<br /></span></a>";
+
+ }
+ }
+ //-- do we need to print this arrow?
+ echo "<img src=\"".$WT_IMAGES["rarrow"]."\" border=\"0\" alt=\"\" /> ";
+
+ //-- print the siblings
+ foreach ($cfamids as $family) {
+ if (!is_null($family->getHusband()) || !is_null($family->getWife())) {
+ echo "<span class=\"name1\"><br />".WT_I18N::translate('Parents')."<br /></span>";
+ $husb = $family->getHusband();
+ if (!empty($husb)) {
+ $spid = $husb->getXref();
+ echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
+ $name = $husb->getFullName();
$name = rtrim($name);
if (hasRTLText($name))
echo "class=\"name2\">";
else echo "class=\"name1\">";
echo PrintReady($name);
echo "<br /></span></a>";
-
}
-
- $children = $family->getChildren();
- foreach ($children as $id=>$child) {
- $cid = $child->getXref();
- echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$cid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
- $name = $child->getFullName();
+ $husb = $family->getWife();
+ if (!empty($husb)) {
+ $spid = $husb->getXref();
+ echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
+ $name = $husb->getFullName();
$name = rtrim($name);
if (hasRTLText($name))
- echo "class=\"name2\">&lt; ";
- else echo "class=\"name1\">&lt; ";
+ echo "class=\"name2\">";
+ else echo "class=\"name1\">";
echo PrintReady($name);
-
echo "<br /></span></a>";
-
}
}
- }
- //-- do we need to print this arrow?
- echo "<img src=\"".$WT_IMAGES["rarrow"]."\" border=\"0\" alt=\"\" /> ";
-
- //-- print the siblings
- foreach ($cfamids as $famid=>$family) {
- if (!is_null($family)) {
- if (!is_null($family->getHusband()) || !is_null($family->getWife())) {
- echo "<span class=\"name1\"><br />".WT_I18N::translate('Parents')."<br /></span>";
- $husb = $family->getHusband();
- if (!empty($husb)) {
- $spid = $husb->getXref();
- echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
- $name = $husb->getFullName();
- $name = rtrim($name);
- if (hasRTLText($name))
- echo "class=\"name2\">";
- else echo "class=\"name1\">";
- echo PrintReady($name);
- echo "<br /></span></a>";
- }
- $husb = $family->getWife();
- if (!empty($husb)) {
- $spid = $husb->getXref();
- echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
- $name = $husb->getFullName();
- $name = rtrim($name);
- if (hasRTLText($name))
- echo "class=\"name2\">";
- else echo "class=\"name1\">";
- echo PrintReady($name);
- echo "<br /></span></a>";
- }
- }
- $children = $family->getChildren();
- $num = $family->getNumberOfChildren();
- if ($num>2) echo "<span class=\"name1\"><br />".WT_I18N::translate('Siblings')."<br /></span>";
- if ($num==2) echo "<span class=\"name1\"><br />".WT_I18N::translate('Sibling')."<br /></span>";
- foreach ($children as $id=>$child) {
- $cid = $child->getXref();
- if ($cid!=$pid) {
- echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$cid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
- $name = $child->getFullName();
- $name = rtrim($name);
- if (hasRTLText($name))
- echo "class=\"name2\"> ";
- else echo "class=\"name1\"> ";
- echo PrintReady($name);
- echo "<br /></span></a>";
+ $children = $family->getChildren();
+ $num = $family->getNumberOfChildren();
+ if ($num>2) echo "<span class=\"name1\"><br />".WT_I18N::translate('Siblings')."<br /></span>";
+ if ($num==2) echo "<span class=\"name1\"><br />".WT_I18N::translate('Sibling')."<br /></span>";
+ foreach ($children as $id=>$child) {
+ $cid = $child->getXref();
+ if ($cid!=$pid) {
+ echo "&nbsp;&nbsp;<a href=\"hourglass.php?pid={$cid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\"><span ";
+ $name = $child->getFullName();
+ $name = rtrim($name);
+ if (hasRTLText($name))
+ echo "class=\"name2\"> ";
+ else echo "class=\"name1\"> ";
+ echo PrintReady($name);
+ echo "<br /></span></a>";
- }
}
}
}
@@ -457,7 +451,7 @@ class WT_Controller_Hourglass extends WT_Controller_Base {
$famids = $person->getSpouseFamilies();
if ($person->getNumberOfChildren()==0) return $depth-1;
$maxdc = $depth;
- foreach ($famids as $famid => $family) {
+ foreach ($famids as $family) {
$ct = preg_match_all("/1 CHIL @(.*)@/", $family->getGedcomRecord(), $match, PREG_SET_ORDER);
for ($i=0; $i<$ct; $i++) {
$chil = trim($match[$i][1]);
diff --git a/library/WT/Controller/Lifespan.php b/library/WT/Controller/Lifespan.php
index 63aca4506b..da1afffdb2 100644
--- a/library/WT/Controller/Lifespan.php
+++ b/library/WT/Controller/Lifespan.php
@@ -225,7 +225,7 @@ class WT_Controller_Lifespan extends WT_Controller_Base {
$this->pids[] = $newpid;
$families = $person->getSpouseFamilies();
//-- foreach gets the spouse and children of the individual.
- foreach ($families as $famID => $family) {
+ foreach ($families as $family) {
if ($newpid != $family->getHusbId()) {
if ($gen>0) $this->pids[] = addFamily($family->getHusbId(), $gen-1);
else $this->pids[] = $family->getHusbId();
@@ -242,7 +242,7 @@ class WT_Controller_Lifespan extends WT_Controller_Base {
}
$families = $person->getChildFamilies();
//-- foreach gets the father, mother and sibblings of the individual.
- foreach ($families as $famID => $family) {
+ foreach ($families as $family) {
if ($gen>0) $this->pids[] = addFamily($family->getHusbId(), $gen-1);
else $this->pids[] = $family->getHusbId();
if ($gen>0) $this->pids[] = addFamily($family->getWifeId(), $gen-1);
diff --git a/library/WT/Person.php b/library/WT/Person.php
index 7716a8d45f..18dd002e22 100644
--- a/library/WT/Person.php
+++ b/library/WT/Person.php
@@ -572,7 +572,7 @@ class WT_Person extends WT_GedcomRecord {
} else {
// only include family if it is displayable by current user
if ($SHOW_LIVING_NAMES || $family->canDisplayDetails()) {
- $this->spouseFamilies[$famid] = $family;
+ $this->spouseFamilies[] = $family;
}
}
}
@@ -687,31 +687,27 @@ class WT_Person extends WT_GedcomRecord {
* @return array array of Family objects
*/
function getStepFamilies() {
- $families = array();
- $fams = $this->getChildFamilies();
- foreach ($fams as $family) {
- if (!is_null($family)) {
- $father = $family->getHusband();
- if (!is_null($father)) {
- $pfams = $father->getSpouseFamilies();
- foreach ($pfams as $key1=>$fam) {
- if (!is_null($fam) && !isset($fams[$key1]) && ($fam->getNumberOfChildren() > 0)) {
- $families[$key1] = $fam;
- }
+ $step_families=array();
+ $families=$this->getChildFamilies();
+ foreach ($families as $family) {
+ $father=$family->getHusband();
+ if ($father) {
+ foreach ($father->getSpouseFamilies() as $step_family) {
+ if (!$family->equals($step_family)) {
+ $step_families[]=$step_family;
}
}
- $mother = $family->getWife();
- if (!is_null($mother)) {
- $pfams = $mother->getSpouseFamilies();
- foreach ($pfams as $key1=>$fam) {
- if (!is_null($fam) && !isset($fams[$key1]) && ($fam->getNumberOfChildren() > 0)) {
- $families[$key1] = $fam;
- }
+ }
+ $mother=$family->getWife();
+ if ($mother) {
+ foreach ($mother->getSpouseFamilies() as $step_family) {
+ if (!$family->equals($step_family)) {
+ $step_families[]=$step_family;
}
}
}
}
- return $families;
+ return $step_families;
}
/**
* get global facts
@@ -889,7 +885,6 @@ class WT_Person extends WT_GedcomRecord {
$this->parseFacts();
//-- Get the facts from the family with spouse (FAMS)
foreach ($this->getSpouseFamilies() as $family) {
- if (is_null($family)) continue;
$updfamily = $family->getUpdatedFamily(); //-- updated family ?
$spouse = $family->getSpouse($this);
@@ -1014,8 +1009,8 @@ class WT_Person extends WT_GedcomRecord {
if (is_null($parent)) {
continue;
}
- foreach ($parent->getSpouseFamilies() as $sfamid=>$sfamily) {
- if ($sfamid==$famid) {
+ foreach ($parent->getSpouseFamilies() as $sfamily) {
+ if ($sfamily->equals($family)) {
if ($parent->getSex()=='F') {
// show current family marriage only once
continue;
diff --git a/library/WT/Report/Base.php b/library/WT/Report/Base.php
index bf91c85357..8e9bb12c66 100644
--- a/library/WT/Report/Base.php
+++ b/library/WT/Report/Base.php
@@ -3454,8 +3454,7 @@ function RelativesSHandler($attrs) {
$list[$id] = $person;
switch ($group) {
case "child-family":
- $famids = $person->getChildFamilies();
- foreach ($famids as $family) {
+ foreach ($person->getChildFamilies() as $family) {
$husband = $family->getHusband();
$wife = $family->getWife();
if (!empty($husband)) {
@@ -3471,8 +3470,7 @@ function RelativesSHandler($attrs) {
}
break;
case "spouse-family":
- $famids = $person->getSpouseFamilies();
- foreach ($famids as $family) {
+ foreach ($person->getSpouseFamilies() as $family) {
$husband = $family->getHusband();
$wife = $family->getWife();
if (!empty($husband)) {
diff --git a/library/WT/TreeNav.php b/library/WT/TreeNav.php
index 2fbb6536e4..5bef0f0f1b 100644
--- a/library/WT/TreeNav.php
+++ b/library/WT/TreeNav.php
@@ -384,8 +384,7 @@ class WT_TreeNav {
*/
function drawAllChildren(&$person, $gen=2) {
if (!empty($person) && $gen>0) {
- $fams = $person->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($person->getSpouseFamilies() as $family) {
$children = $family->getChildren();
$indichilds = array();
foreach ($children as $ci=>$child) {
@@ -504,8 +503,7 @@ class WT_TreeNav {
echo PrintReady($person->getSexImage('small', $style)." ".$name);
?><br />
<?php
- $fams = $person->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($person->getSpouseFamilies() as $family) {
$spouse = $family->getSpouse($person);
if (!is_null($spouse)) {
$name = $spouse->getFullName();
@@ -538,8 +536,7 @@ class WT_TreeNav {
</td>
</tr>
<?php
- $fams = $person->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($person->getSpouseFamilies() as $family) {
$spouse = $family->getSpouse($person);
$mother = null;
if ($spouse!=null) {
diff --git a/modules/GEDFact_assistant/_CENS/census_3_find.php b/modules/GEDFact_assistant/_CENS/census_3_find.php
index 6ce13f3f2e..d4d9e0c9de 100644
--- a/modules/GEDFact_assistant/_CENS/census_3_find.php
+++ b/modules/GEDFact_assistant/_CENS/census_3_find.php
@@ -681,25 +681,21 @@ if ($action=="filter") {
}
//-- Build Indi Parents Family to get FBP and MBP -----------
- $families = $indi->getChildFamilies();
- foreach ($families as $famid=>$family) {
- if (!is_null($family)) {
- $father = $family->getHusband();
- $mother = $family->getWife();
- if (!is_null($father)) {
- $FBP = $father->getBirthPlace();
- }
- if (!is_null($mother)) {
- $MBP = $mother->getBirthPlace();
- }
+ foreach ($indi->getChildFamilies() as $family) {
+ $father = $family->getHusband();
+ $mother = $family->getWife();
+ if (!is_null($father)) {
+ $FBP = $father->getBirthPlace();
+ }
+ if (!is_null($mother)) {
+ $MBP = $mother->getBirthPlace();
}
}
if (!isset($FBP)) { $FBP = "UNK, UNK, UNK, UNK"; }
if (!isset($MBP)) { $MBP = "UNK, UNK, UNK, UNK"; }
//-- Build Indi Spouse Family to get marriage Date ----------
- $families = $indi->getSpouseFamilies();
- foreach ($families as $famid=>$family) {
+ foreach ($indi->getSpouseFamilies() as $family) {
$marrdate = $family->getMarriageDate();
$marrdate = ($marrdate->minJD()+$marrdate->maxJD())/2; // Julian
$children = $family->getChildren();
diff --git a/modules/GEDFact_assistant/_CENS/census_3_search_add.php b/modules/GEDFact_assistant/_CENS/census_3_search_add.php
index 8e5e150993..130215d83d 100644
--- a/modules/GEDFact_assistant/_CENS/census_3_search_add.php
+++ b/modules/GEDFact_assistant/_CENS/census_3_search_add.php
@@ -122,7 +122,7 @@ if (!defined('WT_WEBTREES')) {
//-- Get Parents Children's Name, DOB, DOD --------------------------
if (isset($people["children"])) {
$chBLDarray = Array();
- foreach ($people["children"] as $key=>$child) {
+ foreach ($people["children"] as $child) {
$chnam = $child->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
@@ -399,13 +399,13 @@ if (!defined('WT_WEBTREES')) {
//-- Parent's Children's Details --------------------------------------
$elderdate = $family->getMarriageDate();
- foreach ($people["children"] as $key=>$child) {
+ foreach ($people["children"] as $child) {
// Get Child's Children's Name DOB DOD ----
$chBLDarray=Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
- foreach ($chchildren as $key=>$chchild) {
+ foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
@@ -568,7 +568,7 @@ if (!defined('WT_WEBTREES')) {
//-- Get Children's Name, DOB, DOD --------------------------
if (isset($people["children"])) {
$chBLDarray = Array();
- foreach ($people["children"] as $key=>$child) {
+ foreach ($people["children"] as $child) {
$chnam = $child->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
@@ -868,13 +868,13 @@ if (!defined('WT_WEBTREES')) {
$styleadd = "";
if (isset($people["children"])) {
$elderdate = $family->getMarriageDate();
- foreach ($people["children"] as $key=>$child) {
+ foreach ($people["children"] as $child) {
// Get Child's Children
$chBLDarray=Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
- foreach ($chchildren as $key=>$chchild) {
+ foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
@@ -1001,7 +1001,7 @@ if (!defined('WT_WEBTREES')) {
//-- Build Spouse Family ---------------------------------------------------
$families = $this->indi->getSpouseFamilies();
//$personcount = 0;
- foreach ($families as $famid=>$family) {
+ foreach ($families as $family) {
$people = $this->buildFamilyList($family, "spouse");
if ($this->indi->equals($people["husb"])) {
$spousetag = 'WIFE';
@@ -1013,7 +1013,7 @@ if (!defined('WT_WEBTREES')) {
//-- Get Children's Name, DOB, DOD --------------------------
if (isset($people["children"])) {
$chBLDarray = Array();
- foreach ($people["children"] as $key=>$child) {
+ foreach ($people["children"] as $child) {
$chnam = $child->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
@@ -1032,7 +1032,7 @@ if (!defined('WT_WEBTREES')) {
//-- Spouse Husbands Parents --------------------------------------
$gparent=WT_Person::getInstance($people["husb"]->getXref());
$fams = $gparent->getChildFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
if (!is_null($family)) {
$phusb = $family->getHusband($gparent);
$pwife = $family->getWife($gparent);
@@ -1167,7 +1167,7 @@ if (!defined('WT_WEBTREES')) {
//-- Spouse Wifes Parents --------------------------------------
$gparent=WT_Person::getInstance($people["wife"]->getXref());
$fams = $gparent->getChildFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
if (!is_null($family)) {
$husb = $family->getHusband($gparent);
$wife = $family->getWife($gparent);
@@ -1308,7 +1308,7 @@ if (!defined('WT_WEBTREES')) {
}
// Spouse Children
- foreach ($people["children"] as $key=>$child) {
+ foreach ($people["children"] as $child) {
// Get Spouse child's marriage status
$married="";
@@ -1322,7 +1322,7 @@ if (!defined('WT_WEBTREES')) {
$chBLDarray=Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
- foreach ($chchildren as $key=>$chchild) {
+ foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
@@ -1530,7 +1530,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Parent families --------------------------------------
$fams = $person->getChildFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
$marrdate = $family->getMarriageDate();
$married = WT_Date::Compare($censdate, $marrdate);
@@ -1544,7 +1544,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Get Parent Children's Name, DOB, DOD --------------------------
if (isset($children)) {
$chBLDarray = Array();
- foreach ($children as $key=>$child) {
+ foreach ($children as $child) {
$chnam = $child->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
@@ -1560,15 +1560,15 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Parent Husband ------------------------------
if ($husb || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($husb) {
//-- Parent Husbands Parents ----------------------
$gparent=WT_Person::getInstance($husb->getXref());
$parfams = $gparent->getChildFamilies();
- foreach ($parfams as $famid=>$pfamily) {
+ foreach ($parfams as $pfamily) {
if (!is_null($pfamily)) {
$phusb = $pfamily->getHusband($gparent);
$pwife = $pfamily->getWife($gparent);
@@ -1652,15 +1652,15 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Parent Wife ------------------------------
if ($wife || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($wife) {
//-- Parent Wifes Parents ----------------------
$gparent=WT_Person::getInstance($wife->getXref());
$parfams = $gparent->getChildFamilies();
- foreach ($parfams as $famid=>$pfamily) {
+ foreach ($parfams as $pfamily) {
if (!is_null($pfamily)) {
$pwhusb = $pfamily->getHusband($gparent);
$pwwife = $pfamily->getWife($gparent);
@@ -1758,7 +1758,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Step families -----------------------------------------
$fams = $person->getStepFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
$marrdate = $family->getMarriageDate();
$married = WT_Date::Compare($censdate, $marrdate);
if (!is_null($family)) {
@@ -1771,7 +1771,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Get StepParent's Children's Name, DOB, DOD --------------------------
if (isset($children)) {
$chBLDarray = Array();
- foreach ($children as $key=>$child) {
+ foreach ($children as $child) {
$chnam = $child->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
@@ -1789,15 +1789,15 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
} else {
if (($husb || $num>0) && $husb->getLabel() != ".") {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($husb) {
//-- Step Husbands Parents -----------------------------
$gparent=WT_Person::getInstance($husb->getXref());
$parfams = $gparent->getChildFamilies();
- foreach ($parfams as $famid=>$pfamily) {
+ foreach ($parfams as $pfamily) {
if (!is_null($pfamily)) {
$phusb = $pfamily->getHusband($gparent);
$pwife = $pfamily->getWife($gparent);
@@ -1884,15 +1884,15 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
} else {
if ($wife || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($wife) {
//-- Step Wifes Parents ---------------------------
$gparent=WT_Person::getInstance($wife->getXref());
$parfams = $gparent->getChildFamilies();
- foreach ($parfams as $famid=>$pfamily) {
+ foreach ($parfams as $pfamily) {
if (!is_null($pfamily)) {
$pwhusb = $pfamily->getHusband($gparent);
$pwwife = $pfamily->getWife($gparent);
@@ -1991,7 +1991,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
// Spouse Families ------------------------------------------
$fams = $person->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
if (!is_null($family)) {
$spouse = $family->getSpouse($person);
$children = $family->getChildren();
@@ -2003,7 +2003,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Get Spouse's Children's Name, DOB, DOD --------------------------
if (isset($children)) {
$chBLDarray = Array();
- foreach ($children as $key=>$child) {
+ foreach ($children as $child) {
$chnam = $child->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
@@ -2019,16 +2019,16 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Spouse -----------------------------------------
if ($spouse || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($spouse) {
//-- Spouse Parents -----------------------------
$gparent=WT_Person::getInstance($spouse->getXref());
$spousefams = $gparent->getChildFamilies();
- foreach ($spousefams as $famid=>$pfamily) {
+ foreach ($spousefams as $pfamily) {
if (!is_null($pfamily)) {
$phusb = $pfamily->getHusband($gparent);
$pwife = $pfamily->getWife($gparent);
@@ -2137,7 +2137,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
$gparent=WT_Person::getInstance($child->getXref());
$fams = $gparent->getChildFamilies();
$chfams = $gparent->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
if (!is_null($family)) {
$husb = $family->getHusband($gparent);
$wife = $family->getWife($gparent);
@@ -2150,7 +2150,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
$chBLDarray=Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
- foreach ($chchildren as $key=>$chchild) {
+ foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
$chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
diff --git a/modules/GEDFact_assistant/_MEDIA/media_3_search_add.php b/modules/GEDFact_assistant/_MEDIA/media_3_search_add.php
index 19005c1f10..8c64234c58 100644
--- a/modules/GEDFact_assistant/_MEDIA/media_3_search_add.php
+++ b/modules/GEDFact_assistant/_MEDIA/media_3_search_add.php
@@ -113,7 +113,7 @@ if (!defined('WT_WEBTREES')) {
//-- Build Parent Family ---------------------------------------------------
$personcount=0;
$families = $this->indi->getChildFamilies();
- foreach ($families as $famid=>$family) {
+ foreach ($families as $family) {
$label = $this->indi->getChildFamilyLabel($family);
$people = $this->buildFamilyList($family, "parents");
$marrdate = $family->getMarriageDate();
@@ -404,7 +404,7 @@ if (!defined('WT_WEBTREES')) {
}
//-- Build step families ----------------------------------------------------------------
- foreach ($this->indi->getStepFamilies() as $famid=>$family) {
+ foreach ($this->indi->getStepFamilies() as $family) {
$label = $this->indi->getStepFamilyLabel($family);
$people = $this->buildFamilyList($family, "step");
if ($people) {
@@ -688,7 +688,7 @@ if (!defined('WT_WEBTREES')) {
//-- Build Spouse Family ---------------------------------------------------
$families = $this->indi->getSpouseFamilies();
//$personcount = 0;
- foreach ($families as $famid=>$family) {
+ foreach ($families as $family) {
$people = $this->buildFamilyList($family, "spouse");
if ($this->indi->equals($people["husb"])) {
$spousetag = 'WIFE';
@@ -1063,8 +1063,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
$person_step = "";
//-- parent families --------------------------------------
- $fams = $person->getChildFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($person->getChildFamilies() as $family) {
if (!is_null($family)) {
$husb = $family->getHusband($person);
@@ -1077,9 +1076,9 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
// Husband ------------------------------
if ($husb || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($husb) {
$person_parent="Yes";
@@ -1132,9 +1131,9 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
// Wife ------------------------------
if ($wife || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($wife) {
$person_parent="Yes";
@@ -1202,7 +1201,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- step families -----------------------------------------
$fams = $person->getStepFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($fams as $family) {
if (!is_null($family)) {
$husb = $family->getHusband($person);
$wife = $family->getWife($person);
@@ -1216,9 +1215,9 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
// Husband -----------------------
if (($husb || $num>0) && $husb->getLabel() != ".") {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($husb) {
$person_step="Yes";
@@ -1255,9 +1254,9 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
// Wife ----------------------------
if ($wife || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($wife) {
$person_step="Yes";
@@ -1291,8 +1290,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
}
// Spouse Families -------------------------------------- @var $family Family
- $fams = $person->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
+ foreach ($person->getSpouseFamilies() as $family) {
if (!is_null($family)) {
$spouse = $family->getSpouse($person);
$children = $family->getChildren();
@@ -1302,9 +1300,9 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
// Spouse ------------------------------
if ($spouse || $num>0) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
}
if ($spouse) {
if ($TEXT_DIRECTION=="ltr") {
diff --git a/modules/descendancy/module.php b/modules/descendancy/module.php
index 73b022d671..a94f23e201 100644
--- a/modules/descendancy/module.php
+++ b/modules/descendancy/module.php
@@ -212,8 +212,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
$out = '<ul>';
$person = WT_Person::getInstance($pid);
if ($person->canDisplayDetails()) {
- $families = $person->getSpouseFamilies();
- foreach($families as $family) {
+ foreach($person->getSpouseFamilies() as $family) {
$spouse = $family->getSpouse($person);
if ($spouse) {
$out .= $this->getFamilyLi($family, $spouse, $generations-1);
diff --git a/modules/family_nav/module.php b/modules/family_nav/module.php
index b4ac2a7800..85e07a217e 100644
--- a/modules/family_nav/module.php
+++ b/modules/family_nav/module.php
@@ -377,7 +377,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
//-- spouse and children --------------------------------------------------
$families = $this->controller->indi->getSpouseFamilies();
- foreach ($families as $famid=>$family) {
+ foreach ($families as $family) {
echo "<tr><td><br /></td><td></td></tr>";
?>
<tr>
@@ -680,64 +680,61 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
}
// Spouse Families -------------------------------------- @var $family Family
- $fams = $person->getSpouseFamilies();
- foreach ($fams as $famid=>$family) {
- if (!is_null($family)) {
- $spouse = $family->getSpouse($person);
- $children = $family->getChildren();
- $num = count($children);
+ foreach ($person->getSpouseFamilies() as $family) {
+ $spouse = $family->getSpouse($person);
+ $children = $family->getChildren();
+ $num = count($children);
- // Spouse ------------------------------
- if ($spouse || $num>0) {
+ // Spouse ------------------------------
+ if ($spouse || $num>0) {
+ if ($TEXT_DIRECTION=="ltr") {
+ $title = WT_I18N::translate('Family book chart').": ".$family->getXref();
+ } else {
+ $title = $family->getXref()." :".WT_I18N::translate('Family book chart');
+ }
+ if ($spouse) {
if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Family book chart').": ".$famid;
+ $title = WT_I18N::translate('Individual information').": ".$spouse->getXref();
} else {
- $title = $famid." :".WT_I18N::translate('Family book chart');
+ $title = $spouse->getXref()." :".WT_I18N::translate('Individual information');
}
- if ($spouse) {
- if ($TEXT_DIRECTION=="ltr") {
- $title = WT_I18N::translate('Individual information').": ".$spouse->getXref();
- } else {
- $title = $spouse->getXref()." :".WT_I18N::translate('Individual information');
- }
- $spouselinks .= "<a id=\"spouse\" href=\"".$spouse->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$spouse->getHtmlUrl()."');\">";
- $spouselinks .= "&nbsp;".PrintReady($spouse->getFullName());
- $spouselinks .= "</a>";
- $spouselinks .= "<br />";
- if ($spouse->getFullName() != "") {
- $persons = "Yes";
- }
+ $spouselinks .= "<a id=\"spouse\" href=\"".$spouse->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$spouse->getHtmlUrl()."');\">";
+ $spouselinks .= "&nbsp;".PrintReady($spouse->getFullName());
+ $spouselinks .= "</a>";
+ $spouselinks .= "<br />";
+ if ($spouse->getFullName() != "") {
+ $persons = "Yes";
}
}
+ }
- // Children ------------------------------ @var $child Person
- $hasChildren = false;
- foreach ($children as $c=>$child) {
- if ($child) {
- if (!$hasChildren) {
- $hasChildren = true;
- $spouselinks .= "<ul class=\"clist ".$TEXT_DIRECTION."\">";
- }
- $persons="Yes";
- $title = WT_I18N::translate('Individual information').": ".$child->getXref();
- $spouselinks .= "<li id=\"flyout3\">";
- $spouselinks .= "<a href=\"".$child->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$child->getHtmlUrl()."');\">";
- $spouselinks .= PrintReady($child->getFullName());
- $spouselinks .= "</a>";
+ // Children ------------------------------ @var $child Person
+ $hasChildren = false;
+ foreach ($children as $c=>$child) {
+ if ($child) {
+ if (!$hasChildren) {
+ $hasChildren = true;
+ $spouselinks .= "<ul class=\"clist ".$TEXT_DIRECTION."\">";
}
+ $persons="Yes";
+ $title = WT_I18N::translate('Individual information').": ".$child->getXref();
+ $spouselinks .= "<li id=\"flyout3\">";
+ $spouselinks .= "<a href=\"".$child->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$child->getHtmlUrl()."');\">";
+ $spouselinks .= PrintReady($child->getFullName());
+ $spouselinks .= "</a>";
}
- if ($hasChildren) {
- $spouselinks .= "</ul>";
- }
- if (!$hasChildren) {
- $numchil = $family->getNumberOfChildren();
- if ($numchil==0) {
- $spouselinks .= "<img src=\"images/small/childless.gif\" alt=\"".WT_I18N::translate('This family remained childless')."\" height=\"15\" align=\"middle\"/> ".WT_I18N::translate('This family remained childless')."<br />";
- } else if ($numchil==1) {
- $spouselinks .= WT_I18N::translate('1 child');
- } else {
- $spouselinks .= $numchil.'&nbsp;'.WT_I18N::translate('children');
- }
+ }
+ if ($hasChildren) {
+ $spouselinks .= "</ul>";
+ }
+ if (!$hasChildren) {
+ $numchil = $family->getNumberOfChildren();
+ if ($numchil==0) {
+ $spouselinks .= "<img src=\"images/small/childless.gif\" alt=\"".WT_I18N::translate('This family remained childless')."\" height=\"15\" align=\"middle\"/> ".WT_I18N::translate('This family remained childless')."<br />";
+ } else if ($numchil==1) {
+ $spouselinks .= WT_I18N::translate('1 child');
+ } else {
+ $spouselinks .= $numchil.'&nbsp;'.WT_I18N::translate('children');
}
}
}
diff --git a/modules/googlemap/module.php b/modules/googlemap/module.php
index c1c260e804..ba5ad1d84e 100644
--- a/modules/googlemap/module.php
+++ b/modules/googlemap/module.php
@@ -159,7 +159,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo "<div id=\"map_content\">";
$famids = array();
$families = $this->controller->indi->getSpouseFamilies();
- foreach ($families as $famid=>$family) {
+ foreach ($families as $family) {
$famids[] = $family->getXref();
}
$this->controller->indi->add_family_facts(false);
diff --git a/modules/lightbox/module.php b/modules/lightbox/module.php
index 48ccaa2865..9e1d793fe7 100644
--- a/modules/lightbox/module.php
+++ b/modules/lightbox/module.php
@@ -116,7 +116,7 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Config, WT_Modul
private function get_media_count() {
if ($this->mediaCount===null) {
$ct = preg_match("/\d OBJE/", $this->controller->indi->getGedcomRecord());
- foreach ($this->controller->indi->getSpouseFamilies() as $k=>$sfam)
+ foreach ($this->controller->indi->getSpouseFamilies() as $sfam)
$ct += preg_match("/\d OBJE/", $sfam->getGedcomRecord());
$this->mediaCount = $ct;
}
diff --git a/modules/media/module.php b/modules/media/module.php
index cf7fcfc758..745263b36e 100644
--- a/modules/media/module.php
+++ b/modules/media/module.php
@@ -103,7 +103,7 @@ class media_WT_Module extends WT_Module implements WT_Module_Tab {
function get_media_count() {
if ($this->mediaCount===null) {
$ct = preg_match("/\d OBJE/", $this->controller->indi->getGedcomRecord());
- foreach ($this->controller->indi->getSpouseFamilies() as $k=>$sfam)
+ foreach ($this->controller->indi->getSpouseFamilies() as $sfam)
$ct += preg_match("/\d OBJE/", $sfam->getGedcomRecord());
$this->mediaCount = $ct;
}
diff --git a/modules/notes/module.php b/modules/notes/module.php
index 7942d83ecb..7cdcd5f2ad 100644
--- a/modules/notes/module.php
+++ b/modules/notes/module.php
@@ -134,7 +134,7 @@ if (!$SHOW_LEVEL2_NOTES) {
function get_note_count() {
if ($this->noteCount===null) {
$ct = preg_match_all("/\d NOTE /", $this->controller->indi->getGedcomRecord(), $match, PREG_SET_ORDER);
- foreach ($this->controller->indi->getSpouseFamilies() as $k => $sfam)
+ foreach ($this->controller->indi->getSpouseFamilies() as $sfam)
$ct += preg_match("/\d NOTE /", $sfam->getGedcomRecord());
$this->noteCount = $ct;
}
diff --git a/modules/relatives/module.php b/modules/relatives/module.php
index e73b43369d..d2cded8a26 100644
--- a/modules/relatives/module.php
+++ b/modules/relatives/module.php
@@ -384,7 +384,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
}
}
//-- parent families
- foreach ($families as $famid=>$family) {
+ foreach ($families as $family) {
$people = $this->controller->buildFamilyList($family, "parents");
$this->printFamilyHeader($family->getHtmlUrl(), $this->controller->indi->getChildFamilyLabel($family));
?>
@@ -398,7 +398,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
}
//-- step families
- foreach ($this->controller->indi->getStepFamilies() as $famid=>$family) {
+ foreach ($this->controller->indi->getStepFamilies() as $family) {
$people = $this->controller->buildFamilyList($family, "step");
$this->printFamilyHeader($family->getHtmlUrl(), $this->controller->indi->getStepFamilyLabel($family));
?>
@@ -412,8 +412,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
}
//-- spouses and children
- $families = $this->controller->indi->getSpouseFamilies();
- foreach ($families as $famid=>$family) {
+ foreach ($this->controller->indi->getSpouseFamilies() as $family) {
$people = $this->controller->buildFamilyList($family, "spouse");
$this->printFamilyHeader($family->getHtmlUrl(), $this->controller->indi->getSpouseFamilyLabel($family));
?>
diff --git a/modules/sources_tab/module.php b/modules/sources_tab/module.php
index 3d572b46da..f1373ac8e4 100644
--- a/modules/sources_tab/module.php
+++ b/modules/sources_tab/module.php
@@ -115,7 +115,7 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab {
function get_source_count() {
if ($this->sourceCount===null) {
$ct = preg_match_all("/\d SOUR @(.*)@/", $this->controller->indi->getGedcomRecord(), $match, PREG_SET_ORDER);
- foreach ($this->controller->indi->getSpouseFamilies() as $k => $sfam)
+ foreach ($this->controller->indi->getSpouseFamilies() as $sfam)
$ct += preg_match("/\d SOUR /", $sfam->getGedcomRecord());
$this->sourceCount = $ct;
}
diff --git a/pedigree.php b/pedigree.php
index 08447d011d..ca434ca8e1 100644
--- a/pedigree.php
+++ b/pedigree.php
@@ -378,7 +378,7 @@ if ($controller->rootPerson->canDisplayDetails()) {
}
echo $xoffset, "px; top:", $yoffset, "px; width:", $controller->pbwidth, "px; height:", $controller->pbheight, "px; visibility: hidden;\">";
echo "<table class=\"person_box\"><tr><td>";
- foreach ($famids as $ind=>$family) {
+ foreach ($famids as $family) {
if ($family!=null) {
$husb = $family->getHusbId();
$wife = $family->getWifeId();
@@ -404,7 +404,7 @@ if ($controller->rootPerson->canDisplayDetails()) {
}
$children = $family->getChildren();
- foreach ($children as $ind2=>$child) {
+ foreach ($children as $child) {
echo "&nbsp;&nbsp;<a href=\"pedigree.php?PEDIGREE_GENERATIONS={$controller->PEDIGREE_GENERATIONS}&amp;rootid=".$child->getXref()."&amp;show_full={$controller->show_full}&amp;talloffset={$talloffset}\"><span ";
if ($child->canDisplayName()) {
$name = $child->getFullName();
@@ -422,7 +422,7 @@ if ($controller->rootPerson->canDisplayDetails()) {
}
}
//-- echo the siblings
- foreach ($cfamids as $ind=>$family) {
+ foreach ($cfamids as $family) {
if ($family!=null) {
$children = $family->getChildren();
if (count($children)>2) {
@@ -431,7 +431,7 @@ if ($controller->rootPerson->canDisplayDetails()) {
if (count($children)==2) {
echo '<span class="name1"><br />', WT_I18N::translate('Sibling'), '<br /></span>';
}
- foreach ($children as $ind2=>$child) {
+ foreach ($children as $child) {
if (!$controller->rootPerson->equals($child) && !is_null($child)) {
echo "&nbsp;&nbsp;<a href=\"pedigree.php?PEDIGREE_GENERATIONS={$controller->PEDIGREE_GENERATIONS}&amp;rootid=".$child->getXref()."&amp;show_full={$controller->show_full}&amp;talloffset={$talloffset}\"><span ";
if ($child->canDisplayName()) {