Ejemplo n.º 1
0
function AddChild($family, $Parent1ID, $Parent2ID)
{
    $childID = NextPersonID($family);
    // Add new person (the child)
    $child = new XElement("\r\n        <Person childInfoMissing='false' gender='Male' id='{$childID}'>\r\n        <Name first='' last='' />\r\n        <Birth/>\r\n        <Images/>\r\n        <Contact>\r\n            <Email/>\r\n            <www/>\r\n            <Phone/>\r\n            <Address/>\r\n        </Contact>\r\n        <Profession/>\r\n        <Career/>\r\n        <Death/>\r\n        <Miscallaneous/>\r\n        <HiddenComment/>\r\n    </Person>\r\n    ");
    $family->AppendChild($child);
    // Add the new child to the family
    $parentFamily = $family->Element("Family[(ParentID = '{$Parent1ID}') and (ParentID = '{$Parent2ID}')]");
    $parentFamily->AppendChild(new XElement("<ChildID>{$childID}</ChildID>"));
    return $childID;
}
Ejemplo n.º 2
0
function AddSpouse($family, $person)
{
    $spouseID = NextPersonID($family);
    $newFamily = new XElement("\r\n        <Family>\r\n            <ParentID>{$person->getAttribute('id')}</ParentID>\r\n            <ParentID>{$spouseID}</ParentID>\r\n        </Family>\r\n    ");
    if ($person->getAttribute('gender') == 'Male') {
        $gender = 'Female';
    } else {
        $gender = 'Male';
    }
    $spouse = new XElement("\r\n        <Person childInfoMissing='false' gender='{$gender}' id='{$spouseID}'>\r\n        <Name first='' last='' />\r\n        <Birth/>\r\n        <Images/>\r\n        <Contact>\r\n            <Email/>\r\n            <www/>\r\n            <Phone/>\r\n            <Address/>\r\n        </Contact>\r\n        <Profession/>\r\n        <Career/>\r\n        <Death/>\r\n        <Miscallaneous/>\r\n        <HiddenComment/>\r\n    </Person>\r\n    ");
    $family->AppendChild($spouse);
    $family->AppendChild($newFamily);
    return $spouseID;
}