'; // echo ''; echo ''; if (!empty($mediaid)) { echo ''; } if (!empty($linktoid)) { echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } if (!isset($linktoid)) { $linktoid = ""; } echo ''; // Admin Option CHAN log update override ======================= if (WT_USER_IS_ADMIN) { echo "\n"; } echo ''; echo ''; echo ''; echo ''; echo ''; require 'modules/GEDFact_assistant/_MEDIA/media_7_parse_addLinksTbl.php'; echo '
'; echo i18n::translate('Link media'), ' ', $toitems, help_link('add_media_linkid'); echo '
', i18n::translate('Media ID'), ''; if (!empty($mediaid)) { //-- Get the title of this existing Media item $title= WT_DB::prepare("SELECT m_titl FROM `##media` where m_media=? AND m_gedfile=?") ->execute(array($mediaid, WT_GED_ID)) ->fetchOne(); if ($title) { echo '', PrintReady($title), '   '; if ($TEXT_DIRECTION=="rtl") echo getRLM(); echo '(', $mediaid, ')'; if ($TEXT_DIRECTION=="rtl") echo getRLM(); } else { echo '', $mediaid, ''; } echo '
'; //-- Get the filename of this existing Media item $filename= WT_DB::prepare("SELECT m_file FROM `##media` where m_media=? AND m_gedfile=?") ->execute(array($mediaid, WT_GED_ID)) ->fetchOne(); $filename = str_replace(" ", "%20", $filename); $thumbnail = thumbnail_file($filename, false); echo ''; echo '
'; echo '
', i18n::translate('Links'), ''; require 'modules/GEDFact_assistant/_MEDIA/media_query_1a.php'; echo '
'; echo i18n::translate('Add links'); echo ''; if ($linktoid=="") { // ---- } else { $record=Person::getInstance($linktoid); echo '', PrintReady($record->getFullName()), '   '; if ($TEXT_DIRECTION=="rtl") print getRLM(); echo '(', $linktoid, ')'; if ($TEXT_DIRECTION=="rtl") print getRLM(); } echo '
'; print ""; // echo ' Enter Name or ID       OR      Search for ID '; echo ''; echo ' '; if (isset($WT_IMAGES["add"])) { echo '', i18n::translate('Add'), ' '; } else { echo ''; } echo '    '; print_findindi_link("gid", ""); echo ' '; print_findfamily_link("gid"); echo ' '; print_findsource_link("gid"); echo '
'; print "" . i18n::translate('Enter or search for the ID of the person, family, or source to which this media item should be linked.') . ""; echo '

'; echo ''; require 'modules/GEDFact_assistant/_MEDIA/media_query_2a.php'; echo '
"; echo i18n::translate('Admin Option'), "\n"; if ($NO_UPDATE_CHAN) { echo "\n"; } else { echo "\n"; } echo i18n::translate('Do not update the CHAN (Last Change) records'), help_link('no_update_CHAN'), '

'; echo "
'; echo '
'; echo '
'; echo '
'; echo ''; echo '

', i18n::translate('Close Window'), '
'; // print_simple_footer(); } elseif ($action == "update" && $paramok) { echo "", $mediaid, "

"; // Unlink records indicated by radio button ========= if (isset($exist_links) && $exist_links!="No_Values") { $exist_links = substr($exist_links, 0, -1); $rem_exist_links = (explode(", ", $exist_links)); foreach ($rem_exist_links as $remLinkId) { global $linkToId; $linkToId = PrintReady($remLinkId); echo i18n::translate('Link to %s deleted', $remLinkId); echo '
'; if ($update_CHAN=='no_change') { unlinkMedia($remLinkId, 'OBJE', $mediaid, 1, false); } else { unlinkMedia($remLinkId, 'OBJE', $mediaid, 1, true); } } echo '
'; }else{ // echo nothing and do nothing } // Add new Links ==================================== if (isset($more_links) && $more_links!="No_Values" && $more_links!=",") { $more_links = substr($more_links, 0, -1); $add_more_links = (explode(", ", $more_links)); foreach ($add_more_links as $addLinkId) { global $unlinkFromId; $$unlinkFromId = PrintReady($addLinkId); echo i18n::translate('Link to %s added', $addLinkId); if ($update_CHAN=='no_change') { linkMedia($mediaid, $addLinkId, 1, false); } else { linkMedia($mediaid, $addLinkId, 1, true); } echo '
'; } echo '
'; }else if ($more_links==",") { // echo nothing and do nothing }else{ //echo $mediaid, $pgv_lang["media_now_linked to"], '(', $gid, ')
'; //linkMedia($mediaid, $gid); } if ($update_CHAN=='no_change') { echo i18n::translate('No CHAN (Last Change) records were updated'); echo '
'; } echo '

', i18n::translate('Close Window'), '
'; print_simple_footer(); } else { // echo '
You must be logged in as an Administrator
'; echo '

', i18n::translate('Close Window'), '
'; //print_simple_footer(); }