/** * Each object type may have its own special rules, and re-implement this function. * * @param int $access_level * * @return bool */ protected function canShowByType($access_level) { // Hide a family if any member is private preg_match_all('/\\n1 (?:CHIL|HUSB|WIFE) @(' . WT_REGEX_XREF . ')@/', $this->gedcom, $matches); foreach ($matches[1] as $match) { $person = Individual::getInstance($match, $this->tree); if ($person && !$person->canShow($access_level)) { return false; } } return true; }
// Filter for privacy foreach ($rows as $row) { $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);