xref: /webtrees/app/Module/ClippingsCartModule.php (revision cc5ab399cc3c8f78158c8e3027cb0ecf038648dc)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
46bdf7674SGreg Roach * Copyright (C) 2017 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;
220e62c4b8SGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
230e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
240e62c4b8SGreg Roachuse Fisharebest\Webtrees\Individual;
250e62c4b8SGreg Roachuse Fisharebest\Webtrees\Menu;
260e62c4b8SGreg Roachuse Fisharebest\Webtrees\Module\ClippingsCart\ClippingsCartController;
270e62c4b8SGreg Roachuse Fisharebest\Webtrees\Session;
288c2e8227SGreg Roach
298c2e8227SGreg Roach/**
308c2e8227SGreg Roach * Class ClippingsCartModule
318c2e8227SGreg Roach */
32e2a378d3SGreg Roachclass ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, ModuleSidebarInterface {
338c2e8227SGreg Roach	/** {@inheritdoc} */
348c2e8227SGreg Roach	public function getTitle() {
35a86dd8b1SGreg Roach		return /* I18N: Name of a module */
36a86dd8b1SGreg Roach			I18N::translate('Clippings cart');
378c2e8227SGreg Roach	}
388c2e8227SGreg Roach
398c2e8227SGreg Roach	/** {@inheritdoc} */
408c2e8227SGreg Roach	public function getDescription() {
41a86dd8b1SGreg Roach		return /* I18N: Description of the “Clippings cart” module */
423bf19670SGreg Roach			I18N::translate('Select records from your family tree and save them as a GEDCOM file.');
438c2e8227SGreg Roach	}
448c2e8227SGreg Roach
450ee13198SGreg Roach	/**
460ee13198SGreg Roach	 * What is the default access level for this module?
470ee13198SGreg Roach	 *
480ee13198SGreg Roach	 * Some modules are aimed at admins or managers, and are not generally shown to users.
490ee13198SGreg Roach	 *
500ee13198SGreg Roach	 * @return int
510ee13198SGreg Roach	 */
528c2e8227SGreg Roach	public function defaultAccessLevel() {
534b9ff166SGreg Roach		return Auth::PRIV_USER;
548c2e8227SGreg Roach	}
558c2e8227SGreg Roach
5676692c8bSGreg Roach	/**
5776692c8bSGreg Roach	 * This is a general purpose hook, allowing modules to respond to routes
5876692c8bSGreg Roach	 * of the form module.php?mod=FOO&mod_action=BAR
5976692c8bSGreg Roach	 *
6076692c8bSGreg Roach	 * @param string $mod_action
6176692c8bSGreg Roach	 */
628c2e8227SGreg Roach	public function modAction($mod_action) {
638c2e8227SGreg Roach		switch ($mod_action) {
648c2e8227SGreg Roach		case 'ajax':
658c2e8227SGreg Roach			$html = $this->getSidebarAjaxContent();
668c2e8227SGreg Roach			header('Content-Type: text/html; charset=UTF-8');
678c2e8227SGreg Roach			echo $html;
688c2e8227SGreg Roach			break;
698c2e8227SGreg Roach		case 'index':
7031bc7874SGreg Roach			global $controller, $WT_TREE;
718c2e8227SGreg Roach
728c2e8227SGreg Roach			$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
738c2e8227SGreg Roach
740e62c4b8SGreg Roach			$clip_ctrl = new ClippingsCartController;
757bd2dc19SGreg Roach			$cart      = Session::get('cart');
768c2e8227SGreg Roach
778c2e8227SGreg Roach			$controller = new PageController;
788c2e8227SGreg Roach			$controller
798c2e8227SGreg Roach				->setPageTitle($this->getTitle())
8015d603e7SGreg Roach				->pageHeader();
818c2e8227SGreg Roach
828c2e8227SGreg Roach			echo '<script>';
838c2e8227SGreg Roach			echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
848c2e8227SGreg Roach			echo '</script>';
858c2e8227SGreg Roach
8631bc7874SGreg Roach			if (!$cart[$WT_TREE->getTreeId()]) {
878c2e8227SGreg Roach				echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
888c2e8227SGreg Roach			}
898c2e8227SGreg Roach
908c2e8227SGreg Roach			if ($clip_ctrl->action == 'add') {
914e3c4966SGreg Roach				$record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
928c2e8227SGreg Roach				if ($clip_ctrl->type === 'FAM') { ?>
9315d603e7SGreg Roach					<form action="module.php">
948c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
958c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
9615d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
9715d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
984e3c4966SGreg Roach						<input type="hidden" name="action" value="add1">
994e3c4966SGreg Roach						<table>
1004e3c4966SGreg Roach							<thead>
1014e3c4966SGreg Roach								<tr>
1024e3c4966SGreg Roach									<td class="topbottombar">
10315d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1044e3c4966SGreg Roach									</td>
1054e3c4966SGreg Roach								</tr>
1064e3c4966SGreg Roach							</thead>
1074e3c4966SGreg Roach							<tbody>
1084e3c4966SGreg Roach								<tr>
1094e3c4966SGreg Roach									<td class="optionbox">
1104e3c4966SGreg Roach										<input type="radio" name="others" value="parents">
11115d603e7SGreg Roach										<?= $record->getFullName() ?>
1124e3c4966SGreg Roach									</td>
1134e3c4966SGreg Roach								</tr>
1144e3c4966SGreg Roach								<tr>
1154e3c4966SGreg Roach									<td class="optionbox">
1164e3c4966SGreg Roach										<input type="radio" name="others" value="members" checked>
11715d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
11815d603e7SGreg Roach										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">
12415d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
12515d603e7SGreg Roach										I18N::translate('%s and their descendants', $record->getFullName()) ?>
1264e3c4966SGreg Roach									</td>
1274e3c4966SGreg Roach								</tr>
1284e3c4966SGreg Roach							</tbody>
1294e3c4966SGreg Roach							<tfoot>
1304e3c4966SGreg Roach								<tr>
13115d603e7SGreg Roach									<td class="topbottombar"><input type="submit" value="<?= I18N::translate('continue') ?>">
1324e3c4966SGreg Roach									</td>
1334e3c4966SGreg Roach								</tr>
1344e3c4966SGreg Roach							</tfoot>
1358c2e8227SGreg Roach						</table>
1368c2e8227SGreg Roach					</form>
1378c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
13815d603e7SGreg Roach					<form action="module.php">
1398c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
1408c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
14115d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
14215d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
143a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
1444e3c4966SGreg Roach						<table>
1454e3c4966SGreg Roach							<thead>
1464e3c4966SGreg Roach								<tr>
1474e3c4966SGreg Roach									<td class="topbottombar">
14815d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1494e3c4966SGreg Roach									</td>
1504e3c4966SGreg Roach								</tr>
1514e3c4966SGreg Roach							</thead>
1524e3c4966SGreg Roach							<tbody>
1534e3c4966SGreg Roach								<tr>
1544e3c4966SGreg Roach									<td class="optionbox">
1554e3c4966SGreg Roach										<label>
1564e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
15715d603e7SGreg Roach											<?= $record->getFullName() ?>
1584e3c4966SGreg Roach										</label>
1594e3c4966SGreg Roach									</td>
1604e3c4966SGreg Roach								</tr>
1614e3c4966SGreg Roach								<tr>
1624e3c4966SGreg Roach									<td class="optionbox">
1634e3c4966SGreg Roach										<label>
1644e3c4966SGreg Roach											<input type="radio" name="others" value="parents">
1654e3c4966SGreg Roach											<?php
1664e3c4966SGreg Roach											if ($record->getSex() === 'F') {
167a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
168a86dd8b1SGreg Roach												I18N::translate('%s, her parents and siblings', $record->getFullName());
1694e3c4966SGreg Roach											} else {
170a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
171a86dd8b1SGreg Roach												I18N::translate('%s, his parents and siblings', $record->getFullName());
1724e3c4966SGreg Roach											}
1734e3c4966SGreg Roach											?>
1744e3c4966SGreg Roach										</label>
1754e3c4966SGreg Roach									</td>
1764e3c4966SGreg Roach								</tr>
1774e3c4966SGreg Roach								<tr>
1784e3c4966SGreg Roach									<td class="optionbox">
1794e3c4966SGreg Roach										<label>
1804e3c4966SGreg Roach											<input type="radio" name="others" value="members">
1814e3c4966SGreg Roach											<?php
1824e3c4966SGreg Roach											if ($record->getSex() === 'F') {
183a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
184a86dd8b1SGreg Roach												I18N::translate('%s, her spouses and children', $record->getFullName());
1854e3c4966SGreg Roach											} else {
186a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
187a86dd8b1SGreg Roach												I18N::translate('%s, his spouses and children', $record->getFullName());
1884e3c4966SGreg Roach											}
1894e3c4966SGreg Roach											?>
1904e3c4966SGreg Roach										</label>
1914e3c4966SGreg Roach									</td>
1924e3c4966SGreg Roach								</tr>
1934e3c4966SGreg Roach								<tr>
1944e3c4966SGreg Roach									<td class="optionbox">
1954e3c4966SGreg Roach										<label>
1964e3c4966SGreg Roach											<input type="radio" name="others" value="ancestors" id="ancestors">
1974e3c4966SGreg Roach											<?php
1984e3c4966SGreg Roach											if ($record->getSex() === 'F') {
199a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
200a86dd8b1SGreg Roach												I18N::translate('%s and her ancestors', $record->getFullName());
2014e3c4966SGreg Roach											} else {
202a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
203a86dd8b1SGreg Roach												I18N::translate('%s and his ancestors', $record->getFullName());
2044e3c4966SGreg Roach											}
2054e3c4966SGreg Roach											?>
2064e3c4966SGreg Roach										</label>
2074e3c4966SGreg Roach										<br>
20815d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
20915d603e7SGreg Roach										<input type="text" size="5" name="level1" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestors');">
2104e3c4966SGreg Roach									</td>
2114e3c4966SGreg Roach								</tr>
2124e3c4966SGreg Roach								<tr>
2134e3c4966SGreg Roach									<td class="optionbox">
2144e3c4966SGreg Roach										<label>
2154e3c4966SGreg Roach											<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
2164e3c4966SGreg Roach											<?php
2174e3c4966SGreg Roach											if ($record->getSex() === 'F') {
218a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
219a86dd8b1SGreg Roach												I18N::translate('%s, her ancestors and their families', $record->getFullName());
2204e3c4966SGreg Roach											} else {
221a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
222a86dd8b1SGreg Roach												I18N::translate('%s, his ancestors and their families', $record->getFullName());
2234e3c4966SGreg Roach											}
2244e3c4966SGreg Roach											?>
2254e3c4966SGreg Roach										</label>
2264e3c4966SGreg Roach										<br>
22715d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
22815d603e7SGreg Roach										<input type="text" size="5" name="level2" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestorsfamilies');">
2294e3c4966SGreg Roach									</td>
2304e3c4966SGreg Roach								</tr>
2314e3c4966SGreg Roach								<tr>
2324e3c4966SGreg Roach									<td class="optionbox">
2334e3c4966SGreg Roach										<label>
2344e3c4966SGreg Roach											<input type="radio" name="others" value="descendants" id="descendants">
2354e3c4966SGreg Roach											<?php
2364e3c4966SGreg Roach											if ($record->getSex() === 'F') {
237a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
238a86dd8b1SGreg Roach												I18N::translate('%s, her spouses and descendants', $record->getFullName());
2394e3c4966SGreg Roach											} else {
240a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
241a86dd8b1SGreg Roach												I18N::translate('%s, his spouses and descendants', $record->getFullName());
2424e3c4966SGreg Roach											}
2434e3c4966SGreg Roach											?>
2444e3c4966SGreg Roach										</label>
2454e3c4966SGreg Roach										<br>
24615d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
24715d603e7SGreg Roach										<input type="text" size="5" name="level3" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('descendants');">
2484e3c4966SGreg Roach									</td>
2494e3c4966SGreg Roach								</tr>
2504e3c4966SGreg Roach							</tbody>
2514e3c4966SGreg Roach							<tfoot>
2524e3c4966SGreg Roach								<tr>
2534e3c4966SGreg Roach									<td class="topbottombar">
25415d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
2554e3c4966SGreg Roach									</td>
2564e3c4966SGreg Roach								</tr>
2574e3c4966SGreg Roach							</tfoot>
2588c2e8227SGreg Roach						</table>
2598c2e8227SGreg Roach					</form>
2608c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
26115d603e7SGreg Roach					<form action="module.php">
2628c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
2638c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
26415d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
26515d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
266a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
2674e3c4966SGreg Roach						<table>
2684e3c4966SGreg Roach							<thead>
2694e3c4966SGreg Roach								<tr>
2704e3c4966SGreg Roach									<td class="topbottombar">
27115d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
2724e3c4966SGreg Roach									</td>
2734e3c4966SGreg Roach								</tr>
2744e3c4966SGreg Roach							</thead>
2754e3c4966SGreg Roach							<tbody>
2764e3c4966SGreg Roach								<tr>
2774e3c4966SGreg Roach									<td class="optionbox">
2784e3c4966SGreg Roach										<label>
2794e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
28015d603e7SGreg Roach											<?= $record->getFullName() ?>
2814e3c4966SGreg Roach										</label>
2824e3c4966SGreg Roach									</td>
2834e3c4966SGreg Roach								</tr>
2844e3c4966SGreg Roach								<tr>
2854e3c4966SGreg Roach									<td class="optionbox">
2864e3c4966SGreg Roach										<label>
2874e3c4966SGreg Roach											<input type="radio" name="others" value="linked">
28815d603e7SGreg Roach											<?= /* I18N: %s is the name of a source */
28915d603e7SGreg Roach											I18N::translate('%s and the individuals that reference it.', $record->getFullName()) ?>
2904e3c4966SGreg Roach										</label>
2914e3c4966SGreg Roach									</td>
2924e3c4966SGreg Roach								</tr>
2934e3c4966SGreg Roach							</tbody>
2944e3c4966SGreg Roach							<tfoot>
2954e3c4966SGreg Roach								<tr>
2964e3c4966SGreg Roach									<td class="topbottombar">
29715d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
2984e3c4966SGreg Roach									</td>
2994e3c4966SGreg Roach								</tr>
3004e3c4966SGreg Roach							</tfoot>
3018c2e8227SGreg Roach						</table>
3028c2e8227SGreg Roach					</form>
3038c2e8227SGreg Roach				<?php }
3048c2e8227SGreg Roach			}
3058c2e8227SGreg Roach
30631bc7874SGreg Roach			if (!$cart[$WT_TREE->getTreeId()]) {
3078c2e8227SGreg Roach				if ($clip_ctrl->action != 'add') {
3082a277e58SGreg Roach					echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.');
3098c2e8227SGreg Roach					?>
31015d603e7SGreg Roach					<form name="addin" action="module.php">
3118c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3128c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3138c2e8227SGreg Roach						<table>
3144e3c4966SGreg Roach							<thead>
3158c2e8227SGreg Roach								<tr>
3164e3c4966SGreg Roach									<td colspan="2" class="topbottombar">
31715d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
3188c2e8227SGreg Roach									</td>
3198c2e8227SGreg Roach								</tr>
3204e3c4966SGreg Roach							</thead>
3214e3c4966SGreg Roach							<tbody>
3228c2e8227SGreg Roach								<tr>
3238c2e8227SGreg Roach									<td class="optionbox">
3248c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
3258c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
3268c2e8227SGreg Roach									</td>
3278c2e8227SGreg Roach									<td class="optionbox">
32815d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
3298c2e8227SGreg Roach									</td>
3308c2e8227SGreg Roach								</tr>
3314e3c4966SGreg Roach							</tbody>
3328c2e8227SGreg Roach						</table>
3338c2e8227SGreg Roach					</form>
3348c2e8227SGreg Roach					<?php
3358c2e8227SGreg Roach				}
3368c2e8227SGreg Roach
3378c2e8227SGreg Roach				// -- end new lines
3388c2e8227SGreg Roach				echo I18N::translate('Your clippings cart is empty.');
3398c2e8227SGreg Roach			} else {
3408c2e8227SGreg Roach				// Keep track of the INDI from the parent page, otherwise it will
3418c2e8227SGreg Roach				// get lost after ajax updates
3428c2e8227SGreg Roach				$pid = Filter::get('pid', WT_REGEX_XREF);
3438c2e8227SGreg Roach
344a86dd8b1SGreg Roach				if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?>
34515d603e7SGreg Roach					<form action="module.php">
3468c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3478c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3488c2e8227SGreg Roach						<input type="hidden" name="action" value="download">
34915d603e7SGreg Roach						<input type="hidden" name="pid" value="<?= $pid ?>">
3508c2e8227SGreg Roach						<table>
351a86dd8b1SGreg Roach							<tr>
352a86dd8b1SGreg Roach								<td colspan="2" class="topbottombar">
35315d603e7SGreg Roach									<h2><?= I18N::translate('Download') ?></h2>
354a86dd8b1SGreg Roach								</td>
355a86dd8b1SGreg Roach							</tr>
3566fd6cde8SGreg Roach							<tr>
3576fd6cde8SGreg Roach								<td class="descriptionbox width50 wrap">
35815d603e7SGreg Roach									<?= 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.') ?>
3596fd6cde8SGreg Roach								</td>
3606fd6cde8SGreg Roach								<td class="optionbox wrap">
3616fd6cde8SGreg Roach									<input type="checkbox" name="Zip" value="yes">
36215d603e7SGreg Roach									<?= I18N::translate('Zip file(s)') ?>
3636fd6cde8SGreg Roach								</td>
3646fd6cde8SGreg Roach							</tr>
3656fd6cde8SGreg Roach							<tr>
3666fd6cde8SGreg Roach								<td class="descriptionbox width50 wrap">
36715d603e7SGreg Roach									<?= I18N::translate('Include media (automatically zips files)') ?>
3686fd6cde8SGreg Roach								</td>
369a86dd8b1SGreg Roach								<td class="optionbox">
370a86dd8b1SGreg Roach									<input type="checkbox" name="IncludeMedia" value="yes">
371a86dd8b1SGreg Roach								</td>
372a86dd8b1SGreg Roach							</tr>
3738c2e8227SGreg Roach
3744b9ff166SGreg Roach							<?php if (Auth::isManager($WT_TREE)) { ?>
375a86dd8b1SGreg Roach								<tr>
376a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
37715d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
378a86dd8b1SGreg Roach									</td>
3798c2e8227SGreg Roach									<td class="optionbox">
380a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="none" checked>
38115d603e7SGreg Roach										<?= I18N::translate('None') ?>
382a86dd8b1SGreg Roach										<br>
383a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="gedadmin">
38415d603e7SGreg Roach										<?= I18N::translate('Manager') ?>
385a86dd8b1SGreg Roach										<br>
386a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="user">
38715d603e7SGreg Roach										<?= I18N::translate('Member') ?>
388a86dd8b1SGreg Roach										<br>
389a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="visitor">
39015d603e7SGreg Roach										<?= I18N::translate('Visitor') ?>
391a86dd8b1SGreg Roach									</td>
392a86dd8b1SGreg Roach								</tr>
3934b9ff166SGreg Roach							<?php } elseif (Auth::isMember($WT_TREE)) { ?>
394a86dd8b1SGreg Roach								<tr>
395a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
39615d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
397a86dd8b1SGreg Roach									</td>
3988c2e8227SGreg Roach									<td class="optionbox">
39915d603e7SGreg Roach										<input type="radio" name="privatize_export" value="user" checked> <?= I18N::translate('Member') ?><br>
40015d603e7SGreg Roach										<input type="radio" name="privatize_export" value="visitor"> <?= I18N::translate('Visitor') ?>
401a86dd8b1SGreg Roach									</td>
402a86dd8b1SGreg Roach								</tr>
4038c2e8227SGreg Roach							<?php } ?>
4048c2e8227SGreg Roach
405a86dd8b1SGreg Roach							<tr>
406a86dd8b1SGreg Roach								<td class="descriptionbox width50 wrap">
40715d603e7SGreg Roach									<?= I18N::translate('Convert from UTF-8 to ISO-8859-1') ?>
408a86dd8b1SGreg Roach								</td>
409a86dd8b1SGreg Roach								<td class="optionbox">
410a86dd8b1SGreg Roach									<input type="checkbox" name="convert" value="yes">
411a86dd8b1SGreg Roach								</td>
412a86dd8b1SGreg Roach							</tr>
4138c2e8227SGreg Roach
414a86dd8b1SGreg Roach							<tr>
415a86dd8b1SGreg Roach								<td class="descriptionbox width50 wrap">
41615d603e7SGreg Roach									<?= I18N::translate('Add the GEDCOM media path to filenames') ?>
417a86dd8b1SGreg Roach								</td>
4188c2e8227SGreg Roach								<td class="optionbox">
419*cc5ab399SGreg Roach									<input type="checkbox" name="conv_path" value="<?= Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) ?>">
420*cc5ab399SGreg Roach									<span dir="auto"><?= Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) ?></span>
421a86dd8b1SGreg Roach								</td>
422a86dd8b1SGreg Roach							</tr>
4238c2e8227SGreg Roach
424a86dd8b1SGreg Roach							<tr>
425a86dd8b1SGreg Roach								<td class="topbottombar" colspan="2">
42615d603e7SGreg Roach									<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('download') ?>">
427a86dd8b1SGreg Roach								</td>
428a86dd8b1SGreg Roach							</tr>
429a86dd8b1SGreg Roach						</table>
4308c2e8227SGreg Roach					</form>
4318c2e8227SGreg Roach					<br>
4328c2e8227SGreg Roach
43315d603e7SGreg Roach					<form name="addin" action="module.php">
4348c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
4358c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
4368c2e8227SGreg Roach						<table>
4374e3c4966SGreg Roach							<thead>
4388c2e8227SGreg Roach								<tr>
4398c2e8227SGreg Roach									<td colspan="2" class="topbottombar" style="text-align:center; ">
44015d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
4418c2e8227SGreg Roach									</td>
4428c2e8227SGreg Roach								</tr>
4434e3c4966SGreg Roach							</thead>
4444e3c4966SGreg Roach							<tbody>
4458c2e8227SGreg Roach								<tr>
4468c2e8227SGreg Roach									<td class="optionbox">
4478c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
4488c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
4498c2e8227SGreg Roach									</td>
4508c2e8227SGreg Roach									<td class="optionbox">
45115d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
4528c2e8227SGreg Roach									</td>
4538c2e8227SGreg Roach								</tr>
4544e3c4966SGreg Roach							</tbody>
455a86dd8b1SGreg Roach							<tfoot>
456a86dd8b1SGreg Roach								<tr>
457a86dd8b1SGreg Roach									<th colspan="2">
458a86dd8b1SGreg Roach										<a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty">
45915d603e7SGreg Roach											<?= I18N::translate('Empty the clippings cart') ?>
460a86dd8b1SGreg Roach										</a>
461a86dd8b1SGreg Roach									</th>
462a86dd8b1SGreg Roach								</tr>
463a86dd8b1SGreg Roach							</tfoot>
4648c2e8227SGreg Roach						</table>
4658c2e8227SGreg Roach					</form>
4668c2e8227SGreg Roach
4678c2e8227SGreg Roach				<?php } ?>
4688c2e8227SGreg Roach
469a86dd8b1SGreg Roach				<h2>
47015d603e7SGreg Roach					<?= I18N::translate('Family tree clippings cart') ?>
471a86dd8b1SGreg Roach				</h2>
4728c2e8227SGreg Roach				<table id="mycart" class="sortable list_table width100">
473a86dd8b1SGreg Roach					<thead>
4748c2e8227SGreg Roach						<tr>
47515d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Record') ?></th>
47615d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Remove') ?></th>
4778c2e8227SGreg Roach						</tr>
478a86dd8b1SGreg Roach					</thead>
479a86dd8b1SGreg Roach					<tbody>
4808c2e8227SGreg Roach						<?php
48131bc7874SGreg Roach						foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
48224ec66ceSGreg Roach							$record = GedcomRecord::getInstance($xref, $WT_TREE);
4838c2e8227SGreg Roach							if ($record) {
4848c2e8227SGreg Roach								switch ($record::RECORD_TYPE) {
485a86dd8b1SGreg Roach								case 'INDI':
486a86dd8b1SGreg Roach									$icon = 'icon-indis';
487a86dd8b1SGreg Roach									break;
488a86dd8b1SGreg Roach								case 'FAM':
489a86dd8b1SGreg Roach									$icon = 'icon-sfamily';
490a86dd8b1SGreg Roach									break;
491a86dd8b1SGreg Roach								case 'SOUR':
492a86dd8b1SGreg Roach									$icon = 'icon-source';
493a86dd8b1SGreg Roach									break;
494a86dd8b1SGreg Roach								case 'REPO':
495a86dd8b1SGreg Roach									$icon = 'icon-repository';
496a86dd8b1SGreg Roach									break;
497a86dd8b1SGreg Roach								case 'NOTE':
498a86dd8b1SGreg Roach									$icon = 'icon-note';
499a86dd8b1SGreg Roach									break;
500a86dd8b1SGreg Roach								case 'OBJE':
501a86dd8b1SGreg Roach									$icon = 'icon-media';
502a86dd8b1SGreg Roach									break;
503a86dd8b1SGreg Roach								default:
504a86dd8b1SGreg Roach									$icon = 'icon-clippings';
505a86dd8b1SGreg Roach									break;
5068c2e8227SGreg Roach								}
5078c2e8227SGreg Roach								?>
508a86dd8b1SGreg Roach								<tr>
509a86dd8b1SGreg Roach									<td class="list_value">
51015d603e7SGreg Roach										<i class="<?= $icon ?>"></i>
5118c2e8227SGreg Roach										<?php
5128c2e8227SGreg Roach										echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
5138c2e8227SGreg Roach										?>
5148c2e8227SGreg Roach									</td>
51515d603e7SGreg Roach									<td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;id=<?= $xref ?>" class="icon-remove" title="<?= I18N::translate('Remove') ?>"></a></td>
5168c2e8227SGreg Roach								</tr>
5178c2e8227SGreg Roach								<?php
5188c2e8227SGreg Roach							}
5198c2e8227SGreg Roach						}
5208c2e8227SGreg Roach						?>
5218c2e8227SGreg Roach				</table>
5228c2e8227SGreg Roach				<?php
5238c2e8227SGreg Roach			}
5248c2e8227SGreg Roach			break;
5258c2e8227SGreg Roach		default:
5268c2e8227SGreg Roach			http_response_code(404);
5278c2e8227SGreg Roach			break;
5288c2e8227SGreg Roach		}
5298c2e8227SGreg Roach	}
5308c2e8227SGreg Roach
5310ee13198SGreg Roach	/**
5320ee13198SGreg Roach	 * The user can re-order menus. Until they do, they are shown in this order.
5330ee13198SGreg Roach	 *
5340ee13198SGreg Roach	 * @return int
5350ee13198SGreg Roach	 */
5368c2e8227SGreg Roach	public function defaultMenuOrder() {
5378c2e8227SGreg Roach		return 20;
5388c2e8227SGreg Roach	}
5398c2e8227SGreg Roach
5400ee13198SGreg Roach	/**
5410ee13198SGreg Roach	 * A menu, to be added to the main application menu.
5420ee13198SGreg Roach	 *
5430ee13198SGreg Roach	 * @return Menu|null
5440ee13198SGreg Roach	 */
5458c2e8227SGreg Roach	public function getMenu() {
5464b9ff166SGreg Roach		global $controller, $WT_TREE;
5478c2e8227SGreg Roach
54813abd6f3SGreg Roach		$submenus = [];
5498c2e8227SGreg Roach		if (isset($controller->record)) {
55015d603e7SGreg Roach			$submenus[] = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings-cart', ['rel' => 'nofollow']);
5518c2e8227SGreg Roach		}
5528c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
55315d603e7SGreg 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-clippings-add', ['rel' => 'nofollow']);
5548c2e8227SGreg Roach		}
555cbc1590aSGreg Roach
556941edf23SGreg Roach		if ($submenus) {
55713abd6f3SGreg Roach			return new Menu($this->getTitle(), '#', 'menu-clippings', ['rel' => 'nofollow'], $submenus);
558941edf23SGreg Roach		} else {
55913abd6f3SGreg Roach			return new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', ['rel' => 'nofollow']);
560941edf23SGreg Roach		}
5618c2e8227SGreg Roach	}
5628c2e8227SGreg Roach
5638c2e8227SGreg Roach	/** {@inheritdoc} */
5648c2e8227SGreg Roach	public function defaultSidebarOrder() {
5658c2e8227SGreg Roach		return 60;
5668c2e8227SGreg Roach	}
5678c2e8227SGreg Roach
5688c2e8227SGreg Roach	/** {@inheritdoc} */
5698c2e8227SGreg Roach	public function hasSidebarContent() {
5708c2e8227SGreg Roach		// Creating a controller has the side effect of initialising the cart
5710e62c4b8SGreg Roach		new ClippingsCartController;
5728c2e8227SGreg Roach
5738c2e8227SGreg Roach		return true;
5748c2e8227SGreg Roach	}
5758c2e8227SGreg Roach
57676692c8bSGreg Roach	/**
57776692c8bSGreg Roach	 * Load this sidebar synchronously.
57876692c8bSGreg Roach	 *
57976692c8bSGreg Roach	 * @return string
58076692c8bSGreg Roach	 */
5818c2e8227SGreg Roach	public function getSidebarContent() {
5828c2e8227SGreg Roach		global $controller;
5838c2e8227SGreg Roach
5848c2e8227SGreg Roach		$controller->addInlineJavascript('
58515d603e7SGreg Roach				$("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
58615d603e7SGreg Roach					$("#sb_clippings_content").load(this.href);
5878c2e8227SGreg Roach					return false;
5888c2e8227SGreg Roach				});
5898c2e8227SGreg Roach			');
5908c2e8227SGreg Roach
5918c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
5928c2e8227SGreg Roach	}
5938c2e8227SGreg Roach
5948c2e8227SGreg Roach	/** {@inheritdoc} */
5958c2e8227SGreg Roach	public function getSidebarAjaxContent() {
59631bc7874SGreg Roach		global $WT_TREE;
59731bc7874SGreg Roach
59831bc7874SGreg Roach		$cart = Session::get('cart');
5998c2e8227SGreg Roach
6000e62c4b8SGreg Roach		$clip_ctrl         = new ClippingsCartController;
6018c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
6028c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
6038c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
6048c2e8227SGreg Roach		$others            = Filter::get('others');
6058c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
6068c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
6078c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
6088c2e8227SGreg Roach		if ($add) {
60924ec66ceSGreg Roach			$record = GedcomRecord::getInstance($add, $WT_TREE);
6108c2e8227SGreg Roach			if ($record) {
6118c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6128c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6138c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
6148c2e8227SGreg Roach			}
6158c2e8227SGreg Roach		} elseif ($add1) {
61624ec66ceSGreg Roach			$record = Individual::getInstance($add1, $WT_TREE);
6178c2e8227SGreg Roach			if ($record) {
6188c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6198c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6208c2e8227SGreg Roach				if ($others == 'parents') {
6218c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
6228c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6238c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6248c2e8227SGreg Roach					}
6258c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
6268c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
6278c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
6288c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
6298c2e8227SGreg Roach				} elseif ($others == 'members') {
6308c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6318c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6328c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6338c2e8227SGreg Roach					}
6348c2e8227SGreg Roach				} elseif ($others == 'descendants') {
6358c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6368c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6378c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
6388c2e8227SGreg Roach					}
6398c2e8227SGreg Roach				}
6408c2e8227SGreg Roach			}
6418c2e8227SGreg Roach		} elseif ($remove) {
64231bc7874SGreg Roach			unset($cart[$WT_TREE->getTreeId()][$remove]);
64331bc7874SGreg Roach			Session::put('cart', $cart);
6448c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
64513abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
64631bc7874SGreg Roach			Session::put('cart', $cart);
6478c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
6488c2e8227SGreg Roach			return $this->downloadForm($clip_ctrl);
6498c2e8227SGreg Roach		}
65031bc7874SGreg Roach
6518c2e8227SGreg Roach		return $this->getCartList();
6528c2e8227SGreg Roach	}
6538c2e8227SGreg Roach
6548c2e8227SGreg Roach	/**
6558c2e8227SGreg Roach	 * A list for the side bar.
6568c2e8227SGreg Roach	 *
6578c2e8227SGreg Roach	 * @return string
6588c2e8227SGreg Roach	 */
6598c2e8227SGreg Roach	public function getCartList() {
66031bc7874SGreg Roach		global $WT_TREE;
6618c2e8227SGreg Roach
66213abd6f3SGreg Roach		$cart = Session::get('cart', []);
66331bc7874SGreg Roach		if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
66413abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
66531bc7874SGreg Roach		}
6668c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
6678c2e8227SGreg Roach
66831bc7874SGreg Roach		if (!$cart[$WT_TREE->getTreeId()]) {
6698c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
6708c2e8227SGreg Roach		} else {
6718c2e8227SGreg Roach			$out = '<ul>';
67231bc7874SGreg Roach			foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
67324ec66ceSGreg Roach				$record = GedcomRecord::getInstance($xref, $WT_TREE);
6748c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
6758c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
6768c2e8227SGreg Roach					case 'INDI':
6778c2e8227SGreg Roach						$icon = 'icon-indis';
6788c2e8227SGreg Roach						break;
6798c2e8227SGreg Roach					case 'FAM':
6808c2e8227SGreg Roach						$icon = 'icon-sfamily';
6818c2e8227SGreg Roach						break;
6828c2e8227SGreg Roach					}
6838c2e8227SGreg Roach					$out .= '<li>';
6848c2e8227SGreg Roach					if (!empty($icon)) {
6858c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
6868c2e8227SGreg Roach					}
6878c2e8227SGreg Roach					$out .= '<a href="' . $record->getHtmlUrl() . '">';
6888c2e8227SGreg Roach					if ($record instanceof Individual) {
6898c2e8227SGreg Roach						$out .= $record->getSexImage();
6908c2e8227SGreg Roach					}
6918c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
6928c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
6938c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
6948c2e8227SGreg Roach					}
6958c2e8227SGreg Roach					$out .= '</a>';
696cdaf7c6cSGreg Roach					$out .= '<a class="icon-remove remove_cart" href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;remove=' . $xref . '&amp;pid=' . $pid . '" title="' . I18N::translate('Remove') . '"></a>';
6978c2e8227SGreg Roach					$out .= '</li>';
6988c2e8227SGreg Roach				}
6998c2e8227SGreg Roach			}
7008c2e8227SGreg Roach			$out .= '</ul>';
7018c2e8227SGreg Roach		}
7028c2e8227SGreg Roach
70331bc7874SGreg Roach		if ($cart[$WT_TREE->getTreeId()]) {
7048c2e8227SGreg Roach			$out .=
705cdaf7c6cSGreg Roach				'<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
7068c2e8227SGreg Roach				I18N::translate('Empty the clippings cart') .
7078c2e8227SGreg Roach				'</a>' .
7088c2e8227SGreg Roach				'<br>' .
709cdaf7c6cSGreg Roach				'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
7108c2e8227SGreg Roach				I18N::translate('Download') .
7118c2e8227SGreg Roach				'</a>';
7128c2e8227SGreg Roach		}
71324ec66ceSGreg Roach		$record = Individual::getInstance($pid, $WT_TREE);
71431bc7874SGreg Roach		if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
715beb9c394SGreg Roach			$out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;action=add1&amp;type=INDI&amp;id=' . $pid . '&amp;pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>';
7168c2e8227SGreg Roach		}
717cbc1590aSGreg Roach
7188c2e8227SGreg Roach		return $out;
7198c2e8227SGreg Roach	}
7208c2e8227SGreg Roach
7218c2e8227SGreg Roach	/**
72276692c8bSGreg Roach	 * A form to choose the download options.
72376692c8bSGreg Roach	 *
7240e62c4b8SGreg Roach	 * @param ClippingsCartController $clip_ctrl
7258c2e8227SGreg Roach	 *
7268c2e8227SGreg Roach	 * @return string
7278c2e8227SGreg Roach	 */
7280e62c4b8SGreg Roach	public function downloadForm(ClippingsCartController $clip_ctrl) {
7298c2e8227SGreg Roach		global $WT_TREE;
7308c2e8227SGreg Roach
7318c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
7328c2e8227SGreg Roach
7338c2e8227SGreg Roach		$out = '<script>';
7348c2e8227SGreg Roach		$out .= 'function cancelDownload() {
735cdaf7c6cSGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&pid=' . $pid . '";
73615d603e7SGreg Roach				$("#sb_clippings_content").load(link);
7378c2e8227SGreg Roach			}';
7388c2e8227SGreg Roach		$out .= '</script>';
73915d603e7SGreg Roach		$out .= '<form action="module.php">
7408c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
7418c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
7428c2e8227SGreg Roach		<input type="hidden" name="pid" value="' . $pid . '">
7438c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
7448c2e8227SGreg Roach		<table>
7458c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr>
7466fd6cde8SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td>
7478c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
7488c2e8227SGreg Roach
749d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td>
7508c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
7518c2e8227SGreg Roach		';
7528c2e8227SGreg Roach
7534b9ff166SGreg Roach		if (Auth::isManager($WT_TREE)) {
7548c2e8227SGreg Roach			$out .=
755d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7568c2e8227SGreg Roach				'<td class="optionbox">' .
7578c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
7588c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
7598c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
7608c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7618c2e8227SGreg Roach				'</td></tr>';
7624b9ff166SGreg Roach		} elseif (Auth::isMember($WT_TREE)) {
7638c2e8227SGreg Roach			$out .=
764d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7658c2e8227SGreg Roach				'<td class="list_value">' .
7668c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
7678c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7688c2e8227SGreg Roach				'</td></tr>';
7698c2e8227SGreg Roach		}
7708c2e8227SGreg Roach
7718c2e8227SGreg Roach		$out .= '
772d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td>
7738c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
7748c2e8227SGreg Roach
7758c2e8227SGreg Roach		<tr>
776d1928687SGreg Roach		<td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td>
7778c2e8227SGreg Roach		<td class="optionbox">
778*cc5ab399SGreg Roach		<input type="checkbox" name="conv_path" value="' . Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '">
779*cc5ab399SGreg Roach		<span dir="auto">' . Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td>
7808c2e8227SGreg Roach		</tr>
7818c2e8227SGreg Roach
7828c2e8227SGreg Roach		<input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '">
7838c2e8227SGreg Roach
7848c2e8227SGreg Roach		</td></tr>
7858c2e8227SGreg Roach
7868c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
78791e873d9SGreg Roach		<input type="button" value="' . /* I18N: A button label. */ I18N::translate('cancel') . '" onclick="cancelDownload();">
78891e873d9SGreg Roach		<input type="submit" value="' . /* I18N: A button label. */ I18N::translate('download') . '">
7898c2e8227SGreg Roach		</form>';
7908c2e8227SGreg Roach
7918c2e8227SGreg Roach		return $out;
7928c2e8227SGreg Roach	}
7938c2e8227SGreg Roach}
794