Exemplo n.º 1
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
  */
 protected function renderContent()
 {
     /** @var \Fisharebest\Webtrees\Tree $tree */
     $tree = $this->data->get('tree');
     echo '<h2 class="center">', $this->data->get('title'), '</h2>';
     echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>';
     if ($this->data->get('issurnames', false)) {
         $surns = $this->data->get('surnameslist', array());
         $extra_params = array('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage');
         // Show the surname list
         switch ($tree->getPreference('SURNAME_LIST_STYLE')) {
             case 'style1':
                 echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $tree, $extra_params);
                 break;
             case 'style3':
                 echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params);
                 break;
             case 'style2':
             default:
                 echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params);
                 break;
         }
     } else {
         if ($this->data->get('islineages', false)) {
             //Link to indilist
             echo '<p class="center"><strong>' . '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) . '">' . I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')) . '</a></strong></p>';
             $lineages = $this->data->get('lineages', null);
             $nb_lineages = count($lineages);
             if (is_null($lineages) || $nb_lineages == 0) {
                 echo '<p class="center"><span class="warning">', I18N::translate('No individuals with surname %s has been found. Please try another name.', '<span dir="auto">' . $this->data->get('legend') . '</span>'), '</span></p>';
             } else {
                 echo '<div id="patronymiclineages">' . '<div class="list_label">', $this->data->get('table_title'), '</div>';
                 echo '<div class="list_value_wrap">';
                 foreach ($lineages as $i => $lineage) {
                     $this->printRootLineage($lineage);
                     if ($i < $nb_lineages - 1) {
                         echo '<hr />';
                     }
                 }
                 echo '</div>';
                 echo '<div class="list_label">', I18N::translate('%s lineages found', $nb_lineages), '</div>' . '</div>';
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $ctype, $WT_TREE;
     $filter = $this->getBlockSetting($block_id, 'filter', '1');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     foreach (array('filter', 'infoStyle', 'sortStyle', 'block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     $todayjd = WT_CLIENT_JD;
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
         $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
     } else {
         $title = '';
     }
     $title .= $this->getTitle();
     $content = '';
     // If we are only showing living individuals, then we don't need to search for DEAT events.
     $tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT';
     switch ($infoStyle) {
         case 'list':
             // Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
             $content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
             break;
         case 'table':
             // Style 2: New format, tables, big text, etc. Not too good on right side of page
             ob_start();
             $content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
             $content .= ob_get_clean();
             break;
     }
     if ($template) {
         if ($block) {
             $class .= ' small_inner_block';
         }
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
 /**
  * Display the search results
  */
 public function printResults()
 {
     if ($this->myindilist) {
         uasort($this->myindilist, '\\Fisharebest\\Webtrees\\GedcomRecord::compare');
         echo FunctionsPrintLists::individualTable($this->myindilist);
     } elseif (array_filter($this->values)) {
         echo '<p class="ui-state-highlight">', I18N::translate('No results found.'), '</p>';
     }
 }
Exemplo n.º 4
0
                            break;
                    }
                    if ($count) {
                        if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') {
                            $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
                        } else {
                            $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
                        }
                    } else {
                        $list[] = $html;
                    }
                }
                // Search spiders don't get the "show all" option as the other links give them everything.
                if (!Auth::isSearchEngine()) {
                    if ($show_all_firstnames === 'yes') {
                        $list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
                    } else {
                        $list[] = '<a href="' . $url . '&amp;show_all_firstnames=yes">' . I18N::translate('All') . '</a>';
                    }
                }
                if ($show_all === 'no') {
                    echo '<h2 class="center">', I18N::translate('Individuals with surname %s', $legend), '</h2>';
                }
                echo '<p class="center alpha_index">', implode(' | ', $list), '</p>';
            }
        }
        if ($show === 'indi') {
            echo FunctionsPrintLists::familyTable(QueryName::families($WT_TREE, $surname, $alpha, $falpha, $show_marnm === 'yes'));
        }
    }
}
Exemplo n.º 5
0
 * Copyright (C) 2016 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', 'repolist.php');
require './includes/session.php';
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Repositories'));
$controller->pageHeader();
echo '<div id="repolist-page">', '<h2>', I18N::translate('Repositories'), '</h2>';
echo FunctionsPrintLists::repositoryTable(FunctionsDb::getRepositoryList($WT_TREE));
echo '</div>';
Exemplo n.º 6
0
 /**
  * Display the search results
  */
 public function printResults()
 {
     if ($this->action !== 'replace' && ($this->query || $this->firstname || $this->lastname || $this->place)) {
         if ($this->myindilist || $this->myfamlist || $this->mysourcelist || $this->mynotelist) {
             $this->addInlineJavascript('jQuery("#search-result-tabs").tabs();');
             $this->addInlineJavascript('jQuery("#search-result-tabs").css("visibility", "visible");');
             $this->addInlineJavascript('jQuery(".loading-image").css("display", "none");');
             echo '<br>';
             echo '<div class="loading-image"></div>';
             echo '<div id="search-result-tabs"><ul>';
             if (!empty($this->myindilist)) {
                 echo '<li><a href="#individual-results-tab">', I18N::translate('Individuals'), '</a></li>';
             }
             if (!empty($this->myfamlist)) {
                 echo '<li><a href="#families-results-tab">', I18N::translate('Families'), '</a></li>';
             }
             if (!empty($this->mysourcelist)) {
                 echo '<li><a href="#sources-results-tab">', I18N::translate('Sources'), '</a></li>';
             }
             if (!empty($this->mynotelist)) {
                 echo '<li><a href="#notes-results-tab">', I18N::translate('Notes'), '</a></li>';
             }
             echo '</ul>';
             if (!empty($this->myindilist)) {
                 echo '<div id="individual-results-tab">', FunctionsPrintLists::individualTable($this->myindilist), '</div>';
             }
             if (!empty($this->myfamlist)) {
                 echo '<div id="families-results-tab">', FunctionsPrintLists::familyTable($this->myfamlist), '</div>';
             }
             if (!empty($this->mysourcelist)) {
                 echo '<div id="sources-results-tab">', FunctionsPrintLists::sourceTable($this->mysourcelist), '</div>';
             }
             if (!empty($this->mynotelist)) {
                 echo '<div id="notes-results-tab">', FunctionsPrintLists::noteTable($this->mynotelist), '</div>';
             }
             echo '</div>';
         } else {
             // One or more search terms were specified, but no results were found.
             echo '<div class="warning center">' . I18N::translate('No results found.') . '</div>';
         }
     }
 }
Exemplo n.º 7
0
    echo '<li><a href="#sources-media"><span id="sourcemedia">', I18N::translate('Sources'), '</span></a></li>';
}
if ($linked_repo) {
    echo '<li><a href="#repo-media"><span id="repomedia">', I18N::translate('Repositories'), '</span></a></li>';
}
if ($linked_note) {
    echo '<li><a href="#notes-media"><span id="notemedia">', I18N::translate('Notes'), '</span></a></li>';
}
echo '</ul>';
// Individuals linked to this media object
if ($linked_indi) {
    echo '<div id="indi-media">', FunctionsPrintLists::individualTable($linked_indi), '</div>';
}
// Families linked to this media object
if ($linked_fam) {
    echo '<div id="fam-media">', FunctionsPrintLists::familyTable($linked_fam), '</div>';
}
// Sources linked to this media object
if ($linked_sour) {
    echo '<div id="sources-media">', FunctionsPrintLists::sourceTable($linked_sour), '</div>';
}
// Repositories linked to this media object
if ($linked_repo) {
    echo '<div id="repo-media">', FunctionsPrintLists::repositoryTable($linked_repo), '</div>';
}
// medias linked to this media object
if ($linked_note) {
    echo '<div id="notes-media">', FunctionsPrintLists::noteTable($linked_note), '</div>';
}
echo '</div>';
echo '</div>';
Exemplo n.º 8
0
 * 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>';
Exemplo n.º 9
0
			</div>
		<?php 
}
?>

		<?php 
if ($linked_sour) {
    ?>
			<div id="linked-sources">
				<?php 
    echo FunctionsPrintLists::sourceTable($linked_sour);
    ?>
			</div>
		<?php 
}
?>

		<?php 
if ($linked_note) {
    ?>
			<div id="linked-notes">
				<?php 
    echo FunctionsPrintLists::noteTable($linked_note);
    ?>
			</div>
		<?php 
}
?>
	</div>
</div>
<?php 
Exemplo n.º 10
0
if ($linked_sour) {
    echo '<li><a href="#source-repo"><span id="reposource">', I18N::translate('Sources'), '</span></a></li>';
}
echo '</ul>';
echo '<div id="repo-edit">';
echo '<table class="facts_table">';
// Fetch the facts
$facts = $controller->record->getFacts();
// Sort the facts
usort($facts, function (Fact $x, Fact $y) {
    static $order = array('NAME' => 0, 'ADDR' => 1, 'NOTE' => 2, 'WWW' => 3, 'REFN' => 4, 'RIN' => 5, '_UID' => 6, 'CHAN' => 7);
    return (array_key_exists($x->getTag(), $order) ? $order[$x->getTag()] : PHP_INT_MAX) - (array_key_exists($y->getTag(), $order) ? $order[$y->getTag()] : PHP_INT_MAX);
});
// Print the facts
foreach ($facts as $fact) {
    FunctionsPrintFacts::printFact($fact, $controller->record);
}
// new fact link
if ($controller->record->canEdit()) {
    FunctionsPrint::printAddNewFact($controller->record->getXref(), $facts, 'REPO');
}
echo '</table>
	</div>';
// Sources linked to this repository
if ($linked_sour) {
    echo '<div id="source-repo">';
    echo FunctionsPrintLists::sourceTable($linked_sour);
    echo '</div>';
}
echo '</div>';
echo '</div>';
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $WT_TREE, $ctype;
     $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
     $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
     $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES);
     $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
     $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
     $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
     $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
     $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
     $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
     $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
     $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
     $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
     $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
     $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
     $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
     $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
     $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
     $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
     $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
     // This can be overriden when embedding in an HTML block
     $block = '0';
     foreach (array('show_common_surnames', 'number_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
         $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
     } else {
         $title = '';
     }
     $title .= $this->getTitle() . ' — ' . $WT_TREE->getTitleHtml();
     $stats = new Stats($WT_TREE);
     $content = '';
     if ($show_last_update) {
         $content .= '<p>' . I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</p>';
     }
     /** Responsive Design */
     $content .= '<div class="stat-table1">';
     if ($stat_indi) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individuals') . '</div><div class="facts_value stats_value stat-cell"><a href="' . "indilist.php?surname_sublist=no&amp;ged=" . $WT_TREE->getNameUrl() . '">' . $stats->totalIndividuals() . '</a></div></div>';
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Males') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexMales() . '<br>' . $stats->totalSexMalesPercentage() . '</div></div>';
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Females') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexFemales() . '<br>' . $stats->totalSexFemalesPercentage() . '</div></div>';
     }
     if ($stat_surname) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total surnames') . '</div><div class="facts_value stats_value stat-cell"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSurnames() . '</a></div></div>';
     }
     if ($stat_fam) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Families') . '</div><div class="facts_value stats_value stat-cell"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalFamilies() . '</a></div></div>';
     }
     if ($stat_sour) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Sources') . '</div><div class="facts_value stats_value stat-cell"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSources() . '</a></div></div>';
     }
     if ($stat_media) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Media objects') . '</div><div class="facts_value stats_value stat-cell"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalMedia() . '</a></div></div>';
     }
     if ($stat_repo) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Repositories') . '</div><div class="facts_value stats_value stat-cell"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalRepositories() . '</a></div></div>';
     }
     if ($stat_events) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total events') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalEvents() . '</div></div>';
     }
     if ($stat_users) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total users') . '</div><div class="facts_value stats_value stat-cell">';
         if (Auth::isManager($WT_TREE)) {
             $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>';
         } else {
             $content .= $stats->totalUsers();
         }
         $content .= '</div></div>';
     }
     if (!$block) {
         $content .= '</div><div class="facts_table stat-table2">';
     }
     if ($stat_first_birth) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstBirthYear() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_last_birth) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastBirthYear() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_first_death) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest death year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstDeathYear() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . $stats->firstDeath() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_last_death) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest death year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastDeathYear() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . $stats->lastDeath() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_long_life) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individual who lived the longest') . '</div><div class="facts_value stats_value stat-cell">' . $stats->longestLifeAge() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . $stats->longestLife() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_avg_life) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Average age at death') . '</div><div class="facts_value stats_value stat-cell">' . $stats->averageLifespan() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . I18N::translate('Males') . ':&nbsp;' . $stats->averageLifespanMale();
             $content .= '&nbsp;&nbsp;&nbsp;' . I18N::translate('Females') . ':&nbsp;' . $stats->averageLifespanFemale() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_most_chil && !$block) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Family with the most children') . '</div><div class="facts_value stats_value stat-cell">' . $stats->largestFamilySize() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left">' . $stats->largestFamily() . '</div>';
         }
         $content .= '</div>';
     }
     if ($stat_avg_chil) {
         $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Average number of children per family') . '</div><div class="facts_value stats_value stat-cell">' . $stats->averageChildren() . '</div>';
         if (!$block) {
             $content .= '<div class="facts_value stat-cell left"></div>';
         }
         $content .= '</div>';
     }
     $content .= '</div>';
     if ($show_common_surnames) {
         $surnames = FunctionsDb::getTopSurnames($WT_TREE->getTreeId(), 0, (int) $number_of_surnames);
         $all_surnames = array();
         foreach (array_keys($surnames) as $surname) {
             $all_surnames = array_merge($all_surnames, QueryName::surnames($WT_TREE, $surname, '', false, false));
         }
         if (!empty($surnames)) {
             ksort($all_surnames);
             $content .= '<div class="clearfloat">';
             $content .= '<p>';
             $content .= '<strong>' . I18N::translate('Most common surnames') . '</strong>';
             $content .= '<br>';
             $content .= '<span class="common_surnames">' . FunctionsPrintLists::surnameList($all_surnames, 2, false, 'indilist.php', $WT_TREE) . '</span>';
             $content .= '</p>';
             $content .= '</div>';
         }
     }
     if ($template) {
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Exemplo n.º 12
0
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $ctype, $WT_TREE;
     $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'date_desc');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0');
     foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     $found_facts = FunctionsDb::getRecentChanges(WT_CLIENT_JD - $days);
     if (!$found_facts && $hide_empty) {
         return '';
     }
     // Print block header
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
         $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
     } else {
         $title = '';
     }
     $title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
     $content = '';
     // Print block content
     if (count($found_facts) == 0) {
         $content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
     } else {
         ob_start();
         switch ($infoStyle) {
             case 'list':
                 $content .= FunctionsPrintLists::changesList($found_facts, $sortStyle);
                 break;
             case 'table':
                 // sortable table
                 $content .= FunctionsPrintLists::changesTable($found_facts, $sortStyle);
                 break;
         }
         $content .= ob_get_clean();
     }
     if ($template) {
         if ($block) {
             $class .= ' small_inner_block';
         }
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Exemplo n.º 13
0
 /**
  * Find common surnames.
  *
  * @param string   $type
  * @param bool     $show_tot
  * @param string[] $params
  *
  * @return string
  */
 private function commonSurnamesQuery($type = 'list', $show_tot = false, $params = array())
 {
     $threshold = empty($params[0]) ? 10 : (int) $params[0];
     $number_of_surnames = empty($params[1]) ? 10 : (int) $params[1];
     $sorting = empty($params[2]) ? 'alpha' : $params[2];
     $surname_list = FunctionsDb::getTopSurnames($this->tree->getTreeId(), $threshold, $number_of_surnames);
     if (empty($surname_list)) {
         return '';
     }
     switch ($sorting) {
         default:
         case 'alpha':
             uksort($surname_list, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
             break;
         case 'count':
             asort($surname_list);
             break;
         case 'rcount':
             arsort($surname_list);
             break;
     }
     // Note that we count/display SPFX SURN, but sort/group under just SURN
     $surnames = array();
     foreach (array_keys($surname_list) as $surname) {
         $surnames = array_merge($surnames, QueryName::surnames($this->tree, $surname, '', false, false));
     }
     return FunctionsPrintLists::surnameList($surnames, $type == 'list' ? 1 : 2, $show_tot, 'indilist.php', $this->tree);
 }
Exemplo n.º 14
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        ?>
                
        <div id="maj-cert-page" class="center">
			<h2><?php 
        echo $this->data->get('title');
        ?>
</h2>
			
    		<?php 
        if ($this->data->get('has_certif', false)) {
            /** @var Certificate $certificate   */
            $certificate = $this->data->get('certificate');
            $has_linked_indis = $this->data->get('has_linked_indis', false);
            $has_linked_fams = $this->data->get('has_linked_fams', false);
            ?>
    		<div id="certificate-details">
        		<h3>
        			<?php 
            echo $certificate->getCity();
            ?>
        		</h3>
        		<h4>
        			<a href="<?php 
            echo $this->data->get('url_certif_city');
            ?>
">
        			[<?php 
            echo I18N::translate('See all certificates for %s', $certificate->getCity());
            ?>
]
        			</a>
        		</h4>
    			<div id="certificate-tabs">
    				<div id="certificate-edit">
    					<?php 
            echo $certificate->displayImage();
            ?>
    				</div>
    				<?php 
            if ($has_linked_indis || $has_linked_fams) {
                ?>
    				<ul>
    					<?php 
                if ($has_linked_indis) {
                    ?>
    					<li>
    						<a href="#indi-certificate">
    							<span id="indisource"><?php 
                    echo I18N::translate('Individuals');
                    ?>
</span>
    						</a>
    					</li>
    					<?php 
                }
                ?>
    					<?php 
                if ($has_linked_fams) {
                    ?>
    					<li>
    						<a href="#fam-certificate">
    							<span id="famsource"><?php 
                    echo I18N::translate('Families');
                    ?>
</span>
    						</a>
    					</li>
    					<?php 
                }
                ?>
    				</ul>
    				
    				<?php 
                if ($has_linked_indis) {
                    ?>
    				<div id="indi-certificate">
    					<?php 
                    echo FunctionsPrintLists::individualTable($this->data->get('linked_indis'));
                    ?>
    				</div>
					<?php 
                }
                ?>
					
					<?php 
                if ($has_linked_fams) {
                    ?>
    				<div id="fam-certificate">
    					<?php 
                    echo FunctionsPrintLists::familyTable($this->data->get('linked_fams'));
                    ?>
    				</div>
					<?php 
                }
                ?>
					
    				<?php 
            }
            ?>
    			</div>
    		</div>
    		<?php 
        }
        ?>
    	</div>
    	
    	<?php 
    }
Exemplo n.º 15
0
                }
            }
            echo '<br>';
            //-- display results
            $controller->addInlineJavascript('jQuery("#places-tabs").tabs();')->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");')->addInlineJavascript('jQuery(".loading-image").css("display", "none");');
            echo '<div class="loading-image"></div>';
            echo '<div id="places-tabs"><ul>';
            if (!empty($myindilist)) {
                echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>';
            }
            if (!empty($myfamlist)) {
                echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>';
            }
            echo '</ul>';
            if (!empty($myindilist)) {
                echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>';
            }
            if (!empty($myfamlist)) {
                echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>';
            }
            echo '</div>';
            // <div id="places-tabs">
        }
        echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>';
        if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
            $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names);
        }
        break;
}
echo '</div>';
// <div id="place-hierarchy">
Exemplo n.º 16
0
                            break;
                    }
                    if ($count) {
                        if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') {
                            $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
                        } else {
                            $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
                        }
                    } else {
                        $list[] = $html;
                    }
                }
                // Search spiders don't get the "show all" option as the other links give them everything.
                if (!Auth::isSearchEngine()) {
                    if ($show_all_firstnames === 'yes') {
                        $list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
                    } else {
                        $list[] = '<a href="' . $url . '&amp;show_all_firstnames=yes">' . I18N::translate('All') . '</a>';
                    }
                }
                if ($show_all === 'no') {
                    echo '<h2 class="center">', I18N::translate('Individuals with surname %s', $legend), '</h2>';
                }
                echo '<p class="center alpha_index">', implode(' | ', $list), '</p>';
            }
        }
        if ($show === 'indi') {
            echo FunctionsPrintLists::individualTable(QueryName::individuals($WT_TREE, $surname, $alpha, $falpha, $show_marnm === 'yes', false));
        }
    }
}
Exemplo n.º 17
0
    /**
     * Render the Ajax response for the sortable table of Sosa family
     * @param AjaxController $controller
     */
    protected function renderFamSosaListIndi(AjaxController $controller)
    {
        global $WT_TREE;
        $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);
        $this->view_bag->set('has_sosa', false);
        if (count($listFamSosa) > 0) {
            $this->view_bag->set('has_sosa', true);
            $table_id = 'table-sosa-fam-' . Uuid::uuid4();
            $this->view_bag->set('table_id', $table_id);
            $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
                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 . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
                    ' . I18N::datatablesI18N(array(16, 32, 64, 128, -1)) . ',
					jQueryUI: true,
					autoWidth: false,
					processing: true,
					retrieve: true,
					columns: [
						/* 0-Sosa */  	   { dataSort: 1, class: "center"},
		                /* 1-SOSA */ 	   { type: "num", visible: false },
						/* 2-Husb Givn */  { dataSort: 4},
						/* 3-Husb Surn */  { dataSort: 5},
						/* 4-GIVN,SURN */  { type: "unicode", visible: false},
						/* 5-SURN,GIVN */  { type: "unicode", visible: false},
						/* 6-Husb Age  */  { dataSort: 7, class: "center"},
						/* 7-AGE       */  { type: "num", visible: false},
						/* 8-Wife Givn */  { dataSort: 10},
						/* 9-Wife Surn */  { dataSort: 11},
						/* 10-GIVN,SURN */ { type: "unicode", visible: false},
						/* 11-SURN,GIVN */ { type: "unicode", visible: false},
						/* 12-Wife Age  */ { dataSort: 13, class: "center"},
						/* 13-AGE       */ { type: "num", visible: false},
						/* 14-Marr Date */ { dataSort: 15, class: "center"},
						/* 15-MARR:DATE */ { visible: false},
						/* 16-Marr Plac */ { type: "unicode", class: "center"},
						/* 17-Marr Sour */ { dataSort : 18, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' },
						/* 18-Sort Sour */ { visible: false},
						/* 19-Children  */ { dataSort: 20, class: "center"},
						/* 20-NCHI      */ { type: "num", visible: false},
						/* 21-MARR      */ { visible: false},
						/* 22-DEAT      */ { visible: false},
						/* 23-TREE      */ { visible: false}
					],
					sorting: [[0, "asc"]],
					displayLength: 16,
					pagingType: "full_numbers"
			   });
					
				jQuery("#' . $table_id . '")
				/* Hide/show parents */
				.on("click", ".btn-toggle-parents", function() {
					jQuery(this).toggleClass("ui-state-active");
					jQuery(".parents", jQuery(this).closest("table").DataTable().rows().nodes()).slideToggle();
				})
				/* Hide/show statistics */
				.on("click",  ".btn-toggle-statistics", function() {
					jQuery(this).toggleClass("ui-state-active");
					jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle();
				})
				/* Filter buttons in table header */
				.on("click", "button[data-filter-column]", function() {
					var btn = $(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("#sosa-fam-list").css("visibility", "visible");
				
				jQuery("#btn-toggle-statistics-' . $table_id . '").click();
           ');
            $stats = new Stats($WT_TREE);
            $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1;
            //-- init chart data
            $marr_by_age = array();
            for ($age = 0; $age <= $max_age; $age++) {
                $marr_by_age[$age] = '';
            }
            $birt_by_decade = array();
            $marr_by_decade = array();
            for ($year = 1550; $year < 2030; $year += 10) {
                $birt_by_decade[$year] = '';
                $marr_by_decade[$year] = '';
            }
            foreach ($listFamSosa as $sosa => $fid) {
                $sfamily = Family::getInstance($fid, $WT_TREE);
                if (!$sfamily || !$sfamily->canShow()) {
                    unset($sfamily[$sosa]);
                    continue;
                }
                $mdate = $sfamily->getMarriageDate();
                if (($husb = $sfamily->getHusband()) && ($hdate = $husb->getBirthDate()) && $hdate->isOK() && $mdate->isOK()) {
                    if (FunctionsPrint::isDateWithinChartsRange($hdate)) {
                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
                    }
                    $hage = Date::getAge($hdate, $mdate, 0);
                    if ($hage >= 0 && $hage <= $max_age) {
                        $marr_by_age[$hage] .= $husb->getSex();
                    }
                }
                if (($wife = $sfamily->getWife()) && ($wdate = $wife->getBirthDate()) && $wdate->isOK() && $mdate->isOK()) {
                    if (FunctionsPrint::isDateWithinChartsRange($wdate)) {
                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
                    }
                    $wage = Date::getAge($wdate, $mdate, 0);
                    if ($wage >= 0 && $wage <= $max_age) {
                        $marr_by_age[$wage] .= $wife->getSex();
                    }
                }
                if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) {
                    $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex();
                }
                $listFamSosa[$sosa] = $sfamily;
            }
            $this->view_bag->set('sosa_list', $listFamSosa);
            $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
            $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage')));
            $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage')));
        }
        ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render();
    }
Exemplo n.º 18
0
echo $text;
?>
</td>
				</tr>
				<?php 
foreach ($facts as $fact) {
    FunctionsPrintFacts::printFact($fact, $controller->record);
}
if ($controller->record->canEdit()) {
    FunctionsPrint::printAddNewFact($controller->record->getXref(), $facts, 'NOTE');
}
?>
			</table>
		</div>
		<?php 
if ($linked_indi) {
    echo '<div id="indi-note">', FunctionsPrintLists::individualTable($linked_indi), '</div>';
}
if ($linked_fam) {
    echo '<div id="fam-note">', FunctionsPrintLists::familyTable($linked_fam), '</div>';
}
if ($linked_obje) {
    echo '<div id="media-note">', FunctionsPrintLists::mediaTable($linked_obje), '</div>';
}
if ($linked_sour) {
    echo '<div id="source-note">', FunctionsPrintLists::sourceTable($linked_sour), '</div>';
}
?>
	</div>
</div>
<?php 
Exemplo n.º 19
0
            $controller->addInlineJavascript('jQuery("#places-tabs").tabs();')->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");')->addInlineJavascript('jQuery(".loading-image").css("display", "none");');
            echo '<div class="loading-image">&nbsp;</div>';
            echo '<div id="places-tabs"><ul>';
            if ($myindilist) {
                echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>';
            }
            if ($myfamlist) {
                echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>';
            }
            echo '</ul>';
            if ($myindilist) {
                echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>';
            }
            if ($myfamlist) {
                echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>';
            }
            if (!$myindilist && !$myfamlist) {
                echo '<div id="places-indi">', FunctionsPrintLists::individualTable(array()), '</div>';
            }
            echo '</div>';
            // <div id="places-tabs">
        }
        echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>';
        if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
            echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">';
            $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names);
        }
        break;
}
echo '</div>';
// <div id="place-hierarchy">
Exemplo n.º 20
0
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $WT_TREE, $ctype;
     $COMMON_NAMES_REMOVE = $WT_TREE->getPreference('COMMON_NAMES_REMOVE');
     $COMMON_NAMES_THRESHOLD = $WT_TREE->getPreference('COMMON_NAMES_THRESHOLD');
     $num = $this->getBlockSetting($block_id, 'num', '10');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $block = $this->getBlockSetting($block_id, 'block', '0');
     foreach (array('num', 'infoStyle', 'block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     // This next function is a bit out of date, and doesn't cope well with surname variants
     $top_surnames = FunctionsDb::getTopSurnames($WT_TREE->getTreeId(), $COMMON_NAMES_THRESHOLD, $num);
     // Remove names found in the "Remove Names" list
     if ($COMMON_NAMES_REMOVE) {
         foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
             unset($top_surnames[$delname]);
             unset($top_surnames[I18N::strtoupper($delname)]);
         }
     }
     $all_surnames = array();
     $i = 0;
     foreach (array_keys($top_surnames) as $top_surname) {
         $all_surnames = array_merge($all_surnames, QueryName::surnames($WT_TREE, $top_surname, '', false, false));
         if (++$i == $num) {
             break;
         }
     }
     if ($i < $num) {
         $num = $i;
     }
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
         $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
     } else {
         $title = '';
     }
     if ($num == 1) {
         // I18N: i.e. most popular surname.
         $title .= I18N::translate('Top surname');
     } else {
         // I18N: Title for a list of the most common surnames, %s is a number. Note that a separate translation exists when %s is 1
         $title .= I18N::plural('Top %s surname', 'Top %s surnames', $num, I18N::number($num));
     }
     switch ($infoStyle) {
         case 'tagcloud':
             uksort($all_surnames, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
             $content = FunctionsPrintLists::surnameTagCloud($all_surnames, 'indilist.php', true, $WT_TREE);
             break;
         case 'list':
             uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort');
             $content = FunctionsPrintLists::surnameList($all_surnames, '1', true, 'indilist.php', $WT_TREE);
             break;
         case 'array':
             uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort');
             $content = FunctionsPrintLists::surnameList($all_surnames, '2', true, 'indilist.php', $WT_TREE);
             break;
         case 'table':
         default:
             uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort');
             $content = FunctionsPrintLists::surnameTable($all_surnames, 'indilist.php', $WT_TREE);
             break;
     }
     if ($template) {
         if ($block) {
             $class .= ' small_inner_block';
         }
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Exemplo n.º 21
0
 /**
  * Find common surnames.
  *
  * @param string   $type
  * @param bool     $show_tot
  * @param string[] $params
  *
  * @return string
  */
 private function commonSurnamesQuery($type = 'list', $show_tot = false, $params = array())
 {
     if (isset($params[0]) && $params[0] > 0) {
         $threshold = (int) $params[0];
     } else {
         $threshold = $this->tree->getPreference('COMMON_NAMES_THRESHOLD');
     }
     if (isset($params[1])) {
         $maxtoshow = (int) $params[1];
     } else {
         $maxtoshow = 0;
     }
     if (isset($params[2])) {
         $sorting = $params[2];
     } else {
         $sorting = 'alpha';
     }
     $surname_list = FunctionsDb::getCommonSurnames($threshold, $this->tree);
     if (count($surname_list) == 0) {
         return '';
     }
     uasort($surname_list, '\\Fisharebest\\Webtrees\\Stats::nameTotalReverseSort');
     if ($maxtoshow > 0) {
         $surname_list = array_slice($surname_list, 0, $maxtoshow);
     }
     switch ($sorting) {
         default:
         case 'alpha':
             uksort($surname_list, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
             break;
         case 'count':
             uasort($surname_list, '\\Fisharebest\\Webtrees\\Stats::nameTotalSort');
             break;
         case 'rcount':
             uasort($surname_list, '\\Fisharebest\\Webtrees\\Stats::nameTotalReverseSort');
             break;
     }
     // Note that we count/display SPFX SURN, but sort/group under just SURN
     $surnames = array();
     foreach (array_keys($surname_list) as $surname) {
         $surnames = array_merge($surnames, QueryName::surnames($this->tree, $surname, '', false, false));
     }
     return FunctionsPrintLists::surnameList($surnames, $type == 'list' ? 1 : 2, $show_tot, 'indilist.php', $this->tree);
 }
Exemplo n.º 22
0
    echo '<p class="ui-state-error">', $controller->error_message, '</p>';
} else {
    switch ($controller->chart_style) {
        case 0:
            // List
            echo '<ul id="descendancy_chart" class="chart_common">';
            $controller->printChildDescendancy($controller->root, $controller->generations);
            echo '</ul>';
            break;
        case 1:
            // Booklet
            $show_cousins = true;
            echo '<div id="descendancy_booklet">';
            $controller->printChildFamily($controller->root, $controller->generations);
            echo '</div>';
            break;
        case 2:
            // Individual list
            $descendants = $controller->individualDescendancy($controller->root, $controller->generations, array());
            echo '<div id="descendancy-list">', FunctionsPrintLists::individualTable($descendants), '</div>';
            break;
        case 3:
            // Family list
            $descendants = $controller->familyDescendancy($controller->root, $controller->generations, array());
            echo '<div id="descendancy-list">', FunctionsPrintLists::familyTable($descendants), '</div>';
            break;
    }
}
?>
</div>
<?php 
Exemplo n.º 23
0
 * 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>';
Exemplo n.º 24
0
        echo GedcomTag::getLabel('OBJE');
        echo '</td><td class="optionbox">';
        echo '<a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&amp;linktoid=', $controller->record->getXref(), '\', \'_blank\', edit_window_specs); return false;">', I18N::translate('Add a new media object'), '</a>';
        echo FunctionsPrint::helpLink('OBJE');
        echo '<br>';
        echo '<a href="#" onclick="window.open(\'inverselink.php?linktoid=', $controller->record->getXref(), '&amp;linkto=source\', \'_blank\', find_window_specs); return false;">', I18N::translate('Link to an existing media object'), '</a>';
        echo '</td></tr>';
    }
}
echo '</table>
	</div>';
// Individuals linked to this source
if ($linked_indi) {
    echo '<div id="indi-sources">', FunctionsPrintLists::individualTable($linked_indi), '</div>';
}
// Families linked to this source
if ($linked_fam) {
    echo '<div id="fam-sources">', FunctionsPrintLists::familyTable($linked_fam), '</div>';
}
// Media Items linked to this source
if ($linked_obje) {
    echo '<div id="media-sources">', FunctionsPrintLists::mediaTable($linked_obje), '</div>';
}
// Shared Notes linked to this source
if ($linked_note) {
    echo '<div id="note-sources">', FunctionsPrintLists::noteTable($linked_note), '</div>';
}
echo '</div>';
//close div "source-tabs"
echo '</div>';
//close div "source-details"
Exemplo n.º 25
0
        $ancestors = array_filter($ancestors);
        // The SOSA array includes empty placeholders
        foreach ($ancestors as $sosa => $individual) {
            foreach ($individual->getChildFamilies() as $family) {
                FunctionsCharts::printSosaFamily($family->getXref(), $individual->getXref(), $sosa, '', '', '', $controller->show_cousins, $controller->showFull());
            }
        }
        echo '</div>';
        break;
    case 2:
        // Individual list
        $ancestors = $controller->sosaAncestors($controller->generations);
        $ancestors = array_filter($ancestors);
        // The SOSA array includes empty placeholders
        echo '<div id="ancestry-list">', FunctionsPrintLists::individualTable($ancestors, 'sosa'), '</div>';
        break;
    case 3:
        // Family list
        $ancestors = $controller->sosaAncestors($controller->generations - 1);
        $ancestors = array_filter($ancestors);
        // The SOSA array includes empty placeholders
        $families = array();
        foreach ($ancestors as $individual) {
            foreach ($individual->getChildFamilies() as $family) {
                $families[$family->getXref()] = $family;
            }
        }
        echo '<div id="ancestry-list">', FunctionsPrintLists::familyTable($families), '</div>';
        break;
}
echo '</div>';
Exemplo n.º 26
0
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $WT_TREE, $ctype;
     $COMMON_NAMES_REMOVE = $WT_TREE->getPreference('COMMON_NAMES_REMOVE');
     $COMMON_NAMES_THRESHOLD = $WT_TREE->getPreference('COMMON_NAMES_THRESHOLD');
     $num = $this->getBlockSetting($block_id, 'num', '10');
     // The “Minimum number of occurrences” input field from Control Panel’s Preferences page
     // has to be copied here otherwise user doesn't understand why the result is different
     // than expected (input of add and remove surnames may also be copied to make this module
     // indenpendent from module statistics; it is not copied yet).  The data of original input
     // field is still used in the bottom of the statistics module
     $threshold = $this->getBlockSetting($block_id, 'threshold', '5');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $block = $this->getBlockSetting($block_id, 'block', '0');
     foreach (array('num', 'infoStyle', 'block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     // This next function is a bit out of date, and doesn't cope well with surname variants
     // First defining the upper limit of surname occurrences to get at least one row in
     // result list if user sets too high number in “Minimum number of occurrences” field.
     // Without this definition a short message “No data available in table” appears by
     // webtrees\packages\datatables-1.10.7\js\jquery.dataTables.min.js JavaScript file
     // without the possibility of translating (and only if presentation style is table;
     // all other styles result no message at all)
     $top_surnames_in_DB = FunctionsDb::getCommonSurnames($WT_TREE->getPreference('COMMON_NAMES_THRESHOLD'), $WT_TREE);
     $max_occurrences = 0;
     foreach ($top_surnames_in_DB as $array) {
         if ($array['match'] > $max_occurrences) {
             $max_occurrences = $array['match'];
         }
     }
     if ($threshold > $max_occurrences) {
         $threshold = $max_occurrences;
     }
     $top_surnames = FunctionsDb::getTopSurnames($WT_TREE->getTreeId(), $threshold, $num);
     // Remove names found in the "Remove Names" list
     if ($COMMON_NAMES_REMOVE) {
         foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
             unset($top_surnames[$delname]);
             unset($top_surnames[I18N::strtoupper($delname)]);
         }
     }
     $all_surnames = array();
     $i = 0;
     foreach (array_keys($top_surnames) as $top_surname) {
         $all_surnames = array_merge($all_surnames, QueryName::surnames($WT_TREE, $top_surname, '', false, false));
         if (++$i == $num) {
             break;
         }
     }
     if ($i < $num) {
         $num = $i;
     }
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
         $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
     } else {
         $title = '';
     }
     if ($num == 1) {
         // I18N: i.e. most popular surname.
         $title .= I18N::translate('Top surname');
     } else {
         // I18N: Title for a list of the most common surnames, %s is a number.  Note that a separate translation exists when %s is 1
         $title .= I18N::plural('Top %s surname', 'Top %s surnames', $num, I18N::number($num));
     }
     switch ($infoStyle) {
         case 'tagcloud':
             uksort($all_surnames, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
             $content = FunctionsPrintLists::surnameTagCloud($all_surnames, 'indilist.php', true, $WT_TREE);
             break;
         case 'list':
             uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort');
             $content = FunctionsPrintLists::surnameList($all_surnames, '1', true, 'indilist.php', $WT_TREE);
             break;
         case 'array':
             uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort');
             $content = FunctionsPrintLists::surnameList($all_surnames, '2', true, 'indilist.php', $WT_TREE);
             break;
         case 'table':
         default:
             uasort($all_surnames, '\\Fisharebest\\Webtrees\\Module\\TopSurnamesModule::surnameCountSort');
             $content = FunctionsPrintLists::surnameTable($all_surnames, 'indilist.php', $WT_TREE);
             break;
     }
     if ($template) {
         if ($block) {
             $class .= ' small_inner_block';
         }
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }