xref: /webtrees/app/Module/ClippingsCartModule.php (revision 225e381f36d59b49c8cdac0060465fa5af2fc308)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 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;
23047f239bSGreg 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>';
86c775d873Smakitso				echo '<div class="clipping-cart">';
878c2e8227SGreg Roach
8831bc7874SGreg Roach				if (!$cart[$WT_TREE->getTreeId()]) {
898c2e8227SGreg Roach					echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
908c2e8227SGreg Roach				}
918c2e8227SGreg Roach
928c2e8227SGreg Roach				if ($clip_ctrl->action == 'add') {
934e3c4966SGreg Roach					$record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
948c2e8227SGreg Roach					if ($clip_ctrl->type === 'FAM') { ?>
95742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
968c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
978c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
9815d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
9915d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
1004e3c4966SGreg Roach						<input type="hidden" name="action" value="add1">
101742a5f30Smakitso						<table class="add-to center">
1024e3c4966SGreg Roach							<thead>
1034e3c4966SGreg Roach								<tr>
1044e3c4966SGreg Roach									<td class="topbottombar">
10515d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1064e3c4966SGreg Roach									</td>
1074e3c4966SGreg Roach								</tr>
1084e3c4966SGreg Roach							</thead>
1094e3c4966SGreg Roach							<tbody>
1104e3c4966SGreg Roach								<tr>
1114e3c4966SGreg Roach									<td class="optionbox">
1124e3c4966SGreg Roach										<input type="radio" name="others" value="parents">
11315d603e7SGreg Roach										<?= $record->getFullName() ?>
1144e3c4966SGreg Roach									</td>
1154e3c4966SGreg Roach								</tr>
1164e3c4966SGreg Roach								<tr>
1174e3c4966SGreg Roach									<td class="optionbox">
1184e3c4966SGreg Roach										<input type="radio" name="others" value="members" checked>
11915d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
12015d603e7SGreg Roach											I18N::translate('%s and their children', $record->getFullName()) ?>
1214e3c4966SGreg Roach									</td>
1224e3c4966SGreg Roach								</tr>
1234e3c4966SGreg Roach								<tr>
1244e3c4966SGreg Roach									<td class="optionbox">
1254e3c4966SGreg Roach										<input type="radio" name="others" value="descendants">
12615d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
12715d603e7SGreg Roach											I18N::translate('%s and their descendants', $record->getFullName()) ?>
1284e3c4966SGreg Roach									</td>
1294e3c4966SGreg Roach								</tr>
1304e3c4966SGreg Roach							</tbody>
1314e3c4966SGreg Roach							<tfoot>
1324e3c4966SGreg Roach								<tr>
13315d603e7SGreg Roach									<td class="topbottombar"><input type="submit" value="<?= I18N::translate('continue') ?>">
1344e3c4966SGreg Roach									</td>
1354e3c4966SGreg Roach								</tr>
1364e3c4966SGreg Roach							</tfoot>
1378c2e8227SGreg Roach						</table>
1388c2e8227SGreg Roach					</form>
139742a5f30Smakitso				</div>
1408c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
141742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
1428c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
1438c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
14415d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
14515d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
146a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
147742a5f30Smakitso						<table class="add-to center">
1484e3c4966SGreg Roach							<thead>
1494e3c4966SGreg Roach								<tr>
1504e3c4966SGreg Roach									<td class="topbottombar">
15115d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1524e3c4966SGreg Roach									</td>
1534e3c4966SGreg Roach								</tr>
1544e3c4966SGreg Roach							</thead>
1554e3c4966SGreg Roach							<tbody>
1564e3c4966SGreg Roach								<tr>
1574e3c4966SGreg Roach									<td class="optionbox">
1584e3c4966SGreg Roach										<label>
1594e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
16015d603e7SGreg Roach											<?= $record->getFullName() ?>
1614e3c4966SGreg Roach										</label>
1624e3c4966SGreg Roach									</td>
1634e3c4966SGreg Roach								</tr>
1644e3c4966SGreg Roach								<tr>
1654e3c4966SGreg Roach									<td class="optionbox">
1664e3c4966SGreg Roach										<label>
1674e3c4966SGreg Roach											<input type="radio" name="others" value="parents">
1684e3c4966SGreg Roach											<?php
1694e3c4966SGreg Roach												if ($record->getSex() === 'F') {
170a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
171a86dd8b1SGreg Roach													I18N::translate('%s, her parents and siblings', $record->getFullName());
1724e3c4966SGreg Roach												} else {
173a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
174a86dd8b1SGreg Roach													I18N::translate('%s, his parents and siblings', $record->getFullName());
1754e3c4966SGreg Roach												}
1764e3c4966SGreg Roach												?>
1774e3c4966SGreg Roach										</label>
1784e3c4966SGreg Roach									</td>
1794e3c4966SGreg Roach								</tr>
1804e3c4966SGreg Roach								<tr>
1814e3c4966SGreg Roach									<td class="optionbox">
1824e3c4966SGreg Roach										<label>
1834e3c4966SGreg Roach											<input type="radio" name="others" value="members">
1844e3c4966SGreg Roach											<?php
1854e3c4966SGreg Roach												if ($record->getSex() === 'F') {
186a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
187a86dd8b1SGreg Roach													I18N::translate('%s, her spouses and children', $record->getFullName());
1884e3c4966SGreg Roach												} else {
189a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
190a86dd8b1SGreg Roach													I18N::translate('%s, his spouses and children', $record->getFullName());
1914e3c4966SGreg Roach												}
1924e3c4966SGreg Roach												?>
1934e3c4966SGreg Roach										</label>
1944e3c4966SGreg Roach									</td>
1954e3c4966SGreg Roach								</tr>
1964e3c4966SGreg Roach								<tr>
1974e3c4966SGreg Roach									<td class="optionbox">
1984e3c4966SGreg Roach										<label>
1994e3c4966SGreg Roach											<input type="radio" name="others" value="ancestors" id="ancestors">
2004e3c4966SGreg Roach											<?php
2014e3c4966SGreg Roach												if ($record->getSex() === 'F') {
202a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
203a86dd8b1SGreg Roach													I18N::translate('%s and her ancestors', $record->getFullName());
2044e3c4966SGreg Roach												} else {
205a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
206a86dd8b1SGreg Roach													I18N::translate('%s and his ancestors', $record->getFullName());
2074e3c4966SGreg Roach												}
2084e3c4966SGreg Roach												?>
2094e3c4966SGreg Roach										</label>
2104e3c4966SGreg Roach										<br>
21115d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
21215d603e7SGreg Roach											<input type="text" size="5" name="level1" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestors');">
2134e3c4966SGreg Roach									</td>
2144e3c4966SGreg Roach								</tr>
2154e3c4966SGreg Roach								<tr>
2164e3c4966SGreg Roach									<td class="optionbox">
2174e3c4966SGreg Roach										<label>
2184e3c4966SGreg Roach											<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
2194e3c4966SGreg Roach											<?php
2204e3c4966SGreg Roach												if ($record->getSex() === 'F') {
221a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
222a86dd8b1SGreg Roach													I18N::translate('%s, her ancestors and their families', $record->getFullName());
2234e3c4966SGreg Roach												} else {
224a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
225a86dd8b1SGreg Roach													I18N::translate('%s, his ancestors and their families', $record->getFullName());
2264e3c4966SGreg Roach												}
2274e3c4966SGreg Roach												?>
2284e3c4966SGreg Roach										</label>
2294e3c4966SGreg Roach										<br>
23015d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
23115d603e7SGreg Roach											<input type="text" size="5" name="level2" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestorsfamilies');">
2324e3c4966SGreg Roach									</td>
2334e3c4966SGreg Roach								</tr>
2344e3c4966SGreg Roach								<tr>
2354e3c4966SGreg Roach									<td class="optionbox">
2364e3c4966SGreg Roach										<label>
2374e3c4966SGreg Roach											<input type="radio" name="others" value="descendants" id="descendants">
2384e3c4966SGreg Roach											<?php
2394e3c4966SGreg Roach												if ($record->getSex() === 'F') {
240a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
241a86dd8b1SGreg Roach													I18N::translate('%s, her spouses and descendants', $record->getFullName());
2424e3c4966SGreg Roach												} else {
243a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
244a86dd8b1SGreg Roach													I18N::translate('%s, his spouses and descendants', $record->getFullName());
2454e3c4966SGreg Roach												}
2464e3c4966SGreg Roach												?>
2474e3c4966SGreg Roach										</label>
2484e3c4966SGreg Roach										<br>
24915d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
25015d603e7SGreg Roach											<input type="text" size="5" name="level3" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('descendants');">
2514e3c4966SGreg Roach									</td>
2524e3c4966SGreg Roach								</tr>
2534e3c4966SGreg Roach							</tbody>
2544e3c4966SGreg Roach							<tfoot>
2554e3c4966SGreg Roach								<tr>
2564e3c4966SGreg Roach									<td class="topbottombar">
25715d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
2584e3c4966SGreg Roach									</td>
2594e3c4966SGreg Roach								</tr>
2604e3c4966SGreg Roach							</tfoot>
2618c2e8227SGreg Roach						</table>
2628c2e8227SGreg Roach					</form>
263742a5f30Smakitso				</div>
2648c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
265742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
2668c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
2678c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
26815d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
26915d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
270a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
271742a5f30Smakitso						<table class="add-to center">
2724e3c4966SGreg Roach							<thead>
2734e3c4966SGreg Roach								<tr>
2744e3c4966SGreg Roach									<td class="topbottombar">
27515d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
2764e3c4966SGreg Roach									</td>
2774e3c4966SGreg Roach								</tr>
2784e3c4966SGreg Roach							</thead>
2794e3c4966SGreg Roach							<tbody>
2804e3c4966SGreg Roach								<tr>
2814e3c4966SGreg Roach									<td class="optionbox">
2824e3c4966SGreg Roach										<label>
2834e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
28415d603e7SGreg Roach											<?= $record->getFullName() ?>
2854e3c4966SGreg Roach										</label>
2864e3c4966SGreg Roach									</td>
2874e3c4966SGreg Roach								</tr>
2884e3c4966SGreg Roach								<tr>
2894e3c4966SGreg Roach									<td class="optionbox">
2904e3c4966SGreg Roach										<label>
2914e3c4966SGreg Roach											<input type="radio" name="others" value="linked">
29215d603e7SGreg Roach											<?= /* I18N: %s is the name of a source */
29315d603e7SGreg Roach												I18N::translate('%s and the individuals that reference it.', $record->getFullName()) ?>
2944e3c4966SGreg Roach										</label>
2954e3c4966SGreg Roach									</td>
2964e3c4966SGreg Roach								</tr>
2974e3c4966SGreg Roach							</tbody>
2984e3c4966SGreg Roach							<tfoot>
2994e3c4966SGreg Roach								<tr>
3004e3c4966SGreg Roach									<td class="topbottombar">
30115d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
3024e3c4966SGreg Roach									</td>
3034e3c4966SGreg Roach								</tr>
3044e3c4966SGreg Roach							</tfoot>
3058c2e8227SGreg Roach						</table>
3068c2e8227SGreg Roach					</form>
307742a5f30Smakitso				</div>
3088c2e8227SGreg Roach				<?php }
3098c2e8227SGreg Roach				}
3108c2e8227SGreg Roach
31131bc7874SGreg Roach				if (!$cart[$WT_TREE->getTreeId()]) {
3128c2e8227SGreg Roach					if ($clip_ctrl->action != 'add') {
313742a5f30Smakitso						echo '<div class="center">';
3142a277e58SGreg Roach						echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.');
315742a5f30Smakitso						echo '</div>';
3168c2e8227SGreg Roach						?>
317742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" name="addin" action="module.php">
3188c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3198c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
320742a5f30Smakitso						<table class="add-to center">
3214e3c4966SGreg Roach							<thead>
3228c2e8227SGreg Roach								<tr>
3234e3c4966SGreg Roach									<td colspan="2" class="topbottombar">
32415d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
3258c2e8227SGreg Roach									</td>
3268c2e8227SGreg Roach								</tr>
3274e3c4966SGreg Roach							</thead>
3284e3c4966SGreg Roach							<tbody>
3298c2e8227SGreg Roach								<tr>
3308c2e8227SGreg Roach									<td class="optionbox">
3318c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
3328c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
3338c2e8227SGreg Roach									</td>
3348c2e8227SGreg Roach									<td class="optionbox">
33515d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
3368c2e8227SGreg Roach									</td>
3378c2e8227SGreg Roach								</tr>
3384e3c4966SGreg Roach							</tbody>
3398c2e8227SGreg Roach						</table>
3408c2e8227SGreg Roach					</form>
341742a5f30Smakitso				</div>
3428c2e8227SGreg Roach					<?php
3438c2e8227SGreg Roach					}
344742a5f30Smakitso					echo '<div class="center">';
3458c2e8227SGreg Roach					// -- end new lines
3468c2e8227SGreg Roach					echo I18N::translate('Your clippings cart is empty.');
347742a5f30Smakitso					echo '</div>';
3488c2e8227SGreg Roach				} else {
3498c2e8227SGreg Roach					// Keep track of the INDI from the parent page, otherwise it will
3508c2e8227SGreg Roach					// get lost after ajax updates
3518c2e8227SGreg Roach					$pid = Filter::get('pid', WT_REGEX_XREF);
3528c2e8227SGreg Roach
353a86dd8b1SGreg Roach					if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?>
354742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
3558c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3568c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3578c2e8227SGreg Roach						<input type="hidden" name="action" value="download">
35815d603e7SGreg Roach						<input type="hidden" name="pid" value="<?= $pid ?>">
359742a5f30Smakitso						<table class="add-to center">
360a86dd8b1SGreg Roach							<tr>
361a86dd8b1SGreg Roach								<td colspan="2" class="topbottombar">
36215d603e7SGreg Roach									<h2><?= I18N::translate('Download') ?></h2>
363a86dd8b1SGreg Roach								</td>
364a86dd8b1SGreg Roach							</tr>
3654b9ff166SGreg Roach							<?php if (Auth::isManager($WT_TREE)) { ?>
366a86dd8b1SGreg Roach								<tr>
367a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
36815d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
369a86dd8b1SGreg Roach									</td>
3708c2e8227SGreg Roach									<td class="optionbox">
371a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="none" checked>
37215d603e7SGreg Roach										<?= I18N::translate('None') ?>
373a86dd8b1SGreg Roach										<br>
374a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="gedadmin">
37515d603e7SGreg Roach										<?= I18N::translate('Manager') ?>
376a86dd8b1SGreg Roach										<br>
377a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="user">
37815d603e7SGreg Roach										<?= I18N::translate('Member') ?>
379a86dd8b1SGreg Roach										<br>
380a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="visitor">
38115d603e7SGreg Roach										<?= I18N::translate('Visitor') ?>
382a86dd8b1SGreg Roach									</td>
383a86dd8b1SGreg Roach								</tr>
3844b9ff166SGreg Roach							<?php } elseif (Auth::isMember($WT_TREE)) { ?>
385a86dd8b1SGreg Roach								<tr>
386a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
38715d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
388a86dd8b1SGreg Roach									</td>
3898c2e8227SGreg Roach									<td class="optionbox">
39015d603e7SGreg Roach										<input type="radio" name="privatize_export" value="user" checked> <?= I18N::translate('Member') ?><br>
39115d603e7SGreg Roach										<input type="radio" name="privatize_export" value="visitor"> <?= I18N::translate('Visitor') ?>
392a86dd8b1SGreg Roach									</td>
393a86dd8b1SGreg Roach								</tr>
3948c2e8227SGreg Roach							<?php } ?>
3958c2e8227SGreg Roach
396a86dd8b1SGreg Roach							<tr>
397a86dd8b1SGreg Roach								<td class="descriptionbox width50 wrap">
39815d603e7SGreg Roach									<?= I18N::translate('Convert from UTF-8 to ISO-8859-1') ?>
399a86dd8b1SGreg Roach								</td>
400a86dd8b1SGreg Roach								<td class="optionbox">
401a86dd8b1SGreg Roach									<input type="checkbox" name="convert" value="yes">
402a86dd8b1SGreg Roach								</td>
403a86dd8b1SGreg Roach							</tr>
4048c2e8227SGreg Roach
405a86dd8b1SGreg Roach							<tr>
406a86dd8b1SGreg Roach								<td class="topbottombar" colspan="2">
40715d603e7SGreg Roach									<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('download') ?>">
408a86dd8b1SGreg Roach								</td>
409a86dd8b1SGreg Roach							</tr>
410a86dd8b1SGreg Roach						</table>
4118c2e8227SGreg Roach					</form>
412742a5f30Smakitso				</div>
4138c2e8227SGreg Roach					<br>
4148c2e8227SGreg Roach
415742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" name="addin" action="module.php">
4168c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
4178c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
418742a5f30Smakitso						<table class="add-to center">
4194e3c4966SGreg Roach							<thead>
4208c2e8227SGreg Roach								<tr>
4218c2e8227SGreg Roach									<td colspan="2" class="topbottombar" style="text-align:center; ">
42215d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
4238c2e8227SGreg Roach									</td>
4248c2e8227SGreg Roach								</tr>
4254e3c4966SGreg Roach							</thead>
4264e3c4966SGreg Roach							<tbody>
4278c2e8227SGreg Roach								<tr>
4288c2e8227SGreg Roach									<td class="optionbox">
4298c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
4308c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
4318c2e8227SGreg Roach									</td>
4328c2e8227SGreg Roach									<td class="optionbox">
43315d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
4348c2e8227SGreg Roach									</td>
4358c2e8227SGreg Roach								</tr>
4364e3c4966SGreg Roach							</tbody>
437a86dd8b1SGreg Roach							<tfoot>
438a86dd8b1SGreg Roach								<tr>
439a86dd8b1SGreg Roach									<th colspan="2">
440a86dd8b1SGreg Roach										<a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty">
44115d603e7SGreg Roach											<?= I18N::translate('Empty the clippings cart') ?>
442a86dd8b1SGreg Roach										</a>
443a86dd8b1SGreg Roach									</th>
444a86dd8b1SGreg Roach								</tr>
445a86dd8b1SGreg Roach							</tfoot>
4468c2e8227SGreg Roach						</table>
4478c2e8227SGreg Roach					</form>
448742a5f30Smakitso				</div>
4498c2e8227SGreg Roach				<?php } ?>
450c775d873Smakitso				<div class="clipping-cart">
451a86dd8b1SGreg Roach				<h2>
45215d603e7SGreg Roach					<?= I18N::translate('Family tree clippings cart') ?>
453a86dd8b1SGreg Roach				</h2>
454742a5f30Smakitso				<table id="mycart" class="sortable list_table width50">
455a86dd8b1SGreg Roach					<thead>
4568c2e8227SGreg Roach						<tr>
45715d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Record') ?></th>
45815d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Remove') ?></th>
4598c2e8227SGreg Roach						</tr>
460a86dd8b1SGreg Roach					</thead>
461a86dd8b1SGreg Roach					<tbody>
4628c2e8227SGreg Roach						<?php
46331bc7874SGreg Roach							foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
46424ec66ceSGreg Roach								$record = GedcomRecord::getInstance($xref, $WT_TREE);
4658c2e8227SGreg Roach								if ($record) {
4668c2e8227SGreg Roach									switch ($record::RECORD_TYPE) {
467a86dd8b1SGreg Roach										case 'INDI':
468a86dd8b1SGreg Roach											$icon = 'icon-indis';
469a86dd8b1SGreg Roach											break;
470a86dd8b1SGreg Roach										case 'FAM':
471a86dd8b1SGreg Roach											$icon = 'icon-sfamily';
472a86dd8b1SGreg Roach											break;
473a86dd8b1SGreg Roach										case 'SOUR':
474a86dd8b1SGreg Roach											$icon = 'icon-source';
475a86dd8b1SGreg Roach											break;
476a86dd8b1SGreg Roach										case 'REPO':
477a86dd8b1SGreg Roach											$icon = 'icon-repository';
478a86dd8b1SGreg Roach											break;
479a86dd8b1SGreg Roach										case 'NOTE':
480a86dd8b1SGreg Roach											$icon = 'icon-note';
481a86dd8b1SGreg Roach											break;
482a86dd8b1SGreg Roach										case 'OBJE':
483a86dd8b1SGreg Roach											$icon = 'icon-media';
484a86dd8b1SGreg Roach											break;
485a86dd8b1SGreg Roach										default:
486a86dd8b1SGreg Roach											$icon = 'icon-clippings';
487a86dd8b1SGreg Roach											break;
4888c2e8227SGreg Roach									}
4898c2e8227SGreg Roach								?>
490a86dd8b1SGreg Roach								<tr>
491a86dd8b1SGreg Roach									<td class="list_value">
49215d603e7SGreg Roach										<i class="<?= $icon ?>"></i>
4938c2e8227SGreg Roach										<?php
494b1f1e4efSGreg Roach										echo '<a href="', e($record->url()), '">', $record->getFullName(), '</a>';
4958c2e8227SGreg Roach										?>
4968c2e8227SGreg Roach									</td>
49715d603e7SGreg 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>
4988c2e8227SGreg Roach								</tr>
4998c2e8227SGreg Roach								<?php
5008c2e8227SGreg Roach							}
5018c2e8227SGreg Roach						}
5028c2e8227SGreg Roach						?>
5038c2e8227SGreg Roach				</table>
504742a5f30Smakitso			</div>
5058c2e8227SGreg Roach				<?php
5068c2e8227SGreg Roach			}
5078c2e8227SGreg Roach			break;
5088c2e8227SGreg Roach			default:
5098c2e8227SGreg Roach				http_response_code(404);
5108c2e8227SGreg Roach				break;
5118c2e8227SGreg Roach		}
5128c2e8227SGreg Roach	}
5138c2e8227SGreg Roach
5140ee13198SGreg Roach	/**
5150ee13198SGreg Roach	 * The user can re-order menus. Until they do, they are shown in this order.
5160ee13198SGreg Roach	 *
5170ee13198SGreg Roach	 * @return int
5180ee13198SGreg Roach	 */
5198c2e8227SGreg Roach	public function defaultMenuOrder() {
5208c2e8227SGreg Roach		return 20;
5218c2e8227SGreg Roach	}
5228c2e8227SGreg Roach
5230ee13198SGreg Roach	/**
5240ee13198SGreg Roach	 * A menu, to be added to the main application menu.
5250ee13198SGreg Roach	 *
5260ee13198SGreg Roach	 * @return Menu|null
5270ee13198SGreg Roach	 */
5288c2e8227SGreg Roach	public function getMenu() {
5294b9ff166SGreg Roach		global $controller, $WT_TREE;
5308c2e8227SGreg Roach
53113abd6f3SGreg Roach		$submenus = [];
5328c2e8227SGreg Roach		if (isset($controller->record)) {
53315d603e7SGreg Roach			$submenus[] = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings-cart', ['rel' => 'nofollow']);
5348c2e8227SGreg Roach		}
5358c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
53615d603e7SGreg 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']);
5378c2e8227SGreg Roach		}
538cbc1590aSGreg Roach
539941edf23SGreg Roach		if ($submenus) {
54013abd6f3SGreg Roach			return new Menu($this->getTitle(), '#', 'menu-clippings', ['rel' => 'nofollow'], $submenus);
541941edf23SGreg Roach		} else {
54213abd6f3SGreg Roach			return new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', ['rel' => 'nofollow']);
543941edf23SGreg Roach		}
5448c2e8227SGreg Roach	}
5458c2e8227SGreg Roach
5468c2e8227SGreg Roach	/** {@inheritdoc} */
5478c2e8227SGreg Roach	public function defaultSidebarOrder() {
5488c2e8227SGreg Roach		return 60;
5498c2e8227SGreg Roach	}
5508c2e8227SGreg Roach
5518c2e8227SGreg Roach	/** {@inheritdoc} */
552*225e381fSGreg Roach	public function hasSidebarContent(Individual $individual) {
5538c2e8227SGreg Roach		// Creating a controller has the side effect of initialising the cart
5540e62c4b8SGreg Roach		new ClippingsCartController;
5558c2e8227SGreg Roach
5568c2e8227SGreg Roach		return true;
5578c2e8227SGreg Roach	}
5588c2e8227SGreg Roach
55976692c8bSGreg Roach	/**
56076692c8bSGreg Roach	 * Load this sidebar synchronously.
56176692c8bSGreg Roach	 *
562*225e381fSGreg Roach	 * @param Individual $individual
563*225e381fSGreg Roach	 *
56476692c8bSGreg Roach	 * @return string
56576692c8bSGreg Roach	 */
566*225e381fSGreg Roach	public function getSidebarContent(Individual $individual) {
5678c2e8227SGreg Roach		global $controller;
5688c2e8227SGreg Roach
5698c2e8227SGreg Roach		$controller->addInlineJavascript('
57015d603e7SGreg Roach				$("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
57115d603e7SGreg Roach					$("#sb_clippings_content").load(this.href);
5728c2e8227SGreg Roach					return false;
5738c2e8227SGreg Roach				});
5748c2e8227SGreg Roach			');
5758c2e8227SGreg Roach
5768c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
5778c2e8227SGreg Roach	}
5788c2e8227SGreg Roach
5798c2e8227SGreg Roach	/** {@inheritdoc} */
5808c2e8227SGreg Roach	public function getSidebarAjaxContent() {
58131bc7874SGreg Roach		global $WT_TREE;
58231bc7874SGreg Roach
58331bc7874SGreg Roach		$cart = Session::get('cart');
5848c2e8227SGreg Roach
5850e62c4b8SGreg Roach		$clip_ctrl         = new ClippingsCartController;
5868c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
5878c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
5888c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
5898c2e8227SGreg Roach		$others            = Filter::get('others');
5908c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
5918c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
5928c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
5938c2e8227SGreg Roach		if ($add) {
59424ec66ceSGreg Roach			$record = GedcomRecord::getInstance($add, $WT_TREE);
5958c2e8227SGreg Roach			if ($record) {
5968c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
5978c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
5988c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
5998c2e8227SGreg Roach			}
6008c2e8227SGreg Roach		} elseif ($add1) {
60124ec66ceSGreg Roach			$record = Individual::getInstance($add1, $WT_TREE);
6028c2e8227SGreg Roach			if ($record) {
6038c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6048c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6058c2e8227SGreg Roach				if ($others == 'parents') {
6068c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
6078c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6088c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6098c2e8227SGreg Roach					}
6108c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
6118c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
6128c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
6138c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
6148c2e8227SGreg Roach				} elseif ($others == 'members') {
6158c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6168c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6178c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6188c2e8227SGreg Roach					}
6198c2e8227SGreg Roach				} elseif ($others == 'descendants') {
6208c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6218c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6228c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
6238c2e8227SGreg Roach					}
6248c2e8227SGreg Roach				}
6258c2e8227SGreg Roach			}
6268c2e8227SGreg Roach		} elseif ($remove) {
62731bc7874SGreg Roach			unset($cart[$WT_TREE->getTreeId()][$remove]);
62831bc7874SGreg Roach			Session::put('cart', $cart);
6298c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
63013abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
63131bc7874SGreg Roach			Session::put('cart', $cart);
6328c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
633b6468bb9SGreg Roach			return $this->downloadForm();
6348c2e8227SGreg Roach		}
63531bc7874SGreg Roach
6368c2e8227SGreg Roach		return $this->getCartList();
6378c2e8227SGreg Roach	}
6388c2e8227SGreg Roach
6398c2e8227SGreg Roach	/**
6408c2e8227SGreg Roach	 * A list for the side bar.
6418c2e8227SGreg Roach	 *
6428c2e8227SGreg Roach	 * @return string
6438c2e8227SGreg Roach	 */
6448c2e8227SGreg Roach	public function getCartList() {
64531bc7874SGreg Roach		global $WT_TREE;
6468c2e8227SGreg Roach
64713abd6f3SGreg Roach		$cart = Session::get('cart', []);
64831bc7874SGreg Roach		if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
64913abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
65031bc7874SGreg Roach		}
6518c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
6528c2e8227SGreg Roach
65331bc7874SGreg Roach		if (!$cart[$WT_TREE->getTreeId()]) {
6548c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
6558c2e8227SGreg Roach		} else {
656b6468bb9SGreg Roach			$out = '';
657b6468bb9SGreg Roach			if (!empty($cart[$WT_TREE->getTreeId()])) {
658b6468bb9SGreg Roach				$out .=
659b6468bb9SGreg Roach					'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
660b6468bb9SGreg Roach					I18N::translate('Empty the clippings cart') .
661b6468bb9SGreg Roach					'</a>' .
662b6468bb9SGreg Roach					'<br>' .
663b6468bb9SGreg Roach					'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
664b6468bb9SGreg Roach					I18N::translate('Download') .
665b6468bb9SGreg Roach					'</a><br><br>';
666b6468bb9SGreg Roach			}
667b6468bb9SGreg Roach			$out .= '<ul>';
66831bc7874SGreg Roach			foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
66924ec66ceSGreg Roach				$record = GedcomRecord::getInstance($xref, $WT_TREE);
6708c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
6718c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
6728c2e8227SGreg Roach						case 'INDI':
6738c2e8227SGreg Roach							$icon = 'icon-indis';
6748c2e8227SGreg Roach							break;
6758c2e8227SGreg Roach						case 'FAM':
6768c2e8227SGreg Roach							$icon = 'icon-sfamily';
6778c2e8227SGreg Roach							break;
6788c2e8227SGreg Roach					}
6798c2e8227SGreg Roach					$out .= '<li>';
6808c2e8227SGreg Roach					if (!empty($icon)) {
6818c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
6828c2e8227SGreg Roach					}
683b1f1e4efSGreg Roach					$out .= '<a href="' . e($record->url()) . '">';
6848c2e8227SGreg Roach					if ($record instanceof Individual) {
6858c2e8227SGreg Roach						$out .= $record->getSexImage();
6868c2e8227SGreg Roach					}
6878c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
6888c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
6898c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
6908c2e8227SGreg Roach					}
6918c2e8227SGreg Roach					$out .= '</a>';
692cdaf7c6cSGreg 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>';
6938c2e8227SGreg Roach					$out .= '</li>';
6948c2e8227SGreg Roach				}
6958c2e8227SGreg Roach			}
6968c2e8227SGreg Roach			$out .= '</ul>';
6978c2e8227SGreg Roach		}
6988c2e8227SGreg Roach
69924ec66ceSGreg Roach		$record = Individual::getInstance($pid, $WT_TREE);
70031bc7874SGreg Roach		if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
701beb9c394SGreg 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>';
7028c2e8227SGreg Roach		}
703cbc1590aSGreg Roach
7048c2e8227SGreg Roach		return $out;
7058c2e8227SGreg Roach	}
7068c2e8227SGreg Roach
7078c2e8227SGreg Roach	/**
70876692c8bSGreg Roach	 * A form to choose the download options.
70976692c8bSGreg Roach	 *
7108c2e8227SGreg Roach	 * @return string
7118c2e8227SGreg Roach	 */
712b6468bb9SGreg Roach	public function downloadForm() {
7138c2e8227SGreg Roach		global $WT_TREE;
7148c2e8227SGreg Roach
7158c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
7168c2e8227SGreg Roach
7178c2e8227SGreg Roach		$out = '<script>';
7188c2e8227SGreg Roach		$out .= 'function cancelDownload() {
719cdaf7c6cSGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&pid=' . $pid . '";
72015d603e7SGreg Roach				$("#sb_clippings_content").load(link);
7218c2e8227SGreg Roach			}';
7228c2e8227SGreg Roach		$out .= '</script>';
723742a5f30Smakitso		$out .= '<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
7248c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
7258c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
7268c2e8227SGreg Roach		<input type="hidden" name="pid" value="' . $pid . '">
7278c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
7288c2e8227SGreg Roach		<table>
7298c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr>
7308c2e8227SGreg Roach		';
7318c2e8227SGreg Roach
7324b9ff166SGreg Roach		if (Auth::isManager($WT_TREE)) {
7338c2e8227SGreg Roach			$out .=
734d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7358c2e8227SGreg Roach				'<td class="optionbox">' .
7368c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
7378c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
7388c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
7398c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7408c2e8227SGreg Roach				'</td></tr>';
7414b9ff166SGreg Roach		} elseif (Auth::isMember($WT_TREE)) {
7428c2e8227SGreg Roach			$out .=
743d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7448c2e8227SGreg Roach				'<td class="list_value">' .
7458c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
7468c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7478c2e8227SGreg Roach				'</td></tr>';
7488c2e8227SGreg Roach		}
7498c2e8227SGreg Roach
7508c2e8227SGreg Roach		$out .= '
751d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td>
7528c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
7538c2e8227SGreg Roach
7548c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
755b6468bb9SGreg Roach		<input type="button" class="btn btn-secondary" value="' . /* I18N: A button label. */ I18N::translate('cancel') . '" onclick="cancelDownload();">
756b6468bb9SGreg Roach		<input type="submit" class="btn btn-primary" value="' . /* I18N: A button label. */ I18N::translate('download') . '">
7578c2e8227SGreg Roach		</form>';
7588c2e8227SGreg Roach
7598c2e8227SGreg Roach		return $out;
7608c2e8227SGreg Roach	}
7618c2e8227SGreg Roach}
762