summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-12-22 20:12:39 +0000
committerfisharebest <fisharebest@gmail.com>2010-12-22 20:12:39 +0000
commit8b2cf789f9171fa25ff537573b48c71cdccc4689 (patch)
tree19b66e4b736f356f84c7305d5b22aa972c8657dd /includes
parent08c2bbd10dbdbd7afc5be47527f97e5a714d1e0d (diff)
downloadwebtrees-8b2cf789f9171fa25ff537573b48c71cdccc4689.tar.gz
webtrees-8b2cf789f9171fa25ff537573b48c71cdccc4689.tar.bz2
webtrees-8b2cf789f9171fa25ff537573b48c71cdccc4689.zip
Move gedcom manipulation code to objects
Diffstat (limited to 'includes')
-rw-r--r--includes/controllers/family_ctrl.php6
-rw-r--r--includes/functions/functions.php44
2 files changed, 5 insertions, 45 deletions
diff --git a/includes/controllers/family_ctrl.php b/includes/controllers/family_ctrl.php
index d5ee19447b..98db8d944e 100644
--- a/includes/controllers/family_ctrl.php
+++ b/includes/controllers/family_ctrl.php
@@ -186,7 +186,11 @@ class FamilyController extends BaseController {
}
function getChildren() {
- return find_children_in_record($this->famrec);
+ if (preg_match_all('/\n1 CHIL @('.WT_REGEX_XREF.')@/', $this->famrec, $match)) {
+ return $match[1];
+ } else {
+ return array();
+ }
}
function getChildrenUrlTimeline($start=0) {
diff --git a/includes/functions/functions.php b/includes/functions/functions.php
index 97c514eb8e..22f5126730 100644
--- a/includes/functions/functions.php
+++ b/includes/functions/functions.php
@@ -846,50 +846,6 @@ function find_parents_in_record($famrec) {
return $parents;
}
-/**
- * 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='') {
- $famrec = find_gedcom_record($famid, WT_GED_ID, true);
- if (empty($famrec)) {
- return false;
- }
- return find_children_in_record($famrec);
-}
-
-/**
- * find the children in a family record
- *
- * find and return an array containing the children of the given family record
- * @author John Finlay (yalnifj)
- * @param string $famrec the gedcom record of the family to search in
- * @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_in_record($famrec, $me='') {
- $children = array();
- if (empty($famrec)) {
- return $children;
- }
-
- $num = preg_match_all('/\n1 CHIL @('.WT_REGEX_XREF.')@/', $famrec, $match, PREG_SET_ORDER);
- for ($i=0; $i<$num; $i++) {
- $child = trim($match[$i][1]);
- if ($child!=$me) {
- $children[] = $child;
- }
- }
- return $children;
-}
-
// ************************************************* START OF MULTIMEDIA FUNCTIONS ********************************* //
/**
* find the highlighted media object for a gedcom entity