protected function canShowByType($access_level) { // Hide notes if they are attached to private records $linked_ids = WT_DB::prepare("SELECT l_from FROM `##link` WHERE l_to=? AND l_file=?")->execute(array($this->xref, $this->gedcom_id))->fetchOneColumn(); foreach ($linked_ids as $linked_id) { $linked_record = WT_GedcomRecord::getInstance($linked_id); if ($linked_record && !$linked_record->canShow($access_level)) { return false; } } // Apply default behaviour return parent::canShowByType($access_level); }
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 = WT_Repository::getInstance($match); if ($repo && !$repo->canShow($access_level)) { return false; } } // ... otherwise apply default behaviour return parent::canShowByType($access_level); }