Beispiel #1
0
/**
 * returns a marriage anniversary iCalendar event for a family marriage.
 * If there is no date for the event, or either of the spouses is not alive,
 * no iCalendar event will be returned
 * @param Family $family the Family Object used as the source of the marriage anniversary info
 * @return the marriage anniversary iCalendar event.
 */
function getFamilyAnniversaryIcalEvent($family)
{
    $anniversaryDate = $family->getMarriageDate();
    if ($anniversaryDate == "") {
        return;
    }
    if ($family->isDivorced()) {
        return;
    }
    $wife = $family->getWife();
    $husband = $family->getHusband();
    if ($wife->isDead() || $husband->isDead()) {
        return;
    }
    $anniversaryDate = new GedcomDate($anniversaryDate);
    $summary = "Anniversary of " . $husband->getFullName() . " and " . $wife->getFullName();
    $place = $family->getMarriagePlace();
    $description = "Married on " . $anniversaryDate->Display(false) . ($place == "" ? "" : "in " . $place) . "\n" . encode_url($family->getAbsoluteLinkUrl());
    $iCalRecord = getIcalRecord($anniversaryDate, $summary, $description, encode_url($family->getAbsoluteLinkUrl()));
    return $iCalRecord;
}