record = WT_Family::getInstance($xref); parent::__construct(); } // Get significant information from this page, to allow other pages such as // charts and reports to initialise with the same records public function getSignificantIndividual() { if ($this->record) { foreach ($this->record->getSpouses() as $individual) { return $individual; } foreach ($this->record->getChildren() as $individual) { return $individual; } } return parent::getSignificantIndividual(); } public function getSignificantFamily() { if ($this->record) { return $this->record; } return parent::getSignificantFamily(); } // $tags is an array of HUSB/WIFE/CHIL function getTimelineIndis($tags) { preg_match_all('/\n1 (?:'.implode('|', $tags).') @('.WT_REGEX_XREF.')@/', $this->record->getGedcom(), $matches); foreach ($matches[1] as &$match) { $match='pids%5B%5D='.$match; } return implode('&', $matches[1]); } /** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD=get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-fam'); $menu->addLabel($menu->label, 'down'); if (WT_USER_CAN_EDIT) { // edit_fam / members $submenu = new WT_Menu(WT_I18N::translate('Change family members'), '#', 'menu-fam-change'); $submenu->addOnclick("return change_family_members('".$this->record->getXref()."');"); $menu->addSubmenu($submenu); // edit_fam / add child $submenu = new WT_Menu(WT_I18N::translate('Add a child to this family'), '#', 'menu-fam-addchil'); $submenu->addOnclick("return add_child_to_family('".$this->record->getXref()."', 'U');"); $menu->addSubmenu($submenu); // edit_fam / reorder_children if ($this->record->getNumberOfChildren() > 1) { $submenu = new WT_Menu(WT_I18N::translate('Re-order children'), '#', 'menu-fam-orderchil'); $submenu->addOnclick("return reorder_children('".$this->record->getXref()."');"); $menu->addSubmenu($submenu); } } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-fam-del'); $submenu->addOnclick("return delete_family('" . WT_I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') . "', '".$this->record->getXref()."');"); $menu->addSubmenu($submenu); } // edit raw if (WT_USER_IS_ADMIN || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-fam-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu( /* I18N: Menu option. Add [the current page] to the list of favorites */ WT_I18N::translate('Add to favorites'), '#', 'menu-fam-addfav' ); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'".$this->record->getXref()."'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; } // Get significant information from this page, to allow other pages such as // charts and reports to initialise with the same records public function getSignificantSurname() { if ($this->record && $this->record->getHusband()) { list($surn, $givn)=explode(',', $this->record->getHusband()->getSortname()); return $surn; } else { return ''; } } // Print the facts public function printFamilyFacts() { global $linkToID; $linkToID = $this->record->getXref(); // -- Tell addmedia.php what to link to $indifacts = $this->record->getFacts(); if ($indifacts) { sort_facts($indifacts); foreach ($indifacts as $fact) { print_fact($fact, $this->record); } } else { echo '', WT_I18N::translate('No facts for this family.'), ''; } if (WT_USER_CAN_EDIT) { print_add_new_fact($this->record->getXref(), $indifacts, 'FAM'); echo ''; echo WT_Gedcom_Tag::getLabel('NOTE'); echo ''; echo "record->getXref()."','NOTE');\">", WT_I18N::translate('Add a new note'), ''; echo help_link('add_note'); echo ''; echo ''; echo WT_Gedcom_Tag::getLabel('SHARED_NOTE'); echo ''; echo "record->getXref()."','SHARED_NOTE');\">", WT_I18N::translate('Add a new shared note'), ''; echo help_link('add_shared_note'); echo ''; if (get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) { echo ''; echo WT_Gedcom_Tag::getLabel('OBJE'); echo ''; echo "record->getXref()."', '_blank', edit_window_specs); return false;\">", WT_I18N::translate('Add a new media object'), ''; echo help_link('OBJE'); echo '
'; echo "record->getXref()."&linkto=family', '_blank', find_window_specs); return false;\">", WT_I18N::translate('Link to an existing media object'), ''; echo ''; } echo ''; echo WT_Gedcom_Tag::getLabel('SOUR'); echo ''; echo "record->getXref()."','SOUR');\">", WT_I18N::translate('Add a new source citation'), ''; echo help_link('add_source'); echo ''; } } }