getSidebarAjaxContent();
Zend_Session::writeClose();
header('Content-Type: text/html; charset=UTF-8');
echo $html;
break;
case 'index':
global $MAX_PEDIGREE_GENERATIONS, $controller, $WT_SESSION, $GEDCOM_MEDIA_PATH;
require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
require_once WT_ROOT . 'includes/functions/functions_export.php';
$clip_ctrl = new WT_Controller_Clippings;
$controller = new WT_Controller_Page;
$controller
->setPageTitle($this->getTitle())
->PageHeader()
->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('autocomplete();');
echo '';
if (!$WT_SESSION->cart[WT_GED_ID]) {
echo '
', WT_I18N::translate('Family tree clippings cart'), '
';
}
if ($clip_ctrl->action == 'add') {
$person = WT_GedcomRecord::getInstance($clip_ctrl->id);
echo '';
if ($clip_ctrl->type === 'FAM') { ?>
type === 'INDI') { ?>
type === 'SOUR') { ?>
privCount > 0) {
echo "" . WT_I18N::translate('Some items could not be added due to privacy restrictions') . "
";
}
if (!$WT_SESSION->cart[WT_GED_ID]) {
if ($clip_ctrl->action != 'add') {
echo WT_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.
- How to take clippings?
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 Add to clippings cart option. When you click that link you will be offered several options to download. - How to download?
Once you have items in your cart, you can download them just by clicking the “Download” link. Follow the instructions and links.
');
?>
action != 'download' && $clip_ctrl->action != 'add') { ?>
getName()); ?>
|
|
|
cart[WT_GED_ID]) as $xref) {
$record = WT_GedcomRecord::getInstance($xref);
if ($record) {
switch ($record::RECORD_TYPE) {
case 'INDI': $icon = 'icon-indis'; break;
case 'FAM': $icon = 'icon-sfamily'; break;
case 'SOUR': $icon = 'icon-source'; break;
case 'REPO': $icon = 'icon-repository'; break;
case 'NOTE': $icon = 'icon-note'; break;
case 'OBJE': $icon = 'icon-media'; break;
default: $icon = 'icon-clippings'; break;
}
?>
|
getHtmlUrl(), '">', $record->getFullName(), '';
?>
|
|
|
getTitle(), 'module.php?mod=clippings&mod_action=index&ged=' . WT_GEDURL, 'menu-clippings');
if (isset($controller->record)) {
$submenu = new WT_Menu($this->getTitle(), 'module.php?mod=clippings&mod_action=index&ged=' . WT_GEDURL, 'menu-clippingscart');
$menu->addSubmenu($submenu);
}
if (!empty($controller->record) && $controller->record->canShow()) {
$submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), 'module.php?mod=clippings&mod_action=index&action=add&id=' . $controller->record->getXref(), 'menu-clippingsadd');
$menu->addSubmenu($submenu);
}
return $menu;
}
/** {@inheritdoc} */
public function defaultSidebarOrder() {
return 60;
}
/** {@inheritdoc} */
public function hasSidebarContent() {
global $SEARCH_SPIDER;
if ($SEARCH_SPIDER) {
return false;
} else {
require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
// Creating a controller has the side effect of initialising the cart
new WT_Controller_Clippings;
return true;
}
}
/** {@inheritdoc} */
public function getSidebarContent() {
global $controller;
$controller->addInlineJavascript('
jQuery("#sb_clippings_content").on("click", ".add_cart, .remove_cart", function() {
jQuery("#sb_clippings_content").load(this.href);
return false;
});
');
return '' . $this->getCartList() . '
';
}
/** {@inheritdoc} */
public function getSidebarAjaxContent() {
require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
global $WT_SESSION;
$clip_ctrl = new WT_Controller_Clippings;
$add = WT_Filter::get('add', WT_REGEX_XREF);
$add1 = WT_Filter::get('add1', WT_REGEX_XREF);
$remove = WT_Filter::get('remove', WT_REGEX_XREF);
$others = WT_Filter::get('others');
$clip_ctrl->level1 = WT_Filter::get('level1');
$clip_ctrl->level2 = WT_Filter::get('level2');
$clip_ctrl->level3 = WT_Filter::get('level3');
if ($add) {
$record = WT_GedcomRecord::getInstance($add);
if ($record) {
$clip_ctrl->id = $record->getXref();
$clip_ctrl->type = $record::RECORD_TYPE;
$clip_ctrl->addClipping($record);
}
} elseif ($add1) {
$record = WT_Individual::getInstance($add1);
if ($record) {
$clip_ctrl->id = $record->getXref();
$clip_ctrl->type = $record::RECORD_TYPE;
if ($others == 'parents') {
foreach ($record->getChildFamilies() as $family) {
$clip_ctrl->addClipping($family);
$clip_ctrl->addFamilyMembers($family);
}
} elseif ($others == 'ancestors') {
$clip_ctrl->addAncestorsToCart($record, $clip_ctrl->level1);
} elseif ($others == 'ancestorsfamilies') {
$clip_ctrl->addAncestorsToCartFamilies($record, $clip_ctrl->level2);
} elseif ($others == 'members') {
foreach ($record->getSpouseFamilies() as $family) {
$clip_ctrl->addClipping($family);
$clip_ctrl->addFamilyMembers($family);
}
} elseif ($others == 'descendants') {
foreach ($record->getSpouseFamilies() as $family) {
$clip_ctrl->addClipping($family);
$clip_ctrl->addFamilyDescendancy($family, $clip_ctrl->level3);
}
}
}
} elseif ($remove) {
unset ($WT_SESSION->cart[WT_GED_ID][$remove]);
} elseif (isset($_REQUEST['empty'])) {
$WT_SESSION->cart[WT_GED_ID] = array();
} elseif (isset($_REQUEST['download'])) {
return $this->downloadForm($clip_ctrl);
}
return $this->getCartList();
}
/**
* A list for the side bar.
*
* @return string
*/
public function getCartList() {
global $WT_SESSION;
// Keep track of the INDI from the parent page, otherwise it will
// get lost after ajax updates
$pid = WT_Filter::get('pid', WT_REGEX_XREF);
if (!$WT_SESSION->cart[WT_GED_ID]) {
$out = WT_I18N::translate('Your clippings cart is empty.');
} else {
$out = '';
}
if ($WT_SESSION->cart[WT_GED_ID]) {
$out .=
'
' .
WT_I18N::translate('Empty the clippings cart') .
'' . help_link('empty_cart', $this->getName()) .
'
' .
'' .
WT_I18N::translate('Download') .
'';
}
$record = WT_Individual::getInstance($pid);
if ($record && !array_key_exists($record->getXref(), $WT_SESSION->cart[WT_GED_ID])) {
$out .= '
' . WT_I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '';
}
return $out;
}
/**
* @param WT_Individual $person
*
* @return string
*/
public function askAddOptions(WT_Individual $person) {
global $MAX_PEDIGREE_GENERATIONS;
$out = '';
$out .= '';
if ($person::RECORD_TYPE == 'FAM') {
$out .= '';
} elseif ($person::RECORD_TYPE == 'INDI') {
$out .= '';
} else if ($person::RECORD_TYPE == 'SOUR') {
$out .= '';
}
else return $this->getSidebarContent();
return $out;
}
/**
* @param WT_Controller_Clippings $clip_ctrl
*
* @return string
*/
public function downloadForm(WT_Controller_Clippings $clip_ctrl) {
global $GEDCOM_MEDIA_PATH;
$pid = WT_Filter::get('pid', WT_REGEX_XREF);
$out = '';
$out .= '