private function pageHeader(PageController $controller) { $controller->setPageTitle(I18N::translate('Descendants of %s', $this->getRootPerson()->getFullName()))->pageHeader(); // add javascript files and scripts $this->includeJs($controller, 'page'); if ($this->pdf()) { $this->pdf()->includeJs($controller); } }
/** * SosaStats@index */ public function index() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Sosa Statistics'))->addInlineJavascript('$(".help_tooltip").tooltip();'); $view_bag = new ViewBag(); $view_bag->set('title', $controller->getPageTitle()); $view_bag->set('is_setup', false); if ($this->sosa_provider->isSetup()) { $view_bag->set('is_setup', true); $view_bag->set('root_indi', $this->sosa_provider->getRootIndi()); $sosaCount = $this->sosa_provider->getSosaCount(); $diffSosaCount = $this->sosa_provider->getDifferentSosaCount(); $general_stats = array('sosa_count' => $sosaCount, 'distinct_count' => $diffSosaCount, 'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()), 'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount), 'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime()); $view_bag->set('general_stats', $general_stats); $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); $view_bag->set('missinganc_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=SosaList@missing&ged=' . $WT_TREE->getNameUrl() . '&gen='); $view_bag->set('sosaanc_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=SosaList&ged=' . $WT_TREE->getNameUrl() . '&gen='); $gen_theoretical = 1; $total_theoretical = 0; $prev_diff = 0; $prev_known = 0.5; $gen_equiv = 0; $generation_stats = array(); foreach ($stats_gen as $gen => $tab) { $genY1 = I18N::translate('-'); $genY2 = I18N::translate('-'); if ($tab['firstBirth'] > 0) { $genY1 = $tab['firstBirth']; } if ($tab['lastBirth'] > 0) { $genY2 = $tab['lastBirth']; } $total_theoretical += $gen_theoretical; $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); $gen_equiv += $perc_sosa_count_theor; $missing = 2 * $prev_known - $tab['sosaCount']; $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff; $generation_stats[$gen] = array('gen_min_birth' => $genY1, 'gen_max_birth' => $genY2, 'theoretical' => $gen_theoretical, 'known' => $tab['sosaCount'], 'perc_known' => $perc_sosa_count_theor, 'missing' => $missing, 'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known), 'total_known' => $tab['sosaTotalCount'], 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), 'different' => $gen_diff, 'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']), 'total_different' => $tab['diffSosaTotalCount'], 'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount'])); $gen_theoretical = $gen_theoretical * 2; $prev_known = $tab['sosaCount']; $prev_diff = $tab['diffSosaTotalCount']; } $view_bag->set('generation_stats', $generation_stats); $view_bag->set('equivalent_gen', $gen_equiv); $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2()); $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3()); } ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render(); }
/** * SosaConfig@index */ public function index() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Sosa Configuration'))->restrictAccess(Auth::check())->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->addInlineJavascript(' $( document ).ready(function() { $("#bt_sosa_compute").click(function() { majComputeSosa($("#maj_sosa_input_userid, #maj-sosa-config-select option:selected").val()); }); }); function majComputeSosa(user_id) { jQuery("#bt_sosa_compute").prop( "disabled", true ); jQuery("#bt_sosa_computing").empty().html("<i class=\\"icon-loading-small\\"></i> ' . I18N::translate('Computing...') . '"); jQuery("#bt_sosa_computing").load( "module.php?mod=' . $this->module->getName() . '&mod_action=SosaConfig@computeAll&ged=' . $WT_TREE->getNameUrl() . '&userid=" + user_id, function() { jQuery("#bt_sosa_compute").prop( "disabled", false ); }); }'); $action = Filter::post('action'); if ($action === 'update') { $this->update($controller); } $view_bag = new ViewBag(); $view_bag->set('title', $controller->getPageTitle()); $view_bag->set('tree', $WT_TREE); $view_bag->set('form_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=SosaConfig&ged=' . $WT_TREE->getNameUrl()); $users_root = array(); $users_js_array = 'var users_array = [];'; if (Auth::check()) { $root_id = $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); $users_root[] = array('user' => Auth::user(), 'rootid' => $root_id); $users_js_array .= 'users_array["' . Auth::user()->getUserId() . '"] = "' . $root_id . '";'; if (Auth::isManager($WT_TREE)) { $default_user = User::find(-1); $default_root_id = $WT_TREE->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID'); $users_root[] = array('user' => $default_user, 'rootid' => $default_root_id); $users_js_array .= 'users_array["' . $default_user->getUserId() . '"] = "' . $default_root_id . '";'; } } $view_bag->set('users_settings', $users_root); $controller->addInlineJavascript($users_js_array . ' $("#maj-sosa-config-select").change(function() { $("#rootid").val(users_array[this.value]); }); '); ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render(); }
private function show() { global $controller, $WT_TREE; $items_header_description = '<img src="data/magaziny/Global-Network-icon-128.png" align="left" height="96" id="obrazek-odkazy"><p><br />Zde je nashromážděna sbírka odkazů, které mohou být užitečné nebo zajímavé jak pro členy Naší rodiny, tak pro jiné badatele v rodinné historii. Mnohé z nich používáme pravidelně. Jejich obsahová úroveň je proměnlivá, jak se dá očekávat u tak rozsáhlého výběru, a za jejich obsah neručíme.</p><p>Odkazy čas od času testujeme - ale odkazy měnívají adresu nebo mizí. Pokud narazíte na neplatný odkaz, dejte nám vědět na adresu technické podpory na stránce vespod.</p>'; //Add your own header here. $items_id = webtrees\Filter::get('pages_id'); $controller = new webtrees\Controller\PageController(); $controller->setPageTitle(webtrees\I18N::translate('Odkazy do okolního světa'))->pageHeader(); // HTML common to all pages $html = '<div id="pages-container">' . '<h2>' . $controller->getPageTitle() . '</h2>' . $items_header_description . '<div style="clear:both;"></div>' . '<div id="pages_tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">' . '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'; $items_list = $this->getPagesList(); foreach ($items_list as $items) { $languages = $this->getBlockSetting($items->block_id, 'languages'); if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) { $html .= '<li class="ui-state-default ui-corner-top' . ($items_id == $items->block_id ? ' ui-tabs-selected ui-state-active' : '') . '">' . '<a href="module.php?mod=' . $this->getName() . '&mod_action=show&pages_id=' . $items->block_id . '">' . '<span title="' . str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_title))) . '">' . str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_title))) . '</span></a></li>'; } } $html .= '</ul>'; $html .= '<div id="outer_pages_container" style="padding: 1em;">'; foreach ($items_list as $items) { $languages = $this->getBlockSetting($items->block_id, 'languages'); if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items_id == $items->block_id && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) { $items_content = str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_content))); } } if (isset($items_content)) { $html .= $items_content; } else { $html .= webtrees\I18N::translate('No content found for current access level and language'); } $html .= '</div>'; //close outer_pages_container $html .= '</div>'; //close pages_tabs $html .= '</div>'; //close pages-container $html .= '<script>document.onreadystatechange = function () {if (document.readyState == "complete") {$(".pages-accordion").accordion({heightStyle: "content", collapsible: true});}}</script>'; echo $html; }
if ($year === 0) { $year = $cal_date->y; } // Extract values from date $days_in_month = $cal_date->daysInMonth(); $days_in_week = $cal_date->daysInWeek(); $cal_month = $cal_date->format('%O'); $today_month = $today->format('%O'); // Invalid dates? Go to monthly view, where they'll be found. if ($cal_date->d > $days_in_month && $view === 'day') { $view = 'month'; } // All further uses of $cal are to generate URLs $cal = rawurlencode($cal); $controller = new PageController(); $controller->setPageTitle(I18N::translate('Anniversary calendar')); switch ($view) { case 'day': $controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false)); break; case 'month': $controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y')); break; case 'year': $controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y')); break; } $controller->pageHeader(); ?> <div id="calendar-page"> <table class="facts_table width100">
private function edit() { global $WT_TREE; if (webtrees\Filter::postBool('save') && webtrees\Filter::checkCsrf()) { $block_id = webtrees\Filter::post('block_id'); if ($block_id) { webtrees\Database::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, ''), block_order=? WHERE block_id=?")->execute(array(webtrees\Filter::post('gedcom_id'), (int) webtrees\Filter::post('block_order'), $block_id)); } else { webtrees\Database::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, ''), ?, ?)")->execute(array(webtrees\Filter::post('gedcom_id'), $this->getName(), (int) webtrees\Filter::post('block_order'))); $block_id = webtrees\Database::getInstance()->lastInsertId(); } $this->setBlockSetting($block_id, 'menu_title', webtrees\Filter::post('menu_title')); $this->setBlockSetting($block_id, 'menu_address', webtrees\Filter::post('menu_address')); $this->setBlockSetting($block_id, 'menu_access', webtrees\Filter::post('menu_access')); $languages = array(); foreach (webtrees\I18N::installedLocales() as $locale) { if (webtrees\Filter::postBool('lang_' . $locale->languageTag())) { $languages[] = $locale->languageTag(); } } $this->setBlockSetting($block_id, 'languages', implode(',', $languages)); $this->config(); } else { $block_id = webtrees\Filter::get('block_id'); $controller = new webtrees\Controller\PageController(); $controller->restrictAccess(webtrees\Auth::isEditor($WT_TREE)); if ($block_id) { $controller->setPageTitle(webtrees\I18N::translate('Edit menu')); $menu_title = $this->getBlockSetting($block_id, 'menu_title'); $menu_address = $this->getBlockSetting($block_id, 'menu_address'); $menu_access = $this->getBlockSetting($block_id, 'menu_access'); $block_order = webtrees\Database::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); $gedcom_id = webtrees\Database::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); } else { $controller->setPageTitle(webtrees\I18N::translate('Add menu')); $menu_access = 1; $menu_title = ''; $menu_address = ''; $block_order = webtrees\Database::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne(); $gedcom_id = $WT_TREE->getTreeId(); } $controller->pageHeader(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo webtrees\I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo webtrees\I18N::translate('Module administration'); ?> </a></li> <li><a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_config"><?php echo webtrees\I18N::translate($this->getTitle()); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <form class="form-horizontal" method="POST" action="#" name="menu" id="menuForm"> <?php echo webtrees\Filter::getCsrf(); ?> <input type="hidden" name="save" value="1"> <input type="hidden" name="block_id" value="<?php echo $block_id; ?> "> <h3><?php echo webtrees\I18N::translate('General'); ?> </h3> <div class="form-group"> <label class="control-label col-sm-3" for="menu_title"> <?php echo webtrees\I18N::translate('Title'); ?> </label> <div class="col-sm-9"> <input class="form-control" id="menu_title" size="90" name="menu_title" required type="text" value="<?php echo webtrees\Filter::escapeHtml($menu_title); ?> " > </div> <span class="help-block col-sm-9 col-sm-offset-3 small text-muted"> <?php echo webtrees\I18N::translate('Add your menu title here'); ?> </span> </div> <div class="form-group"> <label class="control-label col-sm-3" for="menu_address"> <?php echo webtrees\I18N::translate('Menu address'); ?> </label> <div class="col-sm-9"> <input class="form-control" id="menu_address" size="90" name="menu_address" required type="text" value="<?php echo webtrees\Filter::escapeHtml($menu_address); ?> " > </div> <span class="help-block col-sm-9 col-sm-offset-3 small text-muted"> <?php echo webtrees\I18N::translate('Add your menu address here'); ?> </span> </div> <h3><?php echo webtrees\I18N::translate('Languages'); ?> </h3> <div class="form-group"> <label class="control-label col-sm-3" for="lang_*"> <?php echo webtrees\I18N::translate('Show this menu for which languages?'); ?> </label> <div class="col-sm-9"> <?php $accepted_languages = explode(',', $this->getBlockSetting($block_id, 'languages')); foreach (webtrees\I18N::installedLocales() as $locale) { ?> <div class="checkbox"> <label title="<?php echo $locale->languageTag(); ?> "> <input type="checkbox" name="lang_<?php echo $locale->languageTag(); ?> " <?php echo in_array($locale->languageTag(), $accepted_languages) ? 'checked' : ''; ?> ><?php echo $locale->endonym(); ?> </label> </div> <?php } ?> </div> </div> <h3><?php echo webtrees\I18N::translate('Visibility and Access'); ?> </h3> <div class="form-group"> <label class="control-label col-sm-3" for="block_order"> <?php echo webtrees\I18N::translate('Menu position'); ?> </label> <div class="col-sm-9"> <input class="form-control" id="position" name="block_order" size="3" required type="number" value="<?php echo webtrees\Filter::escapeHtml($block_order); ?> " > </div> <span class="help-block col-sm-9 col-sm-offset-3 small text-muted"> <?php echo webtrees\I18N::translate('This field controls the order in which the menu items are displayed.'), '<br><br>', webtrees\I18N::translate('You do not have to enter the numbers sequentially. If you leave holes in the numbering scheme, you can insert other menu items later. For example, if you use the numbers 1, 6, 11, 16, you can later insert menu items with the missing sequence numbers. Negative numbers and zero are allowed, and can be used to insert menu items in front of the first one.'), '<br><br>', webtrees\I18N::translate('When more than one menu item has the same position number, only one of these menu items will be visible.'); ?> </span> </div> <div class="form-group"> <label class="control-label col-sm-3" for="block_order"> <?php echo webtrees\I18N::translate('Menu visibility'); ?> </label> <div class="col-sm-9"> <?php echo webtrees\Functions\FunctionsEdit::selectEditControl('gedcom_id', webtrees\Tree::getIdList(), webtrees\I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"'); ?> </div> <span class="help-block col-sm-9 col-sm-offset-3 small text-muted"> <?php echo webtrees\I18N::translate('You can determine whether this menu item will be visible regardless of family tree, or whether it will be visible only to the current family tree.'); ?> </span> </div> <div class="form-group"> <label class="control-label col-sm-3" for="menu_access"> <?php echo webtrees\I18N::translate('Access level'); ?> </label> <div class="col-sm-9"> <?php echo webtrees\Functions\FunctionsEdit::editFieldAccessLevel('menu_access', $menu_access, 'class="form-control"'); ?> </div> </div> <div class="row col-sm-9 col-sm-offset-3"> <button class="btn btn-primary" type="submit"> <i class="fa fa-check"></i> <?php echo webtrees\I18N::translate('save'); ?> </button> <button class="btn" type="button" onclick="window.location='<?php echo $this->getConfigLink(); ?> ';"> <i class="fa fa-close"></i> <?php echo webtrees\I18N::translate('cancel'); ?> </button> </div> </form> <?php } }
* webtrees: online genealogy * Copyright (C) 2015 webtrees development team * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsDb; use Fisharebest\Webtrees\Functions\FunctionsPrintLists; define('WT_SCRIPT_NAME', 'notelist.php'); require './includes/session.php'; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Shared notes')); $controller->pageHeader(); echo '<div id="notelist-page">', '<h2>', I18N::translate('Shared notes'), '</h2>', FunctionsPrintLists::noteTable(FunctionsDb::getNoteList($WT_TREE)); echo '</div>';
// managers, (3) user blocks require the user or an admin $blocks = Module::getActiveBlocks($WT_TREE); if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) { header('Location: ' . WT_BASE_URL); return; } $block = $blocks[$block->module_name]; if (Filter::post('save')) { $ctype = Filter::post('ctype', 'user', 'gedcom'); header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl()); $block->configureBlock($block_id); return; } $ctype = FIlter::get('ctype', 'user', 'gedcom'); $controller = new PageController(); $controller->setPageTitle(I18N::translate('Configure') . ' — ' . $block->getTitle())->pageHeader(); if (Module::getModuleByName('ckeditor')) { CkeditorModule::enableEditor($controller); } ?> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form name="block" method="post" action="?block_id=<?php echo $block_id; ?> "> <input type="hidden" name="save" value="1"> <input type="hidden" name="ged" value="<?php
// managers, (3) user blocks require the user or an admin $blocks = Module::getActiveBlocks($WT_TREE); if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) { header('Location: ' . WT_BASE_URL); return; } $block = $blocks[$block->module_name]; if (Filter::post('save')) { $ctype = Filter::post('ctype', 'user', 'gedcom'); header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl()); $block->configureBlock($block_id); return; } $ctype = Filter::get('ctype', 'user', 'gedcom'); $controller = new PageController(); $controller->setPageTitle($block->getTitle() . ' — ' . I18N::translate('Preferences'))->pageHeader(); if (Module::getModuleByName('ckeditor')) { CkeditorModule::enableEditor($controller); } ?> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form name="block" method="post" action="?block_id=<?php echo $block_id; ?> "> <input type="hidden" name="save" value="1"> <input type="hidden" name="ged" value="<?php
/** * SosaList@missing */ public function missing() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Missing Ancestors')); $this->view_bag->set('title', $controller->getPageTitle()); if ($this->view_bag->get('is_setup', false)) { $this->view_bag->set('url_module', $this->module->getName()); $this->view_bag->set('url_action', 'SosaList@missing'); $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); $this->view_bag->set('min_gen', 2); $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); $this->view_bag->set('perc_sosa', $perc_sosa); if ($this->view_bag->get('has_missing', false)) { $table_id = 'table-sosa-missing-' . Uuid::uuid4(); $this->view_bag->set('table_id', $table_id); $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript(' /* Initialise datatables */ jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; jQuery("#' . $table_id . '").dataTable( { dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', ' . I18N::datatablesI18N() . ', jQueryUI: true, autoWidth:false, processing: true, retrieve: true, columns: [ /* 0-Sosa */ { type: "num", class: "center" }, /* 1-ID */ { class: "center" }, /* 2-givn */ { dataSort: 4, class: "left"}, /* 3-surn */ { dataSort: 5}, /* 4-GIVN,SURN */ { type: "unicode", visible: false}, /* 5-SURN,GIVN */ { type: "unicode", visible: false}, /* PERSO Modify table to include IsSourced module */ /* 6-INDI_SOUR */ { dataSort : 7, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' }, /* 7-SORT_INDISC */ { visible : false}, /* 8-Father */ { class: "center"}, /* 9-Mother */ { class: "center"}, /* 10-Birth */ { dataSort : 11 , class: "center"}, /* 11-SORT_BIRT */ { visible : false}, /* 12-BIRT_PLAC */ { type: "unicode", class: "center"}, /* 13-BIRT_SOUR */ { dataSort : 14, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' }, /* 14-SORT_BIRTSC */{ visible : false}, /* 15-SEX */ { visible : false} /* END PERSO */ ], sorting: [[0,"asc"]], displayLength: 20, pagingType: "full_numbers" }); jQuery("#' . $table_id . '") /* Filter buttons in table header */ .on("click", "button[data-filter-column]", function() { var btn = jQuery(this); // De-activate the other buttons in this button group btn.siblings().removeClass("ui-state-active"); // Apply (or clear) this filter var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); if (btn.hasClass("ui-state-active")) { btn.removeClass("ui-state-active"); col.search("").draw(); } else { btn.addClass("ui-state-active"); col.search(btn.data("filter-value")).draw(); } }); jQuery(".smissing-list").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $unique_indis = array(); $sum_missing_different = 0; $sum_missing_different_without_hidden = 0; foreach ($missing_list as $num => $missing_tab) { if (isset($unique_indis[$missing_tab['indi']])) { unset($missing_list[$num]); continue; } $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); if (!$person || !$person->canShowName()) { unset($missing_list[$num]); continue; } $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; $unique_indis[$person->getXref()] = true; $missing_tab['indi'] = $person; $missing_list[$num] = $missing_tab; } $this->view_bag->set('missing_list', $missing_list); $this->view_bag->set('missing_diff_count', $sum_missing_different); $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); } } ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); }
/** * Main entry point * * @return string */ private function main() { global $WT_TREE; $this->plugins = $this->getPluginList(); // List of available plugins $this->plugin = Filter::get('plugin'); // User parameters $this->xref = Filter::get('xref', WT_REGEX_XREF); $this->action = Filter::get('action'); $this->data = Filter::get('data'); // Don't do any processing until a plugin is chosen. if ($this->plugin && array_key_exists($this->plugin, $this->plugins)) { $this->PLUGIN = new $this->plugin(); $this->PLUGIN->getOptions(); $this->getAllXrefs(); switch ($this->action) { case 'update': $record = self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]); if ($this->PLUGIN->doesRecordNeedUpdate($this->xref, $record)) { $newrecord = $this->PLUGIN->updateRecord($this->xref, $record); if ($newrecord != $record) { if ($newrecord) { GedcomRecord::getInstance($this->xref, $WT_TREE)->updateRecord($newrecord, $this->PLUGIN->chan); } else { GedcomRecord::getInstance($this->xref, $WT_TREE)->deleteRecord(); } } } $this->xref = $this->findNextXref($this->xref); break; case 'update_all': foreach ($this->all_xrefs as $xref => $type) { $record = self::getLatestRecord($xref, $type); if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) { $newrecord = $this->PLUGIN->updateRecord($xref, $record); if ($newrecord != $record) { if ($newrecord) { GedcomRecord::getInstance($xref, $WT_TREE)->updateRecord($newrecord, $this->PLUGIN->chan); } else { GedcomRecord::getInstance($xref, $WT_TREE)->deleteRecord(); } } } } $this->xref = ''; break; } // Make sure that our requested record really does need updating. // It may have been updated in another session, or may not have // been specified at all. if (array_key_exists($this->xref, $this->all_xrefs) && $this->PLUGIN->doesRecordNeedUpdate($this->xref, self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]))) { $this->curr_xref = $this->xref; } // The requested record doesn't need updating - find one that does if (!$this->curr_xref) { $this->curr_xref = $this->findNextXref($this->xref); } if (!$this->curr_xref) { $this->curr_xref = $this->findPrevXref($this->xref); } // If we've found a record to update, get details and look for the next/prev if ($this->curr_xref) { $this->prev_xref = $this->findPrevXref($this->curr_xref); $this->next_xref = $this->findNextXref($this->curr_xref); } } // HTML common to all pages $controller = new PageController(); $controller->setPageTitle(I18N::translate('Batch update'))->restrictAccess(Auth::isAdmin())->pageHeader(); echo $this->getJavascript(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form id="batch_update_form" class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="batch_update"> <input type="hidden" name="mod_action" value="admin_batch_update"> <input type="hidden" name="xref" value="' . $this->xref . '"> <input type="hidden" name="action" value=""><?php // will be set by javascript for next update ?> <input type="hidden" name="data" value=""><?php // will be set by javascript for next update ?> <div class="form-group"> <label class="control-label col-sm-3"><?php echo I18N::translate('Family tree'); ?> </label> <div class="col-sm-9"> <?php echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), '', $WT_TREE->getName(), 'class="form-control" onchange="reset_reload();"'); ?> </div> </div> <div class="form-group"> <label class="control-label col-sm-3"><?php echo I18N::translate('Batch update'); ?> </label> <div class="col-sm-9"> <select class="form-control" name="plugin" onchange="reset_reload();"> <?php if (!$this->plugin) { ?> <option value="" selected></option> <?php } ?> <?php foreach ($this->plugins as $class => $plugin) { ?> <option value="<?php echo $class; ?> " <?php echo $this->plugin == $class ? 'selected' : ''; ?> ><?php echo $plugin->getName(); ?> </option> <?php } ?> </select> <?php if ($this->PLUGIN) { ?> <p class="small text-muted"><?php echo $this->PLUGIN->getDescription(); ?> </p> <?php } ?> </div> </div> <?php if (!Auth::user()->getPreference('auto_accept')) { ?> <div class="alert alert-danger"> <?php echo I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.'); ?> </div> <?php } ?> <?php // If a plugin is selected, display the details ?> <?php if ($this->PLUGIN) { ?> <?php echo $this->PLUGIN->getOptionsForm(); ?> <?php if (substr($this->action, -4) == '_all') { ?> <?php // Reset - otherwise we might "undo all changes", which refreshes the ?> <?php // page, which makes them all again! ?> <script>reset_reload();</script> <?php } else { ?> <hr> <div id="batch_update2" class="col-sm-12"> <?php if ($this->curr_xref) { ?> <?php // Create an object, so we can get the latest version of the name. ?> <?php $this->record = GedcomRecord::getInstance($this->curr_xref, $WT_TREE); ?> <div class="form-group"> <?php echo self::createSubmitButton(I18N::translate('previous'), $this->prev_xref); ?> <?php echo self::createSubmitButton(I18N::translate('next'), $this->next_xref); ?> </div> <div class="form-group"> <a class="lead" href="<?php echo $this->record->getHtmlUrl(); ?> "><?php echo $this->record->getFullName(); ?> </a> <?php echo $this->PLUGIN->getActionPreview($this->record); ?> </div> <div class="form-group"> <?php echo implode(' ', $this->PLUGIN->getActionButtons($this->curr_xref, $this->record)); ?> </div> <?php } else { ?> <div class="alert alert-info"><?php echo I18N::translate('Nothing found.'); ?> </div> <?php } ?> </div> <?php } ?> <?php } ?> </form> <?php }
* * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsDb; define('WT_SCRIPT_NAME', 'index_edit.php'); require './includes/session.php'; $controller = new PageController(); // Only one of $user_id and $gedcom_id should be set $user_id = Filter::get('user_id', WT_REGEX_INTEGER, Filter::post('user_id', WT_REGEX_INTEGER)); $gedcom_id = Filter::get('gedcom_id', WT_REGEX_INTEGER, Filter::post('gedcom_id', WT_REGEX_INTEGER)); if ($user_id) { $gedcom_id = null; if ($user_id < 0) { $controller->setPageTitle(I18N::translate('Set the default blocks for new users')); $can_reset = false; } else { $controller->setPageTitle(I18N::translate('Change the “My page” blocks')); $can_reset = true; } } else { if ($gedcom_id < 0) { $controller->setPageTitle(I18N::translate('Set the default blocks for new family trees')); $can_reset = false; } else { $controller->setPageTitle(I18N::translate('Change the “Home page” blocks')); $can_reset = true; } } // Only an admin can edit the "default" page
$reports = array(); foreach (Module::getActiveReports($WT_TREE) as $rep) { $menu = $rep->getReportMenu(); if (preg_match('/report=(' . preg_quote(WT_MODULES_DIR, '/') . '[a-z0-9_]+\\/[a-z0-9_]+\\.xml)/', $menu->getLink(), $match)) { $reports[$match[1]] = $menu->getLabel(); } } if (!empty($report)) { if (!array_key_exists($report, $reports)) { $action = 'choose'; } } //-- choose a report to run switch ($action) { case 'choose': $controller->setPageTitle(I18N::translate('Choose a report to run'))->pageHeader(); echo '<div id="reportengine-page"> <form name="choosereport" method="get" action="reportengine.php"> <input type="hidden" name="action" value="setup"> <input type="hidden" name="output" value="', Filter::escapeHtml($output), '"> <table class="facts_table width40"> <tr><td class="topbottombar" colspan="2">', I18N::translate('Choose a report to run'), '</td></tr> <tr><td class="descriptionbox wrap width33 vmiddle">', I18N::translate('Report'), '</td> <td class="optionbox"><select name="report">'; foreach ($reports as $file => $report) { echo '<option value="', Filter::escapeHtml($file), '">', Filter::escapeHtml($report), '</option>'; } echo '</select></td></tr> <tr><td class="topbottombar" colspan="2"><input type="submit" value="', I18N::translate('continue'), '"></td></tr> </table></form></div>'; break;
/** * Lineage@index */ public function index() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); $view_bag = new ViewBag(); $view_bag->set('title', $controller->getPageTitle()); $view_bag->set('tree', $WT_TREE); $view_bag->set('alpha', $this->alpha); $view_bag->set('surname', $this->surname); $view_bag->set('legend', $this->legend); $view_bag->set('show_all', $this->show_all); if ($this->isShowingSurnames()) { $view_bag->set('issurnames', true); $view_bag->set('surnameslist', $this->getSurnamesList()); } if ($this->isShowingLineages()) { $view_bag->set('islineages', true); $view_bag->set('lineages', $this->getLineages()); if ($this->show_all === 'no') { $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); } else { $view_bag->set('table_title', I18N::translate('All lineages')); } } ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); }
} if (array_key_exists($module_name, $active_blocks)) { echo $active_blocks[$module_name]->getBlock($block_id); } return; } // Redirect search engines to the full URL if (Filter::get('ctype') !== $ctype || Filter::get('ged') !== $WT_TREE->getName()) { header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl()); return; } $controller = new PageController(); if ($ctype === 'user') { $controller->restrictAccess(Auth::check()); } $controller->setPageTitle($ctype === 'user' ? I18N::translate('My page') : $WT_TREE->getTitle())->setMetaRobots('index,follow')->pageHeader()->addInlineJavascript('jQuery.ajaxSetup({cache:true});'); if ($ctype === 'user') { echo '<div id="my-page">'; echo '<h1 class="center">', I18N::translate('My page'), '</h1>'; } else { echo '<div id="home-page">'; } if ($blocks['main']) { if ($blocks['side']) { echo '<div id="index_main_blocks">'; } else { echo '<div id="index_full_blocks">'; } foreach ($blocks['main'] as $block_id => $module_name) { if (array_key_exists($module_name, $active_blocks)) { if (Auth::isSearchEngine() || !$active_blocks[$module_name]->loadAjax()) {
/** * Show the list of stories */ private function showList() { global $controller, $WT_TREE; $controller = new PageController(); $controller->setPageTitle($this->getTitle())->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript(' jQuery("#story_table").dataTable({ dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', ' . I18N::datatablesI18N() . ', autoWidth: false, paging: true, pagingType: "full_numbers", lengthChange: true, filter: true, info: true, jQueryUI: true, sorting: [[0,"asc"]], columns: [ /* 0-name */ null, /* 1-NAME */ null ] }); '); $stories = Database::prepare("SELECT block_id, xref" . " FROM `##block` b" . " WHERE module_name=?" . " AND gedcom_id=?" . " ORDER BY xref")->execute(array($this->getName(), $WT_TREE->getTreeId()))->fetchAll(); echo '<h2 class="center">', I18N::translate('Stories'), '</h2>'; if (count($stories) > 0) { echo '<table id="story_table" class="width100">'; echo '<thead><tr> <th>', I18N::translate('Story title'), '</th> <th>', I18N::translate('Individual'), '</th> </tr></thead> <tbody>'; foreach ($stories as $story) { $indi = Individual::getInstance($story->xref, $WT_TREE); $story_title = $this->getBlockSetting($story->block_id, 'title'); $languages = $this->getBlockSetting($story->block_id, 'languages'); if (!$languages || in_array(WT_LOCALE, explode(',', $languages))) { if ($indi) { if ($indi->canShow()) { echo '<tr><td><a href="' . $indi->getHtmlUrl() . '#stories">' . $story_title . '</a></td><td><a href="' . $indi->getHtmlUrl() . '#stories">' . $indi->getFullName() . '</a></td></tr>'; } } else { echo '<tr><td>', $story_title, '</td><td class="error">', $story->xref, '</td></tr>'; } } } echo '</tbody></table>'; } }
} header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); return; } $default_tree_title = I18N::translate('My family tree'); $default_tree_name = 'tree'; $default_tree_number = 1; $existing_trees = Tree::getNameList(); while (array_key_exists($default_tree_name . $default_tree_number, $existing_trees)) { $default_tree_number++; } $default_tree_name .= $default_tree_number; // Process GET actions switch (Filter::get('action')) { case 'importform': $controller->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Import a GEDCOM file'))->pageHeader(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_trees_manage.php"><?php echo I18N::translate('Manage family trees'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol>
if ($url === '' || strpos($url, 'index.php?ctype=gedcom') === 0) { $url = 'index.php?ctype=user'; // Switch to a tree where we have a genealogy record (or keep to the current/default). $tree = Database::prepare("SELECT gedcom_name FROM `##gedcom` JOIN `##user_gedcom_setting` USING (gedcom_id)" . " WHERE setting_name = 'gedcomid' AND user_id = :user_id")->execute(array('user_id' => Auth::user()->getUserId()))->fetchOne(); $url .= '&ged=' . Filter::escapeUrl($tree); } // Redirect to the target URL header('Location: ' . WT_BASE_URL . $url); return; } catch (\Exception $ex) { $message = $ex->getMessage(); } // No break; // No break; default: $controller->setPageTitle(I18N::translate('Login'))->pageHeader()->addInlineJavascript(' jQuery("#new_passwd_form").hide(); jQuery("#passwd_click").click(function() { jQuery("#new_passwd_form").slideToggle(100, function() { jQuery("#new_passwd_username").focus() }); return false; }); '); echo '<div id="login-page">'; echo '<div id="login-text">'; switch (Site::getPreference('WELCOME_TEXT_AUTH_MODE')) { case 1: echo I18N::translate('<center><b>Welcome to this genealogy website</b></center><br>Access to this website is permitted to every visitor who has a user account.<br><br>If you have a user account, you can login on this page. If you don’t have a user account, you can apply for one by clicking on the appropriate link below.<br><br>After verifying your application, the website administrator will activate your account. You will receive an email when your application has been approved.'); break; case 2:
FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success'); } header('Location: ' . WT_BASE_URL . 'admin.php'); return; } // Lists of options for <select> controls. $SMTP_SSL_OPTIONS = array('none' => I18N::translate('none'), 'ssl' => I18N::translate('ssl'), 'tls' => I18N::translate('tls')); $SMTP_ACTIVE_OPTIONS = array('internal' => I18N::translate('Use PHP mail to send messages'), 'external' => I18N::translate('Use SMTP to send messages')); $WELCOME_TEXT_AUTH_MODE_OPTIONS = array(0 => I18N::translate('No predefined text'), 1 => I18N::translate('Predefined text that states all users can request a user account'), 2 => I18N::translate('Predefined text that states admin will decide on each request for a user account'), 3 => I18N::translate('Predefined text that states only family members can request a user account'), 4 => I18N::translate('Choose user defined welcome text typed below')); $language_tags = array(); foreach (I18N::activeLocales() as $active_locale) { $language_tags[] = $active_locale->languageTag(); } switch (Filter::get('action')) { case 'site': $controller->setPageTitle(I18N::translate('Website preferences')); break; case 'email': $controller->setPageTitle(I18N::translate('Sending email')); break; case 'login': $controller->setPageTitle(I18N::translate('Login and registration')); break; case 'tracking': $controller->setPageTitle(I18N::translate('Tracking and analytics')); break; case 'languages': $controller->setPageTitle(I18N::translate('Languages')); break; default: header('Location: ' . WT_BASE_URL . 'admin.php');
$gedcom = Filter::post('gedcom'); if ($gedcom && $gedcom !== $WT_TREE->getName()) { try { Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId())); Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName())); } catch (\Exception $ex) { // Probably a duplicate name. } } FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success'); header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php'); return; } switch (Filter::get('action')) { case 'privacy': $controller->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Privacy'))->addInlineJavascript(' jQuery("#default-resn input[type=checkbox]").on("click", function() { if ($(this).prop("checked")) { jQuery($(this).closest("tr").addClass("text-muted")); } else { jQuery($(this).closest("tr").removeClass("text-muted")); } }); jQuery("#add-resn").on("click", function() { jQuery("#default-resn tbody").prepend(jQuery("#new-resn-template").html()); autocomplete(); }); '); break; case 'general': $controller->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Preferences')); break;
/** * Places administration. */ private function adminPlaces() { global $WT_TREE; $action = Filter::get('action'); $parent = Filter::get('parent'); $inactive = Filter::getBool('inactive'); $deleteRecord = Filter::get('deleteRecord'); if (!isset($parent)) { $parent = 0; } $controller = new PageController(); $controller->restrictAccess(Auth::isAdmin()); if ($action == 'ExportFile' && Auth::isAdmin()) { $tmp = $this->placeIdToHierarchy($parent); $maxLevel = $this->getHighestLevel(); if ($maxLevel > 8) { $maxLevel = 8; } $tmp[0] = 'places'; $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); echo '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";'; if ($maxLevel > 0) { echo '"', I18N::translate('State'), '";'; } if ($maxLevel > 1) { echo '"', I18N::translate('County'), '";'; } if ($maxLevel > 2) { echo '"', I18N::translate('City'), '";'; } if ($maxLevel > 3) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 4) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 5) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 6) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 7) { echo '"', I18N::translate('Place'), '";'; } echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";'; echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL; $this->outputLevel($parent); exit; } $controller->setPageTitle(I18N::translate('Google Maps™'))->pageHeader(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <ul class="nav nav-tabs nav-justified" role="tablist"> <li role="presentation"> <a href="?mod=googlemap&mod_action=admin_config" role="tab"> <?php echo I18N::translate('Google Maps™ preferences'); ?> </a> </li> <li role="presentation" class="active"> <a href="#"> <?php echo I18N::translate('Geographic data'); ?> </a> </li> <li role="presentation"> <a href="?mod=googlemap&mod_action=admin_placecheck"> <?php echo I18N::translate('Place check'); ?> </a> </li> </ul> <h2><?php echo I18N::translate('Geographic data'); ?> </h2> <?php if ($action == 'ImportGedcom') { $placelist = array(); $j = 0; $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn(); foreach ($gedcom_records as $gedrec) { $i = 1; $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); while (!empty($placerec)) { if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { $placelist[$j] = array(); $placelist[$j]['place'] = trim($match[1]); if (preg_match("/4 LATI (.*)/", $placerec, $match)) { $placelist[$j]['lati'] = trim($match[1]); if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') { if ($placelist[$j]['lati'] < 0) { $placelist[$j]['lati'][0] = 'S'; } else { $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati']; } } } else { $placelist[$j]['lati'] = null; } if (preg_match("/4 LONG (.*)/", $placerec, $match)) { $placelist[$j]['long'] = trim($match[1]); if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') { if ($placelist[$j]['long'] < 0) { $placelist[$j]['long'][0] = 'W'; } else { $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; } } } else { $placelist[$j]['long'] = null; } $j = $j + 1; } $i = $i + 1; $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); } } asort($placelist); $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $highestIndex = $this->getHighestIndex(); $default_zoom_level = array(4, 7, 10, 12); foreach ($placelistUniq as $k => $place) { $parent = preg_split('/ *, */', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { if (!isset($default_zoom_level[$i])) { $default_zoom_level[$i] = $default_zoom_level[$i - 1]; } $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if ($i < count($parent) - 1) { // Create higher-level places, if necessary if (empty($row)) { $highestIndex++; Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); echo Filter::escapeHtml($escparent), '<br>'; $parent_id = $highestIndex; } else { $parent_id = $row->pl_id; } } else { // Create lowest-level place, if necessary if (empty($row->pl_id)) { $highestIndex++; Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); echo Filter::escapeHtml($escparent), '<br>'; } else { if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id)); echo Filter::escapeHtml($escparent), '<br>'; } } } } } $parent = 0; } if ($action === 'ImportFile') { $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); sort($placefiles); ?> <form class="form-horizontal" method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> <!-- PLACES FILE --> <div class="form-group"> <label class="control-label col-sm-4" for="placesfile"> <?php echo I18N::translate('File containing places (CSV)'); ?> </label> <div class="col-sm-8"> <div class="btn btn-default"> <input id="placesfile" type="file" name="placesfile"> </div> </div> </div> <!-- LOCAL FILE --> <?php if (count($placefiles) > 0) { ?> <div class="form-group"> <label class="control-label col-sm-4" for="localfile"> <?php echo I18N::translate('Server file containing places (CSV)'); ?> </label> <div class="col-sm-8"> <div class="input-group"> <span class="input-group-addon"> <?php echo WT_MODULES_DIR . 'googlemap/extra/'; ?> </span> <?php foreach ($placefiles as $p => $placefile) { unset($placefiles[$p]); $p = Filter::escapeHtml($placefile); if (substr($placefile, 0, 1) == "/") { $placefiles[$p] = substr($placefile, 1); } else { $placefiles[$p] = $placefile; } } echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"'); ?> </div> </div> </div> <?php } ?> <!-- CLEAR DATABASE --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Delete all existing geographic data before importing the file.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('cleardatabase', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- UPDATE ONLY --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Do not create new locations, just import coordinates for existing locations.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('updateonly', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- OVERWRITE DATA --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Overwrite existing coordinates.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('overwritedata', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- SAVE BUTTON --> <div class="form-group"> <div class="col-sm-offset-4 col-sm-8"> <button type="submit" class="btn btn-primary"> <i class="fa fa-check"></i> <?php echo I18N::translate('Continue adding'); ?> </button> </div> </div> </form> <?php exit; } if ($action === 'ImportFile2') { $country_names = array(); $stats = new Stats($WT_TREE); foreach ($stats->iso3166() as $key => $value) { $country_names[$key] = I18N::translate($key); } if (Filter::postBool('cleardatabase')) { Database::exec("DELETE FROM `##placelocation` WHERE 1=1"); } if (!empty($_FILES['placesfile']['tmp_name'])) { $lines = file($_FILES['placesfile']['tmp_name']); } elseif (!empty($_REQUEST['localfile'])) { $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); } // Strip BYTE-ORDER-MARK, if present if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) { $lines[0] = substr($lines[0], 3); } asort($lines); $highestIndex = $this->getHighestIndex(); $placelist = array(); $j = 0; $maxLevel = 0; foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if ($fieldrec[0] > $maxLevel) { $maxLevel = $fieldrec[0]; } } $fields = count($fieldrec); $set_icon = true; if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { $set_icon = false; } foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { $placelist[$j] = array(); $placelist[$j]['place'] = ''; for ($ii = $fields - 4; $ii > 1; $ii--) { if ($fieldrec[0] > $ii - 2) { $placelist[$j]['place'] .= $fieldrec[$ii] . ','; } } foreach ($country_names as $countrycode => $countryname) { if ($countrycode == strtoupper($fieldrec[1])) { $fieldrec[1] = $countryname; break; } } $placelist[$j]['place'] .= $fieldrec[1]; $placelist[$j]['long'] = $fieldrec[$fields - 4]; $placelist[$j]['lati'] = $fieldrec[$fields - 3]; $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; if ($set_icon) { $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); } else { $placelist[$j]['icon'] = ''; } $j = $j + 1; } } $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $placelistUniq[$j]['zoom'] = $place['zoom']; $placelistUniq[$j]['icon'] = $place['icon']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; $placelistUniq[$j - 1]['zoom'] = $place['zoom']; $placelistUniq[$j - 1]['icon'] = $place['icon']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $default_zoom_level = array(); $default_zoom_level[0] = 4; $default_zoom_level[1] = 7; $default_zoom_level[2] = 10; $default_zoom_level[3] = 12; foreach ($placelistUniq as $k => $place) { $parent = explode(',', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if (empty($row)) { // this name does not yet exist: create entry if (!Filter::postBool('updateonly')) { $highestIndex = $highestIndex + 1; if ($i + 1 == count($parent)) { $zoomlevel = $place['zoom']; } elseif (isset($default_zoom_level[$i])) { $zoomlevel = $default_zoom_level[$i]; } else { $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); } if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) { Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); } else { //delete leading zero $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); if ($pl_lati >= 0) { $place['lati'] = 'N' . abs($pl_lati); } elseif ($pl_lati < 0) { $place['lati'] = 'S' . abs($pl_lati); } if ($pl_long >= 0) { $place['long'] = 'E' . abs($pl_long); } elseif ($pl_long < 0) { $place['long'] = 'W' . abs($pl_long); } Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); } $parent_id = $highestIndex; } } else { $parent_id = $row->pl_id; if (Filter::postBool('overwritedata') && $i + 1 == count($parent)) { Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ?, pl_zoom = ?, pl_icon = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); } else { // Update only if existing data is missing if (!$row->pl_long && !$row->pl_lati) { Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $parent_id)); } if (!$row->pl_icon && $place['icon']) { Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?")->execute(array($place['icon'], $parent_id)); } } } } } $parent = 0; } if ($action == 'DeleteRecord') { $exists = Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne(); if (!$exists) { Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord)); } else { echo '<table class="facts_table"><tr><td>', I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>'; } } ?> <script> function updateList(inactive) { window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true); } else { $uri = $_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?> '+inactive; } function edit_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs); return false; } function add_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs); return false; } function delete_place(placeid) { var answer=confirm('<?php echo I18N::translate('Remove this location?'); ?> '); if (answer == true) { window.location = '<?php echo Functions::getQueryUrl(array('action' => 'DeleteRecord')); ?> &action=DeleteRecord&deleteRecord=' + placeid; } } </script> <p id="gm_breadcrumb"> <?php $where_am_i = $this->placeIdToHierarchy($parent); foreach (array_reverse($where_am_i, true) as $id => $place) { if ($id == $parent) { if ($place != 'Unknown') { echo Filter::escapeHtml($place); } else { echo I18N::translate('unknown'); } } else { echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; if ($place != 'Unknown') { echo Filter::escapeHtml($place), '</a>'; } else { echo I18N::translate('unknown'), '</a>'; } } echo ' - '; } ?> <a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '"><?php echo I18N::translate('Top level'); ?> </a> </p> <form class="form-inline" name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"> <div class="checkbox"> <label for="inactive"> <?php echo FunctionsEdit::checkbox('inactive', $inactive, 'onclick="updateList(this.checked)"'); ?> <?php echo I18N::translate('Show inactive places'); ?> </label> </div> <p class="small text-muted"> <?php echo I18N::translate('By default, the list shows only those places which can be found in your family trees. You may have details for other places, such as those imported in bulk from an external file. Selecting this option will show all places, including ones that are not currently used.'); ?> <?php echo I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.'); ?> </p> </form> <?php $placelist = $this->getPlaceListLocation($parent, $inactive); echo '<div class="gm_plac_edit">'; echo '<table class="table table-bordered table-condensed table-hover"><tr>'; echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; echo '<th>', GedcomTag::getLabel('LATI'), '</th>'; echo '<th>', GedcomTag::getLabel('LONG'), '</th>'; echo '<th>', I18N::translate('Zoom level'), '</th>'; echo '<th>', I18N::translate('Icon'), '</th>'; echo '<th>'; echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>'; if (count($placelist) == 0) { echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>'; } foreach ($placelist as $place) { echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">'; if ($place['place'] != 'Unknown') { echo Filter::escapeHtml($place['place']), '</a></td>'; } else { echo I18N::translate('unknown'), '</a></td>'; } echo '<td>', $place['lati'], '</td>'; echo '<td>', $place['long'], '</td>'; echo '<td>', $place['zoom'], '</td>'; echo '<td>'; if ($place['icon']) { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; } else { if ($place['lati'] || $place['long']) { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">'; } else { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">'; } } echo '</td>'; echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>'; $noRows = Database::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne(); if ($noRows == 0) { ?> <td><a href="#" onclick="delete_place(<?php echo $place['place_id']; ?> );return false;" class="icon-delete" title="<?php echo I18N::translate('Remove'); ?> "></a></td> <?php } else { ?> <td><i class="icon-delete-grey"></i></td> <?php } ?> </tr> <?php } ?> </table> </div> <hr> <form class="form-horizontal" action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;"> <div class="form-group"> <label class="form-control-static col-sm-4" for="parent_id"> <?php echo I18N::translate('Add a new geographic location'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('parent_id', $where_am_i, I18N::translate('Top level'), $parent, 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-plus"></i> <?php echo I18N::translate('Add'); ?> </button> </div> </div> </form> <form class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportGedcom"> <div class="form-group"> <label class="form-control-static col-sm-4" for="ged"> <?php echo I18N::translate('Import all places from a family tree'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-upload"></i> <?php echo I18N::translate('Import'); ?> </button> </div> </div> </form> <form class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportFile"> <div class="form-group"> <label class="form-control-static col-sm-4"> <?php echo I18N::translate('Upload geographic data'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <button type="submit" class="btn btn-default"> <i class="fa fa-upload"></i> <?php echo I18N::translate('Upload'); ?> </button> </div> </div> </div> </form> <form class="form-horizontal" action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ExportFile"> <div class="form-group"> <label class="form-control-static col-sm-4"> <?php echo I18N::translate('Download geographic data'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('parent', $where_am_i, I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-download"></i> <?php echo I18N::translate('Download'); ?> </button> </div> </div> </form> <?php }
$show = 'indi'; // SURN list makes no sense here } elseif ($alpha) { $show_all = 'no'; $legend = Filter::escapeHtml($alpha) . '…'; $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . $WT_TREE->getNameUrl(); $show = Filter::get('show', 'surn|indi', 'surn'); } else { $show_all = 'no'; $legend = '…'; $url = WT_SCRIPT_NAME . '?ged=' . $WT_TREE->getNameUrl(); $show = 'none'; // Don't show lists until something is chosen } $legend = '<span dir="auto">' . $legend . '</span>'; $controller->setPageTitle(I18N::translate('Families') . ' : ' . $legend)->pageHeader(); echo '<h2 class="center">', I18N::translate('Families'), '</h2>'; // Print a selection list of initial letters $list = array(); foreach (QueryName::surnameAlpha($WT_TREE, $show_marnm === 'yes', true) as $letter => $count) { switch ($letter) { case '@': $html = I18N::translateContext('Unknown surname', '…'); break; case ',': $html = I18N::translate('None'); break; default: $html = Filter::escapeHtml($letter); break; }
case 'delete': // An administrator can only be deleted by another administrator if (!Auth::user()->getPreference('canadmin')) { // Keep a reference to the currently logged in user because after logging out this user, // a call to Auth::user() will not return this user anymore $currentUser = Auth::user(); Auth::logout(); $currentUser->delete(); } break; } header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); return; } $controller = new PageController(); $controller->setPageTitle(I18N::translate('My account'))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); $my_individual_record = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE); $default_individual = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'rootid'), $WT_TREE); // Form validation ?> <script> function checkform(frm) { if (frm.form_username.value=="") { alert("<?php echo I18N::translate('You must enter a user name.'); ?> "); frm.form_username.focus(); return false; } if (frm.form_realname.value=="") {
/** * Show a list of FAQs */ private function show() { global $controller, $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Frequently asked questions'))->pageHeader(); $faqs = Database::prepare("SELECT block_id, bs1.setting_value AS header, bs2.setting_value AS body, bs3.setting_value AS languages" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " JOIN `##block_setting` bs3 USING (block_id)" . " WHERE module_name = :module_name" . " AND bs1.setting_name = 'header'" . " AND bs2.setting_name = 'faqbody'" . " AND bs3.setting_name = 'languages'" . " AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2" . " ORDER BY block_order")->execute(array('module_name' => $this->getName(), 'tree_id_1' => $WT_TREE->getTreeId(), 'tree_id_2' => $WT_TREE->getTreeId()))->fetchAll(); // Define your colors for the alternating rows echo '<h2 class="center">', I18N::translate('Frequently asked questions'), '</h2>'; // Instructions echo '<div class="faq_italic">', I18N::translate('Click on a title to go straight to it, or scroll down to read them all.'); if (Auth::isManager($WT_TREE)) { echo '<div class="faq_edit"><a href="module.php?mod=', $this->getName(), '&mod_action=admin_config">', I18N::translate('Click here to add, edit, or delete'), '</a></div>'; } echo '</div>'; $row_count = 0; echo '<table class="faq">'; // List of titles foreach ($faqs as $id => $faq) { if (!$faq->languages || in_array(WT_LOCALE, explode(',', $faq->languages))) { $row_color = $row_count % 2 ? 'odd' : 'even'; // NOTE: Print the header of the current item echo '<tr class="', $row_color, '"><td style="padding: 5px;">'; echo '<a href="#faq', $id, '">', $faq->header, '</a>'; echo '</td></tr>'; $row_count++; } } echo '</table><hr>'; // Detailed entries foreach ($faqs as $id => $faq) { if (!$faq->languages || in_array(WT_LOCALE, explode(',', $faq->languages))) { echo '<div class="faq_title" id="faq', $id, '">', $faq->header; echo '<div class="faq_top faq_italic">'; echo '<a href="#content">', I18N::translate('back to top'), '</a>'; echo '</div>'; echo '</div>'; echo '<div class="faq_body">', substr($faq->body, 0, 1) == '<' ? $faq->body : nl2br($faq->body, false), '</div>'; echo '<hr>'; } } }
$datum[9] = I18N::translate('Never'); } $datum[10] = $datum[10] ? I18N::translate('yes') : I18N::translate('no'); $datum[11] = $datum[11] ? I18N::translate('yes') : I18N::translate('no'); } // Total filtered/unfiltered rows $recordsFiltered = (int) Database::prepare("SELECT FOUND_ROWS()")->fetchOne(); $recordsTotal = User::count(); header('Content-type: application/json'); // See http://www.datatables.net/usage/server-side echo json_encode(array('draw' => Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data)); return; case 'edit': $user_id = Filter::getInteger('user_id'); if ($user_id === 0) { $controller->setPageTitle(I18N::translate('Add a user')); $tmp = new \stdClass(); $tmp->user_id = ''; $tmp->user_name = ''; $tmp->real_name = ''; $tmp->email = ''; $user = new User($tmp); } else { $controller->setPageTitle(I18N::translate('Edit the user')); $user = User::find($user_id); } $controller->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->addInlineJavascript(' jQuery(".relpath").change(function() { var fieldIDx = jQuery(this).attr("id"); var idNum = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH",""); var newIDx = "gedcomid"+idNum;
/** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\MediaController; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; use Fisharebest\Webtrees\Query\QueryMedia; define('WT_SCRIPT_NAME', 'medialist.php'); require './includes/session.php'; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Media objects'))->pageHeader(); $action = Filter::get('action'); $sortby = Filter::get('sortby', 'file|title', 'title'); if (!Auth::isEditor($WT_TREE)) { $sortby = 'title'; } $page = Filter::getInteger('page'); $max = Filter::get('max', '10|20|30|40|50|75|100|125|150|200', '20'); $folder = Filter::get('folder', null, ''); // MySQL needs an empty string, not NULL $filter = Filter::get('filter', null, ''); // MySQL needs an empty string, not NULL $columns = Filter::getInteger('columns', 1, 2, 2); $subdirs = Filter::get('subdirs', 'on'); $form_type = Filter::get('form_type', implode('|', array_keys(GedcomTag::getFileFormTypes()))); $currentdironly = $subdirs === 'on' ? false : true;
* Copyright (C) 2015 webtrees development team * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsDb; use Fisharebest\Webtrees\Functions\FunctionsPrintLists; define('WT_SCRIPT_NAME', 'sourcelist.php'); require './includes/session.php'; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Sources')); $controller->pageHeader(); echo '<div id="sourcelist-page">', '<h2>', I18N::translate('Sources'), '</h2>'; echo FunctionsPrintLists::sourceTable(FunctionsDb::getSourceList($WT_TREE)); echo '</div>';
/** * This is a general purpose hook, allowing modules to respond to routes * of the form module.php?mod=FOO&mod_action=BAR * * @param string $mod_action */ public function modAction($mod_action) { switch ($mod_action) { case 'ajax': $html = $this->getSidebarAjaxContent(); header('Content-Type: text/html; charset=UTF-8'); echo $html; break; case 'index': global $controller, $WT_TREE; $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); $clip_ctrl = new ClippingsCartController(); $cart = Session::get('cart'); $controller = new PageController(); $controller->setPageTitle($this->getTitle())->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); echo '<script>'; echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; echo '</script>'; if (!$cart[$WT_TREE->getTreeId()]) { echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>'; } if ($clip_ctrl->action == 'add') { $record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE); if ($clip_ctrl->type === 'FAM') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"> <table> <thead> <tr> <td class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <input type="radio" name="others" value="parents"> <?php echo $record->getFullName(); ?> </td> </tr> <tr> <td class="optionbox"> <input type="radio" name="others" value="members" checked> <?php echo I18N::translate('%s and their children', $record->getFullName()); ?> </td> </tr> <tr> <td class="optionbox"> <input type="radio" name="others" value="descendants"> <?php echo I18N::translate('%s and their descendants', $record->getFullName()); ?> </td> </tr> </tbody> <tfoot> <tr> <td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('continue'); ?> "> </td> </tr> </tfoot> </table> </form> <?php } elseif ($clip_ctrl->type === 'INDI') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"> <table> <thead> <tr> <td class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <label> <input type="radio" name="others" checked value="none"> <?php echo $record->getFullName(); ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="parents"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her parents and siblings', $record->getFullName()); } else { echo I18N::translate('%s, his parents and siblings', $record->getFullName()); } ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="members"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her spouses and children', $record->getFullName()); } else { echo I18N::translate('%s, his spouses and children', $record->getFullName()); } ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="ancestors" id="ancestors"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s and her ancestors', $record->getFullName()); } else { echo I18N::translate('%s and his ancestors', $record->getFullName()); } ?> </label> <br> <?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> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her ancestors and their families', $record->getFullName()); } else { echo I18N::translate('%s, his ancestors and their families', $record->getFullName()); } ?> </label> <br> <?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> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="descendants" id="descendants"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her spouses and descendants', $record->getFullName()); } else { echo I18N::translate('%s, his spouses and descendants', $record->getFullName()); } ?> </label> <br> <?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> </tbody> <tfoot> <tr> <td class="topbottombar"> <input type="submit" value="<?php echo I18N::translate('continue'); ?> "> </td> </tr> </tfoot> </table> </form> <?php } elseif ($clip_ctrl->type === 'SOUR') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"> <table> <thead> <tr> <td class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <label> <input type="radio" name="others" checked value="none"> <?php echo $record->getFullName(); ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="linked"> <?php echo I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?> </label> </td> </tr> </tbody> <tfoot> <tr> <td class="topbottombar"> <input type="submit" value="<?php echo I18N::translate('continue'); ?> "> </td> </tr> </tfoot> </table> </form> <?php } } if (!$cart[$WT_TREE->getTreeId()]) { if ($clip_ctrl->action != 'add') { 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>'); ?> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <thead> <tr> <td colspan="2" class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5"> </td> <td class="optionbox"> <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?> <input type="submit" value="<?php echo I18N::translate('Add'); ?> "> </td> </tr> </tbody> </table> </form> <?php } // -- end new lines echo I18N::translate('Your clippings cart is empty.'); } else { // Keep track of the INDI from the parent page, otherwise it will // get lost after ajax updates $pid = Filter::get('pid', WT_REGEX_XREF); if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?> <form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="action" value="download"> <input type="hidden" name="pid" value="<?php echo $pid; ?> "> <table> <tr> <td colspan="2" class="topbottombar"> <h2><?php echo I18N::translate('Download'); ?> </h2> </td> </tr> <tr> <td class="descriptionbox width50 wrap"> <?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.'); ?> </td> <td class="optionbox wrap"> <input type="checkbox" name="Zip" value="yes"> <?php echo I18N::translate('Zip file(s)'); ?> </td> </tr> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Include media (automatically zips files)'); ?> </td> <td class="optionbox"> <input type="checkbox" name="IncludeMedia" value="yes"> </td> </tr> <?php if (Auth::isManager($WT_TREE)) { ?> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Apply privacy settings'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="none" checked> <?php echo I18N::translate('None'); ?> <br> <input type="radio" name="privatize_export" value="gedadmin"> <?php echo I18N::translate('Manager'); ?> <br> <input type="radio" name="privatize_export" value="user"> <?php echo I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?> </td> </tr> <?php } elseif (Auth::isMember($WT_TREE)) { ?> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Apply privacy settings'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="user" checked> <?php echo I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?> </td> </tr> <?php } ?> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Convert from UTF-8 to ISO-8859-1'); ?> </td> <td class="optionbox"> <input type="checkbox" name="convert" value="yes"> </td> </tr> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Add the GEDCOM media path to filenames'); ?> </td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="<?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?> "> <span dir="auto"><?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?> </span> </td> </tr> <tr> <td class="topbottombar" colspan="2"> <input type="submit" value="<?php echo I18N::translate('Download'); ?> "> </td> </tr> </table> </form> <br> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <thead> <tr> <td colspan="2" class="topbottombar" style="text-align:center; "> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8"> </td> <td class="optionbox"> <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?> <input type="submit" value="<?php echo I18N::translate('Add'); ?> "> </td> </tr> </tbody> <tfoot> <tr> <th colspan="2"> <a href="module.php?mod=clippings&mod_action=index&action=empty"> <?php echo I18N::translate('Empty the clippings cart'); ?> </a> </th> </tr> </tfoot> </table> </form> <?php } ?> <h2> <?php echo I18N::translate('Family tree clippings cart'); ?> </h2> <table id="mycart" class="sortable list_table width100"> <thead> <tr> <th class="list_label"><?php echo I18N::translate('Record'); ?> </th> <th class="list_label"><?php echo I18N::translate('Remove'); ?> </th> </tr> </thead> <tbody> <?php foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) { $record = GedcomRecord::getInstance($xref, $WT_TREE); 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; } ?> <tr> <td class="list_value"> <i class="<?php echo $icon; ?> "></i> <?php echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>'; ?> </td> <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> </tr> <?php } } ?> </table> <?php } break; default: http_response_code(404); break; } }
*/ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsExport; use PclZip; define('WT_SCRIPT_NAME', 'admin_trees_download.php'); require './includes/session.php'; $controller = new PageController(); $controller->setPageTitle(I18N::translate($WT_TREE->getTitleHtml()) . ' — ' . I18N::translate('Export a GEDCOM file'))->restrictAccess(Auth::isManager($WT_TREE)); // Validate user parameters $action = Filter::get('action', 'download'); $convert = Filter::get('convert', 'yes|no', 'no'); $zip = Filter::get('zip', 'yes|no', 'no'); $conv_path = Filter::get('conv_path'); $privatize_export = Filter::get('privatize_export', 'none|visitor|user|gedadmin'); if ($action === 'download') { $exportOptions = array('privatize' => $privatize_export, 'toANSI' => $convert, 'path' => $conv_path); // What to call the downloaded file $download_filename = $WT_TREE->getName(); if (strtolower(substr($download_filename, -4, 4)) != '.ged') { $download_filename .= '.ged'; } if ($zip === 'yes') { $temp_dir = WT_DATA_DIR . 'tmp-' . $WT_TREE->getName() . '-' . date('YmdHis') . '/';
$show = 'indi'; // SURN list makes no sense here } elseif ($alpha) { $show_all = 'no'; $legend = Filter::escapeHtml($alpha) . '…'; $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . $WT_TREE->getNameUrl(); $show = Filter::get('show', 'surn|indi', 'surn'); } else { $show_all = 'no'; $legend = '…'; $url = WT_SCRIPT_NAME . '?ged=' . $WT_TREE->getNameUrl(); $show = 'none'; // Don't show lists until something is chosen } $legend = '<span dir="auto">' . $legend . '</span>'; $controller->setPageTitle(I18N::translate('Individuals') . ' : ' . $legend)->pageHeader(); echo '<h2 class="center">', I18N::translate('Individuals'), '</h2>'; // Print a selection list of initial letters $list = array(); foreach (QueryName::surnameAlpha($WT_TREE, $show_marnm === 'yes', false) as $letter => $count) { switch ($letter) { case '@': $html = I18N::translateContext('Unknown surname', '…'); break; case ',': $html = I18N::translate('None'); break; default: $html = Filter::escapeHtml($letter); break; }