xref: /webtrees/app/Module/ClippingsCartModule.php (revision 8c2e82270a639a3acf607b432e54721116dae723)
1*8c2e8227SGreg Roach<?php
2*8c2e8227SGreg Roachnamespace Fisharebest\Webtrees;
3*8c2e8227SGreg Roach
4*8c2e8227SGreg Roach/**
5*8c2e8227SGreg Roach * webtrees: online genealogy
6*8c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team
7*8c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
8*8c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
9*8c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
10*8c2e8227SGreg Roach * (at your option) any later version.
11*8c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
12*8c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*8c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*8c2e8227SGreg Roach * GNU General Public License for more details.
15*8c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
16*8c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
17*8c2e8227SGreg Roach */
18*8c2e8227SGreg Roach
19*8c2e8227SGreg Roachuse Zend_Session;
20*8c2e8227SGreg Roach
21*8c2e8227SGreg Roach/**
22*8c2e8227SGreg Roach * Class ClippingsCartModule
23*8c2e8227SGreg Roach */
24*8c2e8227SGreg Roachclass ClippingsCartModule extends Module implements ModuleMenuInterface, ModuleSidebarInterface {
25*8c2e8227SGreg Roach
26*8c2e8227SGreg Roach	/** {@inheritdoc} */
27*8c2e8227SGreg Roach	public function getTitle() {
28*8c2e8227SGreg Roach		return /* I18N: Name of a module */ I18N::translate('Clippings cart');
29*8c2e8227SGreg Roach	}
30*8c2e8227SGreg Roach
31*8c2e8227SGreg Roach	/** {@inheritdoc} */
32*8c2e8227SGreg Roach	public function getDescription() {
33*8c2e8227SGreg Roach		return /* I18N: Description of the “Clippings cart” module */ I18N::translate('Select records from your family tree and save them as a GEDCOM file.');
34*8c2e8227SGreg Roach	}
35*8c2e8227SGreg Roach
36*8c2e8227SGreg Roach	/** {@inheritdoc} */
37*8c2e8227SGreg Roach	public function defaultAccessLevel() {
38*8c2e8227SGreg Roach		return WT_PRIV_USER;
39*8c2e8227SGreg Roach	}
40*8c2e8227SGreg Roach
41*8c2e8227SGreg Roach	/** {@inheritdoc} */
42*8c2e8227SGreg Roach	public function modAction($mod_action) {
43*8c2e8227SGreg Roach		switch ($mod_action) {
44*8c2e8227SGreg Roach		case 'ajax':
45*8c2e8227SGreg Roach			$html = $this->getSidebarAjaxContent();
46*8c2e8227SGreg Roach			Zend_Session::writeClose();
47*8c2e8227SGreg Roach			header('Content-Type: text/html; charset=UTF-8');
48*8c2e8227SGreg Roach			echo $html;
49*8c2e8227SGreg Roach			break;
50*8c2e8227SGreg Roach		case 'index':
51*8c2e8227SGreg Roach			global $controller, $WT_SESSION, $WT_TREE;
52*8c2e8227SGreg Roach
53*8c2e8227SGreg Roach			$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
54*8c2e8227SGreg Roach
55*8c2e8227SGreg Roach			$clip_ctrl = new ClippingsCart;
56*8c2e8227SGreg Roach
57*8c2e8227SGreg Roach			$controller = new PageController;
58*8c2e8227SGreg Roach			$controller
59*8c2e8227SGreg Roach				->setPageTitle($this->getTitle())
60*8c2e8227SGreg Roach				->PageHeader()
61*8c2e8227SGreg Roach				->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
62*8c2e8227SGreg Roach				->addInlineJavascript('autocomplete();');
63*8c2e8227SGreg Roach
64*8c2e8227SGreg Roach			echo '<script>';
65*8c2e8227SGreg Roach			echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
66*8c2e8227SGreg Roach			echo '</script>';
67*8c2e8227SGreg Roach
68*8c2e8227SGreg Roach			if (!$WT_SESSION->cart[WT_GED_ID]) {
69*8c2e8227SGreg Roach				echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
70*8c2e8227SGreg Roach			}
71*8c2e8227SGreg Roach
72*8c2e8227SGreg Roach			if ($clip_ctrl->action == 'add') {
73*8c2e8227SGreg Roach				$person = GedcomRecord::getInstance($clip_ctrl->id);
74*8c2e8227SGreg Roach				echo '<h3><a href="', $person->getHtmlUrl(), '">' . $person->getFullName(), '</a></h3>';
75*8c2e8227SGreg Roach				if ($clip_ctrl->type === 'FAM') { ?>
76*8c2e8227SGreg Roach					<form action="module.php" method="get">
77*8c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
78*8c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
79*8c2e8227SGreg Roach					<table>
80*8c2e8227SGreg Roach						<tr><td class="topbottombar"><?php echo I18N::translate('Which other links from this family would you like to add?'); ?>
81*8c2e8227SGreg Roach						<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
82*8c2e8227SGreg Roach						<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
83*8c2e8227SGreg Roach						<input type="hidden" name="action" value="add1"></td></tr>
84*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo I18N::translate('Add just this family record.'); ?></td></tr>
85*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo I18N::translate('Add parents’ records together with this family record.'); ?></td></tr>
86*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo I18N::translate('Add parents’ and children’s records together with this family record.'); ?></td></tr>
87*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="descendants"><?php echo I18N::translate('Add parents’ and all descendants’ records together with this family record.'); ?></td></tr>
88*8c2e8227SGreg Roach						<tr><td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('Continue adding'); ?>"></td></tr>
89*8c2e8227SGreg Roach
90*8c2e8227SGreg Roach					</table>
91*8c2e8227SGreg Roach					</form>
92*8c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'INDI') { ?>
93*8c2e8227SGreg Roach					<form action="module.php" method="get">
94*8c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
95*8c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
96*8c2e8227SGreg Roach					<table>
97*8c2e8227SGreg Roach						<tr><td class="topbottombar"><?php echo I18N::translate('Which links from this individual would you also like to add?'); ?>
98*8c2e8227SGreg Roach						<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
99*8c2e8227SGreg Roach						<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
100*8c2e8227SGreg Roach						<input type="hidden" name="action" value="add1"></td></tr>
101*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo I18N::translate('Add just this individual.'); ?></td></tr>
102*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo I18N::translate('Add this individual, his parents, and siblings.'); ?></td></tr>
103*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors"><?php echo I18N::translate('Add this individual and his direct line ancestors.'); ?><br>
104*8c2e8227SGreg Roach							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');"></td></tr>
105*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"><?php echo I18N::translate('Add this individual, his direct line ancestors, and their families.'); ?><br >
106*8c2e8227SGreg Roach							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');"></td></tr>
107*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo I18N::translate('Add this individual, his spouse, and children.'); ?></td></tr>
108*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants"><?php echo I18N::translate('Add this individual, his spouse, and all descendants.'); ?><br >
109*8c2e8227SGreg Roach							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');"></td></tr>
110*8c2e8227SGreg Roach						<tr><td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('Continue adding'); ?>">
111*8c2e8227SGreg Roach					</table>
112*8c2e8227SGreg Roach					</form>
113*8c2e8227SGreg Roach				<?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
114*8c2e8227SGreg Roach					<form action="module.php" method="get">
115*8c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
116*8c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
117*8c2e8227SGreg Roach					<table>
118*8c2e8227SGreg Roach						<tr><td class="topbottombar"><?php echo I18N::translate('Which records linked to this source should be added?'); ?>
119*8c2e8227SGreg Roach						<input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>">
120*8c2e8227SGreg Roach						<input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>">
121*8c2e8227SGreg Roach						<input type="hidden" name="action" value="add1"></td></tr>
122*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo I18N::translate('Add just this source.'); ?></td></tr>
123*8c2e8227SGreg Roach						<tr><td class="optionbox"><input type="radio" name="others" value="linked"><?php echo I18N::translate('Add this source and families/individuals linked to it.'); ?></td></tr>
124*8c2e8227SGreg Roach						<tr><td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('Continue adding'); ?>">
125*8c2e8227SGreg Roach					</table>
126*8c2e8227SGreg Roach					</form>
127*8c2e8227SGreg Roach				<?php }
128*8c2e8227SGreg Roach				}
129*8c2e8227SGreg Roach
130*8c2e8227SGreg Roach			if (!$WT_SESSION->cart[WT_GED_ID]) {
131*8c2e8227SGreg Roach				if ($clip_ctrl->action != 'add') {
132*8c2e8227SGreg Roach
133*8c2e8227SGreg Roach					echo I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program.  The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple.  Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name.  There you will see the <b>Add to clippings cart</b> option.  When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link.  Follow the instructions and links.</li></ul>');
134*8c2e8227SGreg Roach					?>
135*8c2e8227SGreg Roach					<form method="get" name="addin" action="module.php">
136*8c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
137*8c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
138*8c2e8227SGreg Roach					<table>
139*8c2e8227SGreg Roach					<tr>
140*8c2e8227SGreg Roach						<td colspan="2" class="topbottombar" style="text-align:center; ">
141*8c2e8227SGreg Roach							<?php echo I18N::translate('Enter an individual, family, or source ID'); ?>
142*8c2e8227SGreg Roach						</td>
143*8c2e8227SGreg Roach					</tr>
144*8c2e8227SGreg Roach					<tr>
145*8c2e8227SGreg Roach						<td class="optionbox">
146*8c2e8227SGreg Roach							<input type="hidden" name="action" value="add">
147*8c2e8227SGreg Roach							<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
148*8c2e8227SGreg Roach						</td>
149*8c2e8227SGreg Roach						<td class="optionbox">
150*8c2e8227SGreg Roach							<?php echo print_findindi_link('cart_item_id'); ?>
151*8c2e8227SGreg Roach							<?php echo print_findfamily_link('cart_item_id'); ?>
152*8c2e8227SGreg Roach							<?php echo print_findsource_link('cart_item_id', ''); ?>
153*8c2e8227SGreg Roach							<input type="submit" value="<?php echo I18N::translate('Add'); ?>">
154*8c2e8227SGreg Roach
155*8c2e8227SGreg Roach						</td>
156*8c2e8227SGreg Roach					</tr>
157*8c2e8227SGreg Roach					</table>
158*8c2e8227SGreg Roach					</form>
159*8c2e8227SGreg Roach					<?php
160*8c2e8227SGreg Roach				}
161*8c2e8227SGreg Roach
162*8c2e8227SGreg Roach				// -- end new lines
163*8c2e8227SGreg Roach				echo I18N::translate('Your clippings cart is empty.');
164*8c2e8227SGreg Roach			} else {
165*8c2e8227SGreg Roach				// Keep track of the INDI from the parent page, otherwise it will
166*8c2e8227SGreg Roach				// get lost after ajax updates
167*8c2e8227SGreg Roach				$pid = Filter::get('pid', WT_REGEX_XREF);
168*8c2e8227SGreg Roach
169*8c2e8227SGreg Roach				if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') { ?>
170*8c2e8227SGreg Roach					<table><tr><td class="width33" valign="top" rowspan="3">
171*8c2e8227SGreg Roach					<form method="get" action="module.php">
172*8c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
173*8c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
174*8c2e8227SGreg Roach					<input type="hidden" name="action" value="download">
175*8c2e8227SGreg Roach					<input type="hidden" name="pid" value="<?php echo $pid; ?>">
176*8c2e8227SGreg Roach					<table>
177*8c2e8227SGreg Roach					<tr><td colspan="2" class="topbottombar"><h2><?php echo I18N::translate('Download'); ?></h2></td></tr>
178*8c2e8227SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Zip file(s)'), help_link('zip'); ?></td>
179*8c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="Zip" value="yes"></td></tr>
180*8c2e8227SGreg Roach
181*8c2e8227SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Include media (automatically zips files)'), help_link('include_media'); ?></td>
182*8c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes"></td></tr>
183*8c2e8227SGreg Roach
184*8c2e8227SGreg Roach					<?php if (WT_USER_GEDCOM_ADMIN) {	?>
185*8c2e8227SGreg Roach						<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Apply privacy settings'), help_link('apply_privacy'); ?></td>
186*8c2e8227SGreg Roach						<td class="optionbox">
187*8c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="none" checked> <?php echo I18N::translate('None'); ?><br>
188*8c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="gedadmin"> <?php echo I18N::translate('Manager'); ?><br>
189*8c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="user"> <?php echo I18N::translate('Member'); ?><br>
190*8c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?>
191*8c2e8227SGreg Roach						</td></tr>
192*8c2e8227SGreg Roach					<?php } elseif (WT_USER_CAN_ACCESS) {	?>
193*8c2e8227SGreg Roach						<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Apply privacy settings'), help_link('apply_privacy'); ?></td>
194*8c2e8227SGreg Roach						<td class="optionbox">
195*8c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="user" checked> <?php echo I18N::translate('Member'); ?><br>
196*8c2e8227SGreg Roach							<input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?>
197*8c2e8227SGreg Roach						</td></tr>
198*8c2e8227SGreg Roach					<?php } ?>
199*8c2e8227SGreg Roach
200*8c2e8227SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Convert from UTF-8 to ISO-8859-1'), help_link('utf8_ansi'); ?></td>
201*8c2e8227SGreg Roach					<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
202*8c2e8227SGreg Roach
203*8c2e8227SGreg Roach					<tr><td class="descriptionbox width50 wrap"><?php echo I18N::translate('Add the GEDCOM media path to filenames'), help_link('GEDCOM_MEDIA_PATH'); ?></td>
204*8c2e8227SGreg Roach					<td class="optionbox">
205*8c2e8227SGreg Roach						<input type="checkbox" name="conv_path" value="<?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?>">
206*8c2e8227SGreg Roach						<span dir="auto"><?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?></span>
207*8c2e8227SGreg Roach					</td></tr>
208*8c2e8227SGreg Roach
209*8c2e8227SGreg Roach					<tr><td class="topbottombar" colspan="2">
210*8c2e8227SGreg Roach					<input type="submit" value="<?php echo I18N::translate('Download'); ?>">
211*8c2e8227SGreg Roach					</form>
212*8c2e8227SGreg Roach					</td></tr>
213*8c2e8227SGreg Roach					</table>
214*8c2e8227SGreg Roach					</td></tr>
215*8c2e8227SGreg Roach					</table>
216*8c2e8227SGreg Roach					<br>
217*8c2e8227SGreg Roach
218*8c2e8227SGreg Roach					<form method="get" name="addin" action="module.php">
219*8c2e8227SGreg Roach					<input type="hidden" name="mod" value="clippings">
220*8c2e8227SGreg Roach					<input type="hidden" name="mod_action" value="index">
221*8c2e8227SGreg Roach					<table>
222*8c2e8227SGreg Roach					<tr>
223*8c2e8227SGreg Roach						<td colspan="2" class="topbottombar" style="text-align:center; ">
224*8c2e8227SGreg Roach							<?php echo I18N::translate('Enter an individual, family, or source ID'); ?>
225*8c2e8227SGreg Roach						</td>
226*8c2e8227SGreg Roach					</tr>
227*8c2e8227SGreg Roach					<tr>
228*8c2e8227SGreg Roach						<td class="optionbox">
229*8c2e8227SGreg Roach							<input type="hidden" name="action" value="add">
230*8c2e8227SGreg Roach							<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
231*8c2e8227SGreg Roach						</td>
232*8c2e8227SGreg Roach						<td class="optionbox">
233*8c2e8227SGreg Roach							<?php echo print_findindi_link('cart_item_id'); ?>
234*8c2e8227SGreg Roach							<?php echo print_findfamily_link('cart_item_id'); ?>
235*8c2e8227SGreg Roach							<?php echo print_findsource_link('cart_item_id'); ?>
236*8c2e8227SGreg Roach							<input type="submit" value="<?php echo I18N::translate('Add'); ?>">
237*8c2e8227SGreg Roach
238*8c2e8227SGreg Roach						</td>
239*8c2e8227SGreg Roach					</tr>
240*8c2e8227SGreg Roach					</table>
241*8c2e8227SGreg Roach					</form>
242*8c2e8227SGreg Roach
243*8c2e8227SGreg Roach
244*8c2e8227SGreg Roach				<?php } ?>
245*8c2e8227SGreg Roach				<br><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo I18N::translate('Empty the clippings cart'); ?></a>
246*8c2e8227SGreg Roach				</td></tr>
247*8c2e8227SGreg Roach
248*8c2e8227SGreg Roach				<tr><td class="topbottombar"><h2><?php echo I18N::translate('Family tree clippings cart'); ?></h2></td></tr>
249*8c2e8227SGreg Roach
250*8c2e8227SGreg Roach				<tr><td valign="top">
251*8c2e8227SGreg Roach				<table id="mycart" class="sortable list_table width100">
252*8c2e8227SGreg Roach					<tr>
253*8c2e8227SGreg Roach						<th class="list_label"><?php echo I18N::translate('Record'); ?></th>
254*8c2e8227SGreg Roach						<th class="list_label"><?php echo I18N::translate('Remove'); ?></th>
255*8c2e8227SGreg Roach					</tr>
256*8c2e8227SGreg Roach			<?php
257*8c2e8227SGreg Roach				foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
258*8c2e8227SGreg Roach					$record = GedcomRecord::getInstance($xref);
259*8c2e8227SGreg Roach					if ($record) {
260*8c2e8227SGreg Roach						switch ($record::RECORD_TYPE) {
261*8c2e8227SGreg Roach						case 'INDI': $icon = 'icon-indis'; break;
262*8c2e8227SGreg Roach						case 'FAM':  $icon = 'icon-sfamily'; break;
263*8c2e8227SGreg Roach						case 'SOUR': $icon = 'icon-source'; break;
264*8c2e8227SGreg Roach						case 'REPO': $icon = 'icon-repository'; break;
265*8c2e8227SGreg Roach						case 'NOTE': $icon = 'icon-note'; break;
266*8c2e8227SGreg Roach						case 'OBJE': $icon = 'icon-media'; break;
267*8c2e8227SGreg Roach						default:     $icon = 'icon-clippings'; break;
268*8c2e8227SGreg Roach						}
269*8c2e8227SGreg Roach						?>
270*8c2e8227SGreg Roach						<tr><td class="list_value">
271*8c2e8227SGreg Roach							<i class="<?php echo $icon; ?>"></i>
272*8c2e8227SGreg Roach						<?php
273*8c2e8227SGreg Roach						echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
274*8c2e8227SGreg Roach						?>
275*8c2e8227SGreg Roach						</td>
276*8c2e8227SGreg Roach						<td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;id=<?php echo $xref; ?>" class="icon-remove" title="<?php echo I18N::translate('Remove'); ?>"></a></td>
277*8c2e8227SGreg Roach					</tr>
278*8c2e8227SGreg Roach					<?php
279*8c2e8227SGreg Roach					}
280*8c2e8227SGreg Roach				}
281*8c2e8227SGreg Roach			?>
282*8c2e8227SGreg Roach				</table>
283*8c2e8227SGreg Roach				</td></tr></table>
284*8c2e8227SGreg Roach			<?php
285*8c2e8227SGreg Roach			}
286*8c2e8227SGreg Roach			break;
287*8c2e8227SGreg Roach		default:
288*8c2e8227SGreg Roach			http_response_code(404);
289*8c2e8227SGreg Roach			break;
290*8c2e8227SGreg Roach		}
291*8c2e8227SGreg Roach	}
292*8c2e8227SGreg Roach
293*8c2e8227SGreg Roach	/** {@inheritdoc} */
294*8c2e8227SGreg Roach	public function defaultMenuOrder() {
295*8c2e8227SGreg Roach		return 20;
296*8c2e8227SGreg Roach	}
297*8c2e8227SGreg Roach
298*8c2e8227SGreg Roach	/** {@inheritdoc} */
299*8c2e8227SGreg Roach	public function getMenu() {
300*8c2e8227SGreg Roach		global $controller;
301*8c2e8227SGreg Roach
302*8c2e8227SGreg Roach		if (Auth::isSearchEngine()) {
303*8c2e8227SGreg Roach			return null;
304*8c2e8227SGreg Roach		}
305*8c2e8227SGreg Roach		//-- main clippings menu item
306*8c2e8227SGreg Roach		$menu = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . WT_GEDURL, 'menu-clippings');
307*8c2e8227SGreg Roach		if (isset($controller->record)) {
308*8c2e8227SGreg Roach			$submenu = new Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . WT_GEDURL, 'menu-clippingscart');
309*8c2e8227SGreg Roach			$menu->addSubmenu($submenu);
310*8c2e8227SGreg Roach		}
311*8c2e8227SGreg Roach		if (!empty($controller->record) && $controller->record->canShow()) {
312*8c2e8227SGreg Roach			$submenu = new Menu(I18N::translate('Add to clippings cart'), 'module.php?mod=clippings&amp;mod_action=index&amp;action=add&amp;id=' . $controller->record->getXref(), 'menu-clippingsadd');
313*8c2e8227SGreg Roach			$menu->addSubmenu($submenu);
314*8c2e8227SGreg Roach		}
315*8c2e8227SGreg Roach		return $menu;
316*8c2e8227SGreg Roach	}
317*8c2e8227SGreg Roach
318*8c2e8227SGreg Roach	/** {@inheritdoc} */
319*8c2e8227SGreg Roach	public function defaultSidebarOrder() {
320*8c2e8227SGreg Roach		return 60;
321*8c2e8227SGreg Roach	}
322*8c2e8227SGreg Roach
323*8c2e8227SGreg Roach	/** {@inheritdoc} */
324*8c2e8227SGreg Roach	public function hasSidebarContent() {
325*8c2e8227SGreg Roach		if (Auth::isSearchEngine()) {
326*8c2e8227SGreg Roach			return false;
327*8c2e8227SGreg Roach		} else {
328*8c2e8227SGreg Roach			// Creating a controller has the side effect of initialising the cart
329*8c2e8227SGreg Roach			new ClippingsCart;
330*8c2e8227SGreg Roach
331*8c2e8227SGreg Roach			return true;
332*8c2e8227SGreg Roach		}
333*8c2e8227SGreg Roach	}
334*8c2e8227SGreg Roach
335*8c2e8227SGreg Roach	/** {@inheritdoc} */
336*8c2e8227SGreg Roach	public function getSidebarContent() {
337*8c2e8227SGreg Roach		global $controller;
338*8c2e8227SGreg Roach
339*8c2e8227SGreg Roach		$controller->addInlineJavascript('
340*8c2e8227SGreg Roach				jQuery("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
341*8c2e8227SGreg Roach					jQuery("#sb_clippings_content").load(this.href);
342*8c2e8227SGreg Roach					return false;
343*8c2e8227SGreg Roach				});
344*8c2e8227SGreg Roach			');
345*8c2e8227SGreg Roach
346*8c2e8227SGreg Roach		return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
347*8c2e8227SGreg Roach	}
348*8c2e8227SGreg Roach
349*8c2e8227SGreg Roach	/** {@inheritdoc} */
350*8c2e8227SGreg Roach	public function getSidebarAjaxContent() {
351*8c2e8227SGreg Roach		global $WT_SESSION;
352*8c2e8227SGreg Roach
353*8c2e8227SGreg Roach		$clip_ctrl         = new ClippingsCart;
354*8c2e8227SGreg Roach		$add               = Filter::get('add', WT_REGEX_XREF);
355*8c2e8227SGreg Roach		$add1              = Filter::get('add1', WT_REGEX_XREF);
356*8c2e8227SGreg Roach		$remove            = Filter::get('remove', WT_REGEX_XREF);
357*8c2e8227SGreg Roach		$others            = Filter::get('others');
358*8c2e8227SGreg Roach		$clip_ctrl->level1 = Filter::getInteger('level1');
359*8c2e8227SGreg Roach		$clip_ctrl->level2 = Filter::getInteger('level2');
360*8c2e8227SGreg Roach		$clip_ctrl->level3 = Filter::getInteger('level3');
361*8c2e8227SGreg Roach		if ($add) {
362*8c2e8227SGreg Roach			$record = GedcomRecord::getInstance($add);
363*8c2e8227SGreg Roach			if ($record) {
364*8c2e8227SGreg Roach				$clip_ctrl->id   = $record->getXref();
365*8c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
366*8c2e8227SGreg Roach				$clip_ctrl->addClipping($record);
367*8c2e8227SGreg Roach			}
368*8c2e8227SGreg Roach		} elseif ($add1) {
369*8c2e8227SGreg Roach			$record = Individual::getInstance($add1);
370*8c2e8227SGreg Roach			if ($record) {
371*8c2e8227SGreg Roach				$clip_ctrl->id = $record->getXref();
372*8c2e8227SGreg Roach				$clip_ctrl->type = $record::RECORD_TYPE;
373*8c2e8227SGreg Roach				if ($others == 'parents') {
374*8c2e8227SGreg Roach					foreach ($record->getChildFamilies() as $family) {
375*8c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
376*8c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
377*8c2e8227SGreg Roach					}
378*8c2e8227SGreg Roach				} elseif ($others == 'ancestors') {
379*8c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
380*8c2e8227SGreg Roach				} elseif ($others == 'ancestorsfamilies') {
381*8c2e8227SGreg Roach					$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
382*8c2e8227SGreg Roach				} elseif ($others == 'members') {
383*8c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
384*8c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
385*8c2e8227SGreg Roach						$clip_ctrl->addFamilyMembers($family);
386*8c2e8227SGreg Roach					}
387*8c2e8227SGreg Roach				} elseif ($others == 'descendants') {
388*8c2e8227SGreg Roach					foreach ($record->getSpouseFamilies() as $family) {
389*8c2e8227SGreg Roach						$clip_ctrl->addClipping($family);
390*8c2e8227SGreg Roach						$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
391*8c2e8227SGreg Roach					}
392*8c2e8227SGreg Roach				}
393*8c2e8227SGreg Roach			}
394*8c2e8227SGreg Roach		} elseif ($remove) {
395*8c2e8227SGreg Roach			unset ($WT_SESSION->cart[WT_GED_ID][$remove]);
396*8c2e8227SGreg Roach		} elseif (isset($_REQUEST['empty'])) {
397*8c2e8227SGreg Roach			$WT_SESSION->cart[WT_GED_ID] = array();
398*8c2e8227SGreg Roach		} elseif (isset($_REQUEST['download'])) {
399*8c2e8227SGreg Roach			return $this->downloadForm($clip_ctrl);
400*8c2e8227SGreg Roach		}
401*8c2e8227SGreg Roach		return $this->getCartList();
402*8c2e8227SGreg Roach	}
403*8c2e8227SGreg Roach
404*8c2e8227SGreg Roach	/**
405*8c2e8227SGreg Roach	 * A list for the side bar.
406*8c2e8227SGreg Roach	 *
407*8c2e8227SGreg Roach	 * @return string
408*8c2e8227SGreg Roach	 */
409*8c2e8227SGreg Roach	public function getCartList() {
410*8c2e8227SGreg Roach		global $WT_SESSION;
411*8c2e8227SGreg Roach
412*8c2e8227SGreg Roach		// Keep track of the INDI from the parent page, otherwise it will
413*8c2e8227SGreg Roach		// get lost after ajax updates
414*8c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
415*8c2e8227SGreg Roach
416*8c2e8227SGreg Roach		if (!$WT_SESSION->cart[WT_GED_ID]) {
417*8c2e8227SGreg Roach			$out = I18N::translate('Your clippings cart is empty.');
418*8c2e8227SGreg Roach		} else {
419*8c2e8227SGreg Roach			$out = '<ul>';
420*8c2e8227SGreg Roach			foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
421*8c2e8227SGreg Roach				$record = GedcomRecord::getInstance($xref);
422*8c2e8227SGreg Roach				if ($record instanceof Individual || $record instanceof Family) {
423*8c2e8227SGreg Roach					switch ($record::RECORD_TYPE) {
424*8c2e8227SGreg Roach					case 'INDI':
425*8c2e8227SGreg Roach						$icon = 'icon-indis';
426*8c2e8227SGreg Roach						break;
427*8c2e8227SGreg Roach					case 'FAM':
428*8c2e8227SGreg Roach						$icon = 'icon-sfamily';
429*8c2e8227SGreg Roach						break;
430*8c2e8227SGreg Roach					}
431*8c2e8227SGreg Roach					$out .= '<li>';
432*8c2e8227SGreg Roach					if (!empty($icon)) {
433*8c2e8227SGreg Roach						$out .= '<i class="' . $icon . '"></i>';
434*8c2e8227SGreg Roach					}
435*8c2e8227SGreg Roach					$out .= '<a href="' . $record->getHtmlUrl() . '">';
436*8c2e8227SGreg Roach					if ($record instanceof Individual) {
437*8c2e8227SGreg Roach						$out .= $record->getSexImage();
438*8c2e8227SGreg Roach					}
439*8c2e8227SGreg Roach					$out .= ' ' . $record->getFullName() . ' ';
440*8c2e8227SGreg Roach					if ($record instanceof Individual && $record->canShow()) {
441*8c2e8227SGreg Roach						$out .= ' (' . $record->getLifeSpan() . ')';
442*8c2e8227SGreg Roach					}
443*8c2e8227SGreg Roach					$out .= '</a>';
444*8c2e8227SGreg Roach					$out .= '<a class="icon-remove remove_cart" href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;remove=' . $xref . '&amp;pid=' . $pid . '" title="' . I18N::translate('Remove') . '"></a>';
445*8c2e8227SGreg Roach					$out .= '</li>';
446*8c2e8227SGreg Roach				}
447*8c2e8227SGreg Roach			}
448*8c2e8227SGreg Roach			$out .= '</ul>';
449*8c2e8227SGreg Roach		}
450*8c2e8227SGreg Roach
451*8c2e8227SGreg Roach		if ($WT_SESSION->cart[WT_GED_ID]) {
452*8c2e8227SGreg Roach			$out .=
453*8c2e8227SGreg Roach				'<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
454*8c2e8227SGreg Roach				I18N::translate('Empty the clippings cart') .
455*8c2e8227SGreg Roach				'</a>' .
456*8c2e8227SGreg Roach				'<br>' .
457*8c2e8227SGreg Roach				'<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
458*8c2e8227SGreg Roach				I18N::translate('Download') .
459*8c2e8227SGreg Roach				'</a>';
460*8c2e8227SGreg Roach		}
461*8c2e8227SGreg Roach		$record = Individual::getInstance($pid);
462*8c2e8227SGreg Roach		if ($record && !array_key_exists($record->getXref(), $WT_SESSION->cart[WT_GED_ID])) {
463*8c2e8227SGreg Roach			$out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;add=' . $pid . '&amp;pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>';
464*8c2e8227SGreg Roach		}
465*8c2e8227SGreg Roach		return $out;
466*8c2e8227SGreg Roach	}
467*8c2e8227SGreg Roach
468*8c2e8227SGreg Roach	/**
469*8c2e8227SGreg Roach	 * @param Individual $person
470*8c2e8227SGreg Roach	 *
471*8c2e8227SGreg Roach	 * @return string
472*8c2e8227SGreg Roach	 */
473*8c2e8227SGreg Roach	public function askAddOptions(Individual $person) {
474*8c2e8227SGreg Roach		$MAX_PEDIGREE_GENERATIONS = $person->getTree()->getPreference('MAX_PEDIGREE_GENERATIONS');
475*8c2e8227SGreg Roach
476*8c2e8227SGreg Roach		$out = '<h3><a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a></h3>';
477*8c2e8227SGreg Roach		$out .= '<script>';
478*8c2e8227SGreg Roach		$out .= 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}
479*8c2e8227SGreg Roach			function continueAjax(frm) {
480*8c2e8227SGreg Roach				var others = jQuery("input[name=\'others\']:checked").val();
481*8c2e8227SGreg Roach				var link = "module.php?mod='.$this->getName() . '&mod_action=ajax&sb_action=clippings&add1="+frm.pid.value+"&others="+others+"&level1="+frm.level1.value+"&level2="+frm.level2.value+"&level3="+frm.level3.value;
482*8c2e8227SGreg Roach				jQuery("#sb_clippings_content").load(link);
483*8c2e8227SGreg Roach			}';
484*8c2e8227SGreg Roach		$out .= '</script>';
485*8c2e8227SGreg Roach		if ($person instanceof Family) {
486*8c2e8227SGreg Roach			$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
487*8c2e8227SGreg Roach			<input type="hidden" name="mod" value="clippings">
488*8c2e8227SGreg Roach			<input type="hidden" name="mod_action" value="index">
489*8c2e8227SGreg Roach			<table>
490*8c2e8227SGreg Roach			<tr><td class="topbottombar">' . I18N::translate('Which other links from this family would you like to add?') . '
491*8c2e8227SGreg Roach			<input type="hidden" name="pid" value="'.$person->getXref() . '">
492*8c2e8227SGreg Roach			<input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
493*8c2e8227SGreg Roach			<input type="hidden" name="action" value="add1"></td></tr>
494*8c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" checked value="none">'. I18N::translate('Add just this family record.') . '</td></tr>
495*8c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" value="parents">'. I18N::translate('Add parents’ records together with this family record.') . '</td></tr>
496*8c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" value="members">'. I18N::translate('Add parents’ and children’s records together with this family record.') . '</td></tr>
497*8c2e8227SGreg Roach			<tr><td class="optionbox"><input type="radio" name="others" value="descendants">'. I18N::translate('Add parents’ and all descendants’ records together with this family record.') . '</td></tr>
498*8c2e8227SGreg Roach			<tr><td class="topbottombar"><input type="submit" value="'. I18N::translate('Continue adding') . '"></td></tr>
499*8c2e8227SGreg Roach			</table>
500*8c2e8227SGreg Roach			</form>';
501*8c2e8227SGreg Roach		} elseif ($person instanceof Individual) {
502*8c2e8227SGreg Roach			$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
503*8c2e8227SGreg Roach			<input type="hidden" name="mod" value="clippings">
504*8c2e8227SGreg Roach			<input type="hidden" name="mod_action" value="index">
505*8c2e8227SGreg Roach		' . I18N::translate('Which links from this individual would you also like to add?') . '
506*8c2e8227SGreg Roach		<input type="hidden" name="pid" value="'.$person->getXref() . '">
507*8c2e8227SGreg Roach		<input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
508*8c2e8227SGreg Roach		<input type="hidden" name="action" value="add1">
509*8c2e8227SGreg Roach		<ul>
510*8c2e8227SGreg Roach		<li><input type="radio" name="others" checked value="none">'. I18N::translate('Add just this individual.') . '</li>
511*8c2e8227SGreg Roach		<li><input type="radio" name="others" value="parents">'. I18N::translate('Add this individual, his parents, and siblings.') . '</li>
512*8c2e8227SGreg Roach		<li><input type="radio" name="others" value="ancestors" id="ancestors">'. I18N::translate('Add this individual and his direct line ancestors.') . '<br>
513*8c2e8227SGreg Roach				'. I18N::translate('Number of generations:') . '<input type="text" size="4" name="level1" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'ancestors\');"></li>
514*8c2e8227SGreg Roach		<li><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">'. I18N::translate('Add this individual, his direct line ancestors, and their families.') . '<br>
515*8c2e8227SGreg Roach				'. I18N::translate('Number of generations:') . ' <input type="text" size="4" name="level2" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'ancestorsfamilies\');"></li>
516*8c2e8227SGreg Roach		<li><input type="radio" name="others" value="members">'. I18N::translate('Add this individual, his spouse, and children.') . '</li>
517*8c2e8227SGreg Roach		<li><input type="radio" name="others" value="descendants" id="descendants">'. I18N::translate('Add this individual, his spouse, and all descendants.') . '<br >
518*8c2e8227SGreg Roach				'. I18N::translate('Number of generations:') . ' <input type="text" size="4" name="level3" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'descendants\');"></li>
519*8c2e8227SGreg Roach		</ul>
520*8c2e8227SGreg Roach		<input type="submit" value="'. I18N::translate('Continue adding') . '">
521*8c2e8227SGreg Roach		</form>';
522*8c2e8227SGreg Roach		} else if ($person instanceof Source) {
523*8c2e8227SGreg Roach			$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
524*8c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
525*8c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
526*8c2e8227SGreg Roach		<table>
527*8c2e8227SGreg Roach		<tr><td class="topbottombar">' . I18N::translate('Which records linked to this source should be added?') . '
528*8c2e8227SGreg Roach		<input type="hidden" name="pid" value="'.$person->getXref() . '">
529*8c2e8227SGreg Roach		<input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
530*8c2e8227SGreg Roach		<input type="hidden" name="action" value="add1"></td></tr>
531*8c2e8227SGreg Roach		<tr><td class="optionbox"><input type="radio" name="others" checked value="none">'. I18N::translate('Add just this source.') . '</td></tr>
532*8c2e8227SGreg Roach		<tr><td class="optionbox"><input type="radio" name="others" value="linked">'. I18N::translate('Add this source and families/individuals linked to it.') . '</td></tr>
533*8c2e8227SGreg Roach		<tr><td class="topbottombar"><input type="submit" value="'. I18N::translate('Continue adding') . '">
534*8c2e8227SGreg Roach		</table>
535*8c2e8227SGreg Roach		</form>';
536*8c2e8227SGreg Roach		} else {
537*8c2e8227SGreg Roach			return $this->getSidebarContent();
538*8c2e8227SGreg Roach		}
539*8c2e8227SGreg Roach		return $out;
540*8c2e8227SGreg Roach	}
541*8c2e8227SGreg Roach
542*8c2e8227SGreg Roach	/**
543*8c2e8227SGreg Roach	 * @param ClippingsCart $clip_ctrl
544*8c2e8227SGreg Roach	 *
545*8c2e8227SGreg Roach	 * @return string
546*8c2e8227SGreg Roach	 */
547*8c2e8227SGreg Roach	public function downloadForm(ClippingsCart $clip_ctrl) {
548*8c2e8227SGreg Roach		global $WT_TREE;
549*8c2e8227SGreg Roach
550*8c2e8227SGreg Roach		$pid = Filter::get('pid', WT_REGEX_XREF);
551*8c2e8227SGreg Roach
552*8c2e8227SGreg Roach		$out = '<script>';
553*8c2e8227SGreg Roach		$out .= 'function cancelDownload() {
554*8c2e8227SGreg Roach				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '";
555*8c2e8227SGreg Roach				jQuery("#sb_clippings_content").load(link);
556*8c2e8227SGreg Roach			}';
557*8c2e8227SGreg Roach		$out .= '</script>';
558*8c2e8227SGreg Roach		$out .= '<form method="get" action="module.php">
559*8c2e8227SGreg Roach		<input type="hidden" name="mod" value="clippings">
560*8c2e8227SGreg Roach		<input type="hidden" name="mod_action" value="index">
561*8c2e8227SGreg Roach		<input type="hidden" name="pid" value="' .$pid . '">
562*8c2e8227SGreg Roach		<input type="hidden" name="action" value="download">
563*8c2e8227SGreg Roach		<table>
564*8c2e8227SGreg Roach		<tr><td colspan="2" class="topbottombar"><h2>'. I18N::translate('Download') . '</h2></td></tr>
565*8c2e8227SGreg Roach		<tr><td class="descriptionbox width50 wrap">'. I18N::translate('Zip file(s)') . help_link('zip') . '</td>
566*8c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
567*8c2e8227SGreg Roach
568*8c2e8227SGreg Roach		<tr><td class="descriptionbox width50 wrap">'. I18N::translate('Include media (automatically zips files)') . help_link('include_media') . '</td>
569*8c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
570*8c2e8227SGreg Roach		';
571*8c2e8227SGreg Roach
572*8c2e8227SGreg Roach		if (WT_USER_GEDCOM_ADMIN) {
573*8c2e8227SGreg Roach			$out .=
574*8c2e8227SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . help_link('apply_privacy') . '</td>' .
575*8c2e8227SGreg Roach				'<td class="optionbox">' .
576*8c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' .
577*8c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' .
578*8c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' .
579*8c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
580*8c2e8227SGreg Roach				'</td></tr>';
581*8c2e8227SGreg Roach		} elseif (WT_USER_CAN_ACCESS) {
582*8c2e8227SGreg Roach			$out .=
583*8c2e8227SGreg Roach				'<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . help_link('apply_privacy') . '</td>' .
584*8c2e8227SGreg Roach				'<td class="list_value">' .
585*8c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' .
586*8c2e8227SGreg Roach				'	<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') .
587*8c2e8227SGreg Roach				'</td></tr>';
588*8c2e8227SGreg Roach		}
589*8c2e8227SGreg Roach
590*8c2e8227SGreg Roach		$out .= '
591*8c2e8227SGreg Roach		<tr><td class="descriptionbox width50 wrap">'. I18N::translate('Convert from UTF-8 to ISO-8859-1') . help_link('utf8_ansi') . '</td>
592*8c2e8227SGreg Roach		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
593*8c2e8227SGreg Roach
594*8c2e8227SGreg Roach		<tr>
595*8c2e8227SGreg Roach		<td class="descriptionbox width50 wrap">'. I18N::translate('Add the GEDCOM media path to filenames') . help_link('GEDCOM_MEDIA_PATH') . '</td>
596*8c2e8227SGreg Roach		<td class="optionbox">
597*8c2e8227SGreg Roach		<input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '">
598*8c2e8227SGreg Roach		<span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td>
599*8c2e8227SGreg Roach		</tr>
600*8c2e8227SGreg Roach
601*8c2e8227SGreg Roach		<input type="hidden" name="conv_path" value="'.$clip_ctrl->conv_path . '">
602*8c2e8227SGreg Roach
603*8c2e8227SGreg Roach		</td></tr>
604*8c2e8227SGreg Roach
605*8c2e8227SGreg Roach		<tr><td class="topbottombar" colspan="2">
606*8c2e8227SGreg Roach		<input type="button" value="'. I18N::translate('Cancel') . '" onclick="cancelDownload();">
607*8c2e8227SGreg Roach		<input type="submit" value="'. I18N::translate('Download') . '">
608*8c2e8227SGreg Roach		</form>';
609*8c2e8227SGreg Roach
610*8c2e8227SGreg Roach		return $out;
611*8c2e8227SGreg Roach	}
612*8c2e8227SGreg Roach
613*8c2e8227SGreg Roach}
614