/** * Derived classes should redefine this function, otherwise the object will have no name * * @return string[][] */ public function getAllNames() { if (is_null($this->_getAllNames)) { // Check the script used by each name, so we can match cyrillic with cyrillic, greek with greek, etc. if ($this->husb) { $husb_names = $this->husb->getAllNames(); } else { $husb_names = array(0 => array('type' => 'BIRT', 'sort' => '@N.N.', 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…'))); } foreach ($husb_names as $n => $husb_name) { $husb_names[$n]['script'] = I18N::textScript($husb_name['full']); } if ($this->wife) { $wife_names = $this->wife->getAllNames(); } else { $wife_names = array(0 => array('type' => 'BIRT', 'sort' => '@N.N.', 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…'))); } foreach ($wife_names as $n => $wife_name) { $wife_names[$n]['script'] = I18N::textScript($wife_name['full']); } // Add the matched names first foreach ($husb_names as $husb_name) { foreach ($wife_names as $wife_name) { if ($husb_name['type'] != '_MARNM' && $wife_name['type'] != '_MARNM' && $husb_name['script'] == $wife_name['script']) { $this->_getAllNames[] = array('type' => $husb_name['type'], 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], 'full' => $husb_name['full'] . ' + ' . $wife_name['full']); } } } // Add the unmatched names second (there may be no matched names) foreach ($husb_names as $husb_name) { foreach ($wife_names as $wife_name) { if ($husb_name['type'] != '_MARNM' && $wife_name['type'] != '_MARNM' && $husb_name['script'] != $wife_name['script']) { $this->_getAllNames[] = array('type' => $husb_name['type'], 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], 'full' => $husb_name['full'] . ' + ' . $wife_name['full']); } } } } return $this->_getAllNames; }
$note = Note::getInstance($row->xref, $WT_TREE, $row->gedcom); if ($note->canShowName()) { $data[] = array('value' => $note->getXref(), 'label' => $note->getFullName()); } } echo json_encode($data); return; case 'IFS': $data = array(); // Fetch all data, regardless of privacy $rows = get_INDI_rows($WT_TREE, $term); // Filter for privacy foreach ($rows as $row) { $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); if ($person->canShowName()) { $data[] = array('value' => $person->getXref(), 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); } } // Fetch all data, regardless of privacy $rows = get_SOUR_rows($WT_TREE, $term); // Filter for privacy foreach ($rows as $row) { $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); if ($source->canShowName()) { $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName()); } } // Fetch all data, regardless of privacy $rows = get_FAM_rows($WT_TREE, $term); // Filter for privacy foreach ($rows as $row) {