summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/classes/class_menubar.php6
-rw-r--r--includes/controllers/family_ctrl.php20
2 files changed, 9 insertions, 17 deletions
diff --git a/includes/classes/class_menubar.php b/includes/classes/class_menubar.php
index d472aafae9..5c0f5ef1b7 100644
--- a/includes/classes/class_menubar.php
+++ b/includes/classes/class_menubar.php
@@ -304,7 +304,7 @@ class MenuBar {
switch ($menuType) {
case "parentTimeLine":
// charts / parents_timeline
- $submenu = new Menu(i18n::translate('Show couple on timeline chart'), 'timeline.php?pids[0]='.$controller->getHusband().'&pids[1]='.$controller->getWife().'&ged='.WT_GEDURL);
+ $submenu = new Menu(i18n::translate('Show couple on timeline chart'), 'timeline.php?'.$controller->getTimelineIndis(array('HUSB','WIFE')).'&ged='.WT_GEDURL);
if (!empty($WT_IMAGES["timeline"])) {
$submenu->addIcon('timeline');
}
@@ -314,7 +314,7 @@ class MenuBar {
case "childTimeLine":
// charts / children_timeline
- $submenu = new Menu(i18n::translate('Show children on timeline chart'), 'timeline.php?'.$controller->getChildrenUrlTimeline().'&ged='.WT_GEDURL);
+ $submenu = new Menu(i18n::translate('Show children on timeline chart'), 'timeline.php?'.$controller->getTimelineIndis(array('CHIL')).'&ged='.WT_GEDURL);
if (!empty($WT_IMAGES["timeline"])) {
$submenu->addIcon('timeline');
}
@@ -324,7 +324,7 @@ class MenuBar {
case "familyTimeLine":
// charts / family_timeline
- $submenu = new Menu(i18n::translate('Show family on timeline chart'), 'timeline.php?pids[0]='.$controller->getHusband().'&pids[1]='.$controller->getWife().'&'.$controller->getChildrenUrlTimeline(2).'&ged='.WT_GEDURL);
+ $submenu = new Menu(i18n::translate('Show family on timeline chart'), 'timeline.php?'.$controller->getTimelineIndis(array('HUSB','WIFE','CHIL')).'&ged='.WT_GEDURL);
if (!empty($WT_IMAGES["timeline"])) {
$submenu->addIcon('timeline');
}
diff --git a/includes/controllers/family_ctrl.php b/includes/controllers/family_ctrl.php
index 38755a8cbe..eadf00b58e 100644
--- a/includes/controllers/family_ctrl.php
+++ b/includes/controllers/family_ctrl.php
@@ -175,21 +175,13 @@ class FamilyController extends BaseController {
return null;
}
- function getChildren() {
- if (preg_match_all('/\n1 CHIL @('.WT_REGEX_XREF.')@/', $this->famrec, $match)) {
- return $match[1];
- } else {
- return array();
- }
- }
-
- function getChildrenUrlTimeline($start=0) {
- $children = $this->getChildren();
- $c = count($children);
- for ($i = 0; $i < $c; $i++) {
- $children[$i] = 'pids['.($i + $start).']='.$children[$i];
+ // $tags is an array of HUSB/WIFE/CHIL
+ function getTimelineIndis($tags) {
+ preg_match_all('/\n1 (?:'.implode('|', $tags).') @('.WT_REGEX_XREF.')@/', $this->family->getGedcomRecord(), $matches);
+ foreach ($matches[1] as &$match) {
+ $match='pids[]='.$match;
}
- return join('&amp;', $children);
+ return implode('&amp;', $matches[1]);
}
/**