/** * 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 notes if they are attached to private records $linked_ids = Database::prepare("SELECT l_from FROM `##link` WHERE l_to=? AND l_file=?")->execute(array($this->xref, $this->tree->getTreeId()))->fetchOneColumn(); foreach ($linked_ids as $linked_id) { $linked_record = GedcomRecord::getInstance($linked_id, $this->tree); if ($linked_record && !$linked_record->canShow($access_level)) { return false; } } // Apply default behaviour return parent::canShowByType($access_level); }
/** * 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 sources if they are attached to private repositories ... preg_match_all('/\\n1 REPO @(.+)@/', $this->gedcom, $matches); foreach ($matches[1] as $match) { $repo = Repository::getInstance($match, $this->tree); if ($repo && !$repo->canShow($access_level)) { return false; } } // ... otherwise apply default behaviour return parent::canShowByType($access_level); }