diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2018-07-09 11:04:21 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2018-07-09 11:10:50 +0100 |
| commit | fcd878e25629b9f97a85e3406afb596b7367054f (patch) | |
| tree | e883490f84cf396655fcfdf3cc88d64c5f6f8faa | |
| parent | 9d0054414a826f828027efa711f08ee9e7c47ebe (diff) | |
| download | webtrees-fcd878e25629b9f97a85e3406afb596b7367054f.tar.gz webtrees-fcd878e25629b9f97a85e3406afb596b7367054f.tar.bz2 webtrees-fcd878e25629b9f97a85e3406afb596b7367054f.zip | |
Remove global
| -rw-r--r-- | app/Functions/FunctionsEdit.php | 145 | ||||
| -rw-r--r-- | edit_interface.php | 18 | ||||
| -rw-r--r-- | resources/views/cards/add-associate.php | 8 | ||||
| -rw-r--r-- | resources/views/cards/add-media-object.php | 2 | ||||
| -rw-r--r-- | resources/views/cards/add-note.php | 2 | ||||
| -rw-r--r-- | resources/views/cards/add-restriction.php | 2 | ||||
| -rw-r--r-- | resources/views/cards/add-shared-note.php | 2 | ||||
| -rw-r--r-- | resources/views/cards/add-source-citation.php | 16 | ||||
| -rw-r--r-- | resources/views/edit/new-individual.php | 24 |
9 files changed, 110 insertions, 109 deletions
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php index e96f0ed78b..f2fcd1825b 100644 --- a/app/Functions/FunctionsEdit.php +++ b/app/Functions/FunctionsEdit.php @@ -531,16 +531,17 @@ class FunctionsEdit { * tag[] : tag name * text[] : tag value * - * @param string $tag fact record to edit (eg 2 DATE xxxxx) - * @param string $upperlevel optional upper level tag (eg BIRT) - * @param string $label An optional label to echo instead of the default - * @param string $extra optional text to display after the input field - * @param Individual $person For male/female translations + * @param Tree $tree + * @param string $tag fact record to edit (eg 2 DATE xxxxx) + * @param string $upperlevel optional upper level tag (eg BIRT) + * @param string $label An optional label to echo instead of the default + * @param string $extra optional text to display after the input field + * @param Individual $person For male/female translations * * @return string */ - public static function addSimpleTag($tag, $upperlevel = '', $label = '', $extra = null, Individual $person = null) { - global $tags, $xref, $action, $WT_TREE; + public static function addSimpleTag(Tree $tree, $tag, $upperlevel = '', $label = '', $extra = null, Individual $person = null) { + global $tags, $xref, $action; // Some form fields need access to previous form fields. static $previous_ids = ['SOUR' => '', 'PLAC' => '']; @@ -641,7 +642,7 @@ class FunctionsEdit { // Show names for spouses in MARR/HUSB/AGE and MARR/WIFE/AGE if ($fact === 'HUSB' || $fact === 'WIFE') { - $family = Family::getInstance($xref, $WT_TREE); + $family = Family::getInstance($xref, $tree); if ($family) { $spouse_link = $family->getFirstFact($fact); if ($spouse_link) { @@ -663,7 +664,7 @@ class FunctionsEdit { /** @var CensusAssistantModule $census_assistant */ $census_assistant = Module::getModuleByName('GEDFact_assistant'); - $record = Individual::getInstance($xref, $WT_TREE); + $record = Individual::getInstance($xref, $tree); if ($census_assistant !== null && $record instanceof Individual) { $html .= $census_assistant->createCensusAssistant($record); } @@ -677,12 +678,12 @@ class FunctionsEdit { } elseif ($fact === 'ADOP') { $html .= Bootstrap4::select(GedcomCodeAdop::getValues($person), $value, ['id' => $id, 'name' => $name]); } elseif ($fact === 'ALIA') { - $html .= self::formControlIndividual($WT_TREE, Individual::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]); + $html .= self::formControlIndividual($tree, Individual::getInstance($value, $tree), ['id' => $id, 'name' => $name]); } elseif ($fact === 'ASSO' || $fact === '_ASSO') { $html .= '<div class="input-group">' . '<span class="input-group-btn"><button class="btn btn-secondary" type="button" onclick="createNewRecord(' . $id . ')" title="' . I18N::translate('Create an individual') . '"><i class="fas fa-plus"></i></button></span>' . - self::formControlIndividual($WT_TREE, Individual::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + self::formControlIndividual($tree, Individual::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; if ($level === '1') { $html .= '<p class="small text-muted">' . I18N::translate('An associate is another individual who was involved with this individual, such as a friend or an employer.') . '</p>'; @@ -704,7 +705,7 @@ class FunctionsEdit { $html .= '<div class="input-group">' . '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-target="#modal-create-family" data-element-id="' . $id . '" title="' . I18N::translate('Create a family') . '"><i class="fas fa-plus"></i></button></span>' . - self::formControlFamily($WT_TREE, Family::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + self::formControlFamily($tree, Family::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; } elseif ($fact === 'LATI') { $html .= '<input class="form-control" type="text" id="' . $id . '" name="' . $name . '" value="' . e($value) . '" oninput="valid_lati_long(this, \'N\', \'S\')">'; @@ -714,17 +715,17 @@ class FunctionsEdit { $html .= '<div class="input-group">' . '<span class="input-group-btn">' . - '<button class="btn btn-secondary" type="button" data-toggle="modal" data-target="#wt-ajax-modal" data-href="' . e(route('create-note-object', ['tree' => $WT_TREE->getName()])) . '" data-select-id="' . $id . '" title="' . I18N::translate('Create a shared note') . '">' . + '<button class="btn btn-secondary" type="button" data-toggle="modal" data-target="#wt-ajax-modal" data-href="' . e(route('create-note-object', ['tree' => $tree->getName()])) . '" data-select-id="' . $id . '" title="' . I18N::translate('Create a shared note') . '">' . '<i class="fas fa-plus"></i><' . '/button>' . '</span>' . - self::formControlNote($WT_TREE, Note::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + self::formControlNote($tree, Note::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; } elseif ($fact === 'OBJE') { $html .= '<div class="input-group">' . - '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-media-object', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a media object') . '"><i class="fas fa-plus"></i></button></span>' . - self::formControlMediaObject($WT_TREE, Media::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-media-object', ['tree' => $tree->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a media object') . '"><i class="fas fa-plus"></i></button></span>' . + self::formControlMediaObject($tree, Media::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; } elseif ($fact === 'PAGE') { $html .= '<input class="form-control" type="text" id="' . $id . '" name="' . $name . '" value="' . e($value) . '" data-autocomplete-type="PAGE" data-autocomplete-extra="#' . $previous_ids['SOUR'] . '">'; @@ -739,7 +740,7 @@ class FunctionsEdit { 'value' => $value, 'type' => 'text', 'data-autocomplete-url' => route('autocomplete-place', [ - 'ged' => $WT_TREE->getName(), + 'ged' => $tree->getName(), 'query' => 'QUERY', ]), ]) . '>'; @@ -756,8 +757,8 @@ class FunctionsEdit { } elseif ($fact === 'REPO') { $html .= '<div class="input-group">' . - '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-repository', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a repository') . '"><i class="fas fa-plus"></i></button></span>' . - self::formControlRepository($WT_TREE, Repository::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-repository', ['tree' => $tree->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a repository') . '"><i class="fas fa-plus"></i></button></span>' . + self::formControlRepository($tree, Repository::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; } elseif ($fact === 'RESN') { $html .= '<div class="input-group">'; @@ -773,16 +774,16 @@ class FunctionsEdit { } elseif ($fact === 'SOUR') { $html .= '<div class="input-group">' . - '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-source', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a source') . '"><i class="fas fa-plus"></i></button></span>' . - self::formControlSource($WT_TREE, Source::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-source', ['tree' => $tree->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a source') . '"><i class="fas fa-plus"></i></button></span>' . + self::formControlSource($tree, Source::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; } elseif ($fact === 'STAT') { $html .= Bootstrap4::select(GedcomCodeStat::statusNames($upperlevel), $value); } elseif ($fact === 'SUBM') { $html .= '<div class="input-group">' . - '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-submitter', ['tree' => $WT_TREE->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a submitter') . '"><i class="fas fa-plus"></i></button></span>' . - self::formControlSubmitter($WT_TREE, GedcomRecord::getInstance($value, $WT_TREE), ['id' => $id, 'name' => $name]) . + '<span class="input-group-btn"><button class="btn btn-secondary" type="button" data-toggle="modal" data-href="' . e(route('create-submitter', ['tree' => $tree->getName()])) . '" data-target="#wt-ajax-modal" data-select-id="' . $id . '" title="' . I18N::translate('Create a submitter') . '"><i class="fas fa-plus"></i></button></span>' . + self::formControlSubmitter($tree, GedcomRecord::getInstance($value, $tree), ['id' => $id, 'name' => $name]) . '</div>'; } elseif ($fact === 'TEMP') { $html .= Bootstrap4::select(FunctionsEdit::optionsTemples(), $value, ['id' => $id, 'name' => $name]); @@ -863,48 +864,48 @@ class FunctionsEdit { public static function addSimpleTags(Tree $tree, $fact) { // For new individuals, these facts default to "Y" if ($fact === 'MARR') { - echo self::addSimpleTag('0 ' . $fact . ' Y'); + echo self::addSimpleTag($tree, '0 ' . $fact . ' Y'); } else { - echo self::addSimpleTag('0 ' . $fact); + echo self::addSimpleTag($tree, '0 ' . $fact); } if (!in_array($fact, Config::nonDateFacts())) { - echo self::addSimpleTag('0 DATE', $fact, GedcomTag::getLabel($fact . ':DATE')); - echo self::addSimpleTag('0 RELI', $fact, GedcomTag::getLabel($fact . ':RELI')); + echo self::addSimpleTag($tree, '0 DATE', $fact, GedcomTag::getLabel($fact . ':DATE')); + echo self::addSimpleTag($tree, '0 RELI', $fact, GedcomTag::getLabel($fact . ':RELI')); } if (!in_array($fact, Config::nonPlaceFacts())) { - echo self::addSimpleTag('0 PLAC', $fact, GedcomTag::getLabel($fact . ':PLAC')); + echo self::addSimpleTag($tree, '0 PLAC', $fact, GedcomTag::getLabel($fact . ':PLAC')); if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('ADVANCED_PLAC_FACTS'), $match)) { foreach ($match[1] as $tag) { - echo self::addSimpleTag('0 ' . $tag, $fact, GedcomTag::getLabel($fact . ':PLAC:' . $tag)); + echo self::addSimpleTag($tree, '0 ' . $tag, $fact, GedcomTag::getLabel($fact . ':PLAC:' . $tag)); } } - echo self::addSimpleTag('0 MAP', $fact); - echo self::addSimpleTag('0 LATI', $fact); - echo self::addSimpleTag('0 LONG', $fact); + echo self::addSimpleTag($tree, '0 MAP', $fact); + echo self::addSimpleTag($tree, '0 LATI', $fact); + echo self::addSimpleTag($tree, '0 LONG', $fact); } } /** * Assemble the pieces of a newly created record into gedcom * + * @param Tree $tree + * * @return string */ - public static function addNewName() { - global $WT_TREE; - + public static function addNewName(Tree $tree) { $gedrec = "\n1 NAME " . Filter::post('NAME'); $tags = ['NPFX', 'GIVN', 'SPFX', 'SURN', 'NSFX']; - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('ADVANCED_NAME_FACTS'), $match)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('ADVANCED_NAME_FACTS'), $match)) { $tags = array_merge($tags, $match[1]); } // Paternal and Polish and Lithuanian surname traditions can also create a _MARNM - $SURNAME_TRADITION = $WT_TREE->getPreference('SURNAME_TRADITION'); + $SURNAME_TRADITION = $tree->getPreference('SURNAME_TRADITION'); if ($SURNAME_TRADITION === 'paternal' || $SURNAME_TRADITION === 'polish' || $SURNAME_TRADITION === 'lithuanian') { $tags[] = '_MARNM'; } @@ -1247,7 +1248,7 @@ class FunctionsEdit { // handle MARRiage TYPE if (substr($fact, 0, 5) === 'MARR_') { $tags[0] = 'MARR'; - echo self::addSimpleTag('1 MARR'); + echo self::addSimpleTag($tree, '1 MARR'); self::insertMissingSubtags($tree, $fact); } else { $tags[0] = $fact; @@ -1259,18 +1260,18 @@ class FunctionsEdit { $fact .= ' @'; } if (in_array($fact, Config::emptyFacts())) { - echo self::addSimpleTag('1 ' . $fact . ' Y'); + echo self::addSimpleTag($tree, '1 ' . $fact . ' Y'); } else { - echo self::addSimpleTag('1 ' . $fact); + echo self::addSimpleTag($tree, '1 ' . $fact); } self::insertMissingSubtags($tree, $tags[0]); //-- handle the special SOURce case for level 1 sources [ 1759246 ] if ($fact === 'SOUR') { - echo self::addSimpleTag('2 PAGE'); - echo self::addSimpleTag('3 TEXT'); + echo self::addSimpleTag($tree, '2 PAGE'); + echo self::addSimpleTag($tree, '3 TEXT'); if ($tree->getPreference('FULL_SOURCES')) { - echo self::addSimpleTag('3 DATE', '', GedcomTag::getLabel('DATA:DATE')); - echo self::addSimpleTag('2 QUAY'); + echo self::addSimpleTag($tree, '3 DATE', '', GedcomTag::getLabel('DATA:DATE')); + echo self::addSimpleTag($tree, '2 QUAY'); } } } @@ -1360,17 +1361,17 @@ class FunctionsEdit { $tags[] = $type; $subrecord = $level . ' ' . $type . ' ' . $text; if ($inSource && $type === 'DATE') { - echo self::addSimpleTag($subrecord, '', GedcomTag::getLabel($label, $record)); + echo self::addSimpleTag($tree, $subrecord, '', GedcomTag::getLabel($label, $record)); } elseif (!$inSource && $type === 'DATE') { - echo self::addSimpleTag($subrecord, $level1type, GedcomTag::getLabel($label, $record)); + echo self::addSimpleTag($tree, $subrecord, $level1type, GedcomTag::getLabel($label, $record)); if ($level === '2') { // We already have a date - no need to add one. $add_date = false; } } elseif ($type === 'STAT') { - echo self::addSimpleTag($subrecord, $level1type, GedcomTag::getLabel($label, $record)); + echo self::addSimpleTag($tree, $subrecord, $level1type, GedcomTag::getLabel($label, $record)); } else { - echo self::addSimpleTag($subrecord, $level0type, GedcomTag::getLabel($label, $record)); + echo self::addSimpleTag($tree, $subrecord, $level0type, GedcomTag::getLabel($label, $record)); } } @@ -1386,10 +1387,10 @@ class FunctionsEdit { if (!empty($expected_subtags[$type])) { foreach ($expected_subtags[$type] as $subtag) { if (!in_array($subtag, $subtags)) { - echo self::addSimpleTag(($level + 1) . ' ' . $subtag, '', GedcomTag::getLabel($label . ':' . $subtag)); + echo self::addSimpleTag($tree, ($level + 1) . ' ' . $subtag, '', GedcomTag::getLabel($label . ':' . $subtag)); if (!empty($expected_subtags[$subtag])) { foreach ($expected_subtags[$subtag] as $subsubtag) { - echo self::addSimpleTag(($level + 2) . ' ' . $subsubtag, '', GedcomTag::getLabel($label . ':' . $subtag . ':' . $subsubtag)); + echo self::addSimpleTag($tree, ($level + 2) . ' ' . $subsubtag, '', GedcomTag::getLabel($label . ':' . $subtag . ':' . $subsubtag)); } } } @@ -1441,74 +1442,74 @@ class FunctionsEdit { } if (in_array($level1tag, $value) && !in_array($key, $tags)) { if ($key === 'TYPE') { - echo self::addSimpleTag('2 TYPE ' . $type_val, $level1tag); + echo self::addSimpleTag($tree, '2 TYPE ' . $type_val, $level1tag); } elseif ($level1tag === '_TODO' && $key === 'DATE') { - echo self::addSimpleTag('2 ' . $key . ' ' . strtoupper(date('d M Y')), $level1tag); + echo self::addSimpleTag($tree, '2 ' . $key . ' ' . strtoupper(date('d M Y')), $level1tag); } elseif ($level1tag === '_TODO' && $key === '_WT_USER') { - echo self::addSimpleTag('2 ' . $key . ' ' . Auth::user()->getUserName(), $level1tag); + echo self::addSimpleTag($tree, '2 ' . $key . ' ' . Auth::user()->getUserName(), $level1tag); } elseif ($level1tag === 'NAME' && strstr($tree->getPreference('ADVANCED_NAME_FACTS'), $key) !== false) { - echo self::addSimpleTag('2 ' . $key, $level1tag); + echo self::addSimpleTag($tree, '2 ' . $key, $level1tag); } elseif ($level1tag !== 'NAME') { - echo self::addSimpleTag('2 ' . $key, $level1tag); + echo self::addSimpleTag($tree, '2 ' . $key, $level1tag); } // Add level 3/4 tags as appropriate switch ($key) { case 'PLAC': if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('ADVANCED_PLAC_FACTS'), $match)) { foreach ($match[1] as $tag) { - echo self::addSimpleTag('3 ' . $tag, '', GedcomTag::getLabel($level1tag . ':PLAC:' . $tag)); + echo self::addSimpleTag($tree, '3 ' . $tag, '', GedcomTag::getLabel($level1tag . ':PLAC:' . $tag)); } } - echo self::addSimpleTag('3 MAP'); - echo self::addSimpleTag('4 LATI'); - echo self::addSimpleTag('4 LONG'); + echo self::addSimpleTag($tree, '3 MAP'); + echo self::addSimpleTag($tree, '4 LATI'); + echo self::addSimpleTag($tree, '4 LONG'); break; case 'FILE': - echo self::addSimpleTag('3 FORM'); + echo self::addSimpleTag($tree, '3 FORM'); break; case 'EVEN': - echo self::addSimpleTag('3 DATE'); - echo self::addSimpleTag('3 PLAC'); + echo self::addSimpleTag($tree, '3 DATE'); + echo self::addSimpleTag($tree, '3 PLAC'); break; case 'STAT': if (GedcomCodeTemp::isTagLDS($level1tag)) { - echo self::addSimpleTag('3 DATE', '', GedcomTag::getLabel('STAT:DATE')); + echo self::addSimpleTag($tree, '3 DATE', '', GedcomTag::getLabel('STAT:DATE')); } break; case 'DATE': // TIME is NOT a valid 5.5.1 tag if (in_array($level1tag, Config::dateAndTime())) { - echo self::addSimpleTag('3 TIME'); + echo self::addSimpleTag($tree, '3 TIME'); } break; case 'HUSB': case 'WIFE': - echo self::addSimpleTag('3 AGE'); + echo self::addSimpleTag($tree, '3 AGE'); break; case 'FAMC': if ($level1tag === 'ADOP') { - echo self::addSimpleTag('3 ADOP BOTH'); + echo self::addSimpleTag($tree, '3 ADOP BOTH'); } break; } } elseif ($key === 'DATE' && $add_date) { - echo self::addSimpleTag('2 DATE', $level1tag, GedcomTag::getLabel($level1tag . ':DATE')); + echo self::addSimpleTag($tree, '2 DATE', $level1tag, GedcomTag::getLabel($level1tag . ':DATE')); } } // Do something (anything!) with unrecognized custom tags if (substr($level1tag, 0, 1) === '_' && $level1tag !== '_UID' && $level1tag !== '_PRIM' && $level1tag !== '_TODO') { foreach (['DATE', 'PLAC', 'ADDR', 'AGNC', 'TYPE', 'AGE'] as $tag) { if (!in_array($tag, $tags)) { - echo self::addSimpleTag('2 ' . $tag); + echo self::addSimpleTag($tree, '2 ' . $tag); if ($tag === 'PLAC') { if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('ADVANCED_PLAC_FACTS'), $match)) { foreach ($match[1] as $ptag) { - echo self::addSimpleTag('3 ' . $ptag, '', GedcomTag::getLabel($level1tag . ':PLAC:' . $ptag)); + echo self::addSimpleTag($tree, '3 ' . $ptag, '', GedcomTag::getLabel($level1tag . ':PLAC:' . $ptag)); } } - echo self::addSimpleTag('3 MAP'); - echo self::addSimpleTag('4 LATI'); - echo self::addSimpleTag('4 LONG'); + echo self::addSimpleTag($tree, '3 MAP'); + echo self::addSimpleTag($tree, '4 LATI'); + echo self::addSimpleTag($tree, '4 LONG'); } } } diff --git a/edit_interface.php b/edit_interface.php index 26d868d915..fa04088f43 100644 --- a/edit_interface.php +++ b/edit_interface.php @@ -355,7 +355,7 @@ case 'add_child_to_family_action': FunctionsEdit::splitSource(); $gedrec = '0 @REF@ INDI'; - $gedrec .= FunctionsEdit::addNewName(); + $gedrec .= FunctionsEdit::addNewName($tree); $gedrec .= FunctionsEdit::addNewSex(); if (preg_match_all('/([A-Z0-9_]+)/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { @@ -425,7 +425,7 @@ case 'add_child_to_individual_action': FunctionsEdit::splitSource(); // separate SOUR record from the rest $gedcom = '0 @NEW@ INDI'; - $gedcom .= FunctionsEdit::addNewName(); + $gedcom .= FunctionsEdit::addNewName($tree); $gedcom .= FunctionsEdit::addNewSex(); $gedcom .= "\n" . GedcomCodePedi::createNewFamcPedi($PEDI, $family->getXref()); if (preg_match_all('/([A-Z0-9_]+)/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { @@ -477,7 +477,7 @@ case 'add_parent_to_individual_action': FunctionsEdit::splitSource(); // separate SOUR record from the rest $gedcom = '0 @NEW@ INDI'; - $gedcom .= FunctionsEdit::addNewName(); + $gedcom .= FunctionsEdit::addNewName($tree); $gedcom .= FunctionsEdit::addNewSex(); if (preg_match_all('/([A-Z0-9_]+)/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { @@ -519,7 +519,7 @@ case 'add_unlinked_indi_action': FunctionsEdit::splitSource(); $gedrec = '0 @REF@ INDI'; - $gedrec .= FunctionsEdit::addNewName(); + $gedrec .= FunctionsEdit::addNewName($tree); $gedrec .= FunctionsEdit::addNewSex(); if (preg_match_all('/([A-Z0-9_]+)/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { @@ -558,7 +558,7 @@ case 'add_spouse_to_individual_action': FunctionsEdit::splitSource(); $indi_gedcom = '0 @REF@ INDI'; - $indi_gedcom .= FunctionsEdit::addNewName(); + $indi_gedcom .= FunctionsEdit::addNewName($tree); $indi_gedcom .= FunctionsEdit::addNewSex(); if (preg_match_all('/([A-Z0-9_]+)/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { @@ -620,7 +620,7 @@ case 'add_spouse_to_family_action': FunctionsEdit::splitSource(); // separate SOUR record from the rest $gedrec = '0 @REF@ INDI'; - $gedrec .= FunctionsEdit::addNewName(); + $gedrec .= FunctionsEdit::addNewName($tree); $gedrec .= FunctionsEdit::addNewSex(); if (preg_match_all('/([A-Z0-9_]+)/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { @@ -806,9 +806,9 @@ case 'linkspouse': </div> </div> - <?= FunctionsEdit::addSimpleTag('0 MARR Y') ?> - <?= FunctionsEdit::addSimpleTag('0 DATE', 'MARR') ?> - <?= FunctionsEdit::addSimpleTag('0 PLAC', 'MARR') ?> + <?= FunctionsEdit::addSimpleTag($tree, '0 MARR Y') ?> + <?= FunctionsEdit::addSimpleTag($tree, '0 DATE', 'MARR') ?> + <?= FunctionsEdit::addSimpleTag($tree, '0 PLAC', 'MARR') ?> <div class="row form-group"> <div class="col-sm-9 offset-sm-3"> diff --git a/resources/views/cards/add-associate.php b/resources/views/cards/add-associate.php index d4fd0de91a..07a1a4010c 100644 --- a/resources/views/cards/add-associate.php +++ b/resources/views/cards/add-associate.php @@ -9,9 +9,9 @@ </div> <div class="card-body collapse" id="<?= e($id) ?>"> - <?= FunctionsEdit::addSimpleTag($level . ' _ASSO @') ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' RELA') ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' NOTE') ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' SHARED_NOTE') ?> + <?= FunctionsEdit::addSimpleTag($tree, $level . ' _ASSO @') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' RELA') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' NOTE') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' SHARED_NOTE') ?> </div> </div> diff --git a/resources/views/cards/add-media-object.php b/resources/views/cards/add-media-object.php index af28d2f3f0..bca793aac3 100644 --- a/resources/views/cards/add-media-object.php +++ b/resources/views/cards/add-media-object.php @@ -9,6 +9,6 @@ </div> <div class="card-body collapse" id="add-media-object"> - <?= FunctionsEdit::addSimpleTag($level . ' OBJE') ?> + <?= FunctionsEdit::addSimpleTag($tree, $level . ' OBJE') ?> </div> </div> diff --git a/resources/views/cards/add-note.php b/resources/views/cards/add-note.php index d69931a872..42340ef7c8 100644 --- a/resources/views/cards/add-note.php +++ b/resources/views/cards/add-note.php @@ -9,6 +9,6 @@ </div> <div class="card-body collapse" id="add-note"> - <?= FunctionsEdit::addSimpleTag($level . ' NOTE') ?> + <?= FunctionsEdit::addSimpleTag($tree, $level . ' NOTE') ?> </div> </div> diff --git a/resources/views/cards/add-restriction.php b/resources/views/cards/add-restriction.php index d412321fba..ec71e9dbd6 100644 --- a/resources/views/cards/add-restriction.php +++ b/resources/views/cards/add-restriction.php @@ -9,6 +9,6 @@ </div> <div class="card-body collapse" id="add-restriction"> - <?= FunctionsEdit::addSimpleTag($level . ' RESN') ?> + <?= FunctionsEdit::addSimpleTag($tree, $level . ' RESN') ?> </div> </div> diff --git a/resources/views/cards/add-shared-note.php b/resources/views/cards/add-shared-note.php index 4fcbabd779..37a4504aa2 100644 --- a/resources/views/cards/add-shared-note.php +++ b/resources/views/cards/add-shared-note.php @@ -9,6 +9,6 @@ </div> <div class="card-body collapse" id="add-note-object"> - <?= FunctionsEdit::addSimpleTag($level . ' SHARED_NOTE') ?> + <?= FunctionsEdit::addSimpleTag($tree, $level . ' SHARED_NOTE') ?> </div> </div> diff --git a/resources/views/cards/add-source-citation.php b/resources/views/cards/add-source-citation.php index da3e1cc1a9..cf495345c8 100644 --- a/resources/views/cards/add-source-citation.php +++ b/resources/views/cards/add-source-citation.php @@ -10,7 +10,7 @@ </div> <div class="card-body collapse" id="add-source-citation"> - <?= FunctionsEdit::addSimpleTag($level . ' SOUR @') ?> + <?= FunctionsEdit::addSimpleTag($tree, $level . ' SOUR @') ?> <?php if ($level === 1): ?> <div class="row"> @@ -64,16 +64,16 @@ </div> <?php endif ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' PAGE') ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' DATA') ?> - <?= FunctionsEdit::addSimpleTag(($level + 2) . ' TEXT') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' PAGE') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' DATA') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 2) . ' TEXT') ?> <?php if ($full_citations): ?> - <?= FunctionsEdit::addSimpleTag(($level + 2) . ' DATE', '', I18N::translate('Date of entry in original source')) ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' QUAY') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 2) . ' DATE', '', I18N::translate('Date of entry in original source')) ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' QUAY') ?> <?php endif ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' OBJE') ?> - <?= FunctionsEdit::addSimpleTag(($level + 1) . ' SHARED_NOTE') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' OBJE') ?> + <?= FunctionsEdit::addSimpleTag($tree, ($level + 1) . ' SHARED_NOTE') ?> </div> </div> diff --git a/resources/views/edit/new-individual.php b/resources/views/edit/new-individual.php index e8c508780c..ac5bea7fda 100644 --- a/resources/views/edit/new-individual.php +++ b/resources/views/edit/new-individual.php @@ -140,14 +140,14 @@ $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR <?= csrf_field() ?> <?php if ($nextaction === 'add_child_to_family_action' || $nextaction === 'add_child_to_individual_action'): ?> - <?= FunctionsEdit::addSimpleTag('0 PEDI') ?> + <?= FunctionsEdit::addSimpleTag($tree, '0 PEDI') ?> <?php endif ?> <?php // First - standard name fields foreach ($name_fields as $tag => $value) { if (substr_compare($tag, '_', 0, 1) !== 0) { - echo FunctionsEdit::addSimpleTag('0 ' . $tag . ' ' . $value, '', '', null, $individual); + echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value, '', '', null, $individual); } } @@ -170,18 +170,18 @@ $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR // Edit existing tags, grouped together if (preg_match_all('/2 ' . $tag . ' (.+)/', $namerec, $match)) { foreach ($match[1] as $value) { - echo FunctionsEdit::addSimpleTag('2 ' . $tag . ' ' . $value, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); + echo FunctionsEdit::addSimpleTag($tree, '2 ' . $tag . ' ' . $value, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); if ($tag === '_MARNM') { preg_match_all('/\/([^\/]*)\//', $value, $matches); - echo FunctionsEdit::addSimpleTag('2 _MARNM_SURN ' . implode(',', $matches[1])); + echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); } } } // Allow a new tag to be entered if (!array_key_exists($tag, $name_fields)) { - echo FunctionsEdit::addSimpleTag('0 ' . $tag, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); + echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); if ($tag === '_MARNM') { - echo FunctionsEdit::addSimpleTag('0 _MARNM_SURN'); + echo FunctionsEdit::addSimpleTag($tree, '0 _MARNM_SURN'); } } } @@ -189,10 +189,10 @@ $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR // Third - new/existing custom name fields foreach ($name_fields as $tag => $value) { if (substr_compare($tag, '_', 0, 1) === 0) { - echo FunctionsEdit::addSimpleTag('0 ' . $tag . ' ' . $value); + echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value); if ($tag === '_MARNM') { preg_match_all('/\/([^\/]*)\//', $value, $matches); - echo FunctionsEdit::addSimpleTag('2 _MARNM_SURN ' . implode(',', $matches[1])); + echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); } } } @@ -219,7 +219,7 @@ $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR $text .= "\n" . $cmatch[1]; $i++; } - echo FunctionsEdit::addSimpleTag($level . ' ' . $type . ' ' . $text); + echo FunctionsEdit::addSimpleTag($tree, $level . ' ' . $type . ' ' . $text); } $tags[] = $type; $i++; @@ -238,11 +238,11 @@ $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR echo '</table><br><table class="table wt-facts-table">'; // 1 SEX if ($famtag === 'HUSB' || $gender === 'M') { - echo FunctionsEdit::addSimpleTag('0 SEX M'); + echo FunctionsEdit::addSimpleTag($tree, '0 SEX M'); } elseif ($famtag === 'WIFE' || $gender === 'F') { - echo FunctionsEdit::addSimpleTag('0 SEX F'); + echo FunctionsEdit::addSimpleTag($tree, '0 SEX F'); } else { - echo FunctionsEdit::addSimpleTag('0 SEX U'); + echo FunctionsEdit::addSimpleTag($tree, '0 SEX U'); } $bdm = 'BD'; if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { |
