diff options
Diffstat (limited to 'library/WT/Controller')
| -rw-r--r-- | library/WT/Controller/Descendancy.php | 18 | ||||
| -rw-r--r-- | library/WT/Controller/Family.php | 2 | ||||
| -rw-r--r-- | library/WT/Controller/Familybook.php | 28 | ||||
| -rw-r--r-- | library/WT/Controller/Fanchart.php | 4 | ||||
| -rw-r--r-- | library/WT/Controller/GedcomRecord.php | 4 | ||||
| -rw-r--r-- | library/WT/Controller/Hourglass.php | 54 | ||||
| -rw-r--r-- | library/WT/Controller/Lifespan.php | 5 |
7 files changed, 45 insertions, 70 deletions
diff --git a/library/WT/Controller/Descendancy.php b/library/WT/Controller/Descendancy.php index 9ee2c3d733..d40004c0f4 100644 --- a/library/WT/Controller/Descendancy.php +++ b/library/WT/Controller/Descendancy.php @@ -196,26 +196,22 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { if (is_null($family)) return; if (is_null($person)) return; - $spouse=$family->getSpouse($person); - if (!$spouse) { - // One parent families have no spouse - $spouse=new WT_Individual(''); - } - // print marriage info echo '<li>'; echo '<img src="', $WT_IMAGES['spacer'], '" height="2" width="', ($Dindent+4), '" alt="">'; echo '<span class="details1" style="white-space:nowrap;">'; echo "<a href=\"#\" onclick=\"expand_layer('".$family->getXref().$personcount."'); return false;\" class=\"top\"><i id=\"".$family->getXref().$personcount."_img\" class=\"icon-minus\" title=\"".WT_I18N::translate('View Family')."\"></i></a>"; - $marriage = $family->getMarriage(); - if ($marriage->canShow()) { - echo ' <a href="', $family->getHtmlUrl(), '" class="details1">'; - $marriage->print_simple_fact(); - echo '</a>'; + foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { + if ($fact->canShow()) { + echo ' <a href="', $family->getHtmlUrl(), '" class="details1">'; + $fact->print_simple_fact(); + echo '</a>'; + } } echo '</span>'; // print spouse + $spouse=$family->getSpouse($person); echo '<ul style="list-style:none; display:block;" id="'.$family->getXref().$personcount.'">'; echo '<li>'; echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td>'; diff --git a/library/WT/Controller/Family.php b/library/WT/Controller/Family.php index 686627562b..cb9b9181c9 100644 --- a/library/WT/Controller/Family.php +++ b/library/WT/Controller/Family.php @@ -68,7 +68,7 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { function getTimelineIndis($tags) { preg_match_all('/\n1 (?:'.implode('|', $tags).') @('.WT_REGEX_XREF.')@/', $this->record->getGedcom(), $matches); foreach ($matches[1] as &$match) { - $match='pids[]='.$match; + $match='pids%5B%5D='.$match; } return implode('&', $matches[1]); } diff --git a/library/WT/Controller/Familybook.php b/library/WT/Controller/Familybook.php index c509a10af4..8d01fcddec 100644 --- a/library/WT/Controller/Familybook.php +++ b/library/WT/Controller/Familybook.php @@ -216,22 +216,18 @@ class WT_Controller_Familybook extends WT_Controller_Chart { if ($count==1 ) { if ($this->show_spouse) { foreach ($sfamilies as $family) { - if (!is_null($family)) { - $spouse = $family->getSpouse($person); - if ($spouse!=null) { - echo '</td></tr><tr><td>'; - //-- shrink the box for the spouses - $tempw = $bwidth; - $temph = $bheight; - $bwidth -= 10; - $bheight -= 10; - print_pedigree_person($spouse); - $bwidth = $tempw; - $bheight = $temph; - $numkids += 0.95; - echo '</td><td></td>'; - } - } + $spouse = $family->getSpouse($person); + echo '</td></tr><tr><td>'; + //-- shrink the box for the spouses + $tempw = $bwidth; + $temph = $bheight; + $bwidth -= 10; + $bheight -= 10; + print_pedigree_person($spouse); + $bwidth = $tempw; + $bheight = $temph; + $numkids += 0.95; + echo '</td><td></td>'; } } } diff --git a/library/WT/Controller/Fanchart.php b/library/WT/Controller/Fanchart.php index ea6edf7c12..2eccce80f5 100644 --- a/library/WT/Controller/Fanchart.php +++ b/library/WT/Controller/Fanchart.php @@ -321,9 +321,7 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { // spouse(s) and children foreach ($person->getSpouseFamilies() as $family) { $spouse=$family->getSpouse($person); - if ($spouse) { - $html.= '<br><a href="'.$spouse->getHtmlUrl().'" class="name1">'.$spouse->getFullName().'</a>'; - } + $html.= '<br><a href="'.$spouse->getHtmlUrl().'" class="name1">'.$spouse->getFullName().'</a>'; foreach ($family->getChildren() as $child) { $html.= '<br> <a href="'.$child->getHtmlUrl().'" class="name1">< '.$child->getFullName().'</a>'; } diff --git a/library/WT/Controller/GedcomRecord.php b/library/WT/Controller/GedcomRecord.php index 233c7fbaac..205ba4d4d4 100644 --- a/library/WT/Controller/GedcomRecord.php +++ b/library/WT/Controller/GedcomRecord.php @@ -29,6 +29,10 @@ class WT_Controller_GedcomRecord extends WT_Controller_Page { public $record; // individual, source, repository, etc. public function __construct() { + // Non-existant record? + if ($this->record->getXref() == WT_GedcomRecord::DUMMY_XREF) { + $this->record = null; + } // Automatically fix broken links if ($this->record && $this->record->canEdit()) { $broken_links=0; diff --git a/library/WT/Controller/Hourglass.php b/library/WT/Controller/Hourglass.php index 01285b296b..d60dcc1e92 100644 --- a/library/WT/Controller/Hourglass.php +++ b/library/WT/Controller/Hourglass.php @@ -301,13 +301,8 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { //-- move the arrow up to line up with the correct box if ($this->show_spouse) { foreach ($families as $family) { - /* @var $family Family */ - if (!is_null($family)) { - $spouse = $family->getSpouse($person); - if ($spouse!=null) { - echo "<br><br><br>"; - } - } + $spouse = $family->getSpouse($person); + echo "<br><br><br>"; } } echo "</td><td width=\"$bwidth\">"; @@ -321,23 +316,17 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { //----- Print the spouse if ($this->show_spouse) { foreach ($families as $family) { - /* @var $family Family */ - if (!is_null($family)) { - $spouse = $family->getSpouse($person); - if ($spouse!=null) { - echo "</td></tr><tr><td align=\"$otablealign\">"; - //-- shrink the box for the spouses - $tempw = $bwidth; - $temph = $bheight; - $bwidth -= 10; - $bheight -= 10; - print_pedigree_person($spouse); - $bwidth = $tempw; - $bheight = $temph; - $numkids += 0.95; - echo "</td><td></td>"; - } - } + echo "</td></tr><tr><td align=\"$otablealign\">"; + //-- shrink the box for the spouses + $tempw = $bwidth; + $temph = $bheight; + $bwidth -= 10; + $bheight -= 10; + print_pedigree_person($family->getSpouse($person)); + $bwidth = $tempw; + $bheight = $temph; + $numkids += 0.95; + echo "</td><td></td>"; } //-- add offset divs to make things line up better if ($count==$this->dgenerations) echo "<tr><td colspan\"2\"><div style=\"height: ".($bhalfheight/2)."px; width: ".$bwidth."px;\"><br></div>"; @@ -365,16 +354,12 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { foreach ($famids as $family) { $spouse = $family->getSpouse($person); - if ($spouse) { - $spid = $spouse->getXref(); - echo "<a href=\"hourglass.php?rootid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; - echo $spouse->getFullName(); - echo '</a><br>'; - - } + $spid = $spouse->getXref(); + echo "<a href=\"hourglass.php?rootid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; + echo $spouse->getFullName(); + echo '</a><br>'; - $children = $family->getChildren(); - foreach ($children as $id=>$child) { + foreach ($family->getChildren() as $child) { $cid = $child->getXref(); echo " <a href=\"hourglass.php?rootid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; echo $child->getFullName(); @@ -401,11 +386,10 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { echo '</a><br>'; } } - $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) { + foreach ($family->getChildren() as $child) { $cid = $child->getXref(); if ($cid!=$pid) { echo " <a href=\"hourglass.php?rootid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; diff --git a/library/WT/Controller/Lifespan.php b/library/WT/Controller/Lifespan.php index e142ad9343..5412b60e95 100644 --- a/library/WT/Controller/Lifespan.php +++ b/library/WT/Controller/Lifespan.php @@ -211,10 +211,7 @@ class WT_Controller_Lifespan extends WT_Controller_Page { $this->pids[]=$person->getXref(); if ($add_family) { foreach ($person->getSpouseFamilies() as $family) { - $spouse=$family->getSpouse($person); - if ($spouse) { - $this->pids[]=$spouse->getXref(); - } + $this->pids[]=$family->getSpouse($person)->getXref(); foreach ($family->getChildren() as $child) { $this->pids[]=$child->getXref(); } |
