";
// If person is living calculate todays age
if ($living == "1") {
// Today
$datum_2_tr = date ("Y-m-d", time() + ( 3600 * $time_offset ) );
}
// Only if one of the FROM and one of the TO dates are filled
if (($datum_1_tr != "0000-00-00" || $datum_alt_1_tr != "0000-00-00") && ($datum_2_tr != "0000-00-00" || $datum_alt_2_tr != "0000-00-00"))
{
// FROM date
// $datum1 = result datum1
// $datum_1_tr = date numeric, Datum_1 = date alfanumeric
// $datum_alt_1_tr = alternative date numeric, $datum_alt_1 = alternative date alfanumeric
if ($datum_1_tr != "0000-00-00")
{
$datum1 = $datum_1_tr;
if (substr($datum_1, 0, 3) == "BEF") {
$sign1 = ">"; }
else {
if (substr($datum_1, 0, 3) == "AFT") {
$sign1 = "<";
$datum1 = substr_replace($datum1, "12-31", 5); }
else {
if (substr($datum_1, 1, 4) == substr($datum1, 0, 4)) {
$sign1 = "~";
$datum1 = substr_replace($datum1, "07-15", 5); }
else {
if (substr($datum_1, 0, 2) < 1) {
$sign1 = "~";
$datum1 = substr_replace($datum1, "15", 8); } } } }
}
else
{
$datum1 = $datum_alt_1_tr;
$sign1 = "~";
if (substr($datum_alt_1, 0, 3) == "BEF") {
$sign1 = ">"; }
else {
if (substr($datum_alt_1, 0, 3) == "AFT") {
$sign1 = "<";
$datum1 = substr_replace($datum1, "12-31", 5); }
else {
if (substr($datum_alt_1, 1, 4) == substr($datum1, 0, 4)) {
$datum1 = substr_replace($datum1, "07-15", 5); }
else {
if (substr($datum_alt_1, 0, 2) < 1) {
$datum1 = substr_replace($datum1, "15", 8); } } } }
}
// TO date
// $datum2 = result datum2
// $datum_2_tr = date numeric, Datum_2 = datum alfanumeric
// $datum_alt_2_tr = alternative date numeric, $datum_alt_2 = alternative date alfanumeric
if ($datum_2_tr != "0000-00-00")
{
$datum2 = $datum_2_tr;
if (substr($datum_2, 0, 3) == "BEF") {
$sign2 = "<";}
else {
if (substr($datum_2, 0, 3) == "AFT") {
$sign2 = ">";
$datum2 = substr_replace($datum2, "12-31", 5);}
else {
if (substr($datum_2, 1, 4) == substr($datum2, 0, 4)) {
$datum2 = substr_replace($datum2, "07-15", 5);}
else {
if (substr($datum2, 8, 2) < 1) {
$datum2 = substr_replace($datum2, "15", 8);} } } }
}
else
{
$datum2 = $datum_alt_2_tr;
$sign2 = "~";
if (substr($datum_alt_2, 0, 3) == "BEF") {
$sign2 = "<"; }
else {
if (substr($datum_alt_2, 0, 3) == "AFT") {
$sign2 = ">";
$datum2 = substr_replace($datum2, "12-31", 5); }
else {
if (substr($datum_alt_2, 1, 4) == substr($datum2, 0, 4)) {
$datum2 = substr_replace($datum2, "07-15", 5); }
else {
if (substr($datum_alt_2, 0, 2) < 1) {
$datum2 = substr_replace($datum2, "15", 8); } } } }
}
// age = date2 - date1
$datum1 = substr($datum1, 0, 4) . substr($datum1, 5, 2) . substr($datum1, 8, 2);
$datum2 = substr($datum2, 0, 4) . substr($datum2, 5, 2) . substr($datum2, 8, 2);
//echo "Plek 3: ".$datum1." en ".$datum2."
";
$leeftijd = $datum2 - $datum1;
// format age
if ($leeftijd < 0) {
$leeftijd = ""; }
else {
if ($leeftijd >= 0 && $leeftijd < 10000) {
$leeftijd = "0 "; }
else {
if ($leeftijd > 9999 && $leeftijd < 100000) {
$leeftijd = substr($leeftijd, 0, 1); }
else {
if ($leeftijd > 99999 && $leeftijd < 1000000) {
$leeftijd = substr($leeftijd, 0, 2); }
else {
if ($leeftijd > 999999) {
$leeftijd = substr($leeftijd, 0, 3); }
}
}
}
}
// format sign
if ((($sign1 == "<") || ($sign1 == ">")) && (($sign2 == "<") || ($sign2 == ">"))) {
$sign = "~"; }
else {
if (($sign1 == "~") || ($sign2 == "~")) {
$sign = "~"; }
else {
if ($sign1 <> " ") $sign = $sign1;
if ($sign2 <> " ") $sign = $sign2;
}
}
if ($sign <> "") {
$leeftijd = $sign . " " . $leeftijd; }
}
if ($leeftijd <> "") {
global $text;
$leeftijd .= " {$text['years']}";
}
return $leeftijd;
}
function getDeathInfo( $thisperson ) {
global $text, $placesearch_url, $cms;
$deathstring = "";
if( $thisperson[deathdate] ) {
$deathstring .= "$text[deathabbr] " . displayDate( $thisperson[deathdate] );
if( $thisperson[deathplace] ) {
$place2 = $thisperson[deathplace];
$deathstring .= ", $place2 ";
$deathstring .= "
";
}
}
else if( $thisperson[burialdate] ) {
$deathstring .= "$text[burialabbr] " . displayDate( $thisperson[burialdate] );
if( $thisperson[burialplace] ) {
$place2 = $thisperson[burialplace];
$deathstring .= ", $place2 ";
$deathstring .= "
";
}
}
return $deathstring;
}
function getBirthInfo2( $thisperson ) {
global $text, $placesearch_url, $cms;
$birthstring = "";
if( $thisperson[birthdate] ) {
$birthstring .= "$text[birthabbr] " . displayDate( $thisperson[birthdate] );
if( $thisperson[birthplace] ) {
$place2 = $thisperson[birthplace];
$birthstring .= ", $place2 ";
$birthstring .= "
";
}
}
else if( $thisperson[altbirthdate] ) {
$birthstring .= "$text[chrabbr] " . displayDate( $thisperson[altbirthdate] );
if( $thisperson[altbirthplace] ) {
$place2 = $thisperson[altbirthplace];
$birthstring .= ", $place2 ";
$birthstring .= "
";
}
}
return $birthstring;
}
?>