diff options
| author | Greg Roach <fisharebest@gmail.com> | 2013-08-09 06:57:36 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2013-08-09 06:57:36 +0100 |
| commit | 7cfc9f7da10957bfa6bf513dabecb6e95dc9eab0 (patch) | |
| tree | d8ebb9a8806e880631deba57bab8c0e3f5c4af9e /modules_v3 | |
| parent | 85c99731cac862ed79b9fa5effa0cac7f80c18b8 (diff) | |
| download | webtrees-7cfc9f7da10957bfa6bf513dabecb6e95dc9eab0.tar.gz webtrees-7cfc9f7da10957bfa6bf513dabecb6e95dc9eab0.tar.bz2 webtrees-7cfc9f7da10957bfa6bf513dabecb6e95dc9eab0.zip | |
Replace linkMedia() / unlinkMedia()
Diffstat (limited to 'modules_v3')
| -rw-r--r-- | modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php index a8a4d82e88..511858909e 100644 --- a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php +++ b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php @@ -605,41 +605,16 @@ function shiftlinks() { // Unlink records indicated by radio button ========= if ($exist_links) { foreach (explode(',', $exist_links) as $remLinkId) { - unlinkMedia($remLinkId, 'OBJE', $mediaid, 1, $update_CHAN!='no_change'); + $indi = WT_Individual::getInstance($remLinkId); + $indi->removeLinks($media_id, $update_CHAN!='no_change'); } } // Add new Links ==================================== if ($more_links) { foreach (explode(',', $more_links) as $addLinkId) { - linkMedia($mediaid, $addLinkId, 1, $update_CHAN!='no_change'); + $indi = WT_Individual::getInstance($addLinkId); + $indi->createFact('1 OBJE @' . $addLinkId . '@', $update_CHAN!='no_change'); } } $controller->addInlineJavascript('closePopupAndReloadParent();'); } - -/** -* unLink Media ID to Indi, Family, or Source ID -* -* @param string $mediaid Media ID to be unlinked. -* @param string $linktoid Indi, Family, or Source ID that the Media ID should be unlinked from. -* @param $linenum should be ALWAYS set to 'OBJE'. -* @param int $level Level where the Media Object reference should be removed from (not used) -* @param boolean $chan Whether or not to update/add the CHAN record -* -* @return bool success or failure -*/ -function unlinkMedia($linktoid, $linenum, $mediaid, $level=1, $chan=true) { - if (empty($level)) $level = 1; - if ($level!=1) return false; // Level 2 items get unlinked elsewhere (maybe ??) - // find Indi, Family, or Source record to unlink from - $gedrec = find_gedcom_record($linktoid, WT_GED_ID, true); - - //-- when deleting/unlinking a media link - //-- $linenum comes as an OBJE and the $mediaid to delete should be set - if (!is_numeric($linenum)) { - $newged = remove_media_subrecord($gedrec, $mediaid); - } else { - $newged = remove_subline($gedrec, $linenum); - } - replace_gedrec($linktoid, WT_GED_ID, $newged, $chan); -} |
