xref: /webtrees/app/Module/ClippingsCartModule.php (revision 941edf23982c18977af54e5a4a909921c00e9712)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
48c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team
58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
88c2e8227SGreg Roach * (at your option) any later version.
98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128c2e8227SGreg Roach * GNU General Public License for more details.
138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
158c2e8227SGreg Roach */
1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
1776692c8bSGreg Roach
180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth;
190e62c4b8SGreg Roachuse Fisharebest\Webtrees\Controller\PageController;
200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Family;
210e62c4b8SGreg Roachuse Fisharebest\Webtrees\Filter;
223d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint;
230e62c4b8SGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
240e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
250e62c4b8SGreg Roachuse Fisharebest\Webtrees\Individual;
260e62c4b8SGreg Roachuse Fisharebest\Webtrees\Menu;
270e62c4b8SGreg Roachuse Fisharebest\Webtrees\Module\ClippingsCart\ClippingsCartController;
280e62c4b8SGreg Roachuse Fisharebest\Webtrees\Session;
298c2e8227SGreg Roach
308c2e8227SGreg Roach/**
318c2e8227SGreg Roach * Class ClippingsCartModule
328c2e8227SGreg Roach */
33e2a378d3SGreg Roachclass ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, ModuleSidebarInterface {
348c2e8227SGreg Roach	/** {@inheritdoc} */
358c2e8227SGreg Roach	public function getTitle() {
368c2e8227SGreg Roach		return /* I18N: Name of a module */ I18N::translate('Clippings cart');
378c2e8227SGreg Roach	}
388c2e8227SGreg Roach
398c2e8227SGreg Roach	/** {@inheritdoc} */
408c2e8227SGreg Roach	public function getDescription() {
418c2e8227SGreg Roach		return /* I18N: Description of the “Clippings cart” module */ I18N::translate('Select records from your family tree and save them as a GEDCOM file.');
428c2e8227SGreg Roach	}
438c2e8227SGreg Roach
440ee13198SGreg Roach	/**
450ee13198SGreg Roach	 * What is the default access level for this module?
460ee13198SGreg Roach	 *
470ee13198SGreg Roach	 * Some modules are aimed at admins or managers, and are not generally shown to users.
480ee13198SGreg Roach	 *
490ee13198SGreg Roach	 * @return int
500ee13198SGreg Roach	 */
518c2e8227SGreg Roach	public function defaultAccessLevel() {
524b9ff166SGreg Roach		return Auth::PRIV_USER;
538c2e8227SGreg Roach	}
548c2e8227SGreg Roach
5576692c8bSGreg Roach	/**
5676692c8bSGreg Roach	 * This is a general purpose hook, allowing modules to respond to routes
5776692c8bSGreg Roach	 * of the form module.php?mod=FOO&mod_action=BAR
5876692c8bSGreg Roach	 *
5976692c8bSGreg Roach	 * @param string $mod_action
6076692c8bSGreg Roach	 */
618c2e8227SGreg Roach	public function modAction($mod_action) {
628c2e8227SGreg Roach		switch ($mod_action) {
638c2e8227SGreg Roach		case 'ajax':
648c2e8227SGreg Roach			$html = $this->getSidebarAjaxContent();
658c2e8227SGreg Roach			header('Content-Type: text/html; charset=UTF-8');
668c2e8227SGreg Roach			echo $html;
678c2e8227SGreg Roach			break;
688c2e8227SGreg Roach		case 'index':
6931bc7874SGreg Roach			global $controller, $WT_TREE;
708c2e8227SGreg Roach
718c2e8227SGreg Roach			$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
728c2e8227SGreg Roach
730e62c4b8SGreg Roach			$clip_ctrl = new ClippingsCartController;
747bd2dc19SGreg Roach			$cart      = Session::get('cart');
758c2e8227SGreg Roach
768c2e8227SGreg Roach			$controller = new PageController;
778c2e8227SGreg Roach			$controller
788c2e8227SGreg Roach				->setPageTitle($this->getTitle())
798c2e8227SGreg Roach				->PageHeader()
808c2e8227SGreg Roach				->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
818c2e8227SGreg Roach				->addInlineJavascript('autocomplete();');
828c2e8227SGreg Roach
838c2e8227SGreg Roach			echo '<script>';
848c2e8227SGreg Roach			echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
858c2e8227SGreg Roach			echo '</script>';
868c2e8227SGreg Roach
8731bc7874SGreg Roach			if (!$cart[$WT_TREE->getTreeId()]) {
888c2e8227SGreg Roach				echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
898c2e8227SGreg Roach			}
908c2e8227SGreg Roach
918c2e8227SGreg Roach			if ($clip_ctrl->action == 'add') {
924e3c4966SGreg Roach				$record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
938c2e8227SGreg Roach				if ($clip_ctrl->type === 'FAM') { ?>
948c2e8227SGreg Roach				<form action="module.php" method="get">
958c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
968c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
978c2e8227SGreg Roach					<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
988c2e8227SGreg Roach					<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
994e3c4966SGreg Roach					<input type="hidden" name="action" value="add1">
1004e3c4966SGreg Roach					<table>
1014e3c4966SGreg Roach						<thead>
1024e3c4966SGreg Roach							<tr>
1034e3c4966SGreg Roach								<td class="topbottombar">
1044e3c4966SGreg Roach									<?php echo I18N::translate('Add to the clippings cart'); ?>
1054e3c4966SGreg Roach								</td>
1064e3c4966SGreg Roach							</tr>
1074e3c4966SGreg Roach						</thead>
1084e3c4966SGreg Roach						<tbody>
1094e3c4966SGreg Roach							<tr>
1104e3c4966SGreg Roach								<td class="optionbox">
1114e3c4966SGreg Roach									<input type="radio" name="others" value="parents">
1124e3c4966SGreg Roach									<?php echo $record->getFullName(); ?>
1134e3c4966SGreg Roach								</td>
1144e3c4966SGreg Roach							</tr>
1154e3c4966SGreg Roach							<tr>
1164e3c4966SGreg Roach								<td class="optionbox">
1174e3c4966SGreg Roach									<input type="radio" name="others" value="members" checked>
1184e3c4966SGreg Roach									<?php echo /* I18N: %s is a family (husband + wife) */ I18N::translate('%s and their children', $record->getFullName()); ?>
1194e3c4966SGreg Roach								</td>
1204e3c4966SGreg Roach							</tr>
1214e3c4966SGreg Roach							<tr>
1224e3c4966SGreg Roach								<td class="optionbox">
1234e3c4966SGreg Roach									<input type="radio" name="others" value="descendants">
1244e3c4966SGreg Roach									<?php echo /* I18N: %s is a family (husband + wife) */ I18N::translate('%s and their descendants', $record->getFullName()); ?>
1254e3c4966SGreg Roach								</td>
1264e3c4966SGreg Roach							</tr>
1274e3c4966SGreg Roach						</tbody>
1284e3c4966SGreg Roach						<tfoot>
1294e3c4966SGreg Roach							<tr>
1304e3c4966SGreg Roach								<td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('continue'); ?>">
1314e3c4966SGreg Roach								</td>
1324e3c4966SGreg Roach							</tr>
1334e3c4966SGreg Roach						</tfoot>
1348c2e8227SGreg Roach					</table>
1358c2e8227SGreg Roach				</form>
1368c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
1378c2e8227SGreg Roach				<form action="module.php" method="get">
1388c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
1398c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
1408c2e8227SGreg Roach					<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
1418c2e8227SGreg Roach					<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
1428c2e8227SGreg Roach					<input type="hidden" name="action" value="add1"></td></tr>
1434e3c4966SGreg Roach					<table>
1444e3c4966SGreg Roach						<thead>
1454e3c4966SGreg Roach							<tr>
1464e3c4966SGreg Roach								<td class="topbottombar">
1474e3c4966SGreg Roach									<?php echo I18N::translate('Add to the clippings cart'); ?>
1484e3c4966SGreg Roach								</td>
1494e3c4966SGreg Roach							</tr>
1504e3c4966SGreg Roach						</thead>
1514e3c4966SGreg Roach						<tbody>
1524e3c4966SGreg Roach							<tr>
1534e3c4966SGreg Roach								<td class="optionbox">
1544e3c4966SGreg Roach									<label>
1554e3c4966SGreg Roach										<input type="radio" name="others" checked value="none">
1564e3c4966SGreg Roach										<?php echo $record->getFullName(); ?>
1574e3c4966SGreg Roach									</label>
1584e3c4966SGreg Roach								</td>
1594e3c4966SGreg Roach							</tr>
1604e3c4966SGreg Roach							<tr>
1614e3c4966SGreg Roach								<td class="optionbox">
1624e3c4966SGreg Roach									<label>
1634e3c4966SGreg Roach										<input type="radio" name="others" value="parents">
1644e3c4966SGreg Roach										<?php
1654e3c4966SGreg Roach										if ($record->getSex() === 'F') {
1664e3c4966SGreg Roach											echo /* I18N: %s is a woman's name */ I18N::translate('%s, her parents and siblings', $record->getFullName());
1674e3c4966SGreg Roach										} else {
1684e3c4966SGreg Roach											echo /* I18N: %s is a man's name */ I18N::translate('%s, his parents and siblings', $record->getFullName());
1694e3c4966SGreg Roach										}
1704e3c4966SGreg Roach										?>
1714e3c4966SGreg Roach									</label>
1724e3c4966SGreg Roach								</td>
1734e3c4966SGreg Roach							</tr>
1744e3c4966SGreg Roach							<tr>
1754e3c4966SGreg Roach								<td class="optionbox">
1764e3c4966SGreg Roach									<label>
1774e3c4966SGreg Roach										<input type="radio" name="others" value="members">
1784e3c4966SGreg Roach										<?php
1794e3c4966SGreg Roach										if ($record->getSex() === 'F') {
1804e3c4966SGreg Roach											echo /* I18N: %s is a woman's name */ I18N::translate('%s, her spouses and children', $record->getFullName());
1814e3c4966SGreg Roach										} else {
1824e3c4966SGreg Roach											echo /* I18N: %s is a man's name */ I18N::translate('%s, his spouses and children', $record->getFullName());
1834e3c4966SGreg Roach										}
1844e3c4966SGreg Roach										?>
1854e3c4966SGreg Roach									</label>
1864e3c4966SGreg Roach								</td>
1874e3c4966SGreg Roach							</tr>
1884e3c4966SGreg Roach							<tr>
1894e3c4966SGreg Roach								<td class="optionbox">
1904e3c4966SGreg Roach									<label>
1914e3c4966SGreg Roach										<input type="radio" name="others" value="ancestors" id="ancestors">
1924e3c4966SGreg Roach										<?php
1934e3c4966SGreg Roach										if ($record->getSex() === 'F') {
1944e3c4966SGreg Roach										echo /* I18N: %s is a woman's name */ I18N::translate('%s and her ancestors', $record->getFullName());
1954e3c4966SGreg Roach										} else {
1964e3c4966SGreg Roach										echo /* I18N: %s is a man's name */ I18N::translate('%s and his ancestors', $record->getFullName());
1974e3c4966SGreg Roach										}
1984e3c4966SGreg Roach									?>
1994e3c4966SGreg Roach									</label>
2004e3c4966SGreg Roach									<br>
2014e3c4966SGreg Roach									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2024e3c4966SGreg Roach									<?php echo I18N::translate('Number of generations'); ?>
2034e3c4966SGreg Roach									<input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');">
2044e3c4966SGreg Roach								</td>
2054e3c4966SGreg Roach							</tr>
2064e3c4966SGreg Roach							<tr>
2074e3c4966SGreg Roach								<td class="optionbox">
2084e3c4966SGreg Roach									<label>
2094e3c4966SGreg Roach										<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
2104e3c4966SGreg Roach										<?php
2114e3c4966SGreg Roach										if ($record->getSex() === 'F') {
2124e3c4966SGreg Roach											echo /* I18N: %s is a woman's name */ I18N::translate('%s, her ancestors and their families', $record->getFullName());
2134e3c4966SGreg Roach										} else {
2144e3c4966SGreg Roach											echo /* I18N: %s is a man's name */ I18N::translate('%s, his ancestors and their families', $record->getFullName());
2154e3c4966SGreg Roach										}
2164e3c4966SGreg Roach										?>
2174e3c4966SGreg Roach									</label>
2184e3c4966SGreg Roach									<br >
2194e3c4966SGreg Roach									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2204e3c4966SGreg Roach									<?php echo I18N::translate('Number of generations'); ?>
2214e3c4966SGreg Roach									<input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');">
2224e3c4966SGreg Roach								</td>
2234e3c4966SGreg Roach							</tr>
2244e3c4966SGreg Roach							<tr>
2254e3c4966SGreg Roach								<td class="optionbox">
2264e3c4966SGreg Roach									<label>
2274e3c4966SGreg Roach										<input type="radio" name="others" value="descendants" id="descendants">
2284e3c4966SGreg Roach										<?php
2294e3c4966SGreg Roach										if ($record->getSex() === 'F') {
2304e3c4966SGreg Roach											echo /* I18N: %s is a woman's name */ I18N::translate('%s, her spouses and descendants', $record->getFullName());
2314e3c4966SGreg Roach										} else {
2324e3c4966SGreg Roach											echo /* I18N: %s is a man's name */ I18N::translate('%s, his spouses and descendants', $record->getFullName());
2334e3c4966SGreg Roach										}
2344e3c4966SGreg Roach										?>
2354e3c4966SGreg Roach									</label>
2364e3c4966SGreg Roach									<br >
2374e3c4966SGreg Roach									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2384e3c4966SGreg Roach									<?php echo I18N::translate('Number of generations'); ?>
2394e3c4966SGreg Roach									<input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');">
2404e3c4966SGreg Roach								</td>
2414e3c4966SGreg Roach							</tr>
2424e3c4966SGreg Roach						</tbody>
2434e3c4966SGreg Roach						<tfoot>
2444e3c4966SGreg Roach							<tr>
2454e3c4966SGreg Roach								<td class="topbottombar">
2464e3c4966SGreg Roach									<input type="submit" value="<?php echo I18N::translate('continue'); ?>">
2474e3c4966SGreg Roach								</td>
2484e3c4966SGreg Roach							</tr>
2494e3c4966SGreg Roach						</tfoot>
2508c2e8227SGreg Roach					</table>
2518c2e8227SGreg Roach				</form>
2528c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
2538c2e8227SGreg Roach				<form action="module.php" method="get">
2548c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
2558c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
2568c2e8227SGreg Roach					<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
2578c2e8227SGreg Roach					<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
2588c2e8227SGreg Roach					<input type="hidden" name="action" value="add1"></td></tr>
2594e3c4966SGreg Roach					<table>
2604e3c4966SGreg Roach						<thead>
2614e3c4966SGreg Roach							<tr>
2624e3c4966SGreg Roach								<td class="topbottombar">
2634e3c4966SGreg Roach									<?php echo I18N::translate('Add to the clippings cart'); ?>
2644e3c4966SGreg Roach								</td>
2654e3c4966SGreg Roach							</tr>
2664e3c4966SGreg Roach						</thead>
2674e3c4966SGreg Roach						<tbody>
2684e3c4966SGreg Roach							<tr>
2694e3c4966SGreg Roach								<td class="optionbox">
2704e3c4966SGreg Roach									<label>
2714e3c4966SGreg Roach										<input type="radio" name="others" checked value="none">
2724e3c4966SGreg Roach										<?php echo $record->getFullName(); ?>
2734e3c4966SGreg Roach									</label>
2744e3c4966SGreg Roach								</td>
2754e3c4966SGreg Roach							</tr>
2764e3c4966SGreg Roach							<tr>
2774e3c4966SGreg Roach								<td class="optionbox">
2784e3c4966SGreg Roach									<label>
2794e3c4966SGreg Roach										<input type="radio" name="others" value="linked">
2804e3c4966SGreg Roach										<?php echo /* I18N: %s is the name of a source */ I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?>
2814e3c4966SGreg Roach									</label>
2824e3c4966SGreg Roach								</td>
2834e3c4966SGreg Roach							</tr>
2844e3c4966SGreg Roach						</tbody>
2854e3c4966SGreg Roach						<tfoot>
2864e3c4966SGreg Roach							<tr>
2874e3c4966SGreg Roach								<td class="topbottombar">
2884e3c4966SGreg Roach									<input type="submit" value="<?php echo I18N::translate('continue'); ?>">
2894e3c4966SGreg Roach								</td>
2904e3c4966SGreg Roach							</tr>
2914e3c4966SGreg Roach						</tfoot>
2928c2e8227SGreg Roach					</table>
2938c2e8227SGreg Roach				</form>
2948c2e8227SGreg Roach				<?php }
2958c2e8227SGreg Roach				}
2968c2e8227SGreg Roach
29731bc7874SGreg Roach			if (!$cart[$WT_TREE->getTreeId()]) {
2988c2e8227SGreg Roach				if ($clip_ctrl->action != 'add') {
2998c2e8227SGreg 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>');
3008c2e8227SGreg Roach					?>
3018c2e8227SGreg Roach					<form method="get" name="addin" action="module.php">
3028c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
3038c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
3048c2e8227SGreg Roach						<table>
3054e3c4966SGreg Roach							<thead>
3068c2e8227SGreg Roach								<tr>
3074e3c4966SGreg Roach									<td colspan="2" class="topbottombar">
3084e3c4966SGreg Roach										<?php echo I18N::translate('Add to the clippings cart'); ?>
3098c2e8227SGreg Roach									</td>
3108c2e8227SGreg Roach								</tr>
3114e3c4966SGreg Roach							</thead>
3124e3c4966SGreg Roach							<tbody>
3138c2e8227SGreg Roach								<tr>
3148c2e8227SGreg Roach									<td class="optionbox">
3158c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
3168c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
3178c2e8227SGreg Roach									</td>
3188c2e8227SGreg Roach									<td class="optionbox">
3193d7a8a4cSGreg Roach										<?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?>
3203d7a8a4cSGreg Roach										<?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?>
3213d7a8a4cSGreg Roach										<?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?>
3228c2e8227SGreg Roach										<input type="submit" value="<?php echo I18N::translate('Add'); ?>">
3238c2e8227SGreg Roach									</td>
3248c2e8227SGreg Roach								</tr>
3254e3c4966SGreg Roach							</tbody>
3268c2e8227SGreg Roach						</table>
3278c2e8227SGreg Roach					</form>
3288c2e8227SGreg Roach					<?php
3298c2e8227SGreg Roach				}
3308c2e8227SGreg Roach
3318c2e8227SGreg Roach				// -- end new lines
3328c2e8227SGreg Roach				echo I18N::translate('Your clippings cart is empty.');
3338c2e8227SGreg Roach			} else {
3348c2e8227SGreg Roach				// Keep track of the INDI from the parent page, otherwise it will
3358c2e8227SGreg Roach				// get lost after ajax updates
3368c2e8227SGreg Roach				$pid = Filter::get('pid', WT_REGEX_XREF);
3378c2e8227SGreg Roach
3388c2e8227SGreg Roach				if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') { ?>
3398c2e8227SGreg Roach					<table><tr><td class="width33" valign="top" rowspan="3">
3408c2e8227SGreg Roach					<form method="get" action="module.php">
3418c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
3428c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
3438c2e8227SGreg Roach					<input type="hidden" name="action" value="download">
3448c2e8227SGreg Roach					<input type="hidden" name="pid" value="<?php echo $pid; ?>">
3458c2e8227SGreg Roach					<table>
3468c2e8227SGreg Roach					<tr><td colspan="2" class="topbottombar"><h2><?php echo I18N::translate('Download'); ?></h2></td></tr>
3476fd6cde8SGreg Roach					<tr>
3486fd6cde8SGreg Roach						<td class="descriptionbox width50 wrap">
3496fd6cde8SGreg 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.'); ?>
3506fd6cde8SGreg Roach						</td>
3516fd6cde8SGreg Roach						<td class="optionbox wrap">
3526fd6cde8SGreg Roach							<input type="checkbox" name="Zip" value="yes">
3536fd6cde8SGreg Roach							<?php echo I18N::translate('Zip file(s)'); ?>
3546fd6cde8SGreg Roach						</td>
3556fd6cde8SGreg Roach					</tr>
3566fd6cde8SGreg Roach					<tr>
3576fd6cde8SGreg Roach						<td class="descriptionbox width50 wrap">
358d1928687SGreg Roach							<?php echo I18N::translate('Include media (automatically zips files)'); ?>
3596fd6cde8SGreg Roach						</td>
3608c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes"></td></tr>
3618c2e8227SGreg Roach
3624b9ff166SGreg Roach					<?php if (Auth::isManager($WT_TREE)) {	?>
363d1928687SGreg Roach						<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Apply privacy settings'); ?></td>
3648c2e8227SGreg Roach						<td class="optionbox">
3658c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="none" checked> <?php echo I18N::translate('None'); ?><br>
3668c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="gedadmin"> <?php echo I18N::translate('Manager'); ?><br>
3678c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="user"> <?php echo I18N::translate('Member'); ?><br>
3688c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?>
3698c2e8227SGreg Roach						</td></tr>
3704b9ff166SGreg Roach					<?php } elseif (Auth::isMember($WT_TREE)) { ?>
371d1928687SGreg Roach						<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Apply privacy settings'); ?></td>
3728c2e8227SGreg Roach						<td class="optionbox">
3738c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="user" checked> <?php echo I18N::translate('Member'); ?><br>
3748c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?>
3758c2e8227SGreg Roach						</td></tr>
3768c2e8227SGreg Roach					<?php } ?>
3778c2e8227SGreg Roach
378d1928687SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Convert from UTF-8 to ISO-8859-1'); ?></td>
3798c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
3808c2e8227SGreg Roach
381d1928687SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Add the GEDCOM media path to filenames'); ?></td>
3828c2e8227SGreg Roach					<td class="optionbox">
3838c2e8227SGreg Roach						<input type="checkbox" name="conv_path" value="<?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?>">
3848c2e8227SGreg Roach						<span dir="auto"><?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?></span>
3858c2e8227SGreg Roach					</td></tr>
3868c2e8227SGreg Roach
3878c2e8227SGreg Roach					<tr><td class="topbottombar" colspan="2">
3888c2e8227SGreg Roach					<input type="submit" value="<?php echo I18N::translate('Download'); ?>">
3898c2e8227SGreg Roach					</form>
3908c2e8227SGreg Roach					</td></tr>
3918c2e8227SGreg Roach					</table>
3928c2e8227SGreg Roach					</td></tr>
3938c2e8227SGreg Roach					</table>
3948c2e8227SGreg Roach					<br>
3958c2e8227SGreg Roach
3968c2e8227SGreg Roach					<form method="get" name="addin" action="module.php">
3978c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3988c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3998c2e8227SGreg Roach						<table>
4004e3c4966SGreg Roach							<thead>
4018c2e8227SGreg Roach								<tr>
4028c2e8227SGreg Roach									<td colspan="2" class="topbottombar" style="text-align:center; ">
4034e3c4966SGreg Roach										<?php echo I18N::translate('Add to the clippings cart'); ?>
4048c2e8227SGreg Roach									</td>
4058c2e8227SGreg Roach								</tr>
4064e3c4966SGreg Roach							</thead>
4074e3c4966SGreg Roach							<tbody>
4088c2e8227SGreg Roach								<tr>
4098c2e8227SGreg Roach									<td class="optionbox">
4108c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
4118c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
4128c2e8227SGreg Roach									</td>
4138c2e8227SGreg Roach									<td class="optionbox">
4143d7a8a4cSGreg Roach										<?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?>
4153d7a8a4cSGreg Roach										<?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?>
4163d7a8a4cSGreg Roach										<?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?>
4178c2e8227SGreg Roach										<input type="submit" value="<?php echo I18N::translate('Add'); ?>">
4188c2e8227SGreg Roach									</td>
4198c2e8227SGreg Roach								</tr>
4204e3c4966SGreg Roach								</tbody>
4218c2e8227SGreg Roach						</table>
4228c2e8227SGreg Roach					</form>
4238c2e8227SGreg Roach
4248c2e8227SGreg Roach
4258c2e8227SGreg Roach				<?php } ?>
4268c2e8227SGreg Roach				<br><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo I18N::translate('Empty the clippings cart'); ?></a>
4278c2e8227SGreg Roach				</td></tr>
4288c2e8227SGreg Roach
4298c2e8227SGreg Roach				<tr><td class="topbottombar"><h2><?php echo I18N::translate('Family tree clippings cart'); ?></h2></td></tr>
4308c2e8227SGreg Roach
4318c2e8227SGreg Roach				<tr><td valign="top">
4328c2e8227SGreg Roach				<table id="mycart" class="sortable list_table width100">
4338c2e8227SGreg Roach					<tr>
4348c2e8227SGreg Roach						<th class="list_label"><?php echo I18N::translate('Record'); ?></th>
4358c2e8227SGreg Roach						<th class="list_label"><?php echo I18N::translate('Remove'); ?></th>
4368c2e8227SGreg Roach					</tr>
4378c2e8227SGreg Roach			<?php
43831bc7874SGreg Roach				foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
43924ec66ceSGreg Roach					$record = GedcomRecord::getInstance($xref, $WT_TREE);
4408c2e8227SGreg Roach					if ($record) {
4418c2e8227SGreg Roach						switch ($record::RECORD_TYPE) {
4428c2e8227SGreg Roach						case 'INDI': $icon = 'icon-indis'; break;
4438c2e8227SGreg Roach						case 'FAM':  $icon = 'icon-sfamily'; break;
4448c2e8227SGreg Roach						case 'SOUR': $icon = 'icon-source'; break;
4458c2e8227SGreg Roach						case 'REPO': $icon = 'icon-repository'; break;
4468c2e8227SGreg Roach						case 'NOTE': $icon = 'icon-note'; break;
4478c2e8227SGreg Roach						case 'OBJE': $icon = 'icon-media'; break;
4488c2e8227SGreg Roach						default:     $icon = 'icon-clippings'; break;
4498c2e8227SGreg Roach						}
4508c2e8227SGreg Roach						?>
4518c2e8227SGreg Roach						<tr><td class="list_value">
4528c2e8227SGreg Roach							<i class="<?php echo $icon; ?>"></i>
4538c2e8227SGreg Roach						<?php
4548c2e8227SGreg Roach						echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
4558c2e8227SGreg Roach						?>
4568c2e8227SGreg Roach						</td>
4578c2e8227SGreg 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>
4588c2e8227SGreg Roach					</tr>
4598c2e8227SGreg Roach					<?php
4608c2e8227SGreg Roach					}
4618c2e8227SGreg Roach				}
4628c2e8227SGreg Roach			?>
4638c2e8227SGreg Roach				</table>
4648c2e8227SGreg Roach				</td></tr></table>
4658c2e8227SGreg Roach			<?php
4668c2e8227SGreg Roach			}
4678c2e8227SGreg Roach			break;
4688c2e8227SGreg Roach		default:
4698c2e8227SGreg Roach			http_response_code(404);
4708c2e8227SGreg Roach			break;
4718c2e8227SGreg Roach		}
4728c2e8227SGreg Roach	}
4738c2e8227SGreg Roach
4740ee13198SGreg Roach	/**
4750ee13198SGreg Roach	 * The user can re-order menus.  Until they do, they are shown in this order.
4760ee13198SGreg Roach	 *
4770ee13198SGreg Roach	 * @return int
4780ee13198SGreg Roach	 */
4798c2e8227SGreg Roach	public function defaultMenuOrder() {
4808c2e8227SGreg Roach		return 20;
4818c2e8227SGreg Roach	}
4828c2e8227SGreg Roach
4830ee13198SGreg Roach	/**
4840ee13198SGreg Roach	 * A menu, to be added to the main application menu.
4850ee13198SGreg Roach	 *
4860ee13198SGreg Roach	 * @return Menu|null
4870ee13198SGreg Roach	 */
4888c2e8227SGreg Roach	public function getMenu() {
4894b9ff166SGreg Roach		global $controller, $WT_TREE;
4908c2e8227SGreg Roach
491*941edf23SGreg Roach		$submenus = array();
4928c2e8227SGreg Roach		if (isset($controller->record)) {
493*941edf23SGreg Roach			$submenus[] = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippingscart', array('rel' => 'nofollow'));
4948c2e8227SGreg Roach		}
4958c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
496*941edf23SGreg Roach			$submenus[] = new Menu(I18N::translate('Add to the clippings cart'), 'module.php?mod=clippings&amp;mod_action=index&amp;action=add&amp;id=' . $controller->record->getXref(), 'menu-clippingsadd', array('rel' => 'nofollow'));
4978c2e8227SGreg Roach		}
498cbc1590aSGreg Roach
499*941edf23SGreg Roach		if ($submenus) {
500*941edf23SGreg Roach			return new Menu($this->getTitle(), '#', 'menu-clippings', array('rel' => 'nofollow'), $submenus);
501*941edf23SGreg Roach		} else {
502*941edf23SGreg Roach			return new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', array('rel' => 'nofollow'));
503*941edf23SGreg Roach		}
5048c2e8227SGreg Roach	}
5058c2e8227SGreg Roach
5068c2e8227SGreg Roach	/** {@inheritdoc} */
5078c2e8227SGreg Roach	public function defaultSidebarOrder() {
5088c2e8227SGreg Roach		return 60;
5098c2e8227SGreg Roach	}
5108c2e8227SGreg Roach
5118c2e8227SGreg Roach	/** {@inheritdoc} */
5128c2e8227SGreg Roach	public function hasSidebarContent() {
5138c2e8227SGreg Roach		// Creating a controller has the side effect of initialising the cart
5140e62c4b8SGreg Roach		new ClippingsCartController;
5158c2e8227SGreg Roach
5168c2e8227SGreg Roach		return true;
5178c2e8227SGreg Roach	}
5188c2e8227SGreg Roach
51976692c8bSGreg Roach	/**
52076692c8bSGreg Roach	 * Load this sidebar synchronously.
52176692c8bSGreg Roach	 *
52276692c8bSGreg Roach	 * @return string
52376692c8bSGreg Roach	 */
5248c2e8227SGreg Roach	public function getSidebarContent() {
5258c2e8227SGreg Roach		global $controller;
5268c2e8227SGreg Roach
5278c2e8227SGreg Roach		$controller->addInlineJavascript('
5288c2e8227SGreg Roach				jQuery("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
5298c2e8227SGreg Roach					jQuery("#sb_clippings_content").load(this.href);
5308c2e8227SGreg Roach					return false;
5318c2e8227SGreg Roach				});
5328c2e8227SGreg Roach			');
5338c2e8227SGreg Roach
5348c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
5358c2e8227SGreg Roach	}
5368c2e8227SGreg Roach
5378c2e8227SGreg Roach	/** {@inheritdoc} */
5388c2e8227SGreg Roach	public function getSidebarAjaxContent() {
53931bc7874SGreg Roach		global $WT_TREE;
54031bc7874SGreg Roach
54131bc7874SGreg Roach		$cart = Session::get('cart');
5428c2e8227SGreg Roach
5430e62c4b8SGreg Roach		$clip_ctrl         = new ClippingsCartController;
5448c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
5458c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
5468c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
5478c2e8227SGreg Roach		$others            = Filter::get('others');
5488c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
5498c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
5508c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
5518c2e8227SGreg Roach		if ($add) {
55224ec66ceSGreg Roach			$record = GedcomRecord::getInstance($add, $WT_TREE);
5538c2e8227SGreg Roach			if ($record) {
5548c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
5558c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
5568c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
5578c2e8227SGreg Roach			}
5588c2e8227SGreg Roach		} elseif ($add1) {
55924ec66ceSGreg Roach			$record = Individual::getInstance($add1, $WT_TREE);
5608c2e8227SGreg Roach			if ($record) {
5618c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
5628c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
5638c2e8227SGreg Roach				if ($others == 'parents') {
5648c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
5658c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
5668c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
5678c2e8227SGreg Roach					}
5688c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
5698c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
5708c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
5718c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
5728c2e8227SGreg Roach				} elseif ($others == 'members') {
5738c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
5748c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
5758c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
5768c2e8227SGreg Roach					}
5778c2e8227SGreg Roach				} elseif ($others == 'descendants') {
5788c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
5798c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
5808c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
5818c2e8227SGreg Roach					}
5828c2e8227SGreg Roach				}
5838c2e8227SGreg Roach			}
5848c2e8227SGreg Roach		} elseif ($remove) {
58531bc7874SGreg Roach			unset($cart[$WT_TREE->getTreeId()][$remove]);
58631bc7874SGreg Roach			Session::put('cart', $cart);
5878c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
58831bc7874SGreg Roach			$cart[$WT_TREE->getTreeId()] = array();
58931bc7874SGreg Roach			Session::put('cart', $cart);
5908c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
5918c2e8227SGreg Roach			return $this->downloadForm($clip_ctrl);
5928c2e8227SGreg Roach		}
59331bc7874SGreg Roach
5948c2e8227SGreg Roach		return $this->getCartList();
5958c2e8227SGreg Roach	}
5968c2e8227SGreg Roach
5978c2e8227SGreg Roach	/**
5988c2e8227SGreg Roach	 * A list for the side bar.
5998c2e8227SGreg Roach	 *
6008c2e8227SGreg Roach	 * @return string
6018c2e8227SGreg Roach	 */
6028c2e8227SGreg Roach	public function getCartList() {
60331bc7874SGreg Roach		global $WT_TREE;
6048c2e8227SGreg Roach
60531bc7874SGreg Roach		$cart = Session::get('cart', array());
60631bc7874SGreg Roach		if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
60731bc7874SGreg Roach			$cart[$WT_TREE->getTreeId()] = array();
60831bc7874SGreg Roach		}
6098c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
6108c2e8227SGreg Roach
61131bc7874SGreg Roach		if (!$cart[$WT_TREE->getTreeId()]) {
6128c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
6138c2e8227SGreg Roach		} else {
6148c2e8227SGreg Roach			$out = '<ul>';
61531bc7874SGreg Roach			foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
61624ec66ceSGreg Roach				$record = GedcomRecord::getInstance($xref, $WT_TREE);
6178c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
6188c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
6198c2e8227SGreg Roach					case 'INDI':
6208c2e8227SGreg Roach						$icon = 'icon-indis';
6218c2e8227SGreg Roach						break;
6228c2e8227SGreg Roach					case 'FAM':
6238c2e8227SGreg Roach						$icon = 'icon-sfamily';
6248c2e8227SGreg Roach						break;
6258c2e8227SGreg Roach					}
6268c2e8227SGreg Roach					$out .= '<li>';
6278c2e8227SGreg Roach					if (!empty($icon)) {
6288c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
6298c2e8227SGreg Roach					}
6308c2e8227SGreg Roach					$out .= '<a href="' . $record->getHtmlUrl() . '">';
6318c2e8227SGreg Roach					if ($record instanceof Individual) {
6328c2e8227SGreg Roach						$out .= $record->getSexImage();
6338c2e8227SGreg Roach					}
6348c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
6358c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
6368c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
6378c2e8227SGreg Roach					}
6388c2e8227SGreg Roach					$out .= '</a>';
6398c2e8227SGreg 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>';
6408c2e8227SGreg Roach					$out .= '</li>';
6418c2e8227SGreg Roach				}
6428c2e8227SGreg Roach			}
6438c2e8227SGreg Roach			$out .= '</ul>';
6448c2e8227SGreg Roach		}
6458c2e8227SGreg Roach
64631bc7874SGreg Roach		if ($cart[$WT_TREE->getTreeId()]) {
6478c2e8227SGreg Roach			$out .=
6488c2e8227SGreg 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">' .
6498c2e8227SGreg Roach				I18N::translate('Empty the clippings cart') .
6508c2e8227SGreg Roach				'</a>' .
6518c2e8227SGreg Roach				'<br>' .
6528c2e8227SGreg 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">' .
6538c2e8227SGreg Roach				I18N::translate('Download') .
6548c2e8227SGreg Roach				'</a>';
6558c2e8227SGreg Roach		}
65624ec66ceSGreg Roach		$record = Individual::getInstance($pid, $WT_TREE);
65731bc7874SGreg Roach		if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
6588c2e8227SGreg 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>';
6598c2e8227SGreg Roach		}
660cbc1590aSGreg Roach
6618c2e8227SGreg Roach		return $out;
6628c2e8227SGreg Roach	}
6638c2e8227SGreg Roach
6648c2e8227SGreg Roach	/**
66576692c8bSGreg Roach	 * A form to choose the download options.
66676692c8bSGreg Roach	 *
6670e62c4b8SGreg Roach	 * @param ClippingsCartController $clip_ctrl
6688c2e8227SGreg Roach	 *
6698c2e8227SGreg Roach	 * @return string
6708c2e8227SGreg Roach	 */
6710e62c4b8SGreg Roach	public function downloadForm(ClippingsCartController $clip_ctrl) {
6728c2e8227SGreg Roach		global $WT_TREE;
6738c2e8227SGreg Roach
6748c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
6758c2e8227SGreg Roach
6768c2e8227SGreg Roach		$out = '<script>';
6778c2e8227SGreg Roach		$out .= 'function cancelDownload() {
6788c2e8227SGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '";
6798c2e8227SGreg Roach				jQuery("#sb_clippings_content").load(link);
6808c2e8227SGreg Roach			}';
6818c2e8227SGreg Roach		$out .= '</script>';
6828c2e8227SGreg Roach		$out .= '<form method="get" action="module.php">
6838c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
6848c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
6858c2e8227SGreg Roach		<input type="hidden" name="pid" value="' . $pid . '">
6868c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
6878c2e8227SGreg Roach		<table>
6888c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr>
6896fd6cde8SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td>
6908c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
6918c2e8227SGreg Roach
692d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td>
6938c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
6948c2e8227SGreg Roach		';
6958c2e8227SGreg Roach
6964b9ff166SGreg Roach		if (Auth::isManager($WT_TREE)) {
6978c2e8227SGreg Roach			$out .=
698d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
6998c2e8227SGreg Roach				'<td class="optionbox">' .
7008c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
7018c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
7028c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
7038c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7048c2e8227SGreg Roach				'</td></tr>';
7054b9ff166SGreg Roach		} elseif (Auth::isMember($WT_TREE)) {
7068c2e8227SGreg Roach			$out .=
707d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7088c2e8227SGreg Roach				'<td class="list_value">' .
7098c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
7108c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7118c2e8227SGreg Roach				'</td></tr>';
7128c2e8227SGreg Roach		}
7138c2e8227SGreg Roach
7148c2e8227SGreg Roach		$out .= '
715d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td>
7168c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
7178c2e8227SGreg Roach
7188c2e8227SGreg Roach		<tr>
719d1928687SGreg Roach		<td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td>
7208c2e8227SGreg Roach		<td class="optionbox">
7218c2e8227SGreg Roach		<input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '">
7228c2e8227SGreg Roach		<span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td>
7238c2e8227SGreg Roach		</tr>
7248c2e8227SGreg Roach
7258c2e8227SGreg Roach		<input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '">
7268c2e8227SGreg Roach
7278c2e8227SGreg Roach		</td></tr>
7288c2e8227SGreg Roach
7298c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
7308c2e8227SGreg Roach		<input type="button" value="' . I18N::translate('Cancel') . '" onclick="cancelDownload();">
7318c2e8227SGreg Roach		<input type="submit" value="' . I18N::translate('Download') . '">
7328c2e8227SGreg Roach		</form>';
7338c2e8227SGreg Roach
7348c2e8227SGreg Roach		return $out;
7358c2e8227SGreg Roach	}
7368c2e8227SGreg Roach}
737