xref: /webtrees/app/Module/ClippingsCartModule.php (revision 047f239b70b792655dbaa183656298db216028ae)
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;
23*047f239bSGreg Roachuse Fisharebest\Webtrees\Html;
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() {
36a86dd8b1SGreg Roach		return /* I18N: Name of a module */
37a86dd8b1SGreg Roach			I18N::translate('Clippings cart');
388c2e8227SGreg Roach	}
398c2e8227SGreg Roach
408c2e8227SGreg Roach	/** {@inheritdoc} */
418c2e8227SGreg Roach	public function getDescription() {
42a86dd8b1SGreg Roach		return /* I18N: Description of the “Clippings cart” module */
433bf19670SGreg Roach			I18N::translate('Select records from your family tree and save them as a GEDCOM file.');
448c2e8227SGreg Roach	}
458c2e8227SGreg Roach
460ee13198SGreg Roach	/**
470ee13198SGreg Roach	 * What is the default access level for this module?
480ee13198SGreg Roach	 *
490ee13198SGreg Roach	 * Some modules are aimed at admins or managers, and are not generally shown to users.
500ee13198SGreg Roach	 *
510ee13198SGreg Roach	 * @return int
520ee13198SGreg Roach	 */
538c2e8227SGreg Roach	public function defaultAccessLevel() {
544b9ff166SGreg Roach		return Auth::PRIV_USER;
558c2e8227SGreg Roach	}
568c2e8227SGreg Roach
5776692c8bSGreg Roach	/**
5876692c8bSGreg Roach	 * This is a general purpose hook, allowing modules to respond to routes
5976692c8bSGreg Roach	 * of the form module.php?mod=FOO&mod_action=BAR
6076692c8bSGreg Roach	 *
6176692c8bSGreg Roach	 * @param string $mod_action
6276692c8bSGreg Roach	 */
638c2e8227SGreg Roach	public function modAction($mod_action) {
648c2e8227SGreg Roach		switch ($mod_action) {
658c2e8227SGreg Roach		case 'ajax':
668c2e8227SGreg Roach			$html = $this->getSidebarAjaxContent();
678c2e8227SGreg Roach			header('Content-Type: text/html; charset=UTF-8');
688c2e8227SGreg Roach			echo $html;
698c2e8227SGreg Roach			break;
708c2e8227SGreg Roach		case 'index':
7131bc7874SGreg Roach			global $controller, $WT_TREE;
728c2e8227SGreg Roach
738c2e8227SGreg Roach			$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
748c2e8227SGreg Roach
750e62c4b8SGreg Roach			$clip_ctrl = new ClippingsCartController;
767bd2dc19SGreg Roach			$cart      = Session::get('cart');
778c2e8227SGreg Roach
788c2e8227SGreg Roach			$controller = new PageController;
798c2e8227SGreg Roach			$controller
808c2e8227SGreg Roach				->setPageTitle($this->getTitle())
8115d603e7SGreg Roach				->pageHeader();
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') { ?>
9415d603e7SGreg Roach					<form action="module.php">
958c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
968c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
9715d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
9815d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $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">
10415d603e7SGreg Roach										<?= 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">
11215d603e7SGreg Roach										<?= $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>
11815d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
11915d603e7SGreg Roach										I18N::translate('%s and their children', $record->getFullName()) ?>
1204e3c4966SGreg Roach									</td>
1214e3c4966SGreg Roach								</tr>
1224e3c4966SGreg Roach								<tr>
1234e3c4966SGreg Roach									<td class="optionbox">
1244e3c4966SGreg Roach										<input type="radio" name="others" value="descendants">
12515d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
12615d603e7SGreg Roach										I18N::translate('%s and their descendants', $record->getFullName()) ?>
1274e3c4966SGreg Roach									</td>
1284e3c4966SGreg Roach								</tr>
1294e3c4966SGreg Roach							</tbody>
1304e3c4966SGreg Roach							<tfoot>
1314e3c4966SGreg Roach								<tr>
13215d603e7SGreg Roach									<td class="topbottombar"><input type="submit" value="<?= I18N::translate('continue') ?>">
1334e3c4966SGreg Roach									</td>
1344e3c4966SGreg Roach								</tr>
1354e3c4966SGreg Roach							</tfoot>
1368c2e8227SGreg Roach						</table>
1378c2e8227SGreg Roach					</form>
1388c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
13915d603e7SGreg Roach					<form action="module.php">
1408c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
1418c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
14215d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
14315d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
144a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
1454e3c4966SGreg Roach						<table>
1464e3c4966SGreg Roach							<thead>
1474e3c4966SGreg Roach								<tr>
1484e3c4966SGreg Roach									<td class="topbottombar">
14915d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1504e3c4966SGreg Roach									</td>
1514e3c4966SGreg Roach								</tr>
1524e3c4966SGreg Roach							</thead>
1534e3c4966SGreg Roach							<tbody>
1544e3c4966SGreg Roach								<tr>
1554e3c4966SGreg Roach									<td class="optionbox">
1564e3c4966SGreg Roach										<label>
1574e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
15815d603e7SGreg Roach											<?= $record->getFullName() ?>
1594e3c4966SGreg Roach										</label>
1604e3c4966SGreg Roach									</td>
1614e3c4966SGreg Roach								</tr>
1624e3c4966SGreg Roach								<tr>
1634e3c4966SGreg Roach									<td class="optionbox">
1644e3c4966SGreg Roach										<label>
1654e3c4966SGreg Roach											<input type="radio" name="others" value="parents">
1664e3c4966SGreg Roach											<?php
1674e3c4966SGreg Roach											if ($record->getSex() === 'F') {
168a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
169a86dd8b1SGreg Roach												I18N::translate('%s, her parents and siblings', $record->getFullName());
1704e3c4966SGreg Roach											} else {
171a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
172a86dd8b1SGreg Roach												I18N::translate('%s, his parents and siblings', $record->getFullName());
1734e3c4966SGreg Roach											}
1744e3c4966SGreg Roach											?>
1754e3c4966SGreg Roach										</label>
1764e3c4966SGreg Roach									</td>
1774e3c4966SGreg Roach								</tr>
1784e3c4966SGreg Roach								<tr>
1794e3c4966SGreg Roach									<td class="optionbox">
1804e3c4966SGreg Roach										<label>
1814e3c4966SGreg Roach											<input type="radio" name="others" value="members">
1824e3c4966SGreg Roach											<?php
1834e3c4966SGreg Roach											if ($record->getSex() === 'F') {
184a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
185a86dd8b1SGreg Roach												I18N::translate('%s, her spouses and children', $record->getFullName());
1864e3c4966SGreg Roach											} else {
187a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
188a86dd8b1SGreg Roach												I18N::translate('%s, his spouses and children', $record->getFullName());
1894e3c4966SGreg Roach											}
1904e3c4966SGreg Roach											?>
1914e3c4966SGreg Roach										</label>
1924e3c4966SGreg Roach									</td>
1934e3c4966SGreg Roach								</tr>
1944e3c4966SGreg Roach								<tr>
1954e3c4966SGreg Roach									<td class="optionbox">
1964e3c4966SGreg Roach										<label>
1974e3c4966SGreg Roach											<input type="radio" name="others" value="ancestors" id="ancestors">
1984e3c4966SGreg Roach											<?php
1994e3c4966SGreg Roach											if ($record->getSex() === 'F') {
200a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
201a86dd8b1SGreg Roach												I18N::translate('%s and her ancestors', $record->getFullName());
2024e3c4966SGreg Roach											} else {
203a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
204a86dd8b1SGreg Roach												I18N::translate('%s and his ancestors', $record->getFullName());
2054e3c4966SGreg Roach											}
2064e3c4966SGreg Roach											?>
2074e3c4966SGreg Roach										</label>
2084e3c4966SGreg Roach										<br>
20915d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
21015d603e7SGreg Roach										<input type="text" size="5" name="level1" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestors');">
2114e3c4966SGreg Roach									</td>
2124e3c4966SGreg Roach								</tr>
2134e3c4966SGreg Roach								<tr>
2144e3c4966SGreg Roach									<td class="optionbox">
2154e3c4966SGreg Roach										<label>
2164e3c4966SGreg Roach											<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
2174e3c4966SGreg Roach											<?php
2184e3c4966SGreg Roach											if ($record->getSex() === 'F') {
219a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
220a86dd8b1SGreg Roach												I18N::translate('%s, her ancestors and their families', $record->getFullName());
2214e3c4966SGreg Roach											} else {
222a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
223a86dd8b1SGreg Roach												I18N::translate('%s, his ancestors and their families', $record->getFullName());
2244e3c4966SGreg Roach											}
2254e3c4966SGreg Roach											?>
2264e3c4966SGreg Roach										</label>
2274e3c4966SGreg Roach										<br>
22815d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
22915d603e7SGreg Roach										<input type="text" size="5" name="level2" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestorsfamilies');">
2304e3c4966SGreg Roach									</td>
2314e3c4966SGreg Roach								</tr>
2324e3c4966SGreg Roach								<tr>
2334e3c4966SGreg Roach									<td class="optionbox">
2344e3c4966SGreg Roach										<label>
2354e3c4966SGreg Roach											<input type="radio" name="others" value="descendants" id="descendants">
2364e3c4966SGreg Roach											<?php
2374e3c4966SGreg Roach											if ($record->getSex() === 'F') {
238a86dd8b1SGreg Roach												echo /* I18N: %s is a woman's name */
239a86dd8b1SGreg Roach												I18N::translate('%s, her spouses and descendants', $record->getFullName());
2404e3c4966SGreg Roach											} else {
241a86dd8b1SGreg Roach												echo /* I18N: %s is a man's name */
242a86dd8b1SGreg Roach												I18N::translate('%s, his spouses and descendants', $record->getFullName());
2434e3c4966SGreg Roach											}
2444e3c4966SGreg Roach											?>
2454e3c4966SGreg Roach										</label>
2464e3c4966SGreg Roach										<br>
24715d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
24815d603e7SGreg Roach										<input type="text" size="5" name="level3" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('descendants');">
2494e3c4966SGreg Roach									</td>
2504e3c4966SGreg Roach								</tr>
2514e3c4966SGreg Roach							</tbody>
2524e3c4966SGreg Roach							<tfoot>
2534e3c4966SGreg Roach								<tr>
2544e3c4966SGreg Roach									<td class="topbottombar">
25515d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
2564e3c4966SGreg Roach									</td>
2574e3c4966SGreg Roach								</tr>
2584e3c4966SGreg Roach							</tfoot>
2598c2e8227SGreg Roach						</table>
2608c2e8227SGreg Roach					</form>
2618c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
26215d603e7SGreg Roach					<form action="module.php">
2638c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
2648c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
26515d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
26615d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
267a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
2684e3c4966SGreg Roach						<table>
2694e3c4966SGreg Roach							<thead>
2704e3c4966SGreg Roach								<tr>
2714e3c4966SGreg Roach									<td class="topbottombar">
27215d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
2734e3c4966SGreg Roach									</td>
2744e3c4966SGreg Roach								</tr>
2754e3c4966SGreg Roach							</thead>
2764e3c4966SGreg Roach							<tbody>
2774e3c4966SGreg Roach								<tr>
2784e3c4966SGreg Roach									<td class="optionbox">
2794e3c4966SGreg Roach										<label>
2804e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
28115d603e7SGreg Roach											<?= $record->getFullName() ?>
2824e3c4966SGreg Roach										</label>
2834e3c4966SGreg Roach									</td>
2844e3c4966SGreg Roach								</tr>
2854e3c4966SGreg Roach								<tr>
2864e3c4966SGreg Roach									<td class="optionbox">
2874e3c4966SGreg Roach										<label>
2884e3c4966SGreg Roach											<input type="radio" name="others" value="linked">
28915d603e7SGreg Roach											<?= /* I18N: %s is the name of a source */
29015d603e7SGreg Roach											I18N::translate('%s and the individuals that reference it.', $record->getFullName()) ?>
2914e3c4966SGreg Roach										</label>
2924e3c4966SGreg Roach									</td>
2934e3c4966SGreg Roach								</tr>
2944e3c4966SGreg Roach							</tbody>
2954e3c4966SGreg Roach							<tfoot>
2964e3c4966SGreg Roach								<tr>
2974e3c4966SGreg Roach									<td class="topbottombar">
29815d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
2994e3c4966SGreg Roach									</td>
3004e3c4966SGreg Roach								</tr>
3014e3c4966SGreg Roach							</tfoot>
3028c2e8227SGreg Roach						</table>
3038c2e8227SGreg Roach					</form>
3048c2e8227SGreg Roach				<?php }
3058c2e8227SGreg Roach			}
3068c2e8227SGreg Roach
30731bc7874SGreg Roach			if (!$cart[$WT_TREE->getTreeId()]) {
3088c2e8227SGreg Roach				if ($clip_ctrl->action != 'add') {
3092a277e58SGreg Roach					echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.');
3108c2e8227SGreg Roach					?>
31115d603e7SGreg Roach					<form name="addin" action="module.php">
3128c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3138c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3148c2e8227SGreg Roach						<table>
3154e3c4966SGreg Roach							<thead>
3168c2e8227SGreg Roach								<tr>
3174e3c4966SGreg Roach									<td colspan="2" class="topbottombar">
31815d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
3198c2e8227SGreg Roach									</td>
3208c2e8227SGreg Roach								</tr>
3214e3c4966SGreg Roach							</thead>
3224e3c4966SGreg Roach							<tbody>
3238c2e8227SGreg Roach								<tr>
3248c2e8227SGreg Roach									<td class="optionbox">
3258c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
3268c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
3278c2e8227SGreg Roach									</td>
3288c2e8227SGreg Roach									<td class="optionbox">
32915d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
3308c2e8227SGreg Roach									</td>
3318c2e8227SGreg Roach								</tr>
3324e3c4966SGreg Roach							</tbody>
3338c2e8227SGreg Roach						</table>
3348c2e8227SGreg Roach					</form>
3358c2e8227SGreg Roach					<?php
3368c2e8227SGreg Roach				}
3378c2e8227SGreg Roach
3388c2e8227SGreg Roach				// -- end new lines
3398c2e8227SGreg Roach				echo I18N::translate('Your clippings cart is empty.');
3408c2e8227SGreg Roach			} else {
3418c2e8227SGreg Roach				// Keep track of the INDI from the parent page, otherwise it will
3428c2e8227SGreg Roach				// get lost after ajax updates
3438c2e8227SGreg Roach				$pid = Filter::get('pid', WT_REGEX_XREF);
3448c2e8227SGreg Roach
345a86dd8b1SGreg Roach				if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?>
34615d603e7SGreg Roach					<form action="module.php">
3478c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3488c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3498c2e8227SGreg Roach						<input type="hidden" name="action" value="download">
35015d603e7SGreg Roach						<input type="hidden" name="pid" value="<?= $pid ?>">
3518c2e8227SGreg Roach						<table>
352a86dd8b1SGreg Roach							<tr>
353a86dd8b1SGreg Roach								<td colspan="2" class="topbottombar">
35415d603e7SGreg Roach									<h2><?= I18N::translate('Download') ?></h2>
355a86dd8b1SGreg Roach								</td>
356a86dd8b1SGreg Roach							</tr>
3576fd6cde8SGreg Roach							<tr>
3586fd6cde8SGreg Roach								<td class="descriptionbox width50 wrap">
35915d603e7SGreg 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.') ?>
3606fd6cde8SGreg Roach								</td>
3616fd6cde8SGreg Roach								<td class="optionbox wrap">
3626fd6cde8SGreg Roach									<input type="checkbox" name="Zip" value="yes">
36315d603e7SGreg Roach									<?= I18N::translate('Zip file(s)') ?>
3646fd6cde8SGreg Roach								</td>
3656fd6cde8SGreg Roach							</tr>
3666fd6cde8SGreg Roach							<tr>
3676fd6cde8SGreg Roach								<td class="descriptionbox width50 wrap">
36815d603e7SGreg Roach									<?= I18N::translate('Include media (automatically zips files)') ?>
3696fd6cde8SGreg Roach								</td>
370a86dd8b1SGreg Roach								<td class="optionbox">
371a86dd8b1SGreg Roach									<input type="checkbox" name="IncludeMedia" value="yes">
372a86dd8b1SGreg Roach								</td>
373a86dd8b1SGreg Roach							</tr>
3748c2e8227SGreg Roach
3754b9ff166SGreg Roach							<?php if (Auth::isManager($WT_TREE)) { ?>
376a86dd8b1SGreg Roach								<tr>
377a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
37815d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
379a86dd8b1SGreg Roach									</td>
3808c2e8227SGreg Roach									<td class="optionbox">
381a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="none" checked>
38215d603e7SGreg Roach										<?= I18N::translate('None') ?>
383a86dd8b1SGreg Roach										<br>
384a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="gedadmin">
38515d603e7SGreg Roach										<?= I18N::translate('Manager') ?>
386a86dd8b1SGreg Roach										<br>
387a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="user">
38815d603e7SGreg Roach										<?= I18N::translate('Member') ?>
389a86dd8b1SGreg Roach										<br>
390a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="visitor">
39115d603e7SGreg Roach										<?= I18N::translate('Visitor') ?>
392a86dd8b1SGreg Roach									</td>
393a86dd8b1SGreg Roach								</tr>
3944b9ff166SGreg Roach							<?php } elseif (Auth::isMember($WT_TREE)) { ?>
395a86dd8b1SGreg Roach								<tr>
396a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
39715d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
398a86dd8b1SGreg Roach									</td>
3998c2e8227SGreg Roach									<td class="optionbox">
40015d603e7SGreg Roach										<input type="radio" name="privatize_export" value="user" checked> <?= I18N::translate('Member') ?><br>
40115d603e7SGreg Roach										<input type="radio" name="privatize_export" value="visitor"> <?= I18N::translate('Visitor') ?>
402a86dd8b1SGreg Roach									</td>
403a86dd8b1SGreg Roach								</tr>
4048c2e8227SGreg Roach							<?php } ?>
4058c2e8227SGreg Roach
406a86dd8b1SGreg Roach							<tr>
407a86dd8b1SGreg Roach								<td class="descriptionbox width50 wrap">
40815d603e7SGreg Roach									<?= I18N::translate('Convert from UTF-8 to ISO-8859-1') ?>
409a86dd8b1SGreg Roach								</td>
410a86dd8b1SGreg Roach								<td class="optionbox">
411a86dd8b1SGreg Roach									<input type="checkbox" name="convert" value="yes">
412a86dd8b1SGreg Roach								</td>
413a86dd8b1SGreg Roach							</tr>
4148c2e8227SGreg Roach
415a86dd8b1SGreg Roach							<tr>
416a86dd8b1SGreg Roach								<td class="descriptionbox width50 wrap">
41715d603e7SGreg Roach									<?= I18N::translate('Add the GEDCOM media path to filenames') ?>
418a86dd8b1SGreg Roach								</td>
4198c2e8227SGreg Roach								<td class="optionbox">
420cc5ab399SGreg Roach									<input type="checkbox" name="conv_path" value="<?= Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) ?>">
421cc5ab399SGreg Roach									<span dir="auto"><?= Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) ?></span>
422a86dd8b1SGreg Roach								</td>
423a86dd8b1SGreg Roach							</tr>
4248c2e8227SGreg Roach
425a86dd8b1SGreg Roach							<tr>
426a86dd8b1SGreg Roach								<td class="topbottombar" colspan="2">
42715d603e7SGreg Roach									<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('download') ?>">
428a86dd8b1SGreg Roach								</td>
429a86dd8b1SGreg Roach							</tr>
430a86dd8b1SGreg Roach						</table>
4318c2e8227SGreg Roach					</form>
4328c2e8227SGreg Roach					<br>
4338c2e8227SGreg Roach
43415d603e7SGreg Roach					<form name="addin" action="module.php">
4358c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
4368c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
4378c2e8227SGreg Roach						<table>
4384e3c4966SGreg Roach							<thead>
4398c2e8227SGreg Roach								<tr>
4408c2e8227SGreg Roach									<td colspan="2" class="topbottombar" style="text-align:center; ">
44115d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
4428c2e8227SGreg Roach									</td>
4438c2e8227SGreg Roach								</tr>
4444e3c4966SGreg Roach							</thead>
4454e3c4966SGreg Roach							<tbody>
4468c2e8227SGreg Roach								<tr>
4478c2e8227SGreg Roach									<td class="optionbox">
4488c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
4498c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
4508c2e8227SGreg Roach									</td>
4518c2e8227SGreg Roach									<td class="optionbox">
45215d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
4538c2e8227SGreg Roach									</td>
4548c2e8227SGreg Roach								</tr>
4554e3c4966SGreg Roach							</tbody>
456a86dd8b1SGreg Roach							<tfoot>
457a86dd8b1SGreg Roach								<tr>
458a86dd8b1SGreg Roach									<th colspan="2">
459a86dd8b1SGreg Roach										<a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty">
46015d603e7SGreg Roach											<?= I18N::translate('Empty the clippings cart') ?>
461a86dd8b1SGreg Roach										</a>
462a86dd8b1SGreg Roach									</th>
463a86dd8b1SGreg Roach								</tr>
464a86dd8b1SGreg Roach							</tfoot>
4658c2e8227SGreg Roach						</table>
4668c2e8227SGreg Roach					</form>
4678c2e8227SGreg Roach
4688c2e8227SGreg Roach				<?php } ?>
4698c2e8227SGreg Roach
470a86dd8b1SGreg Roach				<h2>
47115d603e7SGreg Roach					<?= I18N::translate('Family tree clippings cart') ?>
472a86dd8b1SGreg Roach				</h2>
4738c2e8227SGreg Roach				<table id="mycart" class="sortable list_table width100">
474a86dd8b1SGreg Roach					<thead>
4758c2e8227SGreg Roach						<tr>
47615d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Record') ?></th>
47715d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Remove') ?></th>
4788c2e8227SGreg Roach						</tr>
479a86dd8b1SGreg Roach					</thead>
480a86dd8b1SGreg Roach					<tbody>
4818c2e8227SGreg Roach						<?php
48231bc7874SGreg Roach						foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
48324ec66ceSGreg Roach							$record = GedcomRecord::getInstance($xref, $WT_TREE);
4848c2e8227SGreg Roach							if ($record) {
4858c2e8227SGreg Roach								switch ($record::RECORD_TYPE) {
486a86dd8b1SGreg Roach								case 'INDI':
487a86dd8b1SGreg Roach									$icon = 'icon-indis';
488a86dd8b1SGreg Roach									break;
489a86dd8b1SGreg Roach								case 'FAM':
490a86dd8b1SGreg Roach									$icon = 'icon-sfamily';
491a86dd8b1SGreg Roach									break;
492a86dd8b1SGreg Roach								case 'SOUR':
493a86dd8b1SGreg Roach									$icon = 'icon-source';
494a86dd8b1SGreg Roach									break;
495a86dd8b1SGreg Roach								case 'REPO':
496a86dd8b1SGreg Roach									$icon = 'icon-repository';
497a86dd8b1SGreg Roach									break;
498a86dd8b1SGreg Roach								case 'NOTE':
499a86dd8b1SGreg Roach									$icon = 'icon-note';
500a86dd8b1SGreg Roach									break;
501a86dd8b1SGreg Roach								case 'OBJE':
502a86dd8b1SGreg Roach									$icon = 'icon-media';
503a86dd8b1SGreg Roach									break;
504a86dd8b1SGreg Roach								default:
505a86dd8b1SGreg Roach									$icon = 'icon-clippings';
506a86dd8b1SGreg Roach									break;
5078c2e8227SGreg Roach								}
5088c2e8227SGreg Roach								?>
509a86dd8b1SGreg Roach								<tr>
510a86dd8b1SGreg Roach									<td class="list_value">
51115d603e7SGreg Roach										<i class="<?= $icon ?>"></i>
5128c2e8227SGreg Roach										<?php
5138c2e8227SGreg Roach										echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
5148c2e8227SGreg Roach										?>
5158c2e8227SGreg Roach									</td>
51615d603e7SGreg 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>
5178c2e8227SGreg Roach								</tr>
5188c2e8227SGreg Roach								<?php
5198c2e8227SGreg Roach							}
5208c2e8227SGreg Roach						}
5218c2e8227SGreg Roach						?>
5228c2e8227SGreg Roach				</table>
5238c2e8227SGreg Roach				<?php
5248c2e8227SGreg Roach			}
5258c2e8227SGreg Roach			break;
5268c2e8227SGreg Roach		default:
5278c2e8227SGreg Roach			http_response_code(404);
5288c2e8227SGreg Roach			break;
5298c2e8227SGreg Roach		}
5308c2e8227SGreg Roach	}
5318c2e8227SGreg Roach
5320ee13198SGreg Roach	/**
5330ee13198SGreg Roach	 * The user can re-order menus. Until they do, they are shown in this order.
5340ee13198SGreg Roach	 *
5350ee13198SGreg Roach	 * @return int
5360ee13198SGreg Roach	 */
5378c2e8227SGreg Roach	public function defaultMenuOrder() {
5388c2e8227SGreg Roach		return 20;
5398c2e8227SGreg Roach	}
5408c2e8227SGreg Roach
5410ee13198SGreg Roach	/**
5420ee13198SGreg Roach	 * A menu, to be added to the main application menu.
5430ee13198SGreg Roach	 *
5440ee13198SGreg Roach	 * @return Menu|null
5450ee13198SGreg Roach	 */
5468c2e8227SGreg Roach	public function getMenu() {
5474b9ff166SGreg Roach		global $controller, $WT_TREE;
5488c2e8227SGreg Roach
54913abd6f3SGreg Roach		$submenus = [];
5508c2e8227SGreg Roach		if (isset($controller->record)) {
55115d603e7SGreg Roach			$submenus[] = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings-cart', ['rel' => 'nofollow']);
5528c2e8227SGreg Roach		}
5538c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
55415d603e7SGreg 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']);
5558c2e8227SGreg Roach		}
556cbc1590aSGreg Roach
557941edf23SGreg Roach		if ($submenus) {
55813abd6f3SGreg Roach			return new Menu($this->getTitle(), '#', 'menu-clippings', ['rel' => 'nofollow'], $submenus);
559941edf23SGreg Roach		} else {
56013abd6f3SGreg Roach			return new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', ['rel' => 'nofollow']);
561941edf23SGreg Roach		}
5628c2e8227SGreg Roach	}
5638c2e8227SGreg Roach
5648c2e8227SGreg Roach	/** {@inheritdoc} */
5658c2e8227SGreg Roach	public function defaultSidebarOrder() {
5668c2e8227SGreg Roach		return 60;
5678c2e8227SGreg Roach	}
5688c2e8227SGreg Roach
5698c2e8227SGreg Roach	/** {@inheritdoc} */
5708c2e8227SGreg Roach	public function hasSidebarContent() {
5718c2e8227SGreg Roach		// Creating a controller has the side effect of initialising the cart
5720e62c4b8SGreg Roach		new ClippingsCartController;
5738c2e8227SGreg Roach
5748c2e8227SGreg Roach		return true;
5758c2e8227SGreg Roach	}
5768c2e8227SGreg Roach
57776692c8bSGreg Roach	/**
57876692c8bSGreg Roach	 * Load this sidebar synchronously.
57976692c8bSGreg Roach	 *
58076692c8bSGreg Roach	 * @return string
58176692c8bSGreg Roach	 */
5828c2e8227SGreg Roach	public function getSidebarContent() {
5838c2e8227SGreg Roach		global $controller;
5848c2e8227SGreg Roach
5858c2e8227SGreg Roach		$controller->addInlineJavascript('
58615d603e7SGreg Roach				$("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
58715d603e7SGreg Roach					$("#sb_clippings_content").load(this.href);
5888c2e8227SGreg Roach					return false;
5898c2e8227SGreg Roach				});
5908c2e8227SGreg Roach			');
5918c2e8227SGreg Roach
5928c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
5938c2e8227SGreg Roach	}
5948c2e8227SGreg Roach
5958c2e8227SGreg Roach	/** {@inheritdoc} */
5968c2e8227SGreg Roach	public function getSidebarAjaxContent() {
59731bc7874SGreg Roach		global $WT_TREE;
59831bc7874SGreg Roach
59931bc7874SGreg Roach		$cart = Session::get('cart');
6008c2e8227SGreg Roach
6010e62c4b8SGreg Roach		$clip_ctrl         = new ClippingsCartController;
6028c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
6038c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
6048c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
6058c2e8227SGreg Roach		$others            = Filter::get('others');
6068c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
6078c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
6088c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
6098c2e8227SGreg Roach		if ($add) {
61024ec66ceSGreg Roach			$record = GedcomRecord::getInstance($add, $WT_TREE);
6118c2e8227SGreg Roach			if ($record) {
6128c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6138c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6148c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
6158c2e8227SGreg Roach			}
6168c2e8227SGreg Roach		} elseif ($add1) {
61724ec66ceSGreg Roach			$record = Individual::getInstance($add1, $WT_TREE);
6188c2e8227SGreg Roach			if ($record) {
6198c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6208c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6218c2e8227SGreg Roach				if ($others == 'parents') {
6228c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
6238c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6248c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6258c2e8227SGreg Roach					}
6268c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
6278c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
6288c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
6298c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
6308c2e8227SGreg Roach				} elseif ($others == 'members') {
6318c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6328c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6338c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6348c2e8227SGreg Roach					}
6358c2e8227SGreg Roach				} elseif ($others == 'descendants') {
6368c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6378c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6388c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
6398c2e8227SGreg Roach					}
6408c2e8227SGreg Roach				}
6418c2e8227SGreg Roach			}
6428c2e8227SGreg Roach		} elseif ($remove) {
64331bc7874SGreg Roach			unset($cart[$WT_TREE->getTreeId()][$remove]);
64431bc7874SGreg Roach			Session::put('cart', $cart);
6458c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
64613abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
64731bc7874SGreg Roach			Session::put('cart', $cart);
6488c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
6498c2e8227SGreg Roach			return $this->downloadForm($clip_ctrl);
6508c2e8227SGreg Roach		}
65131bc7874SGreg Roach
6528c2e8227SGreg Roach		return $this->getCartList();
6538c2e8227SGreg Roach	}
6548c2e8227SGreg Roach
6558c2e8227SGreg Roach	/**
6568c2e8227SGreg Roach	 * A list for the side bar.
6578c2e8227SGreg Roach	 *
6588c2e8227SGreg Roach	 * @return string
6598c2e8227SGreg Roach	 */
6608c2e8227SGreg Roach	public function getCartList() {
66131bc7874SGreg Roach		global $WT_TREE;
6628c2e8227SGreg Roach
66313abd6f3SGreg Roach		$cart = Session::get('cart', []);
66431bc7874SGreg Roach		if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
66513abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
66631bc7874SGreg Roach		}
6678c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
6688c2e8227SGreg Roach
66931bc7874SGreg Roach		if (!$cart[$WT_TREE->getTreeId()]) {
6708c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
6718c2e8227SGreg Roach		} else {
6728c2e8227SGreg Roach			$out = '<ul>';
67331bc7874SGreg Roach			foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
67424ec66ceSGreg Roach				$record = GedcomRecord::getInstance($xref, $WT_TREE);
6758c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
6768c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
6778c2e8227SGreg Roach					case 'INDI':
6788c2e8227SGreg Roach						$icon = 'icon-indis';
6798c2e8227SGreg Roach						break;
6808c2e8227SGreg Roach					case 'FAM':
6818c2e8227SGreg Roach						$icon = 'icon-sfamily';
6828c2e8227SGreg Roach						break;
6838c2e8227SGreg Roach					}
6848c2e8227SGreg Roach					$out .= '<li>';
6858c2e8227SGreg Roach					if (!empty($icon)) {
6868c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
6878c2e8227SGreg Roach					}
6888c2e8227SGreg Roach					$out .= '<a href="' . $record->getHtmlUrl() . '">';
6898c2e8227SGreg Roach					if ($record instanceof Individual) {
6908c2e8227SGreg Roach						$out .= $record->getSexImage();
6918c2e8227SGreg Roach					}
6928c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
6938c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
6948c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
6958c2e8227SGreg Roach					}
6968c2e8227SGreg Roach					$out .= '</a>';
697cdaf7c6cSGreg 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>';
6988c2e8227SGreg Roach					$out .= '</li>';
6998c2e8227SGreg Roach				}
7008c2e8227SGreg Roach			}
7018c2e8227SGreg Roach			$out .= '</ul>';
7028c2e8227SGreg Roach		}
7038c2e8227SGreg Roach
70431bc7874SGreg Roach		if ($cart[$WT_TREE->getTreeId()]) {
7058c2e8227SGreg Roach			$out .=
706cdaf7c6cSGreg Roach				'<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
7078c2e8227SGreg Roach				I18N::translate('Empty the clippings cart') .
7088c2e8227SGreg Roach				'</a>' .
7098c2e8227SGreg Roach				'<br>' .
710cdaf7c6cSGreg Roach				'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
7118c2e8227SGreg Roach				I18N::translate('Download') .
7128c2e8227SGreg Roach				'</a>';
7138c2e8227SGreg Roach		}
71424ec66ceSGreg Roach		$record = Individual::getInstance($pid, $WT_TREE);
71531bc7874SGreg Roach		if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
716beb9c394SGreg 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>';
7178c2e8227SGreg Roach		}
718cbc1590aSGreg Roach
7198c2e8227SGreg Roach		return $out;
7208c2e8227SGreg Roach	}
7218c2e8227SGreg Roach
7228c2e8227SGreg Roach	/**
72376692c8bSGreg Roach	 * A form to choose the download options.
72476692c8bSGreg Roach	 *
7250e62c4b8SGreg Roach	 * @param ClippingsCartController $clip_ctrl
7268c2e8227SGreg Roach	 *
7278c2e8227SGreg Roach	 * @return string
7288c2e8227SGreg Roach	 */
7290e62c4b8SGreg Roach	public function downloadForm(ClippingsCartController $clip_ctrl) {
7308c2e8227SGreg Roach		global $WT_TREE;
7318c2e8227SGreg Roach
7328c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
7338c2e8227SGreg Roach
7348c2e8227SGreg Roach		$out = '<script>';
7358c2e8227SGreg Roach		$out .= 'function cancelDownload() {
736cdaf7c6cSGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&pid=' . $pid . '";
73715d603e7SGreg Roach				$("#sb_clippings_content").load(link);
7388c2e8227SGreg Roach			}';
7398c2e8227SGreg Roach		$out .= '</script>';
74015d603e7SGreg Roach		$out .= '<form action="module.php">
7418c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
7428c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
7438c2e8227SGreg Roach		<input type="hidden" name="pid" value="' . $pid . '">
7448c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
7458c2e8227SGreg Roach		<table>
7468c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr>
7476fd6cde8SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td>
7488c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
7498c2e8227SGreg Roach
750d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td>
7518c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
7528c2e8227SGreg Roach		';
7538c2e8227SGreg Roach
7544b9ff166SGreg Roach		if (Auth::isManager($WT_TREE)) {
7558c2e8227SGreg Roach			$out .=
756d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7578c2e8227SGreg Roach				'<td class="optionbox">' .
7588c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
7598c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
7608c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
7618c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7628c2e8227SGreg Roach				'</td></tr>';
7634b9ff166SGreg Roach		} elseif (Auth::isMember($WT_TREE)) {
7648c2e8227SGreg Roach			$out .=
765d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7668c2e8227SGreg Roach				'<td class="list_value">' .
7678c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
7688c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7698c2e8227SGreg Roach				'</td></tr>';
7708c2e8227SGreg Roach		}
7718c2e8227SGreg Roach
7728c2e8227SGreg Roach		$out .= '
773d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td>
7748c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
7758c2e8227SGreg Roach
7768c2e8227SGreg Roach		<tr>
777d1928687SGreg Roach		<td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td>
7788c2e8227SGreg Roach		<td class="optionbox">
779cc5ab399SGreg Roach		<input type="checkbox" name="conv_path" value="' . Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '">
780cc5ab399SGreg Roach		<span dir="auto">' . Html::escape($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td>
7818c2e8227SGreg Roach		</tr>
7828c2e8227SGreg Roach
7838c2e8227SGreg Roach		<input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '">
7848c2e8227SGreg Roach
7858c2e8227SGreg Roach		</td></tr>
7868c2e8227SGreg Roach
7878c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
78891e873d9SGreg Roach		<input type="button" value="' . /* I18N: A button label. */ I18N::translate('cancel') . '" onclick="cancelDownload();">
78991e873d9SGreg Roach		<input type="submit" value="' . /* I18N: A button label. */ I18N::translate('download') . '">
7908c2e8227SGreg Roach		</form>';
7918c2e8227SGreg Roach
7928c2e8227SGreg Roach		return $out;
7938c2e8227SGreg Roach	}
7948c2e8227SGreg Roach}
795