diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-07-05 17:21:55 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-07-05 17:21:55 +0000 |
| commit | b202d384ab9d1b18f6bddb4f431db06d4e8fed94 (patch) | |
| tree | 65b89f65c029f8082fa52f68c7f85b88581c35cd | |
| parent | 0e913c807f18bfbd9237e0fe309ea9c96a5b91aa (diff) | |
| download | webtrees-b202d384ab9d1b18f6bddb4f431db06d4e8fed94.tar.gz webtrees-b202d384ab9d1b18f6bddb4f431db06d4e8fed94.tar.bz2 webtrees-b202d384ab9d1b18f6bddb4f431db06d4e8fed94.zip | |
More refactoring - get LDS ordinances at a glance
| -rw-r--r-- | includes/functions/functions_print.php | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index 08e3367296..a1cdd67e7b 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -178,7 +178,7 @@ function print_pedigree_person($person, $style=1, $count=0, $personcount="1") { } if ($SHOW_LDS_AT_GLANCE && $show_full) { - $addname = ' <span class="details$style">'.get_lds_glance($indirec).'</span>' . $addname; + $addname = ' <span class="details$style">'.get_lds_glance($person).'</span>' . $addname; } // Show BIRT or equivalent event @@ -1162,38 +1162,18 @@ function print_findfact_link($element_id) { return '<a href="#" onclick="findFact(document.getElementById(\''.$element_id.'\'), \''.WT_GEDURL.'\'); return false;" class="icon-button_find_facts" title="'.WT_I18N::translate('Find a fact or event').'"></a>'; } -/** -* get a quick-glance view of current LDS ordinances -* @param string $indirec -* @return string -*/ -function get_lds_glance($indirec) { - global $GEDCOM; - $ged_id=get_id_from_gedcom($GEDCOM); - $text = ""; +// Summary of LDS ordinances +function get_lds_glance(WT_Individual $indi) { + $BAPL = $indi->getFacts('BAPL') ? 'B' : '_'; + $ENDL = $indi->getFacts('ENDL') ? 'E' : '_'; + $ENDL = $indi->getFacts('SLGC') ? 'C' : '_'; + $SLGS = '_'; - $ord = get_sub_record(1, "1 BAPL", $indirec); - if ($ord) $text .= "B"; - else $text .= "_"; - $ord = get_sub_record(1, "1 ENDL", $indirec); - if ($ord) $text .= "E"; - else $text .= "_"; - $found = false; - $ct = preg_match_all("/1 FAMS @(.*)@/", $indirec, $match, PREG_SET_ORDER); - for ($i=0; $i<$ct; $i++) { - $famrec = find_family_record($match[$i][1], $ged_id); - if ($famrec) { - $ord = get_sub_record(1, "1 SLGS", $famrec); - if ($ord) { - $found = true; - break; - } + foreach ($indi->getSpouseFamilies() as $family) { + if ($family->getFacts('SLGS')) { + $SLGS = ''; } } - if ($found) $text .= "S"; - else $text .= "_"; - $ord = get_sub_record(1, "1 SLGC", $indirec); - if ($ord) $text .= "P"; - else $text .= "_"; - return $text; + + return $BAPL . $ENDL . $SLGS . $SLGC; } |
