当前位置: 首页>>代码示例>>PHP>>正文


PHP I18N::number方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\I18N::number方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::number方法的具体用法?PHP I18N::number怎么用?PHP I18N::number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\I18N的用法示例。


在下文中一共展示了I18N::number方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: htmlAnalysisData

 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisTabGeneralView::htmlAnalysisData()
  */
 protected function htmlAnalysisData()
 {
     $results = $this->data->get('results');
     $analysis_level = $this->data->get('analysis_level');
     $nb_found = $this->data->get('stats_gen_nb_found');
     $nb_other = $this->data->get('stats_gen_nb_other');
     $i = 1;
     $previous_nb = 0;
     $html = '<div class="maj-table center">';
     foreach ($results as $place => $nb) {
         $perc = Functions::safeDivision($nb, $nb_found - $nb_other);
         if ($nb != $previous_nb) {
             $j = I18N::number($i);
         } else {
             $j = '&nbsp;';
         }
         $levels = array_map('trim', explode(',', $place));
         $placename = $levels[$analysis_level - 1];
         if ($placename == '' && $analysis_level > 1) {
             $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level - 2]);
         }
         $html .= '<div class="maj-row">
             <div class="label"><strong>' . $j . '</strong></div>
             <div class="label">' . $placename . '</div>
             <div class="value">' . I18N::translate('%d', $nb) . '</div>
             <div class="value">' . I18N::percentage($perc, 1) . '</div>
          </div>';
         $i++;
         $previous_nb = $nb;
     }
     $html .= '</div>';
     return $html;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:37,代码来源:GeoAnalysisTabGeneralTableView.php

示例2: renderContent

 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
  */
 protected function renderContent()
 {
     if ($this->data->get('has_stats', false)) {
         $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)', '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', date('Y'), '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>');
     } else {
         $html = I18N::translate('No statistics could be retrieved from Piwik.');
     }
     return $html;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:13,代码来源:PiwikStatsView.php

示例3: 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 .= '&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;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:64,代码来源:LoggedInUsersModule.php

示例4: varStartHandler

 /**
  * Process <var var="">
  *
  * @param string[] $attrs
  */
 protected function varStartHandler($attrs)
 {
     if (preg_match('/^I18N::number\\((.+)\\)$/', $attrs['var'], $match)) {
         $this->text .= I18N::number($match[1]);
     } elseif (preg_match('/^I18N::translate\\(\'(.+)\'\\)$/', $attrs['var'], $match)) {
         $this->text .= I18N::translate($match[1]);
     } elseif (preg_match('/^I18N::translateContext\\(\'(.+)\', *\'(.+)\'\\)$/', $attrs['var'], $match)) {
         $this->text .= I18N::translateContext($match[1], $match[2]);
     } else {
         $this->text .= $attrs['var'];
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:17,代码来源:ReportParserSetup.php

示例5: printChildAscendancy

 /**
  * print a child ascendancy
  *
  * @param Individual $individual
  * @param int        $sosa  child sosa number
  * @param int        $depth the ascendancy depth to show
  */
 public function printChildAscendancy(Individual $individual, $sosa, $depth)
 {
     echo '<li>';
     echo '<table><tbody><tr><td>';
     if ($sosa === 1) {
         echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent'), '"></td><td>';
     } else {
         echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="2" alt="">';
         echo '<img src="', Theme::theme()->parameter('image-hline'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent') - 2, '"></td><td>';
     }
     FunctionsPrint::printPedigreePerson($individual, $this->showFull());
     echo '</td><td>';
     if ($sosa > 1) {
         FunctionsCharts::printUrlArrow('?rootid=' . $individual->getXref() . '&amp;PEDIGREE_GENERATIONS=' . $this->generations . '&amp;show_full=' . $this->showFull() . '&amp;chart_style=' . $this->chart_style . '&amp;ged=' . $individual->getTree()->getNameUrl(), I18N::translate('Ancestors of %s', $individual->getFullName()), 3);
     }
     echo '</td><td class="details1">&nbsp;<span class="person_box' . ($sosa === 1 ? 'NN' : ($sosa % 2 ? 'F' : '')) . '">', I18N::number($sosa), '</span> ';
     echo '</td><td class="details1">&nbsp;', FunctionsCharts::getSosaName($sosa), '</td>';
     echo '</tr></tbody></table>';
     // Parents
     $family = $individual->getPrimaryChildFamily();
     if ($family && $depth > 0) {
         // Marriage details
         echo '<span class="details1">';
         echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent'), '" alt=""><a href="#" onclick="return expand_layer(\'sosa_', $sosa, '\');" class="top"><i id="sosa_', $sosa, '_img" class="icon-minus" title="', I18N::translate('View family'), '"></i></a>';
         echo ' <span class="person_box">', I18N::number($sosa * 2), '</span> ', I18N::translate('and');
         echo ' <span class="person_boxF">', I18N::number($sosa * 2 + 1), '</span>';
         if ($family->canShow()) {
             foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
                 echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>';
             }
         }
         echo '</span>';
         // display parents recursively - or show empty boxes
         echo '<ul id="sosa_', $sosa, '" class="generation">';
         if ($family->getHusband()) {
             $this->printChildAscendancy($family->getHusband(), $sosa * 2, $depth - 1);
         }
         if ($family->getWife()) {
             $this->printChildAscendancy($family->getWife(), $sosa * 2 + 1, $depth - 1);
         }
         echo '</ul>';
     }
     echo '</li>';
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:51,代码来源:AncestryController.php

示例6: __construct


//.........这里部分代码省略.........
         // 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
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:LifespanController.php

示例7: getRelationshipNameFromPath


//.........这里部分代码省略.........
                             return I18N::translateContext('great ×5 grandmother’s brother', 'great ×6 uncle');
                         } else {
                             return I18N::translateContext('great ×5 grandparent’s brother', 'great ×6 uncle');
                         }
                     case 'F':
                         return I18N::translate('great ×6 aunt');
                     default:
                         return I18N::translate('great ×6 aunt/uncle');
                 }
             case 8:
                 switch ($sex2) {
                     case 'M':
                         if ($bef_last === 'fat') {
                             return I18N::translateContext('great ×6 grandfather’s brother', 'great ×7 uncle');
                         } elseif ($bef_last === 'mot') {
                             return I18N::translateContext('great ×6 grandmother’s brother', 'great ×7 uncle');
                         } else {
                             return I18N::translateContext('great ×6 grandparent’s brother', 'great ×7 uncle');
                         }
                     case 'F':
                         return I18N::translate('great ×7 aunt');
                     default:
                         return I18N::translate('great ×7 aunt/uncle');
                 }
             default:
                 // Different languages have different rules for naming generations.
                 // An English great ×12 uncle is a Danish great ×10 uncle.
                 //
                 // Need to find out which languages use which rules.
                 switch (WT_LOCALE) {
                     case 'da':
                         switch ($sex2) {
                             case 'M':
                                 return I18N::translate('great ×%s uncle', I18N::number($up - 4));
                             case 'F':
                                 return I18N::translate('great ×%s aunt', I18N::number($up - 4));
                             default:
                                 return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 4));
                         }
                     case 'pl':
                         switch ($sex2) {
                             case 'M':
                                 if ($bef_last === 'fat') {
                                     return I18N::translateContext('great ×(%s-1) grandfather’s brother', 'great ×%s uncle', I18N::number($up - 2));
                                 } elseif ($bef_last === 'mot') {
                                     return I18N::translateContext('great ×(%s-1) grandmother’s brother', 'great ×%s uncle', I18N::number($up - 2));
                                 } else {
                                     return I18N::translateContext('great ×(%s-1) grandparent’s brother', 'great ×%s uncle', I18N::number($up - 2));
                                 }
                             case 'F':
                                 return I18N::translate('great ×%s aunt', I18N::number($up - 2));
                             default:
                                 return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 2));
                         }
                     case 'it':
                         // Source: Michele Locati
                     // Source: Michele Locati
                     case 'en_AU':
                     case 'en_GB':
                     case 'en_US':
                     default:
                         switch ($sex2) {
                             case 'M':
                                 // I18N: if you need a different number for %s, contact the developers, as a code-change is required
                                 return I18N::translate('great ×%s uncle', I18N::number($up - 1));
                             case 'F':
开发者ID:jflash,项目名称:webtrees,代码行数:67,代码来源:Functions.php

示例8: elseif

        $male_female = false;
        if ($z_axis === 300) {
            $zgiven = false;
            $legend[0] = 'all';
            $zmax = 1;
            $z_boundaries[0] = 100000;
        } elseif ($z_axis === 301) {
            $male_female = true;
            $zgiven = true;
            $legend[0] = I18N::translate('Male');
            $legend[1] = I18N::translate('Female');
            $zmax = 2;
            $xtitle = $xtitle . I18N::translate(' per gender');
        } elseif ($z_axis === 302) {
            $xtitle = $xtitle . I18N::translate(' per time period');
        }
        //-- reset the data array
        for ($i = 0; $i < $zmax; $i++) {
            for ($j = 0; $j < $xmax; $j++) {
                $ydata[$i][$j] = 0;
            }
        }
        $total = number_of_children($z_axis, $z_boundaries, $stats);
        $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren();
        my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
        break;
    default:
        echo '<i class="icon-loading-large"></i>';
        break;
}
echo '</div>';
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:statisticsplot.php

示例9: getInitialLettersList

 /**
  * Get the list of initial letters
  * 
  * @return string[]
  */
 private function getInitialLettersList()
 {
     $list = array();
     /** @var \Fisharebest\Webtrees\Tree $tree */
     $tree = $this->data->get('tree');
     $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage';
     foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) {
         switch ($letter) {
             case '@':
                 $html = I18N::translateContext('Unknown surname', '…');
                 break;
             case ',':
                 $html = I18N::translate('None');
                 break;
             default:
                 $html = Filter::escapeHtml($letter);
                 break;
         }
         if ($count) {
             if ($letter == $this->data->get('alpha')) {
                 $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&amp;ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>';
             } else {
                 $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&amp;ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>';
             }
         } else {
             $list[] = $html;
         }
     }
     // Search spiders don't get the "show all" option as the other links give them everything.
     if (!Auth::isSearchEngine()) {
         if ($this->data->get('show_all') === 'yes') {
             $list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
         } else {
             $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&amp;ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>';
         }
     }
     return $list;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:43,代码来源:LineageView.php

示例10: 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, $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;
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:84,代码来源:TopSurnamesModule.php

示例11: getAge

 /**
  * Calculate the the age of a person, on a date.
  *
  * @param Date $d1
  * @param Date $d2
  * @param int  $format
  *
  * @throws \InvalidArgumentException
  *
  * @return int|string
  */
 public static function getAge(Date $d1, Date $d2 = null, $format = 0)
 {
     if ($d2) {
         if ($d2->maximumJulianDay() >= $d1->minimumJulianDay() && $d2->minimumJulianDay() <= $d1->minimumJulianDay()) {
             // Overlapping dates
             $jd = $d1->minimumJulianDay();
         } else {
             // Non-overlapping dates
             $jd = $d2->minimumJulianDay();
         }
     } else {
         // If second date not specified, use today’s date
         $jd = WT_CLIENT_JD;
     }
     switch ($format) {
         case 0:
             // Years - integer only (for statistics, rather than for display)
             if ($jd && $d1->minimumJulianDay() && $d1->minimumJulianDay() <= $jd) {
                 return $d1->minimumDate()->getAge(false, $jd, false);
             } else {
                 return -1;
             }
         case 1:
             // Days - integer only (for sorting, rather than for display)
             if ($jd && $d1->minimumJulianDay()) {
                 return $jd - $d1->minimumJulianDay();
             } else {
                 return -1;
             }
         case 2:
             // Just years, in local digits, with warning for negative/
             if ($jd && $d1->minimumJulianDay()) {
                 if ($d1->minimumJulianDay() > $jd) {
                     return '<i class="icon-warning"></i>';
                 } else {
                     return I18N::number($d1->minimumDate()->getAge(false, $jd));
                 }
             } else {
                 return '';
             }
         default:
             throw new \InvalidArgumentException('format: ' . $format);
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:55,代码来源:Date.php

示例12:

			</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">
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_users.php

示例13: centuryName

 /**
  * Century name, English => 21st, Polish => XXI, etc.
  *
  * @param int $century
  *
  * @return string
  */
 private function centuryName($century)
 {
     if ($century < 0) {
         return str_replace(-$century, self::centuryName(-$century), I18N::translate('%s BCE', I18N::number(-$century)));
     }
     // The current chart engine (Google charts) can't handle <sup></sup> markup
     switch ($century) {
         case 21:
             return strip_tags(I18N::translateContext('CENTURY', '21st'));
         case 20:
             return strip_tags(I18N::translateContext('CENTURY', '20th'));
         case 19:
             return strip_tags(I18N::translateContext('CENTURY', '19th'));
         case 18:
             return strip_tags(I18N::translateContext('CENTURY', '18th'));
         case 17:
             return strip_tags(I18N::translateContext('CENTURY', '17th'));
         case 16:
             return strip_tags(I18N::translateContext('CENTURY', '16th'));
         case 15:
             return strip_tags(I18N::translateContext('CENTURY', '15th'));
         case 14:
             return strip_tags(I18N::translateContext('CENTURY', '14th'));
         case 13:
             return strip_tags(I18N::translateContext('CENTURY', '13th'));
         case 12:
             return strip_tags(I18N::translateContext('CENTURY', '12th'));
         case 11:
             return strip_tags(I18N::translateContext('CENTURY', '11th'));
         case 10:
             return strip_tags(I18N::translateContext('CENTURY', '10th'));
         case 9:
             return strip_tags(I18N::translateContext('CENTURY', '9th'));
         case 8:
             return strip_tags(I18N::translateContext('CENTURY', '8th'));
         case 7:
             return strip_tags(I18N::translateContext('CENTURY', '7th'));
         case 6:
             return strip_tags(I18N::translateContext('CENTURY', '6th'));
         case 5:
             return strip_tags(I18N::translateContext('CENTURY', '5th'));
         case 4:
             return strip_tags(I18N::translateContext('CENTURY', '4th'));
         case 3:
             return strip_tags(I18N::translateContext('CENTURY', '3rd'));
         case 2:
             return strip_tags(I18N::translateContext('CENTURY', '2nd'));
         case 1:
             return strip_tags(I18N::translateContext('CENTURY', '1st'));
         default:
             return $century - 1 . '01-' . $century . '00';
     }
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:60,代码来源:Stats.php

示例14: configureBlock

 /** {@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>';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:52,代码来源:RecentChangesModule.php

示例15: 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('&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;
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:84,代码来源:UserMessagesModule.php


注:本文中的Fisharebest\Webtrees\I18N::number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。