本文整理汇总了PHP中Fisharebest\Webtrees\I18N::plural方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::plural方法的具体用法?PHP I18N::plural怎么用?PHP I18N::plural使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\I18N
的用法示例。
在下文中一共展示了I18N::plural方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAgeAtEvent
/**
* 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: getBlock
/**
* 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 .= ' | ';
}
}
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:
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: getBlock
/**
* 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 . '&ged=' . $WT_TREE->getNameHtml() . '&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: usersLoggedInQuery
/**
* 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: pedigreeMap
//.........这里部分代码省略.........
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&mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>';
echo '</td>';
echo '<td align="center">';
echo '<a href="module.php?mod=googlemap&mod_action=admin_places">', I18N::translate('Geographic data'), '</a>';
echo '</td>';
echo '<td align="right">';
echo '<a href="module.php?mod=googlemap&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:
<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: catch
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: getBlock
/**
* 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('<select>') . '</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: copy
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;
}
示例11: configureBlock
/**
* 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: eventsList
/**
* 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));
}
//.........这里部分代码省略.........
示例13: statusHide
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: renderContent
/**
* {@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" > </th>
<th class="label help_tooltip" title="<?php
echo I18N::translate('Theoretical number of ancestors in generation G.');
?>
">
//.........这里部分代码省略.........
示例15: pedigreeMap
//.........这里部分代码省略.........
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() . '&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>';
echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>';
echo ' | <a href="module.php?mod=' . $this->getName() . '&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>';
}