function filterDistinctPrefixes($arrInput) { $arrDistinct = array(); foreach ($arrInput as $value) { $dateVal = getDatePrefix($value); if ($dateVal != '') { array_push($arrDistinct, $dateVal); } } //filter the array down to the unique dates $arrDistinct = array_unique($arrDistinct); //sort the array so we can get the most recent date rsort($arrDistinct); return $arrDistinct; }
function getYears($row) { global $dates; $years = getGenderIcon($row['sex'], -1); if ($row['allow_living'] && $row['allow_private']) { if ($row['deathdate']) { $deathdate = $row['deathdate']; $truedeath = $row['deathdatetr']; } else { $deathdate = $row['burialdate']; $truedeath = $row['burialdatetr']; } $deathyearonly = $row['death'] && $row['death'] . "-00-00" == $truedeath ? true : false; $deathstr = displayDate($deathdate); $displaydeath = !$row['death'] || $deathyearonly ? $deathstr : getDatePrefix($deathstr) . $row['death']; $displaydeath = $displaydeath != "Y" ? $displaydeath : $dates['Y']; if ($row['birthdate']) { $birthdate = $row['birthdate']; $truebirth = $row['birthdatetr']; } else { $birthdate = $row['altbirthdate']; $truebirth = $row['altbirthdatetr']; } $birthyearonly = $row['birth'] && $row['birth'] . "-00-00" == $truebirth ? true : false; $birthstr = displayDate($birthdate); $displaybirth = !$row['birth'] || $birthyearonly ? $birthstr : getDatePrefix($birthstr) . $row['birth']; if ($displaybirth || $displaydeath) { $years .= " {$displaybirth} - {$displaydeath}"; $age = age($row); if ($age) { $years .= " ({$age})"; } } } return $years; }