/** * find the children in a family * * find and return an array containing the children of the given family record * @author John Finlay (yalnifj) * @param string $famid the gedcom xref id for the family * @param string $me an xref id of a child to ignore, useful when you want to get a person's * siblings but do want to include them as well * @return array */ function find_children($famid, $me = '') { global $pgv_lang; $famrec = find_family_record($famid); if (empty($famrec)) { if (PGV_USER_CAN_EDIT) { $famrec = find_updated_record($famid); if (empty($famrec)) { return false; } } else { return false; } } return find_children_in_record($famrec); }
?> place" /> <?php print_findplace_link("F" . $i . "place"); ?> </td> <?php $tabkey++; ?> <td class="optionbox"> </td> </tr> <?php print_quick_resn("RESN"); } // NOTE: Children $chil = find_children_in_record($famrec, $pid); ?> <tr><td> </td></tr> <tr> <td class="topbottombar" colspan="4"><?php echo $pgv_lang["children"]; ?> </td> </tr> <tr> <td class="descriptionbox"><?php echo $pgv_lang["name"]; ?> </td> <td class="descriptionbox center"><?php echo $factarray["SEX"];
function getChildren() { return find_children_in_record($this->famrec); }
/** * Creates the Family element and all of it's child elements, and appends it to the * Families element. This function will search through the DOMDocument looking * for people in the family. If they are not created yet and they are in the clippings * cart, they will be created and ther hlink added to the family element. * * @param string $frec - the full FAM GEDCOM record of the family to be created * @param string $fid = the ID (F1, F2, F3) of the family that is being created */ function create_family($frec, $fid) { $check = $this->query_dom("./families/family[@id=\"{$fid}\"]/@id"); if (($check == null || $check != $fid) && id_in_cart($fid)) { $famrec = $frec; $eFamily = $this->dom->createElement("family"); $eFamily->setAttribute("id", $fid); $eFamily->setAttribute("handle", $this->generateHandle()); $eFamily->setAttribute("change", time()); $eFamily = $this->eFams->appendChild($eFamily); // Add the <father> element $id = get_gedcom_value("HUSB", 1, $famrec); $pers = $this->query_dom("./people/person[@id=\"{$id}\"]/@handle"); if (!isset($pers) && id_in_cart($id)) { /* * * If the person does not exist and their ID is in the clippings cart, * you must create the person before you can query them in the dom to get * their hlink. The hlink is generated when the person element is created. * This causes overhead creating objects that are never added to the XML file * perhaps there is some other way this can be done reducing the overhead? * */ $this->create_person(find_person_record($id), $id); $pers = $this->query_dom("./people/person[@id=\"{$id}\"]/@handle"); } if (isset($id) && trim($id) && id_in_cart($id)) { $eFather = $this->dom->createElement("father"); $eFather->setAttribute("hlink", $pers); $eFather = $eFamily->appendChild($eFather); } // Add the <mother> element $id = get_gedcom_value("WIFE", 1, $famrec); $pers = $this->query_dom("./people/person[@id=\"{$id}\"]/@handle"); if (!isset($pers) && id_in_cart($id)) { /* * * If the person does not exist and their ID is in the clippings cart, * you must create the person before you can query them in the dom to get * their hlink. The hlink is generated when the person element is created. * This causes overhead creating objects that are never added to the XML file * perhaps there is some other way this can be done reducing the overhead? * */ $this->create_person(find_person_record($id), $id); $pers = $this->query_dom("./people/person[@id=\"{$id}\"]/@handle"); } if (isset($id) && trim($id) != "" && $id != null && id_in_cart($id)) { $eMother = $this->dom->createElement("mother"); $eMother->setAttribute("hlink", $pers); $eMother = $eFamily->appendChild($eMother); } foreach ($this->familyevents as $event) { $this->create_event_ref($eFamily, $frec, $event); } // Add the <child> element $childrenIds = find_children_in_record($famrec); foreach ($childrenIds as $id) { $pers = $this->query_dom("./people/person[@id=\"{$id}\"]/@handle"); global $type; if (isset($id) && isset($pers) && (id_in_cart($id) || $type == 1)) { $eChild = $this->dom->createElement("childref"); $eChild->setAttribute("hlink", $pers); $eChild = $eFamily->appendChild($eChild); } } if (($note = get_sub_record(1, "1 NOTE", $frec)) != null) { $this->create_note($eFamily, $note, 1); } $num = 1; while (($sourcerefRec = get_sub_record(1, "1 SOUR", $frec, $num)) != null) { $this->create_sourceref($eFamily, $sourcerefRec, 1); $num++; } $num = 1; while (($nameSource = get_sub_record(1, "1 OBJE", $frec, $num)) != null) { $this->create_mediaref($eFamily, $nameSource, 1); $num++; } } }