diff options
| author | Łukasz Wilenski <wooc@gazeta.pl> | 2010-12-14 20:16:43 +0000 |
|---|---|---|
| committer | Łukasz Wilenski <wooc@gazeta.pl> | 2010-12-14 20:16:43 +0000 |
| commit | 6c0388f9052d53b3420b9ff1f79a1a604d11dac6 (patch) | |
| tree | 2fa58a173a13670e4ca64795b79fd964a872c2d4 | |
| parent | d56a64a7f4421cf114ac18859e37461f5c90c2b3 (diff) | |
| download | webtrees-6c0388f9052d53b3420b9ff1f79a1a604d11dac6.tar.gz webtrees-6c0388f9052d53b3420b9ff1f79a1a604d11dac6.tar.bz2 webtrees-6c0388f9052d53b3420b9ff1f79a1a604d11dac6.zip | |
number of children can be in NCHI tag, when no recored we should check this tag
| -rw-r--r-- | includes/classes/class_family.php | 10 | ||||
| -rw-r--r-- | modules/family_nav/module.php | 20 |
2 files changed, 18 insertions, 12 deletions
diff --git a/includes/classes/class_family.php b/includes/classes/class_family.php index 3768a7fba9..fda3c07a52 100644 --- a/includes/classes/class_family.php +++ b/includes/classes/class_family.php @@ -203,12 +203,10 @@ class Family extends GedcomRecord { */ function getNumberOfChildren() { - if ($this->numChildren!==false) return $this->numChildren; - - $this->numChildren = get_gedcom_value('NCHI', 1, $this->gedrec); - if ($this->numChildren!='') return $this->numChildren.'.'; - $this->numChildren = preg_match_all('/1\s*CHIL\s*@(.*)@/', $this->gedrec, $smatch); - return $this->numChildren; + $nchi1=(int)get_gedcom_value('NCHI', 1, $this->gedrec); + $nchi2=(int)get_gedcom_value('NCHI', 2, $this->gedrec); + $nchi3=preg_match_all('/1\s*CHIL\s*@(.*)@/', $this->gedrec, $smatch); + return $this->numChildren=max($nchi1, $nchi2, $nchi3); } /** diff --git a/modules/family_nav/module.php b/modules/family_nav/module.php index bcb3590274..f6279a3821 100644 --- a/modules/family_nav/module.php +++ b/modules/family_nav/module.php @@ -739,11 +739,11 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { } // Children ------------------------------ @var $child Person - $hasChildren = 'No'; + $hasChildren = false; foreach ($children as $c=>$child) { if ($child) { - if ($hasChildren == 'No') { - $hasChildren = 'Yes'; + if (!$hasChildren) { + $hasChildren = true; $spouselinks .= "<ul class=\"clist ".$TEXT_DIRECTION."\">"; } $persons="Yes"; @@ -754,10 +754,18 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { $spouselinks .= "</a>"; } } - if ($hasChildren == 'Yes') { + if ($hasChildren) { $spouselinks .= "</ul>"; - } else { - $spouselinks .= "<img src=\"images/small/childless.gif\" alt=\"".i18n::translate('This family remained childless')."\" height=\"15\" align=\"middle\"/> ".i18n::translate('This family remained childless')."<br />"; + } + if (!$hasChildren) { + $numchil = $family->getNumberOfChildren(); + if ($numchil==0) { + $spouselinks .= "<img src=\"images/small/childless.gif\" alt=\"".i18n::translate('This family remained childless')."\" height=\"15\" align=\"middle\"/> ".i18n::translate('This family remained childless')."<br />"; + } else if ($numchil==1) { + $spouselinks .= i18n::translate('1 child'); + } else { + $spouselinks .= $numchil.' '.i18n::translate('children'); + } } } } |
