Пример #1
0
 /**
  * Convert a GEDCOM age string to localized text.
  *
  * @param string $age_string
  * @param bool $show_years
  *
  * @return string
  */
 public static function getAgeAtEvent($age_string, $show_years)
 {
     switch (strtoupper($age_string)) {
         case 'CHILD':
             return I18N::translate('Child');
         case 'INFANT':
             return I18N::translate('Infant');
         case 'STILLBORN':
             return I18N::translate('Stillborn');
         default:
             return preg_replace_callback(array('/(\\d+)([ymwd])/'), function ($match) use($age_string, $show_years) {
                 switch ($match[2]) {
                     case 'y':
                         if ($show_years || preg_match('/[dm]/', $age_string)) {
                             return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
                         } else {
                             return I18N::digits($match[1]);
                         }
                     case 'm':
                         return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
                     case 'w':
                         return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
                     case 'd':
                         return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
                 }
             }, $age_string);
     }
 }
Пример #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 $WT_TREE;
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = $this->getTitle();
     $anonymous = 0;
     $logged_in = array();
     $content = '';
     foreach (User::allLoggedIn() as $user) {
         if (Auth::isAdmin() || $user->getPreference('visibleonline')) {
             $logged_in[] = $user;
         } else {
             $anonymous++;
         }
     }
     $count_logged_in = count($logged_in);
     $content .= '<div class="logged_in_count">';
     if ($anonymous) {
         $content .= I18N::plural('%s anonymous signed-in user', '%s anonymous signed-in users', $anonymous, I18N::number($anonymous));
         if ($count_logged_in) {
             $content .= '&nbsp;|&nbsp;';
         }
     }
     if ($count_logged_in) {
         $content .= I18N::plural('%s signed-in user', '%s signed-in users', $count_logged_in, I18N::number($count_logged_in));
     }
     $content .= '</div>';
     $content .= '<div class="logged_in_list">';
     if (Auth::check()) {
         foreach ($logged_in as $user) {
             $individual = Individual::getInstance($WT_TREE->getUserPreference($user, 'gedcomid'), $WT_TREE);
             $content .= '<div class="logged_in_name">';
             if ($individual) {
                 $content .= '<a href="' . $individual->getHtmlUrl() . '">' . $user->getRealNameHtml() . '</a>';
             } else {
                 $content .= $user->getRealNameHtml();
             }
             $content .= ' - ' . Filter::escapeHtml($user->getUserName());
             if (Auth::id() != $user->getUserId() && $user->getPreference('contactmethod') != 'none') {
                 $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . Filter::escapeHtml($user->getUserName()) . '\', \'\', \'' . Filter::escapeHtml(Functions::getQueryUrl()) . '\');" title="' . I18N::translate('Send a message') . '"></a>';
             }
             $content .= '</div>';
         }
     }
     $content .= '</div>';
     if ($anonymous === 0 && $count_logged_in === 0) {
         return '';
     }
     if ($template) {
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Пример #3
0
        echo I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 50, I18N::digits(1800), I18N::number(50));
        ?>
									</option>
									<option value="1900,1920,1940,1960,1980,1990,2000">
										<?php 
        echo I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 20, I18N::digits(1900), I18N::number(20));
        ?>
									</option>
									<option value="1900,1925,1950,1975,2000">
										<?php 
        echo I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 25, I18N::digits(1900), I18N::number(25));
        ?>
									</option>
									<option value="1940,1950,1960,1970,1980,1990,2000">
										<?php 
        echo I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 10, I18N::digits(1940), I18N::number(10));
        ?>
									</option>
								</select>
								<br>
								<br>
								<?php 
        echo I18N::translate('Results');
        ?>
								<br>
								<label>
									<input type="radio" name="y-as" value="201" checked>
									<?php 
        echo I18N::translate('numbers');
        ?>
								</label>
Пример #4
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;
        $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];
            }
        }
        $stats = new Stats($WT_TREE);
        $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 given name.
            $title .= I18N::translate('Top given name');
        } else {
            // I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1
            $title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num));
        }
        $content = '<div class="normal_inner_block">';
        //Select List or Table
        switch ($infoStyle) {
            case "list":
                // Output style 1:  Simple list style. Better suited to left side of page.
                if (I18N::direction() === 'ltr') {
                    $padding = 'padding-left: 15px';
                } else {
                    $padding = 'padding-right: 15px';
                }
                $params = array(1, $num, 'rcount');
                // List Female names
                $totals = $stats->commonGivenFemaleTotals($params);
                if ($totals) {
                    $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
                }
                // List Male names
                $totals = $stats->commonGivenMaleTotals($params);
                if ($totals) {
                    $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
                }
                break;
            case "table":
                // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
                $params = array(1, $num, 'rcount');
                $content .= '<table style="margin:auto;">
						<tr valign="top">
						<td>' . $stats->commonGivenFemaleTable($params) . '</td>
						<td>' . $stats->commonGivenMaleTable($params) . '</td>';
                $content .= '</tr></table>';
                break;
        }
        $content .= "</div>";
        if ($template) {
            if ($block) {
                $class .= ' small_inner_block';
            }
            return Theme::theme()->formatBlock($id, $title, $class, $content);
        } else {
            return $content;
        }
    }
Пример #5
0
 /**
  * Who is currently logged in?
  *
  * @param string $type
  *
  * @return string
  */
 private function usersLoggedInQuery($type = 'nolist')
 {
     $content = '';
     // List active users
     $NumAnonymous = 0;
     $loggedusers = array();
     foreach (User::allLoggedIn() as $user) {
         if (Auth::isAdmin() || $user->getPreference('visibleonline')) {
             $loggedusers[] = $user;
         } else {
             $NumAnonymous++;
         }
     }
     $LoginUsers = count($loggedusers);
     if ($LoginUsers == 0 && $NumAnonymous == 0) {
         return I18N::translate('No logged-in and no anonymous users');
     }
     if ($NumAnonymous > 0) {
         $content .= '<b>' . I18N::plural('%s anonymous logged-in user', '%s anonymous logged-in users', $NumAnonymous, I18N::number($NumAnonymous)) . '</b>';
     }
     if ($LoginUsers > 0) {
         if ($NumAnonymous) {
             if ($type == 'list') {
                 $content .= "<br><br>";
             } else {
                 $content .= " " . I18N::translate('and') . " ";
             }
         }
         $content .= '<b>' . I18N::plural('%s logged-in user', '%s logged-in users', $LoginUsers, I18N::number($LoginUsers)) . '</b>';
         if ($type == 'list') {
             $content .= '<ul>';
         } else {
             $content .= ': ';
         }
     }
     if (Auth::check()) {
         foreach ($loggedusers as $user) {
             if ($type == 'list') {
                 $content .= '<li>' . Filter::escapeHtml($user->getRealName()) . ' - ' . Filter::escapeHtml($user->getUserName());
             } else {
                 $content .= Filter::escapeHtml($user->getRealName()) . ' - ' . Filter::escapeHtml($user->getUserName());
             }
             if (Auth::id() != $user->getUserId() && $user->getPreference('contactmethod') != 'none') {
                 if ($type == 'list') {
                     $content .= '<br><a class="icon-email" href="#" onclick="return message(\'' . $user->getUserId() . '\', \'\', \'' . Filter::escapeJs(Functions::getQueryUrl()) . '\');" title="' . I18N::translate('Send a message') . '"></a>';
                 } else {
                     $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . $user->getUserId() . '\', \'\', \'' . Filter::escapeJs(Functions::getQueryUrl()) . '\');" title="' . I18N::translate('Send a message') . '"></a>';
                 }
             }
             if ($type == 'list') {
                 $content .= '</li>';
             }
         }
     }
     if ($type == 'list') {
         $content .= '</ul>';
     }
     return $content;
 }
Пример #6
0
    /**
     * Display a map showing the originas of ones ancestors.
     */
    private function pedigreeMap()
    {
        global $controller, $WT_TREE;
        $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
        $controller = new ChartController();
        $this->generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS'));
        $this->treesize = pow(2, $this->generations) - 1;
        $this->ancestors = array_values($controller->sosaAncestors($this->generations));
        // Start of internal configuration variables
        // Limit this to match available number of icons.
        // 8 generations equals 255 individuals
        $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8);
        // End of internal configuration variables
        $controller->setPageTitle(I18N::translate('Pedigree map of %s', $controller->root->getFullName()))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
        echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">';
        echo '<div id="pedigreemap-page">
				<h2>', $controller->getPageTitle(), '</h2>';
        // -- print the form to change the number of displayed generations
        ?>
		<form name="people" method="get" action="?">
			<input type="hidden" name="ged" value="<?php 
        echo $WT_TREE->getNameHtml();
        ?>
">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="pedigree_map">
			<table class="list_table" width="555">
				<tr>
					<td class="descriptionbox wrap">
						<?php 
        echo I18N::translate('Individual');
        ?>
					</td>
					<td class="optionbox">
						<input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php 
        echo $controller->root->getXref();
        ?>
">
						<?php 
        echo FunctionsPrint::printFindIndividualLink('rootid');
        ?>
					</td>
					<td class="topbottombar" rowspan="2">
						<input type="submit" value="<?php 
        echo I18N::translate('View');
        ?>
">
					</td>
				</tr>
				<tr>
					<td class="descriptionbox wrap">
						<?php 
        echo I18N::translate('Generations');
        ?>
					</td>
					<td class="optionbox">
						<select name="PEDIGREE_GENERATIONS">
						<?php 
        for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) {
            echo '<option value="', $p, '" ';
            if ($p == $this->generations) {
                echo 'selected';
            }
            echo '>', $p, '</option>';
        }
        ?>
						</select>
					</td>
				</tr>
			</table>
		</form>
		<!-- end of form -->

		<!-- count records by type -->
		<?php 
        $curgen = 1;
        $priv = 0;
        $count = 0;
        $miscount = 0;
        $missing = '';
        $latlongval = array();
        $lat = array();
        $lon = array();
        for ($i = 0; $i < $this->treesize; $i++) {
            // -- check to see if we have moved to the next generation
            if ($i + 1 >= pow(2, $curgen)) {
                $curgen++;
            }
            $person = $this->ancestors[$i];
            if (!empty($person)) {
                $name = $person->getFullName();
                if ($name == I18N::translate('Private')) {
                    $priv++;
                }
                $place = $person->getBirthPlace();
                if (empty($place)) {
                    $latlongval[$i] = null;
                } else {
                    $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace());
                }
                if ($latlongval[$i]) {
                    $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati);
                    $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
                    if ($lat[$i] && $lon[$i]) {
                        $count++;
                    } else {
                        // The place is in the table but has empty values
                        if ($name) {
                            if ($missing) {
                                $missing .= ', ';
                            }
                            $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                            $miscount++;
                        }
                    }
                } else {
                    // There was no place, or not listed in the map table
                    if ($name) {
                        if ($missing) {
                            $missing .= ', ';
                        }
                        $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                        $miscount++;
                    }
                }
            }
        }
        //<!-- end of count records by type -->
        //<!-- start of map display -->
        echo '<div id="pedigreemap_chart">';
        echo '<table class="tabs_table" cellspacing="0" cellpadding="0" border="0" width="100%">';
        echo '<tr>';
        echo '<td valign="top">';
        echo '<div id="pm_map" style="border: 1px solid gray; height: ', $this->getSetting('GM_YSIZE'), 'px; font-size: 0.9em;';
        echo '"><i class="icon-loading-large"></i></div>';
        if (Auth::isAdmin()) {
            echo '<table width="100%">';
            echo '<tr><td align="left">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>';
            echo '</td>';
            echo '<td align="center">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_places">', I18N::translate('Geographic data'), '</a>';
            echo '</td>';
            echo '<td align="right">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">', I18N::translate('Place check'), '</a>';
            echo '</td></tr>';
            echo '</table>';
        }
        echo '</td><td width="15px"></td>';
        echo '<td width="310px" valign="top">';
        echo '<div id="side_bar" style="width:300px; font-size:0.9em; overflow:auto; overflow-x:hidden; overflow-y:auto; height:', $this->getSetting('GM_YSIZE'), 'px;"></div></td>';
        echo '</tr>';
        echo '</table>';
        // display info under map
        echo '<hr>';
        echo '<table cellspacing="0" cellpadding="0" border="0" width="100%">';
        echo '<tr>';
        echo '<td valign="top">';
        // print summary statistics
        if (isset($curgen)) {
            $total = pow(2, $curgen) - 1;
            echo I18N::plural('%1$s individual displayed, out of the normal total of %2$s, from %3$s generations.', '%1$s individuals displayed, out of the normal total of %2$s, from %3$s generations.', $count, I18N::number($count), I18N::number($total), I18N::number($curgen)), '<br>';
            echo '</td>';
            echo '</tr>';
            echo '<tr>';
            echo '<td valign="top">';
            if ($priv) {
                echo I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>';
            }
            if ($count + $priv != $total) {
                if ($miscount == 0) {
                    echo I18N::translate('No ancestors in the database.'), "<br>";
                } else {
                    echo I18N::plural('%1$s individual is missing birthplace map coordinates: %2$s.', '%1$s individuals are missing birthplace map coordinates: %2$s.', $miscount, I18N::number($miscount), $missing), '<br>';
                }
            }
        }
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
        // close #pedigreemap_chart
        echo '</div>';
        // close #pedigreemap-page
        ?>
		<!-- end of map display -->
		<!-- Start of map scripts -->
		<?php 
        echo '<script src="', $this->googleMapsScript(), '"></script>';
        $controller->addInlineJavascript($this->pedigreeMapJavascript());
    }
Пример #7
0
		<label for="MAX_EXECUTION_TIME" class="col-sm-3 control-label">
			<?php 
    echo I18N::translate('PHP time limit');
    ?>
		</label>
		<div class="col-sm-9">
			<input type="text" class="form-control" id="MAX_EXECUTION_TIME" name="MAX_EXECUTION_TIME" value="<?php 
    echo Filter::escapeHtml(Site::getPreference('MAX_EXECUTION_TIME'));
    ?>
" pattern="[0-9]*" placeholder="<?php 
    echo get_cfg_var('max_execution_time');
    ?>
" maxlength="255">
			<p class="small text-muted">
				<?php 
    echo I18N::plural('By default, your server allows scripts to run for %s second.', 'By default, your server allows scripts to run for %s seconds.', get_cfg_var('max_execution_time'), I18N::number(get_cfg_var('max_execution_time')));
    ?>
				<?php 
    echo I18N::translate('You can request a higher or lower limit, although the server may ignore this request.');
    ?>
				<?php 
    echo I18N::translate('If you leave this setting empty, the default value will be used.');
    ?>
			</p>
		</div>
	</div>

	<!-- TIMEZONE -->
	<div class="form-group">
		<label for="TIMEZONE" class="col-sm-3 control-label">
			<?php 
Пример #8
0
        try {
            Database::prepare("UPDATE `##favorite` SET xref = ? WHERE xref = ? AND gedcom_id = ?")->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
        } catch (\Exception $ex) {
            // Perhaps the favorites module was not installed?
        }
        // How much time do we have left?
        if (microtime(true) - WT_START_TIME > ini_get('max_execution_time') - 2) {
            echo '<p>', I18N::translate('The server’s time limit has been reached.'), '</p>';
            break;
        }
    }
    if ($xrefs) {
    }
} else {
    echo '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>';
    echo '<p>', I18N::translate('You can renumber the records in a family tree, so that these internal reference numbers are not duplicated in any other family tree.'), '</p>';
}
echo '<p>', I18N::plural('This family tree has %s record which uses the same “XREF” as another family tree.', 'This family tree has %s records which use the same “XREF” as another family tree.', count($xrefs), count($xrefs)), '</p>';
if ($xrefs) {
    // We use GET (not POST) for this update operation - because we want the user to
    // be able to press F5 to continue after a timeout.
    echo '<form>';
    echo '<p>', I18N::translate('You can renumber this family tree.'), '</p>';
    echo '<button type="submit" class="btn btn-primary">';
    echo '<i class="fa fa-check"></i> ', I18N::translate('continue');
    echo '</button>';
    echo '<input type="hidden" name="action" value="renumber">';
    echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">';
    echo '</form>';
    echo '<p>', I18N::translate('Caution! This may take a long time. Be patient.'), '</p>';
}
Пример #9
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;
     $block = $this->getBlockSetting($block_id, 'block', '1');
     foreach (array('block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     $messages = Database::prepare("SELECT message_id, sender, subject, body, UNIX_TIMESTAMP(created) AS created FROM `##message` WHERE user_id=? ORDER BY message_id DESC")->execute(array(Auth::id()))->fetchAll();
     $count = count($messages);
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = I18N::plural('%s message', '%s messages', $count, I18N::number($count));
     $users = array_filter(User::all(), function (User $user) {
         return $user->getUserId() !== Auth::id() && $user->getPreference('verified_by_admin') && $user->getPreference('contactmethod') !== 'none';
     });
     $content = '<form id="messageform" name="messageform" method="post" action="module.php?mod=user_messages&mod_action=delete" onsubmit="return confirm(\'' . I18N::translate('Are you sure you want to delete this message?  It cannot be retrieved later.') . '\');">';
     $content .= '<input type="hidden" name="ged" value="' . $ctype . '">';
     $content .= '<input type="hidden" name="ctype" value="' . $WT_TREE->getNameHtml() . '">';
     if ($users) {
         $content .= '<label for="touser">' . I18N::translate('Send a message') . '</label>';
         $content .= '<select id="touser" name="touser">';
         $content .= '<option value="">' . I18N::translate('&lt;select&gt;') . '</option>';
         foreach ($users as $user) {
             $content .= sprintf('<option value="%1$s">%2$s - %1$s</option>', Filter::escapeHtml($user->getUserName()), Filter::escapeHtml($user->getRealName()));
         }
         $content .= '</select>';
         $content .= '<input type="button" value="' . I18N::translate('Send') . '" onclick="return message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\');"><br><br>';
     }
     if ($messages) {
         $content .= '<table class="list_table"><tr>';
         $content .= '<th class="list_label">' . I18N::translate('Delete') . '<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">' . I18N::translate('All') . '</a></th>';
         $content .= '<th class="list_label">' . I18N::translate('Subject') . '</th>';
         $content .= '<th class="list_label">' . I18N::translate('Date sent') . '</th>';
         $content .= '<th class="list_label">' . I18N::translate('Email address') . '</th>';
         $content .= '</tr>';
         foreach ($messages as $message) {
             $content .= '<tr>';
             $content .= '<td class="list_value_wrap"><input type="checkbox" name="message_id[]" value="' . $message->message_id . '" id="cb_message' . $message->message_id . '"></td>';
             $content .= '<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message' . $message->message_id . '\');"><i id="message' . $message->message_id . '_img" class="icon-plus"></i> <b dir="auto">' . Filter::escapeHtml($message->subject) . '</b></a></td>';
             $content .= '<td class="list_value_wrap">' . FunctionsDate::formatTimestamp($message->created + WT_TIMESTAMP_OFFSET) . '</td>';
             $content .= '<td class="list_value_wrap">';
             $user = User::findByIdentifier($message->sender);
             if ($user) {
                 $content .= $user->getRealNameHtml();
                 $content .= '  - <span dir="auto">' . $user->getEmail() . '</span>';
             } else {
                 $content .= '<a href="mailto:' . Filter::escapeHtml($message->sender) . '">' . Filter::escapeHtml($message->sender) . '</a>';
             }
             $content .= '</td>';
             $content .= '</tr>';
             $content .= '<tr><td class="list_value_wrap" colspan="4"><div id="message' . $message->message_id . '" style="display:none;">';
             $content .= '<div dir="auto" style="white-space: pre-wrap;">' . Filter::expandUrls($message->body) . '</div><br>';
             if (strpos($message->subject, I18N::translate('RE: ')) !== 0) {
                 $message->subject = I18N::translate('RE: ') . $message->subject;
             }
             if ($user) {
                 $content .= '<button type="button" onclick="reply(\'' . Filter::escapeJs($message->sender) . '\', \'' . Filter::escapeJs($message->subject) . '\'); return false;">' . I18N::translate('Reply') . '</button> ';
             }
             $content .= '<button type="button" onclick="if (confirm(\'' . I18N::translate('Are you sure you want to delete this message?  It cannot be retrieved later.') . '\')) {jQuery(\'#messageform :checkbox\').prop(\'checked\', false); jQuery(\'#cb_message' . $message->message_id . '\').prop(\'checked\', true); document.messageform.submit();}">' . I18N::translate('Delete') . '</button></div></td></tr>';
         }
         $content .= '</table>';
         $content .= '<p><button type="submit">' . I18N::translate('Delete selected messages') . '</button></p>';
     }
     $content .= '</form>';
     if ($template) {
         if ($block) {
             $class .= ' small_inner_block';
         }
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Пример #10
0
    copy('app/GedcomTag.php', WT_DATA_DIR . 'GedcomTag' . date('-Y-m-d') . '.php');
} catch (\ErrorException $ex) {
    // No problem if we cannot do this.
}
reset_timeout();
$start_time = microtime(true);
$res = $archive->extract(\PCLZIP_OPT_PATH, WT_ROOT, \PCLZIP_OPT_REMOVE_PATH, 'webtrees', \PCLZIP_OPT_REPLACE_NEWER);
$end_time = microtime(true);
if (is_array($res)) {
    foreach ($res as $result) {
        // Note that most of the folders will already exist, so it is not an error if we cannot create them
        if ($result['status'] != 'ok' && !substr($result['filename'], -1) == '/') {
            echo '<br>', I18N::translate('The file %s could not be created.', Html::filename($result['filename'])), $icon_failure;
        }
    }
    echo '<br>', I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', count($res), count($res), I18N::number($end_time - $start_time, 2)), $icon_success;
} else {
    echo '<br>', I18N::translate('An error occurred when unzipping the file.'), $icon_failure;
    echo '</li></ul></form>';
    return;
}
echo '</li>';
////////////////////////////////////////////////////////////////////////////////
// All done - put the site back online
////////////////////////////////////////////////////////////////////////////////
echo '<li>', I18N::translate('Place the website online, by deleting the file %s…', Html::filename($lock_file));
if (File::delete($lock_file)) {
    echo '<br>', I18N::translate('The file %s has been deleted.', Html::filename($lock_file)), $icon_success;
} else {
    echo '<br>', I18N::translate('The file %s could not be deleted.', Html::filename($lock_file)), $icon_failure;
}
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
         $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
         $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', '7');
     $filter = $this->getBlockSetting($block_id, 'filter', '1');
     $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only events of living individuals');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('filter', $filter);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only births, deaths, and marriages');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('alpha' => I18N::translate('sort by name'), 'anniv' => I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Пример #12
0
 /**
  * Print a list of events
  *
  * This performs the same function as print_events_table(), but formats the output differently.
  *
  * @param int $startjd
  * @param int $endjd
  * @param string $events
  * @param bool $only_living
  * @param string $sort_by
  *
  * @return string
  */
 public static function eventsList($startjd, $endjd, $events = 'BIRT MARR DEAT', $only_living = false, $sort_by = 'anniv')
 {
     global $WT_TREE;
     // Did we have any output?  Did we skip anything?
     $output = 0;
     $filter = 0;
     $filtered_events = array();
     $html = '';
     foreach (FunctionsDb::getEventsList($startjd, $endjd, $events, $WT_TREE) as $fact) {
         $record = $fact->getParent();
         //-- only living people ?
         if ($only_living) {
             if ($record instanceof Individual && $record->isDead()) {
                 $filter++;
                 continue;
             }
             if ($record instanceof Family) {
                 $husb = $record->getHusband();
                 if (is_null($husb) || $husb->isDead()) {
                     $filter++;
                     continue;
                 }
                 $wife = $record->getWife();
                 if (is_null($wife) || $wife->isDead()) {
                     $filter++;
                     continue;
                 }
             }
         }
         $output++;
         $filtered_events[] = $fact;
     }
     // Now we've filtered the list, we can sort by event, if required
     switch ($sort_by) {
         case 'anniv':
             // Data is already sorted by anniversary date
             break;
         case 'alpha':
             uasort($filtered_events, function (Fact $x, Fact $y) {
                 return GedcomRecord::compare($x->getParent(), $y->getParent());
             });
             break;
     }
     foreach ($filtered_events as $fact) {
         $record = $fact->getParent();
         $html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item name2">' . $record->getFullName() . '</a>';
         if ($record instanceof Individual) {
             $html .= $record->getSexImage();
         }
         $html .= '<br><div class="indent">';
         $html .= $fact->getLabel() . ' — ' . $fact->getDate()->display(true);
         if ($fact->anniv) {
             $html .= ' (' . I18N::translate('%s year anniversary', I18N::number($fact->anniv)) . ')';
         }
         if (!$fact->getPlace()->isEmpty()) {
             $html .= ' — <a href="' . $fact->getPlace()->getURL() . '">' . $fact->getPlace()->getFullName() . '</a>';
         }
         $html .= '</div>';
     }
     // Print a final summary message about restricted/filtered facts
     $summary = '';
     if ($endjd == WT_CLIENT_JD) {
         // We're dealing with the Today’s Events block
         if ($output == 0) {
             if ($filter == 0) {
                 $summary = I18N::translate('No events exist for today.');
             } else {
                 $summary = I18N::translate('No events for living individuals exist for today.');
             }
         }
     } else {
         // We're dealing with the Upcoming Events block
         if ($output == 0) {
             if ($filter == 0) {
                 if ($endjd == $startjd) {
                     $summary = I18N::translate('No events exist for tomorrow.');
                 } else {
                     // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow”
                     $summary = I18N::plural('No events exist for the next %s day.', 'No events exist for the next %s days.', $endjd - $startjd + 1, I18N::number($endjd - $startjd + 1));
                 }
             } else {
                 if ($endjd == $startjd) {
                     $summary = I18N::translate('No events for living individuals exist for tomorrow.');
                 } else {
                     // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow”
                     $summary = I18N::plural('No events for living people exist for the next %s day.', 'No events for living people exist for the next %s days.', $endjd - $startjd + 1, I18N::number($endjd - $startjd + 1));
                 }
             }
         }
     }
     if ($summary) {
         $html .= "<b>" . $summary . "</b>";
     }
     return $html;
 }
Пример #13
0
        echo " onclick=\"statusDisable('z-axis-boundaries-periods');";
        echo '"><label for="z_none">', I18N::translate('overall'), '</label><br>';
        echo '<input type="radio" id="z_sex" name="z-as" value="301" ';
        echo " onclick=\"statusDisable('z-axis-boundaries-periods');";
        echo '"><label for="z_sex">', I18N::translate('gender'), '</label><br>';
        echo '<input type="radio" id="z_time" name="z-as" value="302" checked';
        echo " onclick=\"statusEnable('z-axis-boundaries-periods');";
        echo '"><label for="z_time">', I18N::translate('date periods'), '</label><br><br>';
        echo I18N::translate('Date range'), '<br>';
        echo '<select id="z-axis-boundaries-periods" name="z-axis-boundaries-periods">
				<option value="1700,1750,1800,1850,1900,1950,2000" selected>', I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 50, I18N::digits(1700), I18N::number(50)), '</option>
				<option value="1800,1840,1880,1920,1950,1970,2000">', I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 40, I18N::digits(1800), I18N::number(40)), '</option>
				<option value="1800,1850,1900,1950,2000">', I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 50, I18N::digits(1800), I18N::number(50)), '</option>
				<option value="1900,1920,1940,1960,1980,1990,2000">', I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 20, I18N::digits(1900), I18N::number(20)), '</option>
				<option value="1900,1925,1950,1975,2000">', I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 25, I18N::digits(1900), I18N::number(25)), '</option>
				<option value="1940,1950,1960,1970,1980,1990,2000">', I18N::plural('from %1$s interval %2$s year', 'from %1$s interval %2$s years', 10, I18N::digits(1940), I18N::number(10)), '</option>
			</select>
			<br><br>';
        echo I18N::translate('Results'), '<br>';
        echo '<input type="radio" id="y_num" name="y-as" value="201" checked';
        echo '><label for="y_num">', I18N::translate('numbers'), '</label><br>';
        echo '<input type="radio" id="y_perc" name="y-as" value="202" ';
        echo '><label for="y_perc">', I18N::translate('percentage'), '</label><br>';
        echo '</td>
			</tr>
			</table>
			<table width="100%">
			<tr align="center"><td>
				<br>
				<input type="submit" value="', I18N::translate('show the plot'), ' ">
				<input type="reset"  value=" ', I18N::translate('reset'), ' " onclick="{statusEnable(\'z_sex\'); statusHide(\'x_years\'); statusHide(\'x_months\'); statusHide(\'x_numbers\'); statusHide(\'map_opt\');}"><br>
Пример #14
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        ?>
                
        <div id="maj-sosa-stats-page">
			<h2><?php 
        echo $this->data->get('title');
        ?>
</h2>
			
			<?php 
        /** @var \Fisharebest\Webtrees\Individual $root_indi */
        $root_indi = $this->data->get('root_indi');
        if ($root_indi !== null && $root_indi->canShowName()) {
            ?>
			<h4 class="center"><?php 
            echo I18N::translate('%s: %s', I18N::translate('Root individual'), $root_indi->getFullName());
            ?>
<h4>
			<?php 
        }
        ?>
			
			<?php 
        if ($this->data->get('is_setup')) {
            $general_stats = $this->data->get('general_stats');
            ?>
			<h3><?php 
            echo I18N::translate('General statistics');
            ?>
</h3>
			<div class="maj-table">
				<div class="maj-row">
					<div class="label"><?php 
            echo I18N::translate('Number of ancestors');
            ?>
</div>
					<div class="value"><?php 
            echo I18N::number($general_stats['sosa_count']);
            ?>
</div>
				</div>
				<div class="maj-row">
					<div class="label"><?php 
            echo I18N::translate('Number of different ancestors');
            ?>
</div>
					<div class="value"><?php 
            echo I18N::number($general_stats['distinct_count']);
            ?>
</div>
				</div>
				<div class="maj-row">
					<div class="label"><?php 
            echo I18N::translate('%% of ancestors in the base');
            ?>
</div>
					<div class="value"><?php 
            echo I18N::percentage($general_stats['sosa_rate'], 1);
            ?>
</div>
				</div>
				<div class="maj-row">
					<div class="label"><?php 
            echo I18N::translate('Pedigree collapse');
            ?>
</div>
					<div class="value"><?php 
            echo I18N::percentage($general_stats['pedi_collapse'], 2);
            ?>
</div>
				</div>
				<div class="maj-row">
					<div class="label"><?php 
            echo I18N::translate('Mean generation time');
            ?>
</div>
					<div class="value"><?php 
            echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'], I18N::number($general_stats['mean_gen_time'], 1));
            ?>
</div>
				</div>
			</div>
			
			<h3><?php 
            echo I18N::translate('Statistics by generations');
            ?>
</h3>
			<table class="maj-table">
				<thead>
					<tr class="maj-row">
						<th class="label" colspan="2" >&nbsp;</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Theoretical number of ancestors in generation G.');
            ?>
">
							<?php 
            echo I18N::translate('Theoretical');
            ?>
						</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Number of ancestors found in generation G. A same individual can be counted several times.');
            ?>
">
							<?php 
            echo I18N::translate('Known');
            ?>
						</th>				
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Ratio of found ancestors in generation G compared to the theoretical number.');
            ?>
">
							<?php 
            echo I18N::translate('%');
            ?>
						</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Number of ancestors not found in generation G, but whose children are known in generation G-1.');
            ?>
">
							<?php 
            echo I18N::translate('Losses G-1');
            ?>
						</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Ratio of not found ancestors in generation G amongst the theoretical ancestors in this generation whose children are known in generation G-1. This is an indicator of the completion of a generation relative to the completion of the previous generation.');
            ?>
">
							<?php 
            echo I18N::translate('%');
            ?>
						</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Cumulative number of ancestors found up to generation G. A same individual can be counted  several times.');
            ?>
">
							<?php 
            echo I18N::translate('Total known');
            ?>
						</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Ratio of cumulative found ancestors in generation G compared to the cumulative theoretical number.');
            ?>
">
						<?php 
            echo I18N::translate('%');
            ?>
</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Number of distinct ancestors found in generation G. A same individual is counted only once.');
            ?>
">
						<?php 
            echo I18N::translate('Different');
            ?>
</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Ratio of distinct individuals compared to the number of ancestors found in generation G.');
            ?>
">
						<?php 
            echo I18N::translate('%');
            ?>
</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Number of cumulative distinct ancestors found up to generation G. A same individual is counted only once in the total number, even if present in different generations.');
            ?>
">
						<?php 
            echo I18N::translate('Total Different');
            ?>
</th>
						<th class="label help_tooltip" title="<?php 
            echo I18N::translate('Pedigree collapse at generation G. Pedigree collapse is a measure of the real number of ancestors of a person compared to its theorical number. The higher this number is, the more marriages between related persons have happened. Extreme examples of high pedigree collapse are royal families for which this number can be as high as nearly 90%% (Alfonso XII of Spain).');
            ?>
">
						<?php 
            echo I18N::translate('Pedigree collapse');
            ?>
</th>
					</tr>
				</thead>
				<tbody>
					<?php 
            foreach ($this->data->get('generation_stats') as $gen => $row) {
                ?>
					<tr class="maj-row">
						<td class="label"><?php 
                echo I18N::translate('<strong>G%d</strong>', $gen);
                ?>
</td>
						<td class="label"><?php 
                echo I18N::translate('%1$s <> %2$s', $row['gen_min_birth'], $row['gen_max_birth']);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::number($row['theoretical']);
                ?>
</td>
						<td class="value"><?php 
                echo $row['known'] > 0 ? '<a href="' . $this->data->get('sosaanc_url') . $gen . '">' . I18N::number($row['known']) . '</a>' : I18N::number($row['known']);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::percentage($row['perc_known'], 2);
                ?>
</td>
						<td class="value"><?php 
                echo $row['missing'] > 0 ? '<a href="' . $this->data->get('missinganc_url') . $gen . '">' . I18N::number($row['missing']) . '</a>' : I18N::number($row['missing']);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::percentage($row['perc_missing'], 2);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::number($row['total_known']);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::percentage($row['perc_total_known'], 2);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::number($row['different']);
                ?>
</td>
						<td class="value left percent_container">
							<div class="percent_frame">
								<div class="percent_cell" style="width:<?php 
                echo 100 * $row['perc_different'];
                ?>
%;">
									&nbsp;<?php 
                echo I18N::percentage($row['perc_different']);
                ?>
&nbsp;
								</div>
							</div>
						</td>
						<td class="value"><?php 
                echo I18N::number($row['total_different']);
                ?>
</td>
						<td class="value"><?php 
                echo I18N::percentage($row['pedi_collapse'], 2);
                ?>
</td>
					</tr>
					<?php 
            }
            ?>
				</tbody>
				<tfoot>
					<tr class="maj-row">
						<td class="label" colspan="13">
							<?php 
            echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'), 2));
            ?>
						</td>
					</tr>
				</tfoot>
			</table>
			<div class="center"><em><?php 
            echo I18N::translate('Hover the column headers to display some help on their meaning.');
            ?>
</em></div>
			
			<h3><?php 
            echo I18N::translate('Known Sosa ancestors\' family dispersion');
            ?>
</h3>
			<div class="center">
				<?php 
            echo $this->data->get('chart_img_g2') ?: '';
            ?>
				<?php 
            echo $this->data->get('chart_img_g3') ?: '';
            ?>
				
				<!--  <canvas id="chart_ancestors_g2" width="300" height="300"></canvas>  -->
			</div>
			
			<?php 
        } else {
            ?>
			<div class="center warning"><?php 
            echo I18N::translate('No Sosa root individual has been defined.');
            ?>
</div>
			<?php 
        }
    }
Пример #15
0
    /**
     * Display a map showing the origins of ones ancestors.
     */
    private function pedigreeMap()
    {
        global $controller, $WT_TREE;
        $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
        // Limit this to match available number of icons.
        // 8 generations equals 255 individuals
        $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8);
        $controller = new ChartController();
        $generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS'));
        $this->treesize = pow(2, $generations) - 1;
        $this->ancestors = array_values($controller->sosaAncestors($generations));
        $controller->setPageTitle(I18N::translate('Pedigree map of %s', $controller->root->getFullName()))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript("\n\t\t\t\tjQuery('head').prepend('<link type=\"text/css\" href =\"" . WT_STATIC_URL . WT_MODULES_DIR . "googlemap/css/wt_v3_googlemap.css\" rel=\"stylesheet\">');\n\t\t\t\tautocomplete();" . $this->pedigreeMapJavascript());
        echo '<div id="pedigreemap-page"><h2>', $controller->getPageTitle(), '</h2>';
        // -- print the form to change the number of displayed generations
        ?>
		<form name="people" method="get" action="?">
			<input type="hidden" name="ged" value="<?php 
        echo $WT_TREE->getNameHtml();
        ?>
">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="pedigree_map">
			<table class="list_table">
				<tr>
					<td class="descriptionbox wrap">
						<label for="rootid">
							<?php 
        echo I18N::translate('Individual');
        ?>
						</label>
					</td>
					<td class="optionbox">
						<input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php 
        echo $controller->root->getXref();
        ?>
">
						<?php 
        echo FunctionsPrint::printFindIndividualLink('rootid');
        ?>
					</td>
					<td class="topbottombar" rowspan="2">
						<input type="submit" value="<?php 
        echo I18N::translate('view');
        ?>
">
					</td>
				</tr>
				<tr>
					<td class="descriptionbox wrap">
						<label for="PEDIGREE_GENERATIONS">
							<?php 
        echo I18N::translate('Generations');
        ?>
						</label>
					</td>
					<td class="optionbox">
						<select name="PEDIGREE_GENERATIONS" id="PEDIGREE_GENERATIONS">
						<?php 
        for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) {
            echo '<option value="', $p, '" ';
            if ($p == $generations) {
                echo 'selected';
            }
            echo '>', $p, '</option>';
        }
        ?>
						</select>
					</td>
				</tr>
			</table>
		</form>
		<!-- end of form -->

		<!-- count records by type -->
		<?php 
        $curgen = 1;
        $priv = 0;
        $count = 0;
        $miscount = 0;
        $missing = array();
        $latlongval = array();
        $lat = array();
        $lon = array();
        for ($i = 0; $i < $this->treesize; $i++) {
            // -- check to see if we have moved to the next generation
            if ($i + 1 >= pow(2, $curgen)) {
                $curgen++;
            }
            $person = $this->ancestors[$i];
            if (!empty($person)) {
                $name = $person->getFullName();
                if ($name == I18N::translate('Private')) {
                    $priv++;
                }
                $place = $person->getBirthPlace();
                if (empty($place)) {
                    $latlongval[$i] = null;
                } else {
                    $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace());
                }
                if ($latlongval[$i]) {
                    $lat[$i] = strtr($latlongval[$i]->pl_lati, array('N' => '', 'S' => '-', ',' => '.'));
                    $lon[$i] = strtr($latlongval[$i]->pl_long, array('N' => '', 'S' => '-', ',' => '.'));
                    if ($lat[$i] && $lon[$i]) {
                        $count++;
                    } else {
                        // The place is in the table but has empty values
                        if ($name) {
                            $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                            $miscount++;
                        }
                    }
                } else {
                    // There was no place, or not listed in the map table
                    if ($name) {
                        $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                        $miscount++;
                    }
                }
            }
        }
        //<!-- end of count records by type -->
        //<!-- start of map display -->
        echo '<div class="gm-pedigree-map">';
        echo '<div class="gm-wrapper">';
        echo '<div class="gm-map"><i class="icon-loading-large"></i></div>';
        echo '<div class="gm-ancestors"></div>';
        echo '</div>';
        if (Auth::isAdmin()) {
            echo '<div class="gm-options noprint">';
            echo '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>';
            echo ' | <a href="module.php?mod=' . $this->getName() . '&amp;mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>';
            echo ' | <a href="module.php?mod=' . $this->getName() . '&amp;mod_action=admin_placecheck">' . I18N::translate('Place check') . '</a>';
            echo '</div>';
        }
        // display info under map
        echo '<hr>';
        // print summary statistics
        if (isset($curgen)) {
            $total = pow(2, $curgen) - 1;
            echo '<div>';
            echo I18N::plural('%1$s individual displayed, out of the normal total of %2$s, from %3$s generations.', '%1$s individuals displayed, out of the normal total of %2$s, from %3$s generations.', $count, I18N::number($count), I18N::number($total), I18N::number($curgen));
            echo '</div>';
            if ($priv) {
                echo '<div>' . I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '</div>';
            }
            if ($count + $priv != $total) {
                if ($miscount == 0) {
                    echo '<div>' . I18N::translate('No ancestors in the database.'), '</div>';
                } else {
                    echo '<div>' . I18N::plural('%1$s individual is missing birthplace map coordinates: %2$s.', '%1$s individuals are missing birthplace map coordinates: %2$s.', $miscount, I18N::number($miscount), implode(I18N::$list_separator, $missing)), '</div>';
                }
            }
        }
        echo '</div>';
        echo '</div>';
        echo '<script src="', $this->googleMapsScript(), '"></script>';
    }
Пример #16
0
 /** {@inheritdoc} */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
         $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
         $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
     $show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
     $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
     $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('name' => I18N::translate('sort by name'), 'date_asc' => I18N::translate('sort by date, oldest first'), 'date_desc' => I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show the user who made the change');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Should this block be hidden when it is empty');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
     echo '</td></tr>';
 }
Пример #17
0
    ?>
							</td>
						</tr>
						<?php 
}
?>
					</tbody>
					<tfoot>
						<tr>
							<td>
								<?php 
echo I18N::translate('Total');
?>
								-
								<?php 
echo I18N::plural('%s family tree', '%s family trees', count(Tree::getAll()), I18N::number(count(Tree::getAll())));
?>
							</td>
							<td class="text-right flip">
								<?php 
echo I18N::number(array_sum($changes));
?>
							</td>
							<td class="text-right flip">
								<?php 
echo I18N::number(array_sum($individuals));
?>
							</td>
							<td class="text-right flip">
								<?php 
echo I18N::number(array_sum($families));
Пример #18
0
 /**
  * Print the childrens list
  * 
  * @param type $family
  * @param type $person
  * @param type $spouse
  * @return string
  */
 private function printChildren($family, $person, $spouse)
 {
     $html = '';
     $match = null;
     if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) {
         $html .= '<div class="children"><p>' . $this->printName($person) . ' ';
         if ($spouse && $spouse->CanShow()) {
             $html .= I18N::translate('and ') . $this->printName($spouse) . ' ';
             $html .= I18N::translateContext('Two parents/one child', 'had');
         } else {
             $html .= I18N::translateContext('One parent/one child', 'had');
         }
         $html .= ' ' . I18N::translate('none') . ' ' . I18N::translate('children') . '.</p></div>';
     } else {
         $children = $family->getChildren();
         if ($children) {
             if ($this->checkPrivacy($children)) {
                 $html .= '<div class="children"><p>' . $this->printName($person) . ' ';
                 // needs multiple translations for the word 'had' to serve different languages.
                 if ($spouse && $spouse->CanShow()) {
                     $html .= I18N::translate('and ') . $this->printName($spouse) . ' ';
                     if (count($children) > 1) {
                         $html .= I18N::translateContext('Two parents/multiple children', 'had');
                     } else {
                         $html .= I18N::translateContext('Two parents/one child', 'had');
                     }
                 } else {
                     if (count($children) > 1) {
                         $html .= I18N::translateContext('One parent/multiple children', 'had');
                     } else {
                         $html .= I18N::translateContext('One parent/one child', 'had');
                     }
                 }
                 $html .= ' ' . I18N::plural('%s child', '%s children', count($children), count($children)) . '.</p></div>';
             } else {
                 $html .= '<div class="children"><p>' . I18N::translate('Children of ') . $this->printName($person);
                 if ($spouse && $spouse->CanShow()) {
                     $html .= ' ' . I18N::translate('and ') . $this->printName($spouse);
                 }
                 $html .= ':<ol>';
                 foreach ($children as $child) {
                     $html .= '<li class="child">' . $this->printNameUrl($child);
                     $pedi = $this->checkPedi($child, $family);
                     if ($pedi) {
                         $html .= ' <span class="pedi">';
                         switch ($pedi) {
                             case 'foster':
                                 switch ($child->getSex()) {
                                     case 'F':
                                         $html .= I18N::translateContext('FEMALE', 'foster child');
                                         break;
                                     default:
                                         $html .= I18N::translateContext('MALE', 'foster child');
                                         break;
                                 }
                                 break;
                             case 'adopted':
                                 switch ($child->getSex()) {
                                     case 'F':
                                         $html .= I18N::translateContext('FEMALE', 'adopted child');
                                         break;
                                     default:
                                         $html .= I18N::translateContext('MALE', 'adopted child');
                                         break;
                                 }
                                 break;
                         }
                         $html .= '</span>';
                     }
                     if ($child->CanShow() && ($child->getBirthDate()->isOK() || $child->getDeathdate()->isOK())) {
                         $html .= '<span class="lifespan"> (' . $child->getLifeSpan() . ')</span>';
                     }
                     $child_family = $this->getFamily($child);
                     // do not load this part of the code in the fancy treeview tab on the individual page.
                     if (WT_SCRIPT_NAME !== 'individual.php') {
                         if ($child->canShow() && $child_family) {
                             $html .= ' - <a class="scroll" href="#' . $child_family->getXref() . '"></a>';
                         } else {
                             // just go to the person details in the next generation (added prefix 'S'for Single Individual, to prevent double ID's.)
                             if ($this->options('show_singles') == true) {
                                 $html .= ' - <a class="scroll" href="#S' . $child->getXref() . '"></a>';
                             }
                         }
                     }
                     $html .= '</li>';
                 }
                 $html .= '</ol></div>';
             }
         }
     }
     return $html;
 }
Пример #19
0
 /**
  * Display the age difference between marriages and the births of children.
  *
  * @param Date $prev
  * @param Date $next
  * @param int  $child_number
  *
  * @return string
  */
 private static function ageDifference(Date $prev, Date $next, $child_number = 0)
 {
     if ($prev->isOK() && $next->isOK()) {
         $days = $next->maximumJulianDay() - $prev->minimumJulianDay();
         if ($days < 0) {
             // Show warning triangle if dates in reverse order
             $diff = '<i class="icon-warning"></i> ';
         } elseif ($child_number > 1 && $days > 1 && $days < 240) {
             // Show warning triangle if children born too close together
             $diff = '<i class="icon-warning"></i> ';
         } else {
             $diff = '';
         }
         $months = round($days * 12 / 365.25);
         // Approximate - we do not know the calendar
         if (abs($months) == 12 || abs($months) >= 24) {
             $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12)));
         } elseif ($months != 0) {
             $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months));
         }
         return '<div class="elderdate age">' . $diff . '</div>';
     } else {
         return '';
     }
 }
Пример #20
0
<h1><?php 
echo $controller->getPageTitle();
?>
</h1>

<?php 
$tree1_id = Filter::post('tree1_id');
$tree2_id = Filter::post('tree2_id');
if ($tree1_id && $tree2_id != $tree1_id) {
    // Every XREF used by both trees
    $xrefs = Database::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id = ?" . "  UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array($tree1_id, $tree1_id, $tree1_id, $tree1_id, $tree1_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id))->fetchAssoc();
    if ($xrefs) {
        $tree1 = Tree::findById($tree1_id);
        $tree2 = Tree::findById($tree2_id);
        echo '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>', '<p>', I18N::plural('The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which use the same “XREF”.', count($xrefs), count($xrefs)), '</p>', '<p>', I18N::translate('You must renumber the records in one of the trees before you can merge them.'), '</p>', '<p>', '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->getNameUrl(), '">', I18N::translate('Renumber family tree'), ' — ', $tree1->getTitleHtml(), '</a>', '</p>', '<p>', '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->getNameUrl(), '">', I18N::translate('Renumber family tree'), ' — ', $tree2->getTitleHtml(), '</a>', '</p>';
    } else {
        Database::beginTransaction();
        Database::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
        Database::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn)" . " SELECT ?, xref, tag_type, resn FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?")->execute(array($tree2_id, $tree1_id));
        // This table may contain old (deleted) references, which could clash. IGNORE these.
        Database::prepare("INSERT IGNORE INTO `##change` (change_time, status, gedcom_id, xref, old_gedcom, new_gedcom, user_id)" . " SELECT change_time, status, ?, xref, old_gedcom, new_gedcom, user_id FROM `##change` AS change2 WHERE gedcom_id = ?")->execute(array($tree2_id, $tree1_id));
Пример #21
0
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'calendar', Filter::post('calendar', 'jewish|gregorian', 'jewish'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', '7');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $calendar = $this->getBlockSetting($block_id, 'calendar', 'jewish');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="' . $days . '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Calendar');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('calendar', array('jewish' => I18N::translate('Jewish'), 'gregorian' => I18N::translate('Gregorian')), null, $calendar, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Пример #22
0
 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     $this->setPageTitle(I18N::translate('Lifespans'));
     $this->facts = explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_DEAT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV);
     $tmp = explode('\\', get_class(I18N::defaultCalendar()));
     $cal = strtolower(array_pop($tmp));
     $this->defaultCalendar = str_replace('calendar', '', $cal);
     $filterPids = false;
     // Request parameters
     $clear = Filter::getBool('clear');
     $newpid = Filter::get('newpid', WT_REGEX_XREF);
     $addfam = Filter::getBool('addFamily');
     $this->place = Filter::get('place');
     $this->beginYear = Filter::getInteger('beginYear', 0, PHP_INT_MAX, null);
     $this->endYear = Filter::getInteger('endYear', 0, PHP_INT_MAX, null);
     $this->calendar = Filter::get('calendar', null, $this->defaultCalendar);
     $this->strictDate = Filter::getBool('strictDate');
     // Set up base color parameters
     $this->colors['M'] = new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1);
     $this->colors['F'] = new ColorGenerator(00, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE);
     // Build a list of people based on the input parameters
     if ($clear) {
         // Empty list & reset form
         $xrefs = array();
         $this->place = null;
         $this->beginYear = null;
         $this->endYear = null;
         $this->calendar = $this->defaultCalendar;
     } elseif ($this->place) {
         // Get all individual & family records found for a place
         $this->place_obj = new Place($this->place, $WT_TREE);
         $xrefs = Database::prepare("SELECT DISTINCT `i_id` FROM `##placelinks`" . " JOIN `##individuals` ON `pl_gid`=`i_id` AND `pl_file`=`i_file`" . " WHERE `i_file`=:tree_id" . " AND `pl_p_id`=:place_id" . " UNION" . " SELECT DISTINCT `f_id` FROM `##placelinks`" . " JOIN `##families` ON `pl_gid`=`f_id` AND `pl_file`=`f_file`" . " WHERE `f_file`=:tree_id" . " AND `pl_p_id`=:place_id")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'place_id' => $this->place_obj->getPlaceId()))->fetchOneColumn();
     } else {
         // Modify an existing list of records
         $xrefs = Session::get(self::SESSION_DATA, array());
         if ($newpid) {
             $xrefs = array_merge($xrefs, $this->addFamily(Individual::getInstance($newpid, $WT_TREE), $addfam));
             $xrefs = array_unique($xrefs);
         } elseif (!$xrefs) {
             $xrefs = $this->addFamily($this->getSignificantIndividual(), false);
         }
     }
     $tmp = $this->getCalendarDate(unixtojd());
     $this->currentYear = $tmp->today()->y;
     $tmp = strtoupper(strtr($this->calendar, array('jewish' => 'hebrew', 'french' => 'french r')));
     $this->calendarEscape = sprintf('@#D%s@', $tmp);
     if ($xrefs) {
         // ensure date ranges are valid in preparation for filtering list
         if ($this->beginYear || $this->endYear) {
             $filterPids = true;
             if (!$this->beginYear) {
                 $tmp = new Date($this->calendarEscape . ' 1');
                 $this->beginYear = $tmp->minimumDate()->y;
             }
             if (!$this->endYear) {
                 $this->endYear = $this->currentYear;
             }
             $this->startDate = new Date($this->calendarEscape . $this->beginYear);
             $this->endDate = new Date($this->calendarEscape . $this->endYear);
         }
         // Test each xref to see if the search criteria are met
         foreach ($xrefs as $key => $xref) {
             $valid = false;
             $person = Individual::getInstance($xref, $WT_TREE);
             if ($person) {
                 if ($person->canShow()) {
                     foreach ($person->getFacts() as $fact) {
                         if ($this->checkFact($fact)) {
                             $this->people[] = $person;
                             $valid = true;
                             break;
                         }
                     }
                 }
             } else {
                 $family = Family::getInstance($xref, $WT_TREE);
                 if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) {
                     $valid = true;
                     $this->people[] = $family->getHusband();
                     $this->people[] = $family->getWife();
                 }
             }
             if (!$valid) {
                 unset($xrefs[$key]);
                 // no point in storing a xref if we can't use it
             }
         }
         Session::put(self::SESSION_DATA, $xrefs);
     } else {
         Session::forget(self::SESSION_DATA);
     }
     $this->people = array_filter(array_unique($this->people));
     $count = count($this->people);
     if ($count) {
         // Build the subtitle
         if ($this->place && $filterPids) {
             $this->subtitle = I18N::plural('%s individual with events in %s between %s and %s', '%s individuals with events in %s between %s and %s', $count, I18N::number($count), $this->place, $this->startDate->display(false, '%Y'), $this->endDate->display(false, '%Y'));
         } elseif ($this->place) {
             $this->subtitle = I18N::plural('%s individual with events in %s', '%s individuals with events in %s', $count, I18N::number($count), $this->place);
         } elseif ($filterPids) {
             $this->subtitle = I18N::plural('%s individual with events between %s and %s', '%s individuals with events between %s and %s', $count, I18N::number($count), $this->startDate->display(false, '%Y'), $this->endDate->display(false, '%Y'));
         } else {
             $this->subtitle = I18N::plural('%s individual', '%s individuals', $count, I18N::number($count));
         }
         // Sort the array in order of birth year
         usort($this->people, function (Individual $a, Individual $b) {
             return Date::compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate());
         });
         //Find the mimimum birth year and maximum death year from the individuals in the array.
         $bdate = $this->getCalendarDate($this->people[0]->getEstimatedBirthDate()->minimumJulianDay());
         $minyear = $bdate->y;
         $that = $this;
         // PHP5.3 cannot access $this inside a closure
         $maxyear = array_reduce($this->people, function ($carry, Individual $item) use($that) {
             $date = $that->getCalendarDate($item->getEstimatedDeathDate()->maximumJulianDay());
             return max($carry, $date->y);
         }, 0);
     } elseif ($filterPids) {
         $minyear = $this->endYear;
         $maxyear = $this->endYear;
     } else {
         $minyear = $this->currentYear;
         $maxyear = $this->currentYear;
     }
     $maxyear = min($maxyear, $this->currentYear);
     // Limit maximum year to current year as we can't forecast the future
     $minyear = min($minyear, $maxyear - $WT_TREE->getPreference('MAX_ALIVE_AGE'));
     // Set default minimum chart length
     $this->timelineMinYear = (int) floor($minyear / 10) * 10;
     // round down to start of the decade
     $this->timelineMaxYear = (int) ceil($maxyear / 10) * 10;
     // round up to start of next decade
 }
Пример #23
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;
     }
 }
Пример #24
0
					<option value="5" <?php 
        if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 5) {
            echo 'selected';
        }
        ?>
><?php 
        echo I18N::plural('±%s year', '±%s years', 5, I18N::number(5));
        ?>
</option>
					<option value="10" <?php 
        if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 10) {
            echo 'selected';
        }
        ?>
><?php 
        echo I18N::plural('±%s year', '±%s years', 10, I18N::number(10));
        ?>
</option>
				</select>
			<?php 
    }
    ?>
		</td>
		<?php 
    //-- relative fields
    if ($i == 0 && $fct > 4) {
        $j = $fct;
        // Get the current options for Father’s and Mother’s name searches
        $fatherGivnOption = 'SDX';
        $fatherSurnOption = 'SDX';
        $motherGivnOption = 'SDX';
Пример #25
0
 /**
  * Add markup to the hit counter.
  *
  * @param int $count
  *
  * @return string
  */
 protected function formatPageViews($count)
 {
     if ($count > 0) {
         return '<div class="page-views">' . I18N::plural('This page has been viewed %s time.', 'This page has been viewed %s times.', $count, '<span class="odometer">' . I18N::digits($count) . '</span>') . '</div>';
     } else {
         return '';
     }
 }
Пример #26
0
			</div>
		</div>

		<!-- PASSWORD -->
		<div class="form-group">
			<label class="control-label col-sm-3" for="pass1">
				<?php 
        echo I18N::translate('Password');
        ?>
			</label>
			<div class="col-sm-9">
				<input class="form-control" type="password" id="pass1" name="pass1" pattern = "<?php 
        echo WT_REGEX_PASSWORD;
        ?>
" placeholder="<?php 
        echo I18N::plural('Use at least %s character.', 'Use at least %s characters.', WT_MINIMUM_PASSWORD_LENGTH, I18N::number(WT_MINIMUM_PASSWORD_LENGTH));
        ?>
" <?php 
        echo $user->getUserId() ? '' : 'required';
        ?>
 onchange="form.pass2.pattern = regex_quote(this.value);">
				<p class="small text-muted">
					<?php 
        echo I18N::translate('Passwords must be at least 6 characters long and are case-sensitive, so that “secret” is different from “SECRET”.');
        ?>
				</p>
			</div>
		</div>

		<!-- CONFIRM PASSWORD -->
		<div class="form-group">
Пример #27
0
 /**
  * print the children table for a family
  *
  * @param Family $family family
  * @param string $childid child ID
  * @param int $sosa child sosa number
  * @param string $label indi label (descendancy booklet)
  * @param int $show_cousins display cousins on chart
  * @param int $show_full large or small box
  */
 public static function printFamilyChildren(Family $family, $childid = '', $sosa = 0, $label = '', $show_cousins = 0, $show_full = 1)
 {
     if ($show_full) {
         $bheight = Theme::theme()->parameter('chart-box-y');
     } else {
         $bheight = Theme::theme()->parameter('compact-chart-box-y');
     }
     $pbheight = $bheight + 14;
     $children = $family->getChildren();
     $numchil = count($children);
     echo '<table border="0" cellpadding="0" cellspacing="2"><tr>';
     if ($sosa > 0) {
         echo '<td></td>';
     }
     echo '<td><span class="subheaders">';
     if ($numchil == 0) {
         echo I18N::translate('No children');
     } else {
         echo I18N::plural('%s child', '%s children', $numchil, $numchil);
     }
     echo '</span>';
     if ($sosa == 0 && Auth::isEditor($family->getTree())) {
         echo '<br>';
         echo "<a href=\"#\" onclick=\"return add_child_to_family('", $family->getXref(), "', 'U');\">" . I18N::translate('Add a child to this family') . "</a>";
         echo ' <a class="icon-sex_m_15x15" href="#" onclick="return add_child_to_family(\'', $family->getXref(), '\', \'M\');" title="', I18N::translate('son'), '"></a>';
         echo ' <a class="icon-sex_f_15x15" href="#" onclick="return add_child_to_family(\'', $family->getXref(), '\', \'F\');" title="', I18N::translate('daughter'), '"></a>';
         echo '<br><br>';
     }
     echo '</td>';
     if ($sosa > 0) {
         echo '<td></td><td></td>';
     }
     echo '</tr>';
     $nchi = 1;
     if ($children) {
         foreach ($children as $child) {
             echo '<tr>';
             if ($sosa != 0) {
                 if ($child->getXref() == $childid) {
                     self::printSosaNumber($sosa, $childid);
                 } elseif (empty($label)) {
                     self::printSosaNumber("");
                 } else {
                     self::printSosaNumber($label . $nchi++ . ".");
                 }
             }
             if ($child->isPendingAddtion()) {
                 echo '<td valign="middle" class="new">';
             } elseif ($child->isPendingDeletion()) {
                 echo '<td valign="middle" class="old">';
             } else {
                 echo '<td valign="middle">';
             }
             FunctionsPrint::printPedigreePerson($child, $show_full);
             echo "</td>";
             if ($sosa != 0) {
                 // loop for all families where current child is a spouse
                 $famids = $child->getSpouseFamilies();
                 $maxfam = count($famids) - 1;
                 for ($f = 0; $f <= $maxfam; $f++) {
                     $famid_child = $famids[$f]->getXref();
                     // multiple marriages
                     if ($f > 0) {
                         echo '</tr><tr><td></td>';
                         echo '<td valign="top"';
                         if (I18N::direction() === 'rtl') {
                             echo ' align="left">';
                         } else {
                             echo ' align="right">';
                         }
                         //find out how many cousins there are to establish vertical line on second families
                         $fchildren = $famids[$f]->getChildren();
                         $kids = count($fchildren);
                         $Pheader = ($bheight - 1) * $kids;
                         $PBadj = 6;
                         // default
                         if ($show_cousins > 0) {
                             if ($kids) {
                                 $PBadj = max(0, $Pheader / 2 + $kids * 4.5);
                             }
                         }
                         if ($f == $maxfam) {
                             echo "<img height=\"" . ($bheight / 2 + $PBadj) . "px\"";
                         } else {
                             echo "<img height=\"" . $pbheight . "px\"";
                         }
                         echo " width=\"3\" src=\"" . Theme::theme()->parameter('image-vline') . "\" alt=\"\">";
                         echo "</td>";
                     }
                     echo "<td class=\"details1\" valign=\"middle\" align=\"center\">";
                     $spouse = $famids[$f]->getSpouse($child);
                     $marr = $famids[$f]->getFirstFact('MARR');
                     $div = $famids[$f]->getFirstFact('DIV');
                     if ($marr) {
                         // marriage date
                         echo $marr->getDate()->minimumDate()->format('%Y');
                         // divorce date
                         if ($div) {
                             echo '–', $div->getDate()->minimumDate()->format('%Y');
                         }
                     }
                     echo "<br><img width=\"100%\" class=\"line5\" height=\"3\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\">";
                     echo "</td>";
                     // spouse information
                     echo "<td style=\"vertical-align: center;";
                     if (!empty($divrec)) {
                         echo " filter:alpha(opacity=40);opacity:0.4;\">";
                     } else {
                         echo "\">";
                     }
                     FunctionsPrint::printPedigreePerson($spouse, $show_full);
                     echo "</td>";
                     // cousins
                     if ($show_cousins) {
                         self::printCousins($famid_child, $show_full);
                     }
                 }
             }
             echo "</tr>";
         }
     } elseif ($sosa < 1) {
         // message 'no children' except for sosa
         if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) {
             echo '<tr><td><i class="icon-childless"></i> ' . I18N::translate('This family remained childless') . '</td></tr>';
         }
     }
     echo "</table><br>";
 }
Пример #28
0
 /**
  * Performs a search and replace
  *
  * @param Tree $tree
  */
 private function searchAndReplace(Tree $tree)
 {
     $this->generalSearch();
     //-- don't try to make any changes if nothing was found
     if (!$this->myindilist && !$this->myfamlist && !$this->mysourcelist && !$this->mynotelist) {
         return;
     }
     Log::addEditLog("Search And Replace old:" . $this->query . " new:" . $this->replace);
     $adv_name_tags = preg_split("/[\\s,;: ]+/", $tree->getPreference('ADVANCED_NAME_FACTS'));
     $name_tags = array_unique(array_merge(Config::standardNameFacts(), $adv_name_tags));
     $name_tags[] = '_MARNM';
     $records_updated = 0;
     foreach ($this->myindilist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         } else {
             if ($this->replaceNames) {
                 foreach ($name_tags as $tag) {
                     $new_record = preg_replace("~(\\d) " . $tag . " (.*)" . $this->query . "(.*)~i", "\$1 " . $tag . " \$2" . $this->replace . "\$3", $new_record);
                 }
             }
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $new_record = preg_replace('~(\\d) PLAC (.*)([,\\W\\s])' . $this->query . '([,\\W\\s])~i', "\$1 PLAC \$2\$3" . $this->replace . "\$4", $new_record);
                 } else {
                     $new_record = preg_replace("~(\\d) PLAC (.*)" . $this->query . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $new_record);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record !== $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->myindilist[$id]);
         }
     }
     if ($records_updated) {
         FlashMessages::addMessage(I18N::plural('%s individual has been updated.', '%s individuals have been updated.', $records_updated, I18N::number($records_updated)));
     }
     $records_updated = 0;
     foreach ($this->myfamlist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         } else {
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $new_record = preg_replace('~(\\d) PLAC (.*)([,\\W\\s])' . $this->query . '([,\\W\\s])~i', "\$1 PLAC \$2\$3" . $this->replace . "\$4", $new_record);
                 } else {
                     $new_record = preg_replace("~(\\d) PLAC (.*)" . $this->query . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $new_record);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record !== $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->myfamlist[$id]);
         }
     }
     if ($records_updated) {
         FlashMessages::addMessage(I18N::plural('%s family has been updated.', '%s families have been updated.', $records_updated, I18N::number($records_updated)));
     }
     $records_updated = 0;
     foreach ($this->mysourcelist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         } else {
             if ($this->replaceNames) {
                 $new_record = preg_replace("~(\\d) TITL (.*)" . $this->query . "(.*)~i", "\$1 TITL \$2" . $this->replace . "\$3", $new_record);
                 $new_record = preg_replace("~(\\d) ABBR (.*)" . $this->query . "(.*)~i", "\$1 ABBR \$2" . $this->replace . "\$3", $new_record);
             }
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $new_record = preg_replace('~(\\d) PLAC (.*)([,\\W\\s])' . $this->query . '([,\\W\\s])~i', "\$1 PLAC \$2\$3" . $this->replace . "\$4", $new_record);
                 } else {
                     $new_record = preg_replace("~(\\d) PLAC (.*)" . $this->query . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $new_record);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record !== $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->mysourcelist[$id]);
         }
     }
     if ($records_updated) {
         FlashMessages::addMessage(I18N::plural('%s source has been updated.', '%s sources have been updated.', $records_updated, I18N::number($records_updated)));
     }
     $records_updated = 0;
     foreach ($this->mynotelist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record != $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->mynotelist[$id]);
         }
     }
     if ($records_updated) {
         FlashMessages::addMessage(I18N::plural('%s note has been updated.', '%s notes have been updated.', $records_updated, I18N::number($records_updated)));
     }
 }
Пример #29
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;
     }
 }