xref: /webtrees/app/Module/ClippingsCartModule.php (revision 1eca16b3ca2ec51e9e2f25098fdc03dde6f9fe9a)
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;
27*1eca16b3SGreg Roachuse Fisharebest\Webtrees\Module;
280e62c4b8SGreg Roachuse Fisharebest\Webtrees\Module\ClippingsCart\ClippingsCartController;
290e62c4b8SGreg Roachuse Fisharebest\Webtrees\Session;
308c2e8227SGreg Roach
318c2e8227SGreg Roach/**
328c2e8227SGreg Roach * Class ClippingsCartModule
338c2e8227SGreg Roach */
34e2a378d3SGreg Roachclass ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, ModuleSidebarInterface {
358c2e8227SGreg Roach	/** {@inheritdoc} */
368c2e8227SGreg Roach	public function getTitle() {
37a86dd8b1SGreg Roach		return /* I18N: Name of a module */
38a86dd8b1SGreg Roach			I18N::translate('Clippings cart');
398c2e8227SGreg Roach	}
408c2e8227SGreg Roach
418c2e8227SGreg Roach	/** {@inheritdoc} */
428c2e8227SGreg Roach	public function getDescription() {
43a86dd8b1SGreg Roach		return /* I18N: Description of the “Clippings cart” module */
443bf19670SGreg Roach			I18N::translate('Select records from your family tree and save them as a GEDCOM file.');
458c2e8227SGreg Roach	}
468c2e8227SGreg Roach
470ee13198SGreg Roach	/**
480ee13198SGreg Roach	 * What is the default access level for this module?
490ee13198SGreg Roach	 *
500ee13198SGreg Roach	 * Some modules are aimed at admins or managers, and are not generally shown to users.
510ee13198SGreg Roach	 *
520ee13198SGreg Roach	 * @return int
530ee13198SGreg Roach	 */
548c2e8227SGreg Roach	public function defaultAccessLevel() {
554b9ff166SGreg Roach		return Auth::PRIV_USER;
568c2e8227SGreg Roach	}
578c2e8227SGreg Roach
5876692c8bSGreg Roach	/**
5976692c8bSGreg Roach	 * This is a general purpose hook, allowing modules to respond to routes
6076692c8bSGreg Roach	 * of the form module.php?mod=FOO&mod_action=BAR
6176692c8bSGreg Roach	 *
6276692c8bSGreg Roach	 * @param string $mod_action
6376692c8bSGreg Roach	 */
648c2e8227SGreg Roach	public function modAction($mod_action) {
65*1eca16b3SGreg Roach		global $WT_TREE;
66*1eca16b3SGreg Roach
67*1eca16b3SGreg Roach		// Only allow access if either the menu or sidebar is enabled.
68*1eca16b3SGreg Roach		if (
69*1eca16b3SGreg Roach			!array_key_exists($this->getName(), Module::getActiveSidebars($WT_TREE)) &&
70*1eca16b3SGreg Roach			!array_key_exists($this->getName(), Module::getActiveMenus($WT_TREE))
71*1eca16b3SGreg Roach		) {
72*1eca16b3SGreg Roach			http_response_code(404);
73*1eca16b3SGreg Roach
74*1eca16b3SGreg Roach			return;
75*1eca16b3SGreg Roach		}
76*1eca16b3SGreg Roach
778c2e8227SGreg Roach		switch ($mod_action) {
788c2e8227SGreg Roach			case 'ajax':
798c2e8227SGreg Roach				$html = $this->getSidebarAjaxContent();
808c2e8227SGreg Roach				header('Content-Type: text/html; charset=UTF-8');
818c2e8227SGreg Roach				echo $html;
828c2e8227SGreg Roach				break;
838c2e8227SGreg Roach			case 'index':
8431bc7874SGreg Roach				global $controller, $WT_TREE;
858c2e8227SGreg Roach
868c2e8227SGreg Roach				$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
878c2e8227SGreg Roach
880e62c4b8SGreg Roach				$clip_ctrl = new ClippingsCartController;
897bd2dc19SGreg Roach				$cart      = Session::get('cart');
908c2e8227SGreg Roach
918c2e8227SGreg Roach				$controller = new PageController;
928c2e8227SGreg Roach				$controller
938c2e8227SGreg Roach					->setPageTitle($this->getTitle())
9415d603e7SGreg Roach					->pageHeader();
958c2e8227SGreg Roach
968c2e8227SGreg Roach				echo '<script>';
978c2e8227SGreg Roach				echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
988c2e8227SGreg Roach				echo '</script>';
99c775d873Smakitso				echo '<div class="clipping-cart">';
1008c2e8227SGreg Roach
10131bc7874SGreg Roach				if (!$cart[$WT_TREE->getTreeId()]) {
1028c2e8227SGreg Roach					echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
1038c2e8227SGreg Roach				}
1048c2e8227SGreg Roach
1058c2e8227SGreg Roach				if ($clip_ctrl->action == 'add') {
1064e3c4966SGreg Roach					$record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
1078c2e8227SGreg Roach					if ($clip_ctrl->type === 'FAM') { ?>
108742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
1098c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
1108c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
11115d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
11215d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
1134e3c4966SGreg Roach						<input type="hidden" name="action" value="add1">
114742a5f30Smakitso						<table class="add-to center">
1154e3c4966SGreg Roach							<thead>
1164e3c4966SGreg Roach								<tr>
1174e3c4966SGreg Roach									<td class="topbottombar">
11815d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1194e3c4966SGreg Roach									</td>
1204e3c4966SGreg Roach								</tr>
1214e3c4966SGreg Roach							</thead>
1224e3c4966SGreg Roach							<tbody>
1234e3c4966SGreg Roach								<tr>
1244e3c4966SGreg Roach									<td class="optionbox">
1254e3c4966SGreg Roach										<input type="radio" name="others" value="parents">
12615d603e7SGreg Roach										<?= $record->getFullName() ?>
1274e3c4966SGreg Roach									</td>
1284e3c4966SGreg Roach								</tr>
1294e3c4966SGreg Roach								<tr>
1304e3c4966SGreg Roach									<td class="optionbox">
1314e3c4966SGreg Roach										<input type="radio" name="others" value="members" checked>
13215d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
13315d603e7SGreg Roach											I18N::translate('%s and their children', $record->getFullName()) ?>
1344e3c4966SGreg Roach									</td>
1354e3c4966SGreg Roach								</tr>
1364e3c4966SGreg Roach								<tr>
1374e3c4966SGreg Roach									<td class="optionbox">
1384e3c4966SGreg Roach										<input type="radio" name="others" value="descendants">
13915d603e7SGreg Roach										<?= /* I18N: %s is a family (husband + wife) */
14015d603e7SGreg Roach											I18N::translate('%s and their descendants', $record->getFullName()) ?>
1414e3c4966SGreg Roach									</td>
1424e3c4966SGreg Roach								</tr>
1434e3c4966SGreg Roach							</tbody>
1444e3c4966SGreg Roach							<tfoot>
1454e3c4966SGreg Roach								<tr>
14615d603e7SGreg Roach									<td class="topbottombar"><input type="submit" value="<?= I18N::translate('continue') ?>">
1474e3c4966SGreg Roach									</td>
1484e3c4966SGreg Roach								</tr>
1494e3c4966SGreg Roach							</tfoot>
1508c2e8227SGreg Roach						</table>
1518c2e8227SGreg Roach					</form>
152742a5f30Smakitso				</div>
1538c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
154742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
1558c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
1568c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
15715d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
15815d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
159a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
160742a5f30Smakitso						<table class="add-to center">
1614e3c4966SGreg Roach							<thead>
1624e3c4966SGreg Roach								<tr>
1634e3c4966SGreg Roach									<td class="topbottombar">
16415d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
1654e3c4966SGreg Roach									</td>
1664e3c4966SGreg Roach								</tr>
1674e3c4966SGreg Roach							</thead>
1684e3c4966SGreg Roach							<tbody>
1694e3c4966SGreg Roach								<tr>
1704e3c4966SGreg Roach									<td class="optionbox">
1714e3c4966SGreg Roach										<label>
1724e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
17315d603e7SGreg Roach											<?= $record->getFullName() ?>
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="parents">
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 parents and siblings', $record->getFullName());
1854e3c4966SGreg Roach												} else {
186a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
187a86dd8b1SGreg Roach													I18N::translate('%s, his parents and siblings', $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="members">
1974e3c4966SGreg Roach											<?php
1984e3c4966SGreg Roach												if ($record->getSex() === 'F') {
199a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
200a86dd8b1SGreg Roach													I18N::translate('%s, her spouses and children', $record->getFullName());
2014e3c4966SGreg Roach												} else {
202a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
203a86dd8b1SGreg Roach													I18N::translate('%s, his spouses and children', $record->getFullName());
2044e3c4966SGreg Roach												}
2054e3c4966SGreg Roach												?>
2064e3c4966SGreg Roach										</label>
2074e3c4966SGreg Roach									</td>
2084e3c4966SGreg Roach								</tr>
2094e3c4966SGreg Roach								<tr>
2104e3c4966SGreg Roach									<td class="optionbox">
2114e3c4966SGreg Roach										<label>
2124e3c4966SGreg Roach											<input type="radio" name="others" value="ancestors" id="ancestors">
2134e3c4966SGreg Roach											<?php
2144e3c4966SGreg Roach												if ($record->getSex() === 'F') {
215a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
216a86dd8b1SGreg Roach													I18N::translate('%s and her ancestors', $record->getFullName());
2174e3c4966SGreg Roach												} else {
218a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
219a86dd8b1SGreg Roach													I18N::translate('%s and his ancestors', $record->getFullName());
2204e3c4966SGreg Roach												}
2214e3c4966SGreg Roach												?>
2224e3c4966SGreg Roach										</label>
2234e3c4966SGreg Roach										<br>
22415d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
22515d603e7SGreg Roach											<input type="text" size="5" name="level1" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestors');">
2264e3c4966SGreg Roach									</td>
2274e3c4966SGreg Roach								</tr>
2284e3c4966SGreg Roach								<tr>
2294e3c4966SGreg Roach									<td class="optionbox">
2304e3c4966SGreg Roach										<label>
2314e3c4966SGreg Roach											<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
2324e3c4966SGreg Roach											<?php
2334e3c4966SGreg Roach												if ($record->getSex() === 'F') {
234a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
235a86dd8b1SGreg Roach													I18N::translate('%s, her ancestors and their families', $record->getFullName());
2364e3c4966SGreg Roach												} else {
237a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
238a86dd8b1SGreg Roach													I18N::translate('%s, his ancestors and their families', $record->getFullName());
2394e3c4966SGreg Roach												}
2404e3c4966SGreg Roach												?>
2414e3c4966SGreg Roach										</label>
2424e3c4966SGreg Roach										<br>
24315d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
24415d603e7SGreg Roach											<input type="text" size="5" name="level2" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('ancestorsfamilies');">
2454e3c4966SGreg Roach									</td>
2464e3c4966SGreg Roach								</tr>
2474e3c4966SGreg Roach								<tr>
2484e3c4966SGreg Roach									<td class="optionbox">
2494e3c4966SGreg Roach										<label>
2504e3c4966SGreg Roach											<input type="radio" name="others" value="descendants" id="descendants">
2514e3c4966SGreg Roach											<?php
2524e3c4966SGreg Roach												if ($record->getSex() === 'F') {
253a86dd8b1SGreg Roach													echo /* I18N: %s is a woman's name */
254a86dd8b1SGreg Roach													I18N::translate('%s, her spouses and descendants', $record->getFullName());
2554e3c4966SGreg Roach												} else {
256a86dd8b1SGreg Roach													echo /* I18N: %s is a man's name */
257a86dd8b1SGreg Roach													I18N::translate('%s, his spouses and descendants', $record->getFullName());
2584e3c4966SGreg Roach												}
2594e3c4966SGreg Roach												?>
2604e3c4966SGreg Roach										</label>
2614e3c4966SGreg Roach										<br>
26215d603e7SGreg Roach										<?= I18N::translate('Number of generations') ?>
26315d603e7SGreg Roach											<input type="text" size="5" name="level3" value="<?= $MAX_PEDIGREE_GENERATIONS ?>" onfocus="radAncestors('descendants');">
2644e3c4966SGreg Roach									</td>
2654e3c4966SGreg Roach								</tr>
2664e3c4966SGreg Roach							</tbody>
2674e3c4966SGreg Roach							<tfoot>
2684e3c4966SGreg Roach								<tr>
2694e3c4966SGreg Roach									<td class="topbottombar">
27015d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
2714e3c4966SGreg Roach									</td>
2724e3c4966SGreg Roach								</tr>
2734e3c4966SGreg Roach							</tfoot>
2748c2e8227SGreg Roach						</table>
2758c2e8227SGreg Roach					</form>
276742a5f30Smakitso				</div>
2778c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
278742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
2798c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
2808c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
28115d603e7SGreg Roach						<input type="hidden" name="id" value="<?= $clip_ctrl->id ?>">
28215d603e7SGreg Roach						<input type="hidden" name="type" value="<?= $clip_ctrl->type ?>">
283a86dd8b1SGreg Roach						<input type="hidden" name="action" value="add1">
284742a5f30Smakitso						<table class="add-to center">
2854e3c4966SGreg Roach							<thead>
2864e3c4966SGreg Roach								<tr>
2874e3c4966SGreg Roach									<td class="topbottombar">
28815d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
2894e3c4966SGreg Roach									</td>
2904e3c4966SGreg Roach								</tr>
2914e3c4966SGreg Roach							</thead>
2924e3c4966SGreg Roach							<tbody>
2934e3c4966SGreg Roach								<tr>
2944e3c4966SGreg Roach									<td class="optionbox">
2954e3c4966SGreg Roach										<label>
2964e3c4966SGreg Roach											<input type="radio" name="others" checked value="none">
29715d603e7SGreg Roach											<?= $record->getFullName() ?>
2984e3c4966SGreg Roach										</label>
2994e3c4966SGreg Roach									</td>
3004e3c4966SGreg Roach								</tr>
3014e3c4966SGreg Roach								<tr>
3024e3c4966SGreg Roach									<td class="optionbox">
3034e3c4966SGreg Roach										<label>
3044e3c4966SGreg Roach											<input type="radio" name="others" value="linked">
30515d603e7SGreg Roach											<?= /* I18N: %s is the name of a source */
30615d603e7SGreg Roach												I18N::translate('%s and the individuals that reference it.', $record->getFullName()) ?>
3074e3c4966SGreg Roach										</label>
3084e3c4966SGreg Roach									</td>
3094e3c4966SGreg Roach								</tr>
3104e3c4966SGreg Roach							</tbody>
3114e3c4966SGreg Roach							<tfoot>
3124e3c4966SGreg Roach								<tr>
3134e3c4966SGreg Roach									<td class="topbottombar">
31415d603e7SGreg Roach										<input type="submit" value="<?= I18N::translate('continue') ?>">
3154e3c4966SGreg Roach									</td>
3164e3c4966SGreg Roach								</tr>
3174e3c4966SGreg Roach							</tfoot>
3188c2e8227SGreg Roach						</table>
3198c2e8227SGreg Roach					</form>
320742a5f30Smakitso				</div>
3218c2e8227SGreg Roach				<?php }
3228c2e8227SGreg Roach				}
3238c2e8227SGreg Roach
32431bc7874SGreg Roach				if (!$cart[$WT_TREE->getTreeId()]) {
3258c2e8227SGreg Roach					if ($clip_ctrl->action != 'add') {
326742a5f30Smakitso						echo '<div class="center">';
3272a277e58SGreg Roach						echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.');
328742a5f30Smakitso						echo '</div>';
3298c2e8227SGreg Roach						?>
330742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" name="addin" action="module.php">
3318c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3328c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
333742a5f30Smakitso						<table class="add-to center">
3344e3c4966SGreg Roach							<thead>
3358c2e8227SGreg Roach								<tr>
3364e3c4966SGreg Roach									<td colspan="2" class="topbottombar">
33715d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
3388c2e8227SGreg Roach									</td>
3398c2e8227SGreg Roach								</tr>
3404e3c4966SGreg Roach							</thead>
3414e3c4966SGreg Roach							<tbody>
3428c2e8227SGreg Roach								<tr>
3438c2e8227SGreg Roach									<td class="optionbox">
3448c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
3458c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
3468c2e8227SGreg Roach									</td>
3478c2e8227SGreg Roach									<td class="optionbox">
34815d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
3498c2e8227SGreg Roach									</td>
3508c2e8227SGreg Roach								</tr>
3514e3c4966SGreg Roach							</tbody>
3528c2e8227SGreg Roach						</table>
3538c2e8227SGreg Roach					</form>
354742a5f30Smakitso				</div>
3558c2e8227SGreg Roach					<?php
3568c2e8227SGreg Roach					}
357742a5f30Smakitso					echo '<div class="center">';
3588c2e8227SGreg Roach					// -- end new lines
3598c2e8227SGreg Roach					echo I18N::translate('Your clippings cart is empty.');
360742a5f30Smakitso					echo '</div>';
3618c2e8227SGreg Roach				} else {
3628c2e8227SGreg Roach					// Keep track of the INDI from the parent page, otherwise it will
3638c2e8227SGreg Roach					// get lost after ajax updates
3648c2e8227SGreg Roach					$pid = Filter::get('pid', WT_REGEX_XREF);
3658c2e8227SGreg Roach
366a86dd8b1SGreg Roach					if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?>
367742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
3688c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
3698c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
3708c2e8227SGreg Roach						<input type="hidden" name="action" value="download">
37115d603e7SGreg Roach						<input type="hidden" name="pid" value="<?= $pid ?>">
372742a5f30Smakitso						<table class="add-to center">
373a86dd8b1SGreg Roach							<tr>
374a86dd8b1SGreg Roach								<td colspan="2" class="topbottombar">
37515d603e7SGreg Roach									<h2><?= I18N::translate('Download') ?></h2>
376a86dd8b1SGreg Roach								</td>
377a86dd8b1SGreg Roach							</tr>
3784b9ff166SGreg Roach							<?php if (Auth::isManager($WT_TREE)) { ?>
379a86dd8b1SGreg Roach								<tr>
380a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
38115d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
382a86dd8b1SGreg Roach									</td>
3838c2e8227SGreg Roach									<td class="optionbox">
384a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="none" checked>
38515d603e7SGreg Roach										<?= I18N::translate('None') ?>
386a86dd8b1SGreg Roach										<br>
387a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="gedadmin">
38815d603e7SGreg Roach										<?= I18N::translate('Manager') ?>
389a86dd8b1SGreg Roach										<br>
390a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="user">
39115d603e7SGreg Roach										<?= I18N::translate('Member') ?>
392a86dd8b1SGreg Roach										<br>
393a86dd8b1SGreg Roach										<input type="radio" name="privatize_export" value="visitor">
39415d603e7SGreg Roach										<?= I18N::translate('Visitor') ?>
395a86dd8b1SGreg Roach									</td>
396a86dd8b1SGreg Roach								</tr>
3974b9ff166SGreg Roach							<?php } elseif (Auth::isMember($WT_TREE)) { ?>
398a86dd8b1SGreg Roach								<tr>
399a86dd8b1SGreg Roach									<td class="descriptionbox width50 wrap">
40015d603e7SGreg Roach										<?= I18N::translate('Apply privacy settings') ?>
401a86dd8b1SGreg Roach									</td>
4028c2e8227SGreg Roach									<td class="optionbox">
40315d603e7SGreg Roach										<input type="radio" name="privatize_export" value="user" checked> <?= I18N::translate('Member') ?><br>
40415d603e7SGreg Roach										<input type="radio" name="privatize_export" value="visitor"> <?= I18N::translate('Visitor') ?>
405a86dd8b1SGreg Roach									</td>
406a86dd8b1SGreg Roach								</tr>
4078c2e8227SGreg Roach							<?php } ?>
4088c2e8227SGreg Roach
409a86dd8b1SGreg Roach							<tr>
410a86dd8b1SGreg Roach								<td class="descriptionbox width50 wrap">
41115d603e7SGreg Roach									<?= I18N::translate('Convert from UTF-8 to ISO-8859-1') ?>
412a86dd8b1SGreg Roach								</td>
413a86dd8b1SGreg Roach								<td class="optionbox">
414a86dd8b1SGreg Roach									<input type="checkbox" name="convert" value="yes">
415a86dd8b1SGreg Roach								</td>
416a86dd8b1SGreg Roach							</tr>
4178c2e8227SGreg Roach
418a86dd8b1SGreg Roach							<tr>
419a86dd8b1SGreg Roach								<td class="topbottombar" colspan="2">
42015d603e7SGreg Roach									<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('download') ?>">
421a86dd8b1SGreg Roach								</td>
422a86dd8b1SGreg Roach							</tr>
423a86dd8b1SGreg Roach						</table>
4248c2e8227SGreg Roach					</form>
425742a5f30Smakitso				</div>
4268c2e8227SGreg Roach					<br>
4278c2e8227SGreg Roach
428742a5f30Smakitso					<form class="wt-page-options wt-page-options-clipping-cart hidden-print" name="addin" action="module.php">
4298c2e8227SGreg Roach						<input type="hidden" name="mod" value="clippings">
4308c2e8227SGreg Roach						<input type="hidden" name="mod_action" value="index">
431742a5f30Smakitso						<table class="add-to center">
4324e3c4966SGreg Roach							<thead>
4338c2e8227SGreg Roach								<tr>
4348c2e8227SGreg Roach									<td colspan="2" class="topbottombar" style="text-align:center; ">
43515d603e7SGreg Roach										<?= I18N::translate('Add to the clippings cart') ?>
4368c2e8227SGreg Roach									</td>
4378c2e8227SGreg Roach								</tr>
4384e3c4966SGreg Roach							</thead>
4394e3c4966SGreg Roach							<tbody>
4408c2e8227SGreg Roach								<tr>
4418c2e8227SGreg Roach									<td class="optionbox">
4428c2e8227SGreg Roach										<input type="hidden" name="action" value="add">
4438c2e8227SGreg Roach										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
4448c2e8227SGreg Roach									</td>
4458c2e8227SGreg Roach									<td class="optionbox">
44615d603e7SGreg Roach										<input type="submit" value="<?= /* I18N: A button label. */ I18N::translate('add') ?>">
4478c2e8227SGreg Roach									</td>
4488c2e8227SGreg Roach								</tr>
4494e3c4966SGreg Roach							</tbody>
450a86dd8b1SGreg Roach							<tfoot>
451a86dd8b1SGreg Roach								<tr>
452a86dd8b1SGreg Roach									<th colspan="2">
453a86dd8b1SGreg Roach										<a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty">
45415d603e7SGreg Roach											<?= I18N::translate('Empty the clippings cart') ?>
455a86dd8b1SGreg Roach										</a>
456a86dd8b1SGreg Roach									</th>
457a86dd8b1SGreg Roach								</tr>
458a86dd8b1SGreg Roach							</tfoot>
4598c2e8227SGreg Roach						</table>
4608c2e8227SGreg Roach					</form>
461742a5f30Smakitso				</div>
4628c2e8227SGreg Roach				<?php } ?>
463c775d873Smakitso				<div class="clipping-cart">
464a86dd8b1SGreg Roach				<h2>
46515d603e7SGreg Roach					<?= I18N::translate('Family tree clippings cart') ?>
466a86dd8b1SGreg Roach				</h2>
467742a5f30Smakitso				<table id="mycart" class="sortable list_table width50">
468a86dd8b1SGreg Roach					<thead>
4698c2e8227SGreg Roach						<tr>
47015d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Record') ?></th>
47115d603e7SGreg Roach							<th class="list_label"><?= I18N::translate('Remove') ?></th>
4728c2e8227SGreg Roach						</tr>
473a86dd8b1SGreg Roach					</thead>
474a86dd8b1SGreg Roach					<tbody>
4758c2e8227SGreg Roach						<?php
47631bc7874SGreg Roach							foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
47724ec66ceSGreg Roach								$record = GedcomRecord::getInstance($xref, $WT_TREE);
4788c2e8227SGreg Roach								if ($record) {
4798c2e8227SGreg Roach									switch ($record::RECORD_TYPE) {
480a86dd8b1SGreg Roach										case 'INDI':
481a86dd8b1SGreg Roach											$icon = 'icon-indis';
482a86dd8b1SGreg Roach											break;
483a86dd8b1SGreg Roach										case 'FAM':
484a86dd8b1SGreg Roach											$icon = 'icon-sfamily';
485a86dd8b1SGreg Roach											break;
486a86dd8b1SGreg Roach										case 'SOUR':
487a86dd8b1SGreg Roach											$icon = 'icon-source';
488a86dd8b1SGreg Roach											break;
489a86dd8b1SGreg Roach										case 'REPO':
490a86dd8b1SGreg Roach											$icon = 'icon-repository';
491a86dd8b1SGreg Roach											break;
492a86dd8b1SGreg Roach										case 'NOTE':
493a86dd8b1SGreg Roach											$icon = 'icon-note';
494a86dd8b1SGreg Roach											break;
495a86dd8b1SGreg Roach										case 'OBJE':
496a86dd8b1SGreg Roach											$icon = 'icon-media';
497a86dd8b1SGreg Roach											break;
498a86dd8b1SGreg Roach										default:
499a86dd8b1SGreg Roach											$icon = 'icon-clippings';
500a86dd8b1SGreg Roach											break;
5018c2e8227SGreg Roach									}
5028c2e8227SGreg Roach								?>
503a86dd8b1SGreg Roach								<tr>
504a86dd8b1SGreg Roach									<td class="list_value">
50515d603e7SGreg Roach										<i class="<?= $icon ?>"></i>
5068c2e8227SGreg Roach										<?php
507b1f1e4efSGreg Roach										echo '<a href="', e($record->url()), '">', $record->getFullName(), '</a>';
5088c2e8227SGreg Roach										?>
5098c2e8227SGreg Roach									</td>
51015d603e7SGreg 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>
5118c2e8227SGreg Roach								</tr>
5128c2e8227SGreg Roach								<?php
5138c2e8227SGreg Roach							}
5148c2e8227SGreg Roach						}
5158c2e8227SGreg Roach						?>
5168c2e8227SGreg Roach				</table>
517742a5f30Smakitso			</div>
5188c2e8227SGreg Roach				<?php
5198c2e8227SGreg Roach			}
5208c2e8227SGreg Roach			break;
5218c2e8227SGreg Roach			default:
5228c2e8227SGreg Roach				http_response_code(404);
5238c2e8227SGreg Roach				break;
5248c2e8227SGreg Roach		}
5258c2e8227SGreg Roach	}
5268c2e8227SGreg Roach
5270ee13198SGreg Roach	/**
5280ee13198SGreg Roach	 * The user can re-order menus. Until they do, they are shown in this order.
5290ee13198SGreg Roach	 *
5300ee13198SGreg Roach	 * @return int
5310ee13198SGreg Roach	 */
5328c2e8227SGreg Roach	public function defaultMenuOrder() {
5338c2e8227SGreg Roach		return 20;
5348c2e8227SGreg Roach	}
5358c2e8227SGreg Roach
5360ee13198SGreg Roach	/**
5370ee13198SGreg Roach	 * A menu, to be added to the main application menu.
5380ee13198SGreg Roach	 *
5390ee13198SGreg Roach	 * @return Menu|null
5400ee13198SGreg Roach	 */
5418c2e8227SGreg Roach	public function getMenu() {
5424b9ff166SGreg Roach		global $controller, $WT_TREE;
5438c2e8227SGreg Roach
54413abd6f3SGreg Roach		$submenus = [];
5458c2e8227SGreg Roach		if (isset($controller->record)) {
54615d603e7SGreg Roach			$submenus[] = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings-cart', ['rel' => 'nofollow']);
5478c2e8227SGreg Roach		}
5488c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
54915d603e7SGreg 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']);
5508c2e8227SGreg Roach		}
551cbc1590aSGreg Roach
552941edf23SGreg Roach		if ($submenus) {
55313abd6f3SGreg Roach			return new Menu($this->getTitle(), '#', 'menu-clippings', ['rel' => 'nofollow'], $submenus);
554941edf23SGreg Roach		} else {
55513abd6f3SGreg Roach			return new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', ['rel' => 'nofollow']);
556941edf23SGreg Roach		}
5578c2e8227SGreg Roach	}
5588c2e8227SGreg Roach
5598c2e8227SGreg Roach	/** {@inheritdoc} */
5608c2e8227SGreg Roach	public function defaultSidebarOrder() {
5618c2e8227SGreg Roach		return 60;
5628c2e8227SGreg Roach	}
5638c2e8227SGreg Roach
5648c2e8227SGreg Roach	/** {@inheritdoc} */
565225e381fSGreg Roach	public function hasSidebarContent(Individual $individual) {
5668c2e8227SGreg Roach		// Creating a controller has the side effect of initialising the cart
5670e62c4b8SGreg Roach		new ClippingsCartController;
5688c2e8227SGreg Roach
5698c2e8227SGreg Roach		return true;
5708c2e8227SGreg Roach	}
5718c2e8227SGreg Roach
57276692c8bSGreg Roach	/**
57376692c8bSGreg Roach	 * Load this sidebar synchronously.
57476692c8bSGreg Roach	 *
575225e381fSGreg Roach	 * @param Individual $individual
576225e381fSGreg Roach	 *
57776692c8bSGreg Roach	 * @return string
57876692c8bSGreg Roach	 */
579225e381fSGreg Roach	public function getSidebarContent(Individual $individual) {
5808c2e8227SGreg Roach		global $controller;
5818c2e8227SGreg Roach
5828c2e8227SGreg Roach		$controller->addInlineJavascript('
58315d603e7SGreg Roach				$("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
58415d603e7SGreg Roach					$("#sb_clippings_content").load(this.href);
5858c2e8227SGreg Roach					return false;
5868c2e8227SGreg Roach				});
5878c2e8227SGreg Roach			');
5888c2e8227SGreg Roach
5898c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
5908c2e8227SGreg Roach	}
5918c2e8227SGreg Roach
5928c2e8227SGreg Roach	/** {@inheritdoc} */
5938c2e8227SGreg Roach	public function getSidebarAjaxContent() {
59431bc7874SGreg Roach		global $WT_TREE;
59531bc7874SGreg Roach
59631bc7874SGreg Roach		$cart = Session::get('cart');
5978c2e8227SGreg Roach
5980e62c4b8SGreg Roach		$clip_ctrl         = new ClippingsCartController;
5998c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
6008c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
6018c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
6028c2e8227SGreg Roach		$others            = Filter::get('others');
6038c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
6048c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
6058c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
6068c2e8227SGreg Roach		if ($add) {
60724ec66ceSGreg Roach			$record = GedcomRecord::getInstance($add, $WT_TREE);
6088c2e8227SGreg Roach			if ($record) {
6098c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6108c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6118c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
6128c2e8227SGreg Roach			}
6138c2e8227SGreg Roach		} elseif ($add1) {
61424ec66ceSGreg Roach			$record = Individual::getInstance($add1, $WT_TREE);
6158c2e8227SGreg Roach			if ($record) {
6168c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
6178c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
6188c2e8227SGreg Roach				if ($others == 'parents') {
6198c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
6208c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6218c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6228c2e8227SGreg Roach					}
6238c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
6248c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
6258c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
6268c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
6278c2e8227SGreg Roach				} elseif ($others == 'members') {
6288c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6298c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6308c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
6318c2e8227SGreg Roach					}
6328c2e8227SGreg Roach				} elseif ($others == 'descendants') {
6338c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
6348c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
6358c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
6368c2e8227SGreg Roach					}
6378c2e8227SGreg Roach				}
6388c2e8227SGreg Roach			}
6398c2e8227SGreg Roach		} elseif ($remove) {
64031bc7874SGreg Roach			unset($cart[$WT_TREE->getTreeId()][$remove]);
64131bc7874SGreg Roach			Session::put('cart', $cart);
6428c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
64313abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
64431bc7874SGreg Roach			Session::put('cart', $cart);
6458c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
646b6468bb9SGreg Roach			return $this->downloadForm();
6478c2e8227SGreg Roach		}
64831bc7874SGreg Roach
6498c2e8227SGreg Roach		return $this->getCartList();
6508c2e8227SGreg Roach	}
6518c2e8227SGreg Roach
6528c2e8227SGreg Roach	/**
6538c2e8227SGreg Roach	 * A list for the side bar.
6548c2e8227SGreg Roach	 *
6558c2e8227SGreg Roach	 * @return string
6568c2e8227SGreg Roach	 */
6578c2e8227SGreg Roach	public function getCartList() {
65831bc7874SGreg Roach		global $WT_TREE;
6598c2e8227SGreg Roach
66013abd6f3SGreg Roach		$cart = Session::get('cart', []);
66131bc7874SGreg Roach		if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
66213abd6f3SGreg Roach			$cart[$WT_TREE->getTreeId()] = [];
66331bc7874SGreg Roach		}
6648c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
6658c2e8227SGreg Roach
66631bc7874SGreg Roach		if (!$cart[$WT_TREE->getTreeId()]) {
6678c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
6688c2e8227SGreg Roach		} else {
669b6468bb9SGreg Roach			$out = '';
670b6468bb9SGreg Roach			if (!empty($cart[$WT_TREE->getTreeId()])) {
671b6468bb9SGreg Roach				$out .=
672b6468bb9SGreg Roach					'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
673b6468bb9SGreg Roach					I18N::translate('Empty the clippings cart') .
674b6468bb9SGreg Roach					'</a>' .
675b6468bb9SGreg Roach					'<br>' .
676b6468bb9SGreg Roach					'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
677b6468bb9SGreg Roach					I18N::translate('Download') .
678b6468bb9SGreg Roach					'</a><br><br>';
679b6468bb9SGreg Roach			}
680b6468bb9SGreg Roach			$out .= '<ul>';
68131bc7874SGreg Roach			foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
68224ec66ceSGreg Roach				$record = GedcomRecord::getInstance($xref, $WT_TREE);
6838c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
6848c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
6858c2e8227SGreg Roach						case 'INDI':
6868c2e8227SGreg Roach							$icon = 'icon-indis';
6878c2e8227SGreg Roach							break;
6888c2e8227SGreg Roach						case 'FAM':
6898c2e8227SGreg Roach							$icon = 'icon-sfamily';
6908c2e8227SGreg Roach							break;
6918c2e8227SGreg Roach					}
6928c2e8227SGreg Roach					$out .= '<li>';
6938c2e8227SGreg Roach					if (!empty($icon)) {
6948c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
6958c2e8227SGreg Roach					}
696b1f1e4efSGreg Roach					$out .= '<a href="' . e($record->url()) . '">';
6978c2e8227SGreg Roach					if ($record instanceof Individual) {
6988c2e8227SGreg Roach						$out .= $record->getSexImage();
6998c2e8227SGreg Roach					}
7008c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
7018c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
7028c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
7038c2e8227SGreg Roach					}
7048c2e8227SGreg Roach					$out .= '</a>';
705cdaf7c6cSGreg 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>';
7068c2e8227SGreg Roach					$out .= '</li>';
7078c2e8227SGreg Roach				}
7088c2e8227SGreg Roach			}
7098c2e8227SGreg Roach			$out .= '</ul>';
7108c2e8227SGreg Roach		}
7118c2e8227SGreg Roach
71224ec66ceSGreg Roach		$record = Individual::getInstance($pid, $WT_TREE);
71331bc7874SGreg Roach		if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
714beb9c394SGreg 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>';
7158c2e8227SGreg Roach		}
716cbc1590aSGreg Roach
7178c2e8227SGreg Roach		return $out;
7188c2e8227SGreg Roach	}
7198c2e8227SGreg Roach
7208c2e8227SGreg Roach	/**
72176692c8bSGreg Roach	 * A form to choose the download options.
72276692c8bSGreg Roach	 *
7238c2e8227SGreg Roach	 * @return string
7248c2e8227SGreg Roach	 */
725b6468bb9SGreg Roach	public function downloadForm() {
7268c2e8227SGreg Roach		global $WT_TREE;
7278c2e8227SGreg Roach
7288c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
7298c2e8227SGreg Roach
7308c2e8227SGreg Roach		$out = '<script>';
7318c2e8227SGreg Roach		$out .= 'function cancelDownload() {
732cdaf7c6cSGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&pid=' . $pid . '";
73315d603e7SGreg Roach				$("#sb_clippings_content").load(link);
7348c2e8227SGreg Roach			}';
7358c2e8227SGreg Roach		$out .= '</script>';
736742a5f30Smakitso		$out .= '<form class="wt-page-options wt-page-options-clipping-cart hidden-print" action="module.php">
7378c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
7388c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
7398c2e8227SGreg Roach		<input type="hidden" name="pid" value="' . $pid . '">
7408c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
7418c2e8227SGreg Roach		<table>
7428c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr>
7438c2e8227SGreg Roach		';
7448c2e8227SGreg Roach
7454b9ff166SGreg Roach		if (Auth::isManager($WT_TREE)) {
7468c2e8227SGreg Roach			$out .=
747d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7488c2e8227SGreg Roach				'<td class="optionbox">' .
7498c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
7508c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
7518c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
7528c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7538c2e8227SGreg Roach				'</td></tr>';
7544b9ff166SGreg Roach		} elseif (Auth::isMember($WT_TREE)) {
7558c2e8227SGreg Roach			$out .=
756d1928687SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' .
7578c2e8227SGreg Roach				'<td class="list_value">' .
7588c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
7598c2e8227SGreg Roach				'<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
7608c2e8227SGreg Roach				'</td></tr>';
7618c2e8227SGreg Roach		}
7628c2e8227SGreg Roach
7638c2e8227SGreg Roach		$out .= '
764d1928687SGreg Roach		<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td>
7658c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
7668c2e8227SGreg Roach
7678c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
768b6468bb9SGreg Roach		<input type="button" class="btn btn-secondary" value="' . /* I18N: A button label. */ I18N::translate('cancel') . '" onclick="cancelDownload();">
769b6468bb9SGreg Roach		<input type="submit" class="btn btn-primary" value="' . /* I18N: A button label. */ I18N::translate('download') . '">
7708c2e8227SGreg Roach		</form>';
7718c2e8227SGreg Roach
7728c2e8227SGreg Roach		return $out;
7738c2e8227SGreg Roach	}
7748c2e8227SGreg Roach}
775