xref: /webtrees/app/Module/ClippingsCartModule.php (revision e284b8e10038aea71b40a71e3f350f701101e146)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roachnamespace Fisharebest\Webtrees;
38c2e8227SGreg Roach
48c2e8227SGreg Roach/**
58c2e8227SGreg Roach * webtrees: online genealogy
68c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team
78c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
88c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
98c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
108c2e8227SGreg Roach * (at your option) any later version.
118c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
128c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
138c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148c2e8227SGreg Roach * GNU General Public License for more details.
158c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
168c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
178c2e8227SGreg Roach */
188c2e8227SGreg Roach
198c2e8227SGreg Roachuse Zend_Session;
208c2e8227SGreg Roach
218c2e8227SGreg Roach/**
228c2e8227SGreg Roach * Class ClippingsCartModule
238c2e8227SGreg Roach */
248c2e8227SGreg Roachclass ClippingsCartModule extends Module implements ModuleMenuInterface, ModuleSidebarInterface {
258c2e8227SGreg Roach
268c2e8227SGreg Roach	/** {@inheritdoc} */
278c2e8227SGreg Roach	public function getTitle() {
288c2e8227SGreg Roach		return /* I18N: Name of a module */ I18N::translate('Clippings cart');
298c2e8227SGreg Roach	}
308c2e8227SGreg Roach
318c2e8227SGreg Roach	/** {@inheritdoc} */
328c2e8227SGreg Roach	public function getDescription() {
338c2e8227SGreg Roach		return /* I18N: Description of the “Clippings cart” module */ I18N::translate('Select records from your family tree and save them as a GEDCOM file.');
348c2e8227SGreg Roach	}
358c2e8227SGreg Roach
368c2e8227SGreg Roach	/** {@inheritdoc} */
378c2e8227SGreg Roach	public function defaultAccessLevel() {
384b9ff166SGreg Roach		return Auth::PRIV_USER;
398c2e8227SGreg Roach	}
408c2e8227SGreg Roach
418c2e8227SGreg Roach	/** {@inheritdoc} */
428c2e8227SGreg Roach	public function modAction($mod_action) {
438c2e8227SGreg Roach		switch ($mod_action) {
448c2e8227SGreg Roach		case 'ajax':
458c2e8227SGreg Roach			$html = $this->getSidebarAjaxContent();
468c2e8227SGreg Roach			Zend_Session::writeClose();
478c2e8227SGreg Roach			header('Content-Type: text/html; charset=UTF-8');
488c2e8227SGreg Roach			echo $html;
498c2e8227SGreg Roach			break;
508c2e8227SGreg Roach		case 'index':
518c2e8227SGreg Roach			global $controller, $WT_SESSION, $WT_TREE;
528c2e8227SGreg Roach
538c2e8227SGreg Roach			$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
548c2e8227SGreg Roach
558c2e8227SGreg Roach			$clip_ctrl = new ClippingsCart;
568c2e8227SGreg Roach
578c2e8227SGreg Roach			$controller = new PageController;
588c2e8227SGreg Roach			$controller
598c2e8227SGreg Roach				->setPageTitle($this->getTitle())
608c2e8227SGreg Roach				->PageHeader()
618c2e8227SGreg Roach				->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
628c2e8227SGreg Roach				->addInlineJavascript('autocomplete();');
638c2e8227SGreg Roach
648c2e8227SGreg Roach			echo '<script>';
658c2e8227SGreg Roach			echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
668c2e8227SGreg Roach			echo '</script>';
678c2e8227SGreg Roach
6824ec66ceSGreg Roach			if (!$WT_SESSION->cart[$WT_TREE->getTreeId()]) {
698c2e8227SGreg Roach				echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
708c2e8227SGreg Roach			}
718c2e8227SGreg Roach
728c2e8227SGreg Roach			if ($clip_ctrl->action == 'add') {
7324ec66ceSGreg Roach				$person = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
748c2e8227SGreg Roach				echo '<h3><a href="', $person->getHtmlUrl(), '">' . $person->getFullName(), '</a></h3>';
758c2e8227SGreg Roach				if ($clip_ctrl->type === 'FAM') { ?>
768c2e8227SGreg Roach					<form action="module.php" method="get">
778c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
788c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
798c2e8227SGreg Roach					<table>
808c2e8227SGreg Roach						<tr><td class="topbottombar"><?php echo I18N::translate('Which other links from this family would you like to add?'); ?>
818c2e8227SGreg Roach						<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
828c2e8227SGreg Roach						<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
838c2e8227SGreg Roach						<input type="hidden" name="action" value="add1"></td></tr>
848c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo I18N::translate('Add just this family record.'); ?></td></tr>
858c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo I18N::translate('Add parents’ records together with this family record.'); ?></td></tr>
868c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo I18N::translate('Add parents’ and children’s records together with this family record.'); ?></td></tr>
878c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="descendants"><?php echo I18N::translate('Add parents’ and all descendants’ records together with this family record.'); ?></td></tr>
888c2e8227SGreg Roach						<tr><td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('Continue adding'); ?>"></td></tr>
898c2e8227SGreg Roach
908c2e8227SGreg Roach					</table>
918c2e8227SGreg Roach					</form>
928c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
938c2e8227SGreg Roach					<form action="module.php" method="get">
948c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
958c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
968c2e8227SGreg Roach					<table>
978c2e8227SGreg Roach						<tr><td class="topbottombar"><?php echo I18N::translate('Which links from this individual would you also like to add?'); ?>
988c2e8227SGreg Roach						<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
998c2e8227SGreg Roach						<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
1008c2e8227SGreg Roach						<input type="hidden" name="action" value="add1"></td></tr>
1018c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo I18N::translate('Add just this individual.'); ?></td></tr>
1028c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo I18N::translate('Add this individual, his parents, and siblings.'); ?></td></tr>
1038c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors"><?php echo I18N::translate('Add this individual and his direct line ancestors.'); ?><br>
104*e284b8e1SGreg Roach							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo I18N::translate('Number of generations'); ?> <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');"></td></tr>
1058c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"><?php echo I18N::translate('Add this individual, his direct line ancestors, and their families.'); ?><br >
106*e284b8e1SGreg Roach							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo I18N::translate('Number of generations'); ?> <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');"></td></tr>
1078c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo I18N::translate('Add this individual, his spouse, and children.'); ?></td></tr>
1088c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants"><?php echo I18N::translate('Add this individual, his spouse, and all descendants.'); ?><br >
109*e284b8e1SGreg Roach							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo I18N::translate('Number of generations'); ?> <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');"></td></tr>
1108c2e8227SGreg Roach						<tr><td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('Continue adding'); ?>">
1118c2e8227SGreg Roach					</table>
1128c2e8227SGreg Roach					</form>
1138c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
1148c2e8227SGreg Roach					<form action="module.php" method="get">
1158c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
1168c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
1178c2e8227SGreg Roach					<table>
1188c2e8227SGreg Roach						<tr><td class="topbottombar"><?php echo I18N::translate('Which records linked to this source should be added?'); ?>
1198c2e8227SGreg Roach						<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
1208c2e8227SGreg Roach						<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
1218c2e8227SGreg Roach						<input type="hidden" name="action" value="add1"></td></tr>
1228c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo I18N::translate('Add just this source.'); ?></td></tr>
1238c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="linked"><?php echo I18N::translate('Add this source and families/individuals linked to it.'); ?></td></tr>
1248c2e8227SGreg Roach						<tr><td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('Continue adding'); ?>">
1258c2e8227SGreg Roach					</table>
1268c2e8227SGreg Roach					</form>
1278c2e8227SGreg Roach				<?php }
1288c2e8227SGreg Roach				}
1298c2e8227SGreg Roach
13024ec66ceSGreg Roach			if (!$WT_SESSION->cart[$WT_TREE->getTreeId()]) {
1318c2e8227SGreg Roach				if ($clip_ctrl->action != 'add') {
1328c2e8227SGreg Roach
1338c2e8227SGreg Roach					echo I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program.  The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple.  Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name.  There you will see the <b>Add to clippings cart</b> option.  When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link.  Follow the instructions and links.</li></ul>');
1348c2e8227SGreg Roach					?>
1358c2e8227SGreg Roach					<form method="get" name="addin" action="module.php">
1368c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
1378c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
1388c2e8227SGreg Roach					<table>
1398c2e8227SGreg Roach					<tr>
1408c2e8227SGreg Roach						<td colspan="2" class="topbottombar" style="text-align:center; ">
1418c2e8227SGreg Roach							<?php echo I18N::translate('Enter an individual, family, or source ID'); ?>
1428c2e8227SGreg Roach						</td>
1438c2e8227SGreg Roach					</tr>
1448c2e8227SGreg Roach					<tr>
1458c2e8227SGreg Roach						<td class="optionbox">
1468c2e8227SGreg Roach							<input type="hidden" name="action" value="add">
1478c2e8227SGreg Roach							<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
1488c2e8227SGreg Roach						</td>
1498c2e8227SGreg Roach						<td class="optionbox">
1508c2e8227SGreg Roach							<?php echo print_findindi_link('cart_item_id'); ?>
1518c2e8227SGreg Roach							<?php echo print_findfamily_link('cart_item_id'); ?>
1528c2e8227SGreg Roach							<?php echo print_findsource_link('cart_item_id', ''); ?>
1538c2e8227SGreg Roach							<input type="submit" value="<?php echo I18N::translate('Add'); ?>">
1548c2e8227SGreg Roach
1558c2e8227SGreg Roach						</td>
1568c2e8227SGreg Roach					</tr>
1578c2e8227SGreg Roach					</table>
1588c2e8227SGreg Roach					</form>
1598c2e8227SGreg Roach					<?php
1608c2e8227SGreg Roach				}
1618c2e8227SGreg Roach
1628c2e8227SGreg Roach				// -- end new lines
1638c2e8227SGreg Roach				echo I18N::translate('Your clippings cart is empty.');
1648c2e8227SGreg Roach			} else {
1658c2e8227SGreg Roach				// Keep track of the INDI from the parent page, otherwise it will
1668c2e8227SGreg Roach				// get lost after ajax updates
1678c2e8227SGreg Roach				$pid = Filter::get('pid', WT_REGEX_XREF);
1688c2e8227SGreg Roach
1698c2e8227SGreg Roach				if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') { ?>
1708c2e8227SGreg Roach					<table><tr><td class="width33" valign="top" rowspan="3">
1718c2e8227SGreg Roach					<form method="get" action="module.php">
1728c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
1738c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
1748c2e8227SGreg Roach					<input type="hidden" name="action" value="download">
1758c2e8227SGreg Roach					<input type="hidden" name="pid" value="<?php echo $pid; ?>">
1768c2e8227SGreg Roach					<table>
1778c2e8227SGreg Roach					<tr><td colspan="2" class="topbottombar"><h2><?php echo I18N::translate('Download'); ?></h2></td></tr>
1786fd6cde8SGreg Roach					<tr>
1796fd6cde8SGreg Roach						<td class="descriptionbox width50 wrap">
1806fd6cde8SGreg Roach							<?php echo I18N::translate('To reduce the size of the download, you can compress the data into a .ZIP file.  You will need to uncompress the .ZIP file before you can use it.'); ?>
1816fd6cde8SGreg Roach						</td>
1826fd6cde8SGreg Roach						<td class="optionbox wrap">
1836fd6cde8SGreg Roach							<input type="checkbox" name="Zip" value="yes">
1846fd6cde8SGreg Roach							<?php echo I18N::translate('Zip file(s)'); ?>
1856fd6cde8SGreg Roach						</td>
1866fd6cde8SGreg Roach					</tr>
1876fd6cde8SGreg Roach					<tr>
1886fd6cde8SGreg Roach						<td class="descriptionbox width50 wrap">
1896fd6cde8SGreg Roach							<?php echo I18N::translate('Include media (automatically zips files)'), help_link('include_media'); ?>
1906fd6cde8SGreg Roach						</td>
1918c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes"></td></tr>
1928c2e8227SGreg Roach
1934b9ff166SGreg Roach					<?php if (Auth::isManager($WT_TREE)) {	?>
1948c2e8227SGreg Roach						<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Apply privacy settings'), help_link('apply_privacy'); ?></td>
1958c2e8227SGreg Roach						<td class="optionbox">
1968c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="none" checked> <?php echo I18N::translate('None'); ?><br>
1978c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="gedadmin"> <?php echo I18N::translate('Manager'); ?><br>
1988c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="user"> <?php echo I18N::translate('Member'); ?><br>
1998c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?>
2008c2e8227SGreg Roach						</td></tr>
2014b9ff166SGreg Roach					<?php } elseif (Auth::isMember($WT_TREE)) { ?>
2028c2e8227SGreg Roach						<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Apply privacy settings'), help_link('apply_privacy'); ?></td>
2038c2e8227SGreg Roach						<td class="optionbox">
2048c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="user" checked> <?php echo I18N::translate('Member'); ?><br>
2058c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?>
2068c2e8227SGreg Roach						</td></tr>
2078c2e8227SGreg Roach					<?php } ?>
2088c2e8227SGreg Roach
2098c2e8227SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Convert from UTF-8 to ISO-8859-1'), help_link('utf8_ansi'); ?></td>
2108c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
2118c2e8227SGreg Roach
2128c2e8227SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Add the GEDCOM media path to filenames'), help_link('GEDCOM_MEDIA_PATH'); ?></td>
2138c2e8227SGreg Roach					<td class="optionbox">
2148c2e8227SGreg Roach						<input type="checkbox" name="conv_path" value="<?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?>">
2158c2e8227SGreg Roach						<span dir="auto"><?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?></span>
2168c2e8227SGreg Roach					</td></tr>
2178c2e8227SGreg Roach
2188c2e8227SGreg Roach					<tr><td class="topbottombar" colspan="2">
2198c2e8227SGreg Roach					<input type="submit" value="<?php echo I18N::translate('Download'); ?>">
2208c2e8227SGreg Roach					</form>
2218c2e8227SGreg Roach					</td></tr>
2228c2e8227SGreg Roach					</table>
2238c2e8227SGreg Roach					</td></tr>
2248c2e8227SGreg Roach					</table>
2258c2e8227SGreg Roach					<br>
2268c2e8227SGreg Roach
2278c2e8227SGreg Roach					<form method="get" name="addin" action="module.php">
2288c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
2298c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
2308c2e8227SGreg Roach					<table>
2318c2e8227SGreg Roach					<tr>
2328c2e8227SGreg Roach						<td colspan="2" class="topbottombar" style="text-align:center; ">
2338c2e8227SGreg Roach							<?php echo I18N::translate('Enter an individual, family, or source ID'); ?>
2348c2e8227SGreg Roach						</td>
2358c2e8227SGreg Roach					</tr>
2368c2e8227SGreg Roach					<tr>
2378c2e8227SGreg Roach						<td class="optionbox">
2388c2e8227SGreg Roach							<input type="hidden" name="action" value="add">
2398c2e8227SGreg Roach							<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
2408c2e8227SGreg Roach						</td>
2418c2e8227SGreg Roach						<td class="optionbox">
2428c2e8227SGreg Roach							<?php echo print_findindi_link('cart_item_id'); ?>
2438c2e8227SGreg Roach							<?php echo print_findfamily_link('cart_item_id'); ?>
2448c2e8227SGreg Roach							<?php echo print_findsource_link('cart_item_id'); ?>
2458c2e8227SGreg Roach							<input type="submit" value="<?php echo I18N::translate('Add'); ?>">
2468c2e8227SGreg Roach
2478c2e8227SGreg Roach						</td>
2488c2e8227SGreg Roach					</tr>
2498c2e8227SGreg Roach					</table>
2508c2e8227SGreg Roach					</form>
2518c2e8227SGreg Roach
2528c2e8227SGreg Roach
2538c2e8227SGreg Roach				<?php } ?>
2548c2e8227SGreg Roach				<br><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo I18N::translate('Empty the clippings cart'); ?></a>
2558c2e8227SGreg Roach				</td></tr>
2568c2e8227SGreg Roach
2578c2e8227SGreg Roach				<tr><td class="topbottombar"><h2><?php echo I18N::translate('Family tree clippings cart'); ?></h2></td></tr>
2588c2e8227SGreg Roach
2598c2e8227SGreg Roach				<tr><td valign="top">
2608c2e8227SGreg Roach				<table id="mycart" class="sortable list_table width100">
2618c2e8227SGreg Roach					<tr>
2628c2e8227SGreg Roach						<th class="list_label"><?php echo I18N::translate('Record'); ?></th>
2638c2e8227SGreg Roach						<th class="list_label"><?php echo I18N::translate('Remove'); ?></th>
2648c2e8227SGreg Roach					</tr>
2658c2e8227SGreg Roach			<?php
26624ec66ceSGreg Roach				foreach (array_keys($WT_SESSION->cart[$WT_TREE->getTreeId()]) as $xref) {
26724ec66ceSGreg Roach					$record = GedcomRecord::getInstance($xref, $WT_TREE);
2688c2e8227SGreg Roach					if ($record) {
2698c2e8227SGreg Roach						switch ($record::RECORD_TYPE) {
2708c2e8227SGreg Roach						case 'INDI': $icon = 'icon-indis'; break;
2718c2e8227SGreg Roach						case 'FAM':  $icon = 'icon-sfamily'; break;
2728c2e8227SGreg Roach						case 'SOUR': $icon = 'icon-source'; break;
2738c2e8227SGreg Roach						case 'REPO': $icon = 'icon-repository'; break;
2748c2e8227SGreg Roach						case 'NOTE': $icon = 'icon-note'; break;
2758c2e8227SGreg Roach						case 'OBJE': $icon = 'icon-media'; break;
2768c2e8227SGreg Roach						default:     $icon = 'icon-clippings'; break;
2778c2e8227SGreg Roach						}
2788c2e8227SGreg Roach						?>
2798c2e8227SGreg Roach						<tr><td class="list_value">
2808c2e8227SGreg Roach							<i class="<?php echo $icon; ?>"></i>
2818c2e8227SGreg Roach						<?php
2828c2e8227SGreg Roach						echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
2838c2e8227SGreg Roach						?>
2848c2e8227SGreg Roach						</td>
2858c2e8227SGreg Roach						<td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;id=<?php echo $xref; ?>" class="icon-remove" title="<?php echo I18N::translate('Remove'); ?>"></a></td>
2868c2e8227SGreg Roach					</tr>
2878c2e8227SGreg Roach					<?php
2888c2e8227SGreg Roach					}
2898c2e8227SGreg Roach				}
2908c2e8227SGreg Roach			?>
2918c2e8227SGreg Roach				</table>
2928c2e8227SGreg Roach				</td></tr></table>
2938c2e8227SGreg Roach			<?php
2948c2e8227SGreg Roach			}
2958c2e8227SGreg Roach			break;
2968c2e8227SGreg Roach		default:
2978c2e8227SGreg Roach			http_response_code(404);
2988c2e8227SGreg Roach			break;
2998c2e8227SGreg Roach		}
3008c2e8227SGreg Roach	}
3018c2e8227SGreg Roach
3028c2e8227SGreg Roach	/** {@inheritdoc} */
3038c2e8227SGreg Roach	public function defaultMenuOrder() {
3048c2e8227SGreg Roach		return 20;
3058c2e8227SGreg Roach	}
3068c2e8227SGreg Roach
3078c2e8227SGreg Roach	/** {@inheritdoc} */
3088c2e8227SGreg Roach	public function getMenu() {
3094b9ff166SGreg Roach		global $controller, $WT_TREE;
3108c2e8227SGreg Roach
3118c2e8227SGreg Roach		if (Auth::isSearchEngine()) {
3128c2e8227SGreg Roach			return null;
3138c2e8227SGreg Roach		}
3148c2e8227SGreg Roach		//-- main clippings menu item
3154b9ff166SGreg Roach		$menu = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings');
3168c2e8227SGreg Roach		if (isset($controller->record)) {
3174b9ff166SGreg Roach			$submenu = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippingscart');
3188c2e8227SGreg Roach			$menu->addSubmenu($submenu);
3198c2e8227SGreg Roach		}
3208c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
3218c2e8227SGreg Roach			$submenu = new Menu(I18N::translate('Add to clippings cart'), 'module.php?mod=clippings&amp;mod_action=index&amp;action=add&amp;id=' . $controller->record->getXref(), 'menu-clippingsadd');
3228c2e8227SGreg Roach			$menu->addSubmenu($submenu);
3238c2e8227SGreg Roach		}
3248c2e8227SGreg Roach		return $menu;
3258c2e8227SGreg Roach	}
3268c2e8227SGreg Roach
3278c2e8227SGreg Roach	/** {@inheritdoc} */
3288c2e8227SGreg Roach	public function defaultSidebarOrder() {
3298c2e8227SGreg Roach		return 60;
3308c2e8227SGreg Roach	}
3318c2e8227SGreg Roach
3328c2e8227SGreg Roach	/** {@inheritdoc} */
3338c2e8227SGreg Roach	public function hasSidebarContent() {
3348c2e8227SGreg Roach		if (Auth::isSearchEngine()) {
3358c2e8227SGreg Roach			return false;
3368c2e8227SGreg Roach		} else {
3378c2e8227SGreg Roach			// Creating a controller has the side effect of initialising the cart
3388c2e8227SGreg Roach			new ClippingsCart;
3398c2e8227SGreg Roach
3408c2e8227SGreg Roach			return true;
3418c2e8227SGreg Roach		}
3428c2e8227SGreg Roach	}
3438c2e8227SGreg Roach
3448c2e8227SGreg Roach	/** {@inheritdoc} */
3458c2e8227SGreg Roach	public function getSidebarContent() {
3468c2e8227SGreg Roach		global $controller;
3478c2e8227SGreg Roach
3488c2e8227SGreg Roach		$controller->addInlineJavascript('
3498c2e8227SGreg Roach				jQuery("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
3508c2e8227SGreg Roach					jQuery("#sb_clippings_content").load(this.href);
3518c2e8227SGreg Roach					return false;
3528c2e8227SGreg Roach				});
3538c2e8227SGreg Roach			');
3548c2e8227SGreg Roach
3558c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
3568c2e8227SGreg Roach	}
3578c2e8227SGreg Roach
3588c2e8227SGreg Roach	/** {@inheritdoc} */
3598c2e8227SGreg Roach	public function getSidebarAjaxContent() {
36024ec66ceSGreg Roach		global $WT_SESSION, $WT_TREE;
3618c2e8227SGreg Roach
3628c2e8227SGreg Roach		$clip_ctrl         = new ClippingsCart;
3638c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
3648c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
3658c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
3668c2e8227SGreg Roach		$others            = Filter::get('others');
3678c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
3688c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
3698c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
3708c2e8227SGreg Roach		if ($add) {
37124ec66ceSGreg Roach			$record = GedcomRecord::getInstance($add, $WT_TREE);
3728c2e8227SGreg Roach			if ($record) {
3738c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
3748c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
3758c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
3768c2e8227SGreg Roach			}
3778c2e8227SGreg Roach		} elseif ($add1) {
37824ec66ceSGreg Roach			$record = Individual::getInstance($add1, $WT_TREE);
3798c2e8227SGreg Roach			if ($record) {
3808c2e8227SGreg Roach				$clip_ctrl->id = $record->getXref();
3818c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
3828c2e8227SGreg Roach				if ($others == 'parents') {
3838c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
3848c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
3858c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
3868c2e8227SGreg Roach					}
3878c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
3888c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
3898c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
3908c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
3918c2e8227SGreg Roach				} elseif ($others == 'members') {
3928c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
3938c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
3948c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
3958c2e8227SGreg Roach					}
3968c2e8227SGreg Roach				} elseif ($others == 'descendants') {
3978c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
3988c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
3998c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
4008c2e8227SGreg Roach					}
4018c2e8227SGreg Roach				}
4028c2e8227SGreg Roach			}
4038c2e8227SGreg Roach		} elseif ($remove) {
40424ec66ceSGreg Roach			unset ($WT_SESSION->cart[$WT_TREE->getTreeId()][$remove]);
4058c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
40624ec66ceSGreg Roach			$WT_SESSION->cart[$WT_TREE->getTreeId()] = array();
4078c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
4088c2e8227SGreg Roach			return $this->downloadForm($clip_ctrl);
4098c2e8227SGreg Roach		}
4108c2e8227SGreg Roach		return $this->getCartList();
4118c2e8227SGreg Roach	}
4128c2e8227SGreg Roach
4138c2e8227SGreg Roach	/**
4148c2e8227SGreg Roach	 * A list for the side bar.
4158c2e8227SGreg Roach	 *
4168c2e8227SGreg Roach	 * @return string
4178c2e8227SGreg Roach	 */
4188c2e8227SGreg Roach	public function getCartList() {
41924ec66ceSGreg Roach		global $WT_SESSION, $WT_TREE;
4208c2e8227SGreg Roach
4218c2e8227SGreg Roach		// Keep track of the INDI from the parent page, otherwise it will
4228c2e8227SGreg Roach		// get lost after ajax updates
4238c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
4248c2e8227SGreg Roach
42524ec66ceSGreg Roach		if (!$WT_SESSION->cart[$WT_TREE->getTreeId()]) {
4268c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
4278c2e8227SGreg Roach		} else {
4288c2e8227SGreg Roach			$out = '<ul>';
42924ec66ceSGreg Roach			foreach (array_keys($WT_SESSION->cart[$WT_TREE->getTreeId()]) as $xref) {
43024ec66ceSGreg Roach				$record = GedcomRecord::getInstance($xref, $WT_TREE);
4318c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
4328c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
4338c2e8227SGreg Roach					case 'INDI':
4348c2e8227SGreg Roach						$icon = 'icon-indis';
4358c2e8227SGreg Roach						break;
4368c2e8227SGreg Roach					case 'FAM':
4378c2e8227SGreg Roach						$icon = 'icon-sfamily';
4388c2e8227SGreg Roach						break;
4398c2e8227SGreg Roach					}
4408c2e8227SGreg Roach					$out .= '<li>';
4418c2e8227SGreg Roach					if (!empty($icon)) {
4428c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
4438c2e8227SGreg Roach					}
4448c2e8227SGreg Roach					$out .= '<a href="' . $record->getHtmlUrl() . '">';
4458c2e8227SGreg Roach					if ($record instanceof Individual) {
4468c2e8227SGreg Roach						$out .= $record->getSexImage();
4478c2e8227SGreg Roach					}
4488c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
4498c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
4508c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
4518c2e8227SGreg Roach					}
4528c2e8227SGreg Roach					$out .= '</a>';
4538c2e8227SGreg Roach					$out .= '<a class="icon-remove remove_cart" href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;remove=' . $xref . '&amp;pid=' . $pid . '" title="' . I18N::translate('Remove') . '"></a>';
4548c2e8227SGreg Roach					$out .= '</li>';
4558c2e8227SGreg Roach				}
4568c2e8227SGreg Roach			}
4578c2e8227SGreg Roach			$out .= '</ul>';
4588c2e8227SGreg Roach		}
4598c2e8227SGreg Roach
46024ec66ceSGreg Roach		if ($WT_SESSION->cart[$WT_TREE->getTreeId()]) {
4618c2e8227SGreg Roach			$out .=
4628c2e8227SGreg Roach				'<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
4638c2e8227SGreg Roach				I18N::translate('Empty the clippings cart') .
4648c2e8227SGreg Roach				'</a>' .
4658c2e8227SGreg Roach				'<br>' .
4668c2e8227SGreg Roach				'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
4678c2e8227SGreg Roach				I18N::translate('Download') .
4688c2e8227SGreg Roach				'</a>';
4698c2e8227SGreg Roach		}
47024ec66ceSGreg Roach		$record = Individual::getInstance($pid, $WT_TREE);
47124ec66ceSGreg Roach		if ($record && !array_key_exists($record->getXref(), $WT_SESSION->cart[$WT_TREE->getTreeId()])) {
4728c2e8227SGreg Roach			$out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;add=' . $pid . '&amp;pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>';
4738c2e8227SGreg Roach		}
4748c2e8227SGreg Roach		return $out;
4758c2e8227SGreg Roach	}
4768c2e8227SGreg Roach
4778c2e8227SGreg Roach	/**
4788c2e8227SGreg Roach	 * @param Individual $person
4798c2e8227SGreg Roach	 *
4808c2e8227SGreg Roach	 * @return string
4818c2e8227SGreg Roach	 */
4828c2e8227SGreg Roach	public function askAddOptions(Individual $person) {
4838c2e8227SGreg Roach		$MAX_PEDIGREE_GENERATIONS = $person->getTree()->getPreference('MAX_PEDIGREE_GENERATIONS');
4848c2e8227SGreg Roach
4858c2e8227SGreg Roach		$out = '<h3><a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a></h3>';
4868c2e8227SGreg Roach		$out .= '<script>';
4878c2e8227SGreg Roach		$out .= 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}
4888c2e8227SGreg Roach			function continueAjax(frm) {
4898c2e8227SGreg Roach				var others = jQuery("input[name=\'others\']:checked").val();
4908c2e8227SGreg Roach				var link = "module.php?mod='.$this->getName() . '&mod_action=ajax&sb_action=clippings&add1="+frm.pid.value+"&others="+others+"&level1="+frm.level1.value+"&level2="+frm.level2.value+"&level3="+frm.level3.value;
4918c2e8227SGreg Roach				jQuery("#sb_clippings_content").load(link);
4928c2e8227SGreg Roach			}';
4938c2e8227SGreg Roach		$out .= '</script>';
4948c2e8227SGreg Roach		if ($person instanceof Family) {
4958c2e8227SGreg Roach			$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
4968c2e8227SGreg Roach			<input type="hidden" name="mod" value="clippings">
4978c2e8227SGreg Roach			<input type="hidden" name="mod_action" value="index">
4988c2e8227SGreg Roach			<table>
4998c2e8227SGreg Roach			<tr><td class="topbottombar">' . I18N::translate('Which other links from this family would you like to add?') . '
5008c2e8227SGreg Roach			<input type="hidden" name="pid" value="'.$person->getXref() . '">
5018c2e8227SGreg Roach			<input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
5028c2e8227SGreg Roach			<input type="hidden" name="action" value="add1"></td></tr>
5038c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" checked value="none">'. I18N::translate('Add just this family record.') . '</td></tr>
5048c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" value="parents">'. I18N::translate('Add parents’ records together with this family record.') . '</td></tr>
5058c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" value="members">'. I18N::translate('Add parents’ and children’s records together with this family record.') . '</td></tr>
5068c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" value="descendants">'. I18N::translate('Add parents’ and all descendants’ records together with this family record.') . '</td></tr>
5078c2e8227SGreg Roach			<tr><td class="topbottombar"><input type="submit" value="'. I18N::translate('Continue adding') . '"></td></tr>
5088c2e8227SGreg Roach			</table>
5098c2e8227SGreg Roach			</form>';
5108c2e8227SGreg Roach		} elseif ($person instanceof Individual) {
5118c2e8227SGreg Roach			$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
5128c2e8227SGreg Roach			<input type="hidden" name="mod" value="clippings">
5138c2e8227SGreg Roach			<input type="hidden" name="mod_action" value="index">
5148c2e8227SGreg Roach		' . I18N::translate('Which links from this individual would you also like to add?') . '
5158c2e8227SGreg Roach		<input type="hidden" name="pid" value="'.$person->getXref() . '">
5168c2e8227SGreg Roach		<input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
5178c2e8227SGreg Roach		<input type="hidden" name="action" value="add1">
5188c2e8227SGreg Roach		<ul>
5198c2e8227SGreg Roach		<li><input type="radio" name="others" checked value="none">'. I18N::translate('Add just this individual.') . '</li>
5208c2e8227SGreg Roach		<li><input type="radio" name="others" value="parents">'. I18N::translate('Add this individual, his parents, and siblings.') . '</li>
5218c2e8227SGreg Roach		<li><input type="radio" name="others" value="ancestors" id="ancestors">'. I18N::translate('Add this individual and his direct line ancestors.') . '<br>
522*e284b8e1SGreg Roach				'. I18N::translate('Number of generations') . '<input type="text" size="4" name="level1" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'ancestors\');"></li>
5238c2e8227SGreg Roach		<li><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">'. I18N::translate('Add this individual, his direct line ancestors, and their families.') . '<br>
524*e284b8e1SGreg Roach				'. I18N::translate('Number of generations') . ' <input type="text" size="4" name="level2" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'ancestorsfamilies\');"></li>
5258c2e8227SGreg Roach		<li><input type="radio" name="others" value="members">'. I18N::translate('Add this individual, his spouse, and children.') . '</li>
5268c2e8227SGreg Roach		<li><input type="radio" name="others" value="descendants" id="descendants">'. I18N::translate('Add this individual, his spouse, and all descendants.') . '<br >
527*e284b8e1SGreg Roach				'. I18N::translate('Number of generations') . ' <input type="text" size="4" name="level3" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'descendants\');"></li>
5288c2e8227SGreg Roach		</ul>
5298c2e8227SGreg Roach		<input type="submit" value="'. I18N::translate('Continue adding') . '">
5308c2e8227SGreg Roach		</form>';
5318c2e8227SGreg Roach		} else if ($person instanceof Source) {
5328c2e8227SGreg Roach			$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
5338c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
5348c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
5358c2e8227SGreg Roach		<table>
5368c2e8227SGreg Roach		<tr><td class="topbottombar">' . I18N::translate('Which records linked to this source should be added?') . '
5378c2e8227SGreg Roach		<input type="hidden" name="pid" value="'.$person->getXref() . '">
5388c2e8227SGreg Roach		<input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
5398c2e8227SGreg Roach		<input type="hidden" name="action" value="add1"></td></tr>
5408c2e8227SGreg Roach		<tr><td class="optionbox"><input type="radio" name="others" checked value="none">'. I18N::translate('Add just this source.') . '</td></tr>
5418c2e8227SGreg Roach		<tr><td class="optionbox"><input type="radio" name="others" value="linked">'. I18N::translate('Add this source and families/individuals linked to it.') . '</td></tr>
5428c2e8227SGreg Roach		<tr><td class="topbottombar"><input type="submit" value="'. I18N::translate('Continue adding') . '">
5438c2e8227SGreg Roach		</table>
5448c2e8227SGreg Roach		</form>';
5458c2e8227SGreg Roach		} else {
5468c2e8227SGreg Roach			return $this->getSidebarContent();
5478c2e8227SGreg Roach		}
5488c2e8227SGreg Roach		return $out;
5498c2e8227SGreg Roach	}
5508c2e8227SGreg Roach
5518c2e8227SGreg Roach	/**
5528c2e8227SGreg Roach	 * @param ClippingsCart $clip_ctrl
5538c2e8227SGreg Roach	 *
5548c2e8227SGreg Roach	 * @return string
5558c2e8227SGreg Roach	 */
5568c2e8227SGreg Roach	public function downloadForm(ClippingsCart $clip_ctrl) {
5578c2e8227SGreg Roach		global $WT_TREE;
5588c2e8227SGreg Roach
5598c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
5608c2e8227SGreg Roach
5618c2e8227SGreg Roach		$out = '<script>';
5628c2e8227SGreg Roach		$out .= 'function cancelDownload() {
5638c2e8227SGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '";
5648c2e8227SGreg Roach				jQuery("#sb_clippings_content").load(link);
5658c2e8227SGreg Roach			}';
5668c2e8227SGreg Roach		$out .= '</script>';
5678c2e8227SGreg Roach		$out .= '<form method="get" action="module.php">
5688c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
5698c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
5708c2e8227SGreg Roach		<input type="hidden" name="pid" value="' .$pid . '">
5718c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
5728c2e8227SGreg Roach		<table>
5738c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>'. I18N::translate('Download') . '</h2></td></tr>
5746fd6cde8SGreg Roach		<tr><td class="descriptionbox width50 wrap">'. I18N::translate('Zip file(s)') . '</td>
5758c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
5768c2e8227SGreg Roach
5778c2e8227SGreg Roach		<tr><td class="descriptionbox width50 wrap">'. I18N::translate('Include media (automatically zips files)') . help_link('include_media') . '</td>
5788c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
5798c2e8227SGreg Roach		';
5808c2e8227SGreg Roach
5814b9ff166SGreg Roach		if (Auth::isManager($WT_TREE)) {
5828c2e8227SGreg Roach			$out .=
5838c2e8227SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . help_link('apply_privacy') . '</td>' .
5848c2e8227SGreg Roach				'<td class="optionbox">' .
5858c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
5868c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
5878c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
5888c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
5898c2e8227SGreg Roach				'</td></tr>';
5904b9ff166SGreg Roach		} elseif (Auth::isMember($WT_TREE)) {
5918c2e8227SGreg Roach			$out .=
5928c2e8227SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . help_link('apply_privacy') . '</td>' .
5938c2e8227SGreg Roach				'<td class="list_value">' .
5948c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
5958c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
5968c2e8227SGreg Roach				'</td></tr>';
5978c2e8227SGreg Roach		}
5988c2e8227SGreg Roach
5998c2e8227SGreg Roach		$out .= '
6008c2e8227SGreg Roach		<tr><td class="descriptionbox width50 wrap">'. I18N::translate('Convert from UTF-8 to ISO-8859-1') . help_link('utf8_ansi') . '</td>
6018c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
6028c2e8227SGreg Roach
6038c2e8227SGreg Roach		<tr>
6048c2e8227SGreg Roach		<td class="descriptionbox width50 wrap">'. I18N::translate('Add the GEDCOM media path to filenames') . help_link('GEDCOM_MEDIA_PATH') . '</td>
6058c2e8227SGreg Roach		<td class="optionbox">
6068c2e8227SGreg Roach		<input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '">
6078c2e8227SGreg Roach		<span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td>
6088c2e8227SGreg Roach		</tr>
6098c2e8227SGreg Roach
6108c2e8227SGreg Roach		<input type="hidden" name="conv_path" value="'.$clip_ctrl->conv_path . '">
6118c2e8227SGreg Roach
6128c2e8227SGreg Roach		</td></tr>
6138c2e8227SGreg Roach
6148c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
6158c2e8227SGreg Roach		<input type="button" value="'. I18N::translate('Cancel') . '" onclick="cancelDownload();">
6168c2e8227SGreg Roach		<input type="submit" value="'. I18N::translate('Download') . '">
6178c2e8227SGreg Roach		</form>';
6188c2e8227SGreg Roach
6198c2e8227SGreg Roach		return $out;
6208c2e8227SGreg Roach	}
6218c2e8227SGreg Roach
6228c2e8227SGreg Roach}
623