Lines Matching refs:this
106 $this->xref = $xref;
107 $this->gedcom = $gedcom;
108 $this->pending = $pending;
109 $this->tree = $tree;
110 $this->facts = $this->parseFacts();
166 preg_match('/^0 @[^@]*@ (\w+)/', $this->gedcom(), $match);
178 return $this->xref;
188 return $this->tree;
199 return $this->pending ?? $this->gedcom;
209 return $this->pending !== null;
219 return $this->pending === '';
230 'xref' => $this->xref(),
231 'tree' => $this->tree->name(),
232 'slug' => Registry::slugFactory()->make($this),
245 $access_level ??= Auth::accessLevel($this->tree);
253 $cache_key = 'show-' . $this->xref . '-' . $this->tree->id() . '-' . $access_level;
255 …return Registry::cache()->array()->remember($cache_key, fn () => $this->canShowRecord($access_leve…
267 return $this->canShow($access_level);
277 if ($this->isPendingDeletion()) {
281 if (Auth::isManager($this->tree)) {
285 $fact = $this->facts(['RESN'])->first();
288 return Auth::isEditor($this->tree) && !$locked;
297 return $this->gedcom;
300 if (!$this->canShow($access_level)) {
307 [$gedcom] = explode("\n", $this->gedcom . $this->pending, 2);
310 foreach ($this->facts([], false, $access_level) as $fact) {
320 $record = Registry::gedcomRecordFactory()->make($xref, $this->tree);
340 $this->addName(static::RECORD_TYPE, $this->getFallBackName(), '');
350 if ($this->getAllNames === []) {
351 if ($this->canShowName()) {
353 $this->extractNames();
355 if ($this->getAllNames === []) {
356 $this->addName(static::RECORD_TYPE, $this->getFallBackName(), '');
359 $this->addName(static::RECORD_TYPE, I18N::translate('Private'), '');
363 return $this->getAllNames;
373 return e($this->xref());
387 if ($this->getPrimaryName === null) {
389 $this->getPrimaryName = 0;
391 foreach ($this->getAllNames() as $n => $name) {
393 $this->getPrimaryName = $n;
399 return $this->getPrimaryName;
409 if ($this->getSecondaryName === null) {
411 $this->getSecondaryName = $this->getPrimaryName();
413 $all_names = $this->getAllNames();
415 $primary_script = I18N::textScript($all_names[$this->getPrimaryName()]['sort']);
417 …if ($n !== $this->getPrimaryName() && $name['type'] !== '_MARNM' && I18N::textScript($name['sort']…
418 $this->getSecondaryName = $n;
425 return $this->getSecondaryName;
437 $this->getPrimaryName = $n;
438 $this->getSecondaryName = null;
448 return $this->xref . '@' . $this->tree->id();
459 if ($this->canShowName()) {
460 $tmp = $this->getAllNames();
462 return $tmp[$this->getPrimaryName()]['full'];
476 $tmp = $this->getAllNames();
478 return $tmp[$this->getPrimaryName()]['sort'];
488 if ($this->canShowName() && $this->getPrimaryName() !== $this->getSecondaryName()) {
489 $all_names = $this->getAllNames();
491 return $all_names[$this->getSecondaryName()]['full'];
504 $html = '<a href="' . e($this->url()) . '">';
505 $html .= '<b>' . $this->fullName() . '</b>';
507 $html .= $this->formatListDetails();
533 $fact = $this->facts($facts, true)->first();
571 foreach ($this->facts($events, false, null, true) as $event) {
590 foreach ($this->facts($events) as $event) {
593 $places[] = new Place($ged_place, $this->tree);
617 $access_level ??= Auth::accessLevel($this->tree);
620 $filter = array_map(fn (string $tag): string => $this->tag() . ':' . $tag, $filter);
623 if ($this->canShow($access_level)) {
624 foreach ($this->facts as $fact) {
632 switch ($this->tag()) {
639 $subtags = Registry::elementFactory()->make($this->tag())->subtags();
640 … $subtags = array_map(fn (string $tag): string => $this->tag() . ':' . $tag, array_keys($subtags));
672 foreach (Registry::elementFactory()->make($this->tag())->subtags() as $subtag => $repeat) {
676 if ($this->facts([$subtag], false, null, true)->count() < $max) {
678 … $missing_facts[$subtag] = Registry::elementFactory()->make($this->tag() . ':' . $subtag)->label();
684 if (!Auth::canUploadMedia($this->tree, Auth::user())) {
701 $chan = $this->facts(['CHAN'])->first();
733 $chan = $this->facts(['CHAN'])->first();
757 $this->updateFact('', $gedcom, $update_chan);
770 $this->updateFact($fact_id, '', $update_chan);
792 if ($this->pending === '') {
799 if ($this->pending !== null && $this->pending !== '') {
800 $old_gedcom = $this->pending;
802 $old_gedcom = $this->gedcom;
809 foreach ($this->facts([], false, Auth::PRIV_HIDE, true) as $fact) {
816 $new_gedcom .= "\n" . $this->updateChange($fact->gedcom());
828 $new_gedcom .= $this->updateChange("\n1 CHAN");
834 'gedcom_id' => $this->tree->id(),
835 'xref' => $this->xref,
842 $this->pending = $new_gedcom;
847 $pending_changes_service->acceptRecord($this);
848 $this->gedcom = $new_gedcom;
849 $this->pending = null;
853 $this->facts = $this->parseFacts();
876 $gedcom = strtr($gedcom, [$match[0] => $this->updateChange($match[0])]);
878 $gedcom .= $this->updateChange("\n1 CHAN");
884 'gedcom_id' => $this->tree->id(),
885 'xref' => $this->xref,
886 'old_gedcom' => $this->gedcom(),
893 $this->pending = $gedcom;
899 $pending_changes_service->acceptRecord($this);
900 $this->gedcom = $gedcom;
901 $this->pending = null;
904 $this->facts = $this->parseFacts();
906 Log::addEditLog('Update: ' . static::RECORD_TYPE . ' ' . $this->xref, $this->tree);
917 if (!$this->isPendingDeletion()) {
919 'gedcom_id' => $this->tree->id(),
920 'xref' => $this->xref,
921 'old_gedcom' => $this->gedcom(),
931 $pending_changes_service->acceptRecord($this);
934 Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref, $this->tree);
949 foreach ($this->facts() as $fact) {
951 $this->deleteFact($fact->id(), $update_chan);
959 $this->updateFact($fact->id(), $gedcom, $update_chan);
973 $fact_privacy = $this->tree->getFactPrivacy();
996 $this->getAllNames[] = [
1030 $this->addName('_MARNM', $match[2], $fact->gedcom());
1032 $this->addName($match[1], $match[2], $fact->gedcom());
1037 $this->addName($submatch[1], $submatch[2], $match[3]);
1054 if ($this->gedcom !== '') {
1055 $gedcom_facts = preg_split('/\n(?=1)/', $this->gedcom);
1060 if ($this->pending !== null && $this->pending !== '') {
1061 $pending_facts = preg_split('/\n(?=1)/', $this->pending);
1070 $fact = new Fact($gedcom_fact, $this, md5($gedcom_fact));
1071 if ($this->pending !== null && !in_array($gedcom_fact, $pending_facts, true)) {
1078 $fact = new Fact($pending_fact, $this, md5($pending_fact));
1097 if (!$this->tree->getPreference('HIDE_LIVE_PEOPLE')) {
1102 …f ($this->xref() === $this->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT…
1108 if (preg_match('/\n1 RESN (.+)/', $this->gedcom(), $match)) {
1124 $individual_privacy = $this->tree->getIndividualPrivacy();
1125 if (isset($individual_privacy[$this->xref()])) {
1126 return $individual_privacy[$this->xref()] >= $access_level;
1135 return $this->canShowByType($access_level);
1144 ->where('o_file', '=', $this->tree->id())
1145 ->where('o_id', '=', $this->xref())