18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 4369c0ce6SGreg Roach * Copyright (C) 2016 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; 223d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint; 230e62c4b8SGreg Roachuse Fisharebest\Webtrees\GedcomRecord; 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()) 817820e4d7SGreg Roach ->pageHeader() 828c2e8227SGreg Roach ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) 838c2e8227SGreg Roach ->addInlineJavascript('autocomplete();'); 848c2e8227SGreg Roach 858c2e8227SGreg Roach echo '<script>'; 868c2e8227SGreg Roach echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; 878c2e8227SGreg Roach echo '</script>'; 888c2e8227SGreg Roach 8931bc7874SGreg Roach if (!$cart[$WT_TREE->getTreeId()]) { 908c2e8227SGreg Roach echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>'; 918c2e8227SGreg Roach } 928c2e8227SGreg Roach 938c2e8227SGreg Roach if ($clip_ctrl->action == 'add') { 944e3c4966SGreg Roach $record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE); 958c2e8227SGreg Roach if ($clip_ctrl->type === 'FAM') { ?> 968c2e8227SGreg Roach <form action="module.php" method="get"> 978c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 988c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 998c2e8227SGreg Roach <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>"> 1008c2e8227SGreg Roach <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>"> 1014e3c4966SGreg Roach <input type="hidden" name="action" value="add1"> 1024e3c4966SGreg Roach <table> 1034e3c4966SGreg Roach <thead> 1044e3c4966SGreg Roach <tr> 1054e3c4966SGreg Roach <td class="topbottombar"> 1064e3c4966SGreg Roach <?php echo I18N::translate('Add to the clippings cart'); ?> 1074e3c4966SGreg Roach </td> 1084e3c4966SGreg Roach </tr> 1094e3c4966SGreg Roach </thead> 1104e3c4966SGreg Roach <tbody> 1114e3c4966SGreg Roach <tr> 1124e3c4966SGreg Roach <td class="optionbox"> 1134e3c4966SGreg Roach <input type="radio" name="others" value="parents"> 1144e3c4966SGreg Roach <?php echo $record->getFullName(); ?> 1154e3c4966SGreg Roach </td> 1164e3c4966SGreg Roach </tr> 1174e3c4966SGreg Roach <tr> 1184e3c4966SGreg Roach <td class="optionbox"> 1194e3c4966SGreg Roach <input type="radio" name="others" value="members" checked> 120a86dd8b1SGreg Roach <?php echo /* I18N: %s is a family (husband + wife) */ 121a86dd8b1SGreg Roach I18N::translate('%s and their children', $record->getFullName()); ?> 1224e3c4966SGreg Roach </td> 1234e3c4966SGreg Roach </tr> 1244e3c4966SGreg Roach <tr> 1254e3c4966SGreg Roach <td class="optionbox"> 1264e3c4966SGreg Roach <input type="radio" name="others" value="descendants"> 127a86dd8b1SGreg Roach <?php echo /* I18N: %s is a family (husband + wife) */ 128a86dd8b1SGreg Roach I18N::translate('%s and their descendants', $record->getFullName()); ?> 1294e3c4966SGreg Roach </td> 1304e3c4966SGreg Roach </tr> 1314e3c4966SGreg Roach </tbody> 1324e3c4966SGreg Roach <tfoot> 1334e3c4966SGreg Roach <tr> 1344e3c4966SGreg Roach <td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('continue'); ?>"> 1354e3c4966SGreg Roach </td> 1364e3c4966SGreg Roach </tr> 1374e3c4966SGreg Roach </tfoot> 1388c2e8227SGreg Roach </table> 1398c2e8227SGreg Roach </form> 1408c2e8227SGreg Roach <?php } elseif ($clip_ctrl->type === 'INDI') { ?> 1418c2e8227SGreg Roach <form action="module.php" method="get"> 1428c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 1438c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 1448c2e8227SGreg Roach <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>"> 1458c2e8227SGreg Roach <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>"> 146a86dd8b1SGreg Roach <input type="hidden" name="action" value="add1"> 1474e3c4966SGreg Roach <table> 1484e3c4966SGreg Roach <thead> 1494e3c4966SGreg Roach <tr> 1504e3c4966SGreg Roach <td class="topbottombar"> 1514e3c4966SGreg Roach <?php echo 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"> 1604e3c4966SGreg Roach <?php echo $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> 2114e3c4966SGreg Roach <?php echo I18N::translate('Number of generations'); ?> 2124e3c4966SGreg Roach <input type="text" size="5" name="level1" value="<?php echo $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> 2304e3c4966SGreg Roach <?php echo I18N::translate('Number of generations'); ?> 2314e3c4966SGreg Roach <input type="text" size="5" name="level2" value="<?php echo $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> 2494e3c4966SGreg Roach <?php echo I18N::translate('Number of generations'); ?> 2504e3c4966SGreg Roach <input type="text" size="5" name="level3" value="<?php echo $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"> 2574e3c4966SGreg Roach <input type="submit" value="<?php echo I18N::translate('continue'); ?>"> 2584e3c4966SGreg Roach </td> 2594e3c4966SGreg Roach </tr> 2604e3c4966SGreg Roach </tfoot> 2618c2e8227SGreg Roach </table> 2628c2e8227SGreg Roach </form> 2638c2e8227SGreg Roach <?php } elseif ($clip_ctrl->type === 'SOUR') { ?> 2648c2e8227SGreg Roach <form action="module.php" method="get"> 2658c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 2668c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 2678c2e8227SGreg Roach <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?>"> 2688c2e8227SGreg Roach <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?>"> 269a86dd8b1SGreg Roach <input type="hidden" name="action" value="add1"> 2704e3c4966SGreg Roach <table> 2714e3c4966SGreg Roach <thead> 2724e3c4966SGreg Roach <tr> 2734e3c4966SGreg Roach <td class="topbottombar"> 2744e3c4966SGreg Roach <?php echo I18N::translate('Add to the clippings cart'); ?> 2754e3c4966SGreg Roach </td> 2764e3c4966SGreg Roach </tr> 2774e3c4966SGreg Roach </thead> 2784e3c4966SGreg Roach <tbody> 2794e3c4966SGreg Roach <tr> 2804e3c4966SGreg Roach <td class="optionbox"> 2814e3c4966SGreg Roach <label> 2824e3c4966SGreg Roach <input type="radio" name="others" checked value="none"> 2834e3c4966SGreg Roach <?php echo $record->getFullName(); ?> 2844e3c4966SGreg Roach </label> 2854e3c4966SGreg Roach </td> 2864e3c4966SGreg Roach </tr> 2874e3c4966SGreg Roach <tr> 2884e3c4966SGreg Roach <td class="optionbox"> 2894e3c4966SGreg Roach <label> 2904e3c4966SGreg Roach <input type="radio" name="others" value="linked"> 291a86dd8b1SGreg Roach <?php echo /* I18N: %s is the name of a source */ 292a86dd8b1SGreg Roach I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?> 2934e3c4966SGreg Roach </label> 2944e3c4966SGreg Roach </td> 2954e3c4966SGreg Roach </tr> 2964e3c4966SGreg Roach </tbody> 2974e3c4966SGreg Roach <tfoot> 2984e3c4966SGreg Roach <tr> 2994e3c4966SGreg Roach <td class="topbottombar"> 3004e3c4966SGreg Roach <input type="submit" value="<?php echo I18N::translate('continue'); ?>"> 3014e3c4966SGreg Roach </td> 3024e3c4966SGreg Roach </tr> 3034e3c4966SGreg Roach </tfoot> 3048c2e8227SGreg Roach </table> 3058c2e8227SGreg Roach </form> 3068c2e8227SGreg Roach <?php } 3078c2e8227SGreg Roach } 3088c2e8227SGreg Roach 30931bc7874SGreg Roach if (!$cart[$WT_TREE->getTreeId()]) { 3108c2e8227SGreg Roach if ($clip_ctrl->action != 'add') { 311*2a277e58SGreg Roach echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.'); 3128c2e8227SGreg Roach ?> 3138c2e8227SGreg Roach <form method="get" name="addin" action="module.php"> 3148c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 3158c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 3168c2e8227SGreg Roach <table> 3174e3c4966SGreg Roach <thead> 3188c2e8227SGreg Roach <tr> 3194e3c4966SGreg Roach <td colspan="2" class="topbottombar"> 3204e3c4966SGreg Roach <?php echo I18N::translate('Add to the clippings cart'); ?> 3218c2e8227SGreg Roach </td> 3228c2e8227SGreg Roach </tr> 3234e3c4966SGreg Roach </thead> 3244e3c4966SGreg Roach <tbody> 3258c2e8227SGreg Roach <tr> 3268c2e8227SGreg Roach <td class="optionbox"> 3278c2e8227SGreg Roach <input type="hidden" name="action" value="add"> 3288c2e8227SGreg Roach <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5"> 3298c2e8227SGreg Roach </td> 3308c2e8227SGreg Roach <td class="optionbox"> 3313d7a8a4cSGreg Roach <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> 3323d7a8a4cSGreg Roach <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> 3333d7a8a4cSGreg Roach <?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?> 334552fa1fbSGreg Roach <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>"> 3358c2e8227SGreg Roach </td> 3368c2e8227SGreg Roach </tr> 3374e3c4966SGreg Roach </tbody> 3388c2e8227SGreg Roach </table> 3398c2e8227SGreg Roach </form> 3408c2e8227SGreg Roach <?php 3418c2e8227SGreg Roach } 3428c2e8227SGreg Roach 3438c2e8227SGreg Roach // -- end new lines 3448c2e8227SGreg Roach echo I18N::translate('Your clippings cart is empty.'); 3458c2e8227SGreg Roach } else { 3468c2e8227SGreg Roach // Keep track of the INDI from the parent page, otherwise it will 3478c2e8227SGreg Roach // get lost after ajax updates 3488c2e8227SGreg Roach $pid = Filter::get('pid', WT_REGEX_XREF); 3498c2e8227SGreg Roach 350a86dd8b1SGreg Roach if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?> 3518c2e8227SGreg Roach <form method="get" action="module.php"> 3528c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 3538c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 3548c2e8227SGreg Roach <input type="hidden" name="action" value="download"> 3558c2e8227SGreg Roach <input type="hidden" name="pid" value="<?php echo $pid; ?>"> 3568c2e8227SGreg Roach <table> 357a86dd8b1SGreg Roach <tr> 358a86dd8b1SGreg Roach <td colspan="2" class="topbottombar"> 359a86dd8b1SGreg Roach <h2><?php echo I18N::translate('Download'); ?></h2> 360a86dd8b1SGreg Roach </td> 361a86dd8b1SGreg Roach </tr> 3626fd6cde8SGreg Roach <tr> 3636fd6cde8SGreg Roach <td class="descriptionbox width50 wrap"> 3646fd6cde8SGreg Roach <?php echo I18N::translate('To reduce the size of the download, you can compress the data into a .ZIP file. You will need to uncompress the .ZIP file before you can use it.'); ?> 3656fd6cde8SGreg Roach </td> 3666fd6cde8SGreg Roach <td class="optionbox wrap"> 3676fd6cde8SGreg Roach <input type="checkbox" name="Zip" value="yes"> 3686fd6cde8SGreg Roach <?php echo I18N::translate('Zip file(s)'); ?> 3696fd6cde8SGreg Roach </td> 3706fd6cde8SGreg Roach </tr> 3716fd6cde8SGreg Roach <tr> 3726fd6cde8SGreg Roach <td class="descriptionbox width50 wrap"> 373d1928687SGreg Roach <?php echo I18N::translate('Include media (automatically zips files)'); ?> 3746fd6cde8SGreg Roach </td> 375a86dd8b1SGreg Roach <td class="optionbox"> 376a86dd8b1SGreg Roach <input type="checkbox" name="IncludeMedia" value="yes"> 377a86dd8b1SGreg Roach </td> 378a86dd8b1SGreg Roach </tr> 3798c2e8227SGreg Roach 3804b9ff166SGreg Roach <?php if (Auth::isManager($WT_TREE)) { ?> 381a86dd8b1SGreg Roach <tr> 382a86dd8b1SGreg Roach <td class="descriptionbox width50 wrap"> 383a86dd8b1SGreg Roach <?php echo I18N::translate('Apply privacy settings'); ?> 384a86dd8b1SGreg Roach </td> 3858c2e8227SGreg Roach <td class="optionbox"> 386a86dd8b1SGreg Roach <input type="radio" name="privatize_export" value="none" checked> 387a86dd8b1SGreg Roach <?php echo I18N::translate('None'); ?> 388a86dd8b1SGreg Roach <br> 389a86dd8b1SGreg Roach <input type="radio" name="privatize_export" value="gedadmin"> 390a86dd8b1SGreg Roach <?php echo I18N::translate('Manager'); ?> 391a86dd8b1SGreg Roach <br> 392a86dd8b1SGreg Roach <input type="radio" name="privatize_export" value="user"> 393a86dd8b1SGreg Roach <?php echo I18N::translate('Member'); ?> 394a86dd8b1SGreg Roach <br> 395a86dd8b1SGreg Roach <input type="radio" name="privatize_export" value="visitor"> 396a86dd8b1SGreg Roach <?php echo I18N::translate('Visitor'); ?> 397a86dd8b1SGreg Roach </td> 398a86dd8b1SGreg Roach </tr> 3994b9ff166SGreg Roach <?php } elseif (Auth::isMember($WT_TREE)) { ?> 400a86dd8b1SGreg Roach <tr> 401a86dd8b1SGreg Roach <td class="descriptionbox width50 wrap"> 402a86dd8b1SGreg Roach <?php echo I18N::translate('Apply privacy settings'); ?> 403a86dd8b1SGreg Roach </td> 4048c2e8227SGreg Roach <td class="optionbox"> 4058c2e8227SGreg Roach <input type="radio" name="privatize_export" value="user" checked> <?php echo I18N::translate('Member'); ?><br> 4068c2e8227SGreg Roach <input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?> 407a86dd8b1SGreg Roach </td> 408a86dd8b1SGreg Roach </tr> 4098c2e8227SGreg Roach <?php } ?> 4108c2e8227SGreg Roach 411a86dd8b1SGreg Roach <tr> 412a86dd8b1SGreg Roach <td class="descriptionbox width50 wrap"> 413a86dd8b1SGreg Roach <?php echo I18N::translate('Convert from UTF-8 to ISO-8859-1'); ?> 414a86dd8b1SGreg Roach </td> 415a86dd8b1SGreg Roach <td class="optionbox"> 416a86dd8b1SGreg Roach <input type="checkbox" name="convert" value="yes"> 417a86dd8b1SGreg Roach </td> 418a86dd8b1SGreg Roach </tr> 4198c2e8227SGreg Roach 420a86dd8b1SGreg Roach <tr> 421a86dd8b1SGreg Roach <td class="descriptionbox width50 wrap"> 422a86dd8b1SGreg Roach <?php echo I18N::translate('Add the GEDCOM media path to filenames'); ?> 423a86dd8b1SGreg Roach </td> 4248c2e8227SGreg Roach <td class="optionbox"> 4258c2e8227SGreg Roach <input type="checkbox" name="conv_path" value="<?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?>"> 4268c2e8227SGreg Roach <span dir="auto"><?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?></span> 427a86dd8b1SGreg Roach </td> 428a86dd8b1SGreg Roach </tr> 4298c2e8227SGreg Roach 430a86dd8b1SGreg Roach <tr> 431a86dd8b1SGreg Roach <td class="topbottombar" colspan="2"> 4328c2e8227SGreg Roach <input type="submit" value="<?php echo I18N::translate('Download'); ?>"> 433a86dd8b1SGreg Roach </td> 434a86dd8b1SGreg Roach </tr> 435a86dd8b1SGreg Roach </table> 4368c2e8227SGreg Roach </form> 4378c2e8227SGreg Roach <br> 4388c2e8227SGreg Roach 4398c2e8227SGreg Roach <form method="get" name="addin" action="module.php"> 4408c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 4418c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 4428c2e8227SGreg Roach <table> 4434e3c4966SGreg Roach <thead> 4448c2e8227SGreg Roach <tr> 4458c2e8227SGreg Roach <td colspan="2" class="topbottombar" style="text-align:center; "> 4464e3c4966SGreg Roach <?php echo I18N::translate('Add to the clippings cart'); ?> 4478c2e8227SGreg Roach </td> 4488c2e8227SGreg Roach </tr> 4494e3c4966SGreg Roach </thead> 4504e3c4966SGreg Roach <tbody> 4518c2e8227SGreg Roach <tr> 4528c2e8227SGreg Roach <td class="optionbox"> 4538c2e8227SGreg Roach <input type="hidden" name="action" value="add"> 4548c2e8227SGreg Roach <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8"> 4558c2e8227SGreg Roach </td> 4568c2e8227SGreg Roach <td class="optionbox"> 4573d7a8a4cSGreg Roach <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> 4583d7a8a4cSGreg Roach <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> 4593d7a8a4cSGreg Roach <?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?> 460552fa1fbSGreg Roach <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>"> 4618c2e8227SGreg Roach </td> 4628c2e8227SGreg Roach </tr> 4634e3c4966SGreg Roach </tbody> 464a86dd8b1SGreg Roach <tfoot> 465a86dd8b1SGreg Roach <tr> 466a86dd8b1SGreg Roach <th colspan="2"> 467a86dd8b1SGreg Roach <a href="module.php?mod=clippings&mod_action=index&action=empty"> 468a86dd8b1SGreg Roach <?php echo I18N::translate('Empty the clippings cart'); ?> 469a86dd8b1SGreg Roach </a> 470a86dd8b1SGreg Roach </th> 471a86dd8b1SGreg Roach </tr> 472a86dd8b1SGreg Roach </tfoot> 4738c2e8227SGreg Roach </table> 4748c2e8227SGreg Roach </form> 4758c2e8227SGreg Roach 4768c2e8227SGreg Roach <?php } ?> 4778c2e8227SGreg Roach 478a86dd8b1SGreg Roach <h2> 479a86dd8b1SGreg Roach <?php echo I18N::translate('Family tree clippings cart'); ?> 480a86dd8b1SGreg Roach </h2> 4818c2e8227SGreg Roach <table id="mycart" class="sortable list_table width100"> 482a86dd8b1SGreg Roach <thead> 4838c2e8227SGreg Roach <tr> 4848c2e8227SGreg Roach <th class="list_label"><?php echo I18N::translate('Record'); ?></th> 4858c2e8227SGreg Roach <th class="list_label"><?php echo I18N::translate('Remove'); ?></th> 4868c2e8227SGreg Roach </tr> 487a86dd8b1SGreg Roach </thead> 488a86dd8b1SGreg Roach <tbody> 4898c2e8227SGreg Roach <?php 49031bc7874SGreg Roach foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) { 49124ec66ceSGreg Roach $record = GedcomRecord::getInstance($xref, $WT_TREE); 4928c2e8227SGreg Roach if ($record) { 4938c2e8227SGreg Roach switch ($record::RECORD_TYPE) { 494a86dd8b1SGreg Roach case 'INDI': 495a86dd8b1SGreg Roach $icon = 'icon-indis'; 496a86dd8b1SGreg Roach break; 497a86dd8b1SGreg Roach case 'FAM': 498a86dd8b1SGreg Roach $icon = 'icon-sfamily'; 499a86dd8b1SGreg Roach break; 500a86dd8b1SGreg Roach case 'SOUR': 501a86dd8b1SGreg Roach $icon = 'icon-source'; 502a86dd8b1SGreg Roach break; 503a86dd8b1SGreg Roach case 'REPO': 504a86dd8b1SGreg Roach $icon = 'icon-repository'; 505a86dd8b1SGreg Roach break; 506a86dd8b1SGreg Roach case 'NOTE': 507a86dd8b1SGreg Roach $icon = 'icon-note'; 508a86dd8b1SGreg Roach break; 509a86dd8b1SGreg Roach case 'OBJE': 510a86dd8b1SGreg Roach $icon = 'icon-media'; 511a86dd8b1SGreg Roach break; 512a86dd8b1SGreg Roach default: 513a86dd8b1SGreg Roach $icon = 'icon-clippings'; 514a86dd8b1SGreg Roach break; 5158c2e8227SGreg Roach } 5168c2e8227SGreg Roach ?> 517a86dd8b1SGreg Roach <tr> 518a86dd8b1SGreg Roach <td class="list_value"> 5198c2e8227SGreg Roach <i class="<?php echo $icon; ?>"></i> 5208c2e8227SGreg Roach <?php 5218c2e8227SGreg Roach echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>'; 5228c2e8227SGreg Roach ?> 5238c2e8227SGreg Roach </td> 5248c2e8227SGreg Roach <td class="list_value center vmiddle"><a href="module.php?mod=clippings&mod_action=index&action=remove&id=<?php echo $xref; ?>" class="icon-remove" title="<?php echo I18N::translate('Remove'); ?>"></a></td> 5258c2e8227SGreg Roach </tr> 5268c2e8227SGreg Roach <?php 5278c2e8227SGreg Roach } 5288c2e8227SGreg Roach } 5298c2e8227SGreg Roach ?> 5308c2e8227SGreg Roach </table> 5318c2e8227SGreg Roach <?php 5328c2e8227SGreg Roach } 5338c2e8227SGreg Roach break; 5348c2e8227SGreg Roach default: 5358c2e8227SGreg Roach http_response_code(404); 5368c2e8227SGreg Roach break; 5378c2e8227SGreg Roach } 5388c2e8227SGreg Roach } 5398c2e8227SGreg Roach 5400ee13198SGreg Roach /** 5410ee13198SGreg Roach * The user can re-order menus. Until they do, they are shown in this order. 5420ee13198SGreg Roach * 5430ee13198SGreg Roach * @return int 5440ee13198SGreg Roach */ 5458c2e8227SGreg Roach public function defaultMenuOrder() { 5468c2e8227SGreg Roach return 20; 5478c2e8227SGreg Roach } 5488c2e8227SGreg Roach 5490ee13198SGreg Roach /** 5500ee13198SGreg Roach * A menu, to be added to the main application menu. 5510ee13198SGreg Roach * 5520ee13198SGreg Roach * @return Menu|null 5530ee13198SGreg Roach */ 5548c2e8227SGreg Roach public function getMenu() { 5554b9ff166SGreg Roach global $controller, $WT_TREE; 5568c2e8227SGreg Roach 557941edf23SGreg Roach $submenus = array(); 5588c2e8227SGreg Roach if (isset($controller->record)) { 559941edf23SGreg Roach $submenus[] = new Menu($this->getTitle(), 'module.php?mod=clippings&mod_action=index&ged=' . $WT_TREE->getNameUrl(), 'menu-clippingscart', array('rel' => 'nofollow')); 5608c2e8227SGreg Roach } 5618c2e8227SGreg Roach if (!empty($controller->record) && $controller->record->canShow()) { 562941edf23SGreg Roach $submenus[] = new Menu(I18N::translate('Add to the clippings cart'), 'module.php?mod=clippings&mod_action=index&action=add&id=' . $controller->record->getXref(), 'menu-clippingsadd', array('rel' => 'nofollow')); 5638c2e8227SGreg Roach } 564cbc1590aSGreg Roach 565941edf23SGreg Roach if ($submenus) { 566941edf23SGreg Roach return new Menu($this->getTitle(), '#', 'menu-clippings', array('rel' => 'nofollow'), $submenus); 567941edf23SGreg Roach } else { 568941edf23SGreg Roach return new Menu($this->getTitle(), 'module.php?mod=clippings&mod_action=index&ged=' . $WT_TREE->getNameUrl(), 'menu-clippings', array('rel' => 'nofollow')); 569941edf23SGreg Roach } 5708c2e8227SGreg Roach } 5718c2e8227SGreg Roach 5728c2e8227SGreg Roach /** {@inheritdoc} */ 5738c2e8227SGreg Roach public function defaultSidebarOrder() { 5748c2e8227SGreg Roach return 60; 5758c2e8227SGreg Roach } 5768c2e8227SGreg Roach 5778c2e8227SGreg Roach /** {@inheritdoc} */ 5788c2e8227SGreg Roach public function hasSidebarContent() { 5798c2e8227SGreg Roach // Creating a controller has the side effect of initialising the cart 5800e62c4b8SGreg Roach new ClippingsCartController; 5818c2e8227SGreg Roach 5828c2e8227SGreg Roach return true; 5838c2e8227SGreg Roach } 5848c2e8227SGreg Roach 58576692c8bSGreg Roach /** 58676692c8bSGreg Roach * Load this sidebar synchronously. 58776692c8bSGreg Roach * 58876692c8bSGreg Roach * @return string 58976692c8bSGreg Roach */ 5908c2e8227SGreg Roach public function getSidebarContent() { 5918c2e8227SGreg Roach global $controller; 5928c2e8227SGreg Roach 5938c2e8227SGreg Roach $controller->addInlineJavascript(' 5948c2e8227SGreg Roach jQuery("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() { 5958c2e8227SGreg Roach jQuery("#sb_clippings_content").load(this.href); 5968c2e8227SGreg Roach return false; 5978c2e8227SGreg Roach }); 5988c2e8227SGreg Roach '); 5998c2e8227SGreg Roach 6008c2e8227SGreg Roach return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>'; 6018c2e8227SGreg Roach } 6028c2e8227SGreg Roach 6038c2e8227SGreg Roach /** {@inheritdoc} */ 6048c2e8227SGreg Roach public function getSidebarAjaxContent() { 60531bc7874SGreg Roach global $WT_TREE; 60631bc7874SGreg Roach 60731bc7874SGreg Roach $cart = Session::get('cart'); 6088c2e8227SGreg Roach 6090e62c4b8SGreg Roach $clip_ctrl = new ClippingsCartController; 6108c2e8227SGreg Roach $add = Filter::get('add', WT_REGEX_XREF); 6118c2e8227SGreg Roach $add1 = Filter::get('add1', WT_REGEX_XREF); 6128c2e8227SGreg Roach $remove = Filter::get('remove', WT_REGEX_XREF); 6138c2e8227SGreg Roach $others = Filter::get('others'); 6148c2e8227SGreg Roach $clip_ctrl->level1 = Filter::getInteger('level1'); 6158c2e8227SGreg Roach $clip_ctrl->level2 = Filter::getInteger('level2'); 6168c2e8227SGreg Roach $clip_ctrl->level3 = Filter::getInteger('level3'); 6178c2e8227SGreg Roach if ($add) { 61824ec66ceSGreg Roach $record = GedcomRecord::getInstance($add, $WT_TREE); 6198c2e8227SGreg Roach if ($record) { 6208c2e8227SGreg Roach $clip_ctrl->id = $record->getXref(); 6218c2e8227SGreg Roach $clip_ctrl->type = $record::RECORD_TYPE; 6228c2e8227SGreg Roach $clip_ctrl->addClipping($record); 6238c2e8227SGreg Roach } 6248c2e8227SGreg Roach } elseif ($add1) { 62524ec66ceSGreg Roach $record = Individual::getInstance($add1, $WT_TREE); 6268c2e8227SGreg Roach if ($record) { 6278c2e8227SGreg Roach $clip_ctrl->id = $record->getXref(); 6288c2e8227SGreg Roach $clip_ctrl->type = $record::RECORD_TYPE; 6298c2e8227SGreg Roach if ($others == 'parents') { 6308c2e8227SGreg Roach foreach ($record->getChildFamilies() as $family) { 6318c2e8227SGreg Roach $clip_ctrl->addClipping($family); 6328c2e8227SGreg Roach $clip_ctrl->addFamilyMembers($family); 6338c2e8227SGreg Roach } 6348c2e8227SGreg Roach } elseif ($others == 'ancestors') { 6358c2e8227SGreg Roach $clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1); 6368c2e8227SGreg Roach } elseif ($others == 'ancestorsfamilies') { 6378c2e8227SGreg Roach $clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2); 6388c2e8227SGreg Roach } elseif ($others == 'members') { 6398c2e8227SGreg Roach foreach ($record->getSpouseFamilies() as $family) { 6408c2e8227SGreg Roach $clip_ctrl->addClipping($family); 6418c2e8227SGreg Roach $clip_ctrl->addFamilyMembers($family); 6428c2e8227SGreg Roach } 6438c2e8227SGreg Roach } elseif ($others == 'descendants') { 6448c2e8227SGreg Roach foreach ($record->getSpouseFamilies() as $family) { 6458c2e8227SGreg Roach $clip_ctrl->addClipping($family); 6468c2e8227SGreg Roach $clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3); 6478c2e8227SGreg Roach } 6488c2e8227SGreg Roach } 6498c2e8227SGreg Roach } 6508c2e8227SGreg Roach } elseif ($remove) { 65131bc7874SGreg Roach unset($cart[$WT_TREE->getTreeId()][$remove]); 65231bc7874SGreg Roach Session::put('cart', $cart); 6538c2e8227SGreg Roach } elseif (isset($_REQUEST['empty'])) { 65431bc7874SGreg Roach $cart[$WT_TREE->getTreeId()] = array(); 65531bc7874SGreg Roach Session::put('cart', $cart); 6568c2e8227SGreg Roach } elseif (isset($_REQUEST['download'])) { 6578c2e8227SGreg Roach return $this->downloadForm($clip_ctrl); 6588c2e8227SGreg Roach } 65931bc7874SGreg Roach 6608c2e8227SGreg Roach return $this->getCartList(); 6618c2e8227SGreg Roach } 6628c2e8227SGreg Roach 6638c2e8227SGreg Roach /** 6648c2e8227SGreg Roach * A list for the side bar. 6658c2e8227SGreg Roach * 6668c2e8227SGreg Roach * @return string 6678c2e8227SGreg Roach */ 6688c2e8227SGreg Roach public function getCartList() { 66931bc7874SGreg Roach global $WT_TREE; 6708c2e8227SGreg Roach 67131bc7874SGreg Roach $cart = Session::get('cart', array()); 67231bc7874SGreg Roach if (!array_key_exists($WT_TREE->getTreeId(), $cart)) { 67331bc7874SGreg Roach $cart[$WT_TREE->getTreeId()] = array(); 67431bc7874SGreg Roach } 6758c2e8227SGreg Roach $pid = Filter::get('pid', WT_REGEX_XREF); 6768c2e8227SGreg Roach 67731bc7874SGreg Roach if (!$cart[$WT_TREE->getTreeId()]) { 6788c2e8227SGreg Roach $out = I18N::translate('Your clippings cart is empty.'); 6798c2e8227SGreg Roach } else { 6808c2e8227SGreg 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 } 6968c2e8227SGreg Roach $out .= '<a href="' . $record->getHtmlUrl() . '">'; 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() . '&mod_action=ajax&remove=' . $xref . '&pid=' . $pid . '" title="' . I18N::translate('Remove') . '"></a>'; 7068c2e8227SGreg Roach $out .= '</li>'; 7078c2e8227SGreg Roach } 7088c2e8227SGreg Roach } 7098c2e8227SGreg Roach $out .= '</ul>'; 7108c2e8227SGreg Roach } 7118c2e8227SGreg Roach 71231bc7874SGreg Roach if ($cart[$WT_TREE->getTreeId()]) { 7138c2e8227SGreg Roach $out .= 714cdaf7c6cSGreg Roach '<br><a href="module.php?mod=' . $this->getName() . '&mod_action=ajax&empty=true&pid=' . $pid . '" class="remove_cart">' . 7158c2e8227SGreg Roach I18N::translate('Empty the clippings cart') . 7168c2e8227SGreg Roach '</a>' . 7178c2e8227SGreg Roach '<br>' . 718cdaf7c6cSGreg Roach '<a href="module.php?mod=' . $this->getName() . '&mod_action=ajax&download=true&pid=' . $pid . '" class="add_cart">' . 7198c2e8227SGreg Roach I18N::translate('Download') . 7208c2e8227SGreg Roach '</a>'; 7218c2e8227SGreg Roach } 72224ec66ceSGreg Roach $record = Individual::getInstance($pid, $WT_TREE); 72331bc7874SGreg Roach if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) { 724beb9c394SGreg Roach $out .= '<br><a href="module.php?mod=' . $this->getName() . '&mod_action=ajax&action=add1&type=INDI&id=' . $pid . '&pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>'; 7258c2e8227SGreg Roach } 726cbc1590aSGreg Roach 7278c2e8227SGreg Roach return $out; 7288c2e8227SGreg Roach } 7298c2e8227SGreg Roach 7308c2e8227SGreg Roach /** 73176692c8bSGreg Roach * A form to choose the download options. 73276692c8bSGreg Roach * 7330e62c4b8SGreg Roach * @param ClippingsCartController $clip_ctrl 7348c2e8227SGreg Roach * 7358c2e8227SGreg Roach * @return string 7368c2e8227SGreg Roach */ 7370e62c4b8SGreg Roach public function downloadForm(ClippingsCartController $clip_ctrl) { 7388c2e8227SGreg Roach global $WT_TREE; 7398c2e8227SGreg Roach 7408c2e8227SGreg Roach $pid = Filter::get('pid', WT_REGEX_XREF); 7418c2e8227SGreg Roach 7428c2e8227SGreg Roach $out = '<script>'; 7438c2e8227SGreg Roach $out .= 'function cancelDownload() { 744cdaf7c6cSGreg Roach var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&pid=' . $pid . '"; 7458c2e8227SGreg Roach jQuery("#sb_clippings_content").load(link); 7468c2e8227SGreg Roach }'; 7478c2e8227SGreg Roach $out .= '</script>'; 7488c2e8227SGreg Roach $out .= '<form method="get" action="module.php"> 7498c2e8227SGreg Roach <input type="hidden" name="mod" value="clippings"> 7508c2e8227SGreg Roach <input type="hidden" name="mod_action" value="index"> 7518c2e8227SGreg Roach <input type="hidden" name="pid" value="' . $pid . '"> 7528c2e8227SGreg Roach <input type="hidden" name="action" value="download"> 7538c2e8227SGreg Roach <table> 7548c2e8227SGreg Roach <tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr> 7556fd6cde8SGreg Roach <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td> 7568c2e8227SGreg Roach <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr> 7578c2e8227SGreg Roach 758d1928687SGreg Roach <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td> 7598c2e8227SGreg Roach <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr> 7608c2e8227SGreg Roach '; 7618c2e8227SGreg Roach 7624b9ff166SGreg Roach if (Auth::isManager($WT_TREE)) { 7638c2e8227SGreg Roach $out .= 764d1928687SGreg Roach '<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' . 7658c2e8227SGreg Roach '<td class="optionbox">' . 7668c2e8227SGreg Roach '<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' . 7678c2e8227SGreg Roach '<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' . 7688c2e8227SGreg Roach '<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' . 7698c2e8227SGreg Roach '<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') . 7708c2e8227SGreg Roach '</td></tr>'; 7714b9ff166SGreg Roach } elseif (Auth::isMember($WT_TREE)) { 7728c2e8227SGreg Roach $out .= 773d1928687SGreg Roach '<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' . 7748c2e8227SGreg Roach '<td class="list_value">' . 7758c2e8227SGreg Roach '<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' . 7768c2e8227SGreg Roach '<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') . 7778c2e8227SGreg Roach '</td></tr>'; 7788c2e8227SGreg Roach } 7798c2e8227SGreg Roach 7808c2e8227SGreg Roach $out .= ' 781d1928687SGreg Roach <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td> 7828c2e8227SGreg Roach <td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr> 7838c2e8227SGreg Roach 7848c2e8227SGreg Roach <tr> 785d1928687SGreg Roach <td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td> 7868c2e8227SGreg Roach <td class="optionbox"> 7878c2e8227SGreg Roach <input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '"> 7888c2e8227SGreg Roach <span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td> 7898c2e8227SGreg Roach </tr> 7908c2e8227SGreg Roach 7918c2e8227SGreg Roach <input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '"> 7928c2e8227SGreg Roach 7938c2e8227SGreg Roach </td></tr> 7948c2e8227SGreg Roach 7958c2e8227SGreg Roach <tr><td class="topbottombar" colspan="2"> 7968c2e8227SGreg Roach <input type="button" value="' . I18N::translate('Cancel') . '" onclick="cancelDownload();"> 7978c2e8227SGreg Roach <input type="submit" value="' . I18N::translate('Download') . '"> 7988c2e8227SGreg Roach </form>'; 7998c2e8227SGreg Roach 8008c2e8227SGreg Roach return $out; 8018c2e8227SGreg Roach } 8028c2e8227SGreg Roach} 803