/**
  * {@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;
 }
Beispiel #2
0
 /**
  * {@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;
 }
 /**
  * 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;
     }
 }
 /**
  * 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'];
     }
 }
 /**
  * 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>';
 }
 /**
  * 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
 }
Beispiel #7
0
 /**
  * Convert a relationship path into a relationship name.
  *
  * @param string $path
  * @param Individual $person1
  * @param Individual $person2
  *
  * @return string
  */
 public static function getRelationshipNameFromPath($path, Individual $person1 = null, Individual $person2 = null)
 {
     if (!preg_match('/^(mot|fat|par|hus|wif|spo|son|dau|chi|bro|sis|sib)*$/', $path)) {
         // TODO: Update all the “3 RELA ” values in class_person
         return '<span class="error">' . $path . '</span>';
     }
     // The path does not include the starting person.  In some languages, the
     // translation for a man’s (relative) is different from a woman’s (relative),
     // due to inflection.
     $sex1 = $person1 ? $person1->getSex() : 'U';
     // The sex of the last person in the relationship determines the name in
     // many cases.  e.g. great-aunt / great-uncle
     if (preg_match('/(fat|hus|son|bro)$/', $path)) {
         $sex2 = 'M';
     } elseif (preg_match('/(mot|wif|dau|sis)$/', $path)) {
         $sex2 = 'F';
     } else {
         $sex2 = 'U';
     }
     switch ($path) {
         case '':
             return I18N::translate('self');
             //  Level One relationships
         //  Level One relationships
         case 'mot':
             return I18N::translate('mother');
         case 'fat':
             return I18N::translate('father');
         case 'par':
             return I18N::translate('parent');
         case 'hus':
             if ($person1 && $person2) {
                 foreach ($person1->getSpouseFamilies() as $family) {
                     if ($person2 === $family->getSpouse($person1)) {
                         if ($family->getFacts('_NMR')) {
                             if ($family->getFacts(WT_EVENTS_DIV)) {
                                 return I18N::translateContext('MALE', 'ex-partner');
                             } else {
                                 return I18N::translateContext('MALE', 'partner');
                             }
                         } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                             return I18N::translate('ex-husband');
                         }
                     }
                 }
             }
             return I18N::translate('husband');
         case 'wif':
             if ($person1 && $person1) {
                 foreach ($person1->getSpouseFamilies() as $family) {
                     if ($person2 === $family->getSpouse($person1)) {
                         if ($family->getFacts('_NMR')) {
                             if ($family->getFacts(WT_EVENTS_DIV)) {
                                 return I18N::translateContext('FEMALE', 'ex-partner');
                             } else {
                                 return I18N::translateContext('FEMALE', 'partner');
                             }
                         } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                             return I18N::translate('ex-wife');
                         }
                     }
                 }
             }
             return I18N::translate('wife');
         case 'spo':
             if ($person1 && $person2) {
                 foreach ($person1->getSpouseFamilies() as $family) {
                     if ($person2 === $family->getSpouse($person1)) {
                         if ($family->getFacts('_NMR')) {
                             if ($family->getFacts(WT_EVENTS_DIV)) {
                                 return I18N::translateContext('MALE/FEMALE', 'ex-partner');
                             } else {
                                 return I18N::translateContext('MALE/FEMALE', 'partner');
                             }
                         } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                             return I18N::translate('ex-spouse');
                         }
                     }
                 }
             }
             return I18N::translate('spouse');
         case 'son':
             return I18N::translate('son');
         case 'dau':
             return I18N::translate('daughter');
         case 'chi':
             return I18N::translate('child');
         case 'bro':
             if ($person1 && $person2) {
                 $dob1 = $person1->getBirthDate();
                 $dob2 = $person2->getBirthDate();
                 if ($dob1->isOK() && $dob2->isOK()) {
                     if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
                         // Exclude BEF, AFT, etc.
                         return I18N::translate('twin brother');
                     } elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
                         return I18N::translate('younger brother');
                     } elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
                         return I18N::translate('elder brother');
                     }
                 }
             }
             return I18N::translate('brother');
         case 'sis':
             if ($person1 && $person2) {
                 $dob1 = $person1->getBirthDate();
                 $dob2 = $person2->getBirthDate();
                 if ($dob1->isOK() && $dob2->isOK()) {
                     if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
                         // Exclude BEF, AFT, etc.
                         return I18N::translate('twin sister');
                     } elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
                         return I18N::translate('younger sister');
                     } elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
                         return I18N::translate('elder sister');
                     }
                 }
             }
             return I18N::translate('sister');
         case 'sib':
             if ($person1 && $person2) {
                 $dob1 = $person1->getBirthDate();
                 $dob2 = $person2->getBirthDate();
                 if ($dob1->isOK() && $dob2->isOK()) {
                     if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->minimumDate()->d !== 0 && !$dob2->minimumDate()->d !== 0) {
                         // Exclude BEF, AFT, etc.
                         return I18N::translate('twin sibling');
                     } elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) {
                         return I18N::translate('younger sibling');
                     } elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) {
                         return I18N::translate('elder sibling');
                     }
                 }
             }
             return I18N::translate('sibling');
             // Level Two relationships
         // Level Two relationships
         case 'brochi':
             return I18N::translateContext('brother’s child', 'nephew/niece');
         case 'brodau':
             return I18N::translateContext('brother’s daughter', 'niece');
         case 'broson':
             return I18N::translateContext('brother’s son', 'nephew');
         case 'browif':
             return I18N::translateContext('brother’s wife', 'sister-in-law');
         case 'chichi':
             return I18N::translateContext('child’s child', 'grandchild');
         case 'chidau':
             return I18N::translateContext('child’s daughter', 'granddaughter');
         case 'chihus':
             return I18N::translateContext('child’s husband', 'son-in-law');
         case 'chison':
             return I18N::translateContext('child’s son', 'grandson');
         case 'chispo':
             return I18N::translateContext('child’s spouse', 'son/daughter-in-law');
         case 'chiwif':
             return I18N::translateContext('child’s wife', 'daughter-in-law');
         case 'dauchi':
             return I18N::translateContext('daughter’s child', 'grandchild');
         case 'daudau':
             return I18N::translateContext('daughter’s daughter', 'granddaughter');
         case 'dauhus':
             return I18N::translateContext('daughter’s husband', 'son-in-law');
         case 'dauson':
             return I18N::translateContext('daughter’s son', 'grandson');
         case 'fatbro':
             return I18N::translateContext('father’s brother', 'uncle');
         case 'fatchi':
             return I18N::translateContext('father’s child', 'half-sibling');
         case 'fatdau':
             return I18N::translateContext('father’s daughter', 'half-sister');
         case 'fatfat':
             return I18N::translateContext('father’s father', 'paternal grandfather');
         case 'fatmot':
             return I18N::translateContext('father’s mother', 'paternal grandmother');
         case 'fatpar':
             return I18N::translateContext('father’s parent', 'paternal grandparent');
         case 'fatsib':
             return I18N::translateContext('father’s sibling', 'aunt/uncle');
         case 'fatsis':
             return I18N::translateContext('father’s sister', 'aunt');
         case 'fatson':
             return I18N::translateContext('father’s son', 'half-brother');
         case 'fatwif':
             return I18N::translateContext('father’s wife', 'step-mother');
         case 'husbro':
             return I18N::translateContext('husband’s brother', 'brother-in-law');
         case 'huschi':
             return I18N::translateContext('husband’s child', 'step-child');
         case 'husdau':
             return I18N::translateContext('husband’s daughter', 'step-daughter');
         case 'husfat':
             return I18N::translateContext('husband’s father', 'father-in-law');
         case 'husmot':
             return I18N::translateContext('husband’s mother', 'mother-in-law');
         case 'hussib':
             return I18N::translateContext('husband’s sibling', 'brother/sister-in-law');
         case 'hussis':
             return I18N::translateContext('husband’s sister', 'sister-in-law');
         case 'husson':
             return I18N::translateContext('husband’s son', 'step-son');
         case 'motbro':
             return I18N::translateContext('mother’s brother', 'uncle');
         case 'motchi':
             return I18N::translateContext('mother’s child', 'half-sibling');
         case 'motdau':
             return I18N::translateContext('mother’s daughter', 'half-sister');
         case 'motfat':
             return I18N::translateContext('mother’s father', 'maternal grandfather');
         case 'mothus':
             return I18N::translateContext('mother’s husband', 'step-father');
         case 'motmot':
             return I18N::translateContext('mother’s mother', 'maternal grandmother');
         case 'motpar':
             return I18N::translateContext('mother’s parent', 'maternal grandparent');
         case 'motsib':
             return I18N::translateContext('mother’s sibling', 'aunt/uncle');
         case 'motsis':
             return I18N::translateContext('mother’s sister', 'aunt');
         case 'motson':
             return I18N::translateContext('mother’s son', 'half-brother');
         case 'parbro':
             return I18N::translateContext('parent’s brother', 'uncle');
         case 'parchi':
             return I18N::translateContext('parent’s child', 'half-sibling');
         case 'pardau':
             return I18N::translateContext('parent’s daughter', 'half-sister');
         case 'parfat':
             return I18N::translateContext('parent’s father', 'grandfather');
         case 'parmot':
             return I18N::translateContext('parent’s mother', 'grandmother');
         case 'parpar':
             return I18N::translateContext('parent’s parent', 'grandparent');
         case 'parsib':
             return I18N::translateContext('parent’s sibling', 'aunt/uncle');
         case 'parsis':
             return I18N::translateContext('parent’s sister', 'aunt');
         case 'parson':
             return I18N::translateContext('parent’s son', 'half-brother');
         case 'parspo':
             return I18N::translateContext('parent’s spouse', 'step-parent');
         case 'sibchi':
             return I18N::translateContext('sibling’s child', 'nephew/niece');
         case 'sibdau':
             return I18N::translateContext('sibling’s daughter', 'niece');
         case 'sibson':
             return I18N::translateContext('sibling’s son', 'nephew');
         case 'sibspo':
             return I18N::translateContext('sibling’s spouse', 'brother/sister-in-law');
         case 'sischi':
             return I18N::translateContext('sister’s child', 'nephew/niece');
         case 'sisdau':
             return I18N::translateContext('sister’s daughter', 'niece');
         case 'sishus':
             return I18N::translateContext('sister’s husband', 'brother-in-law');
         case 'sisson':
             return I18N::translateContext('sister’s son', 'nephew');
         case 'sonchi':
             return I18N::translateContext('son’s child', 'grandchild');
         case 'sondau':
             return I18N::translateContext('son’s daughter', 'granddaughter');
         case 'sonson':
             return I18N::translateContext('son’s son', 'grandson');
         case 'sonwif':
             return I18N::translateContext('son’s wife', 'daughter-in-law');
         case 'spobro':
             return I18N::translateContext('spouse’s brother', 'brother-in-law');
         case 'spochi':
             return I18N::translateContext('spouse’s child', 'step-child');
         case 'spodau':
             return I18N::translateContext('spouse’s daughter', 'step-daughter');
         case 'spofat':
             return I18N::translateContext('spouse’s father', 'father-in-law');
         case 'spomot':
             return I18N::translateContext('spouse’s mother', 'mother-in-law');
         case 'sposis':
             return I18N::translateContext('spouse’s sister', 'sister-in-law');
         case 'sposon':
             return I18N::translateContext('spouse’s son', 'step-son');
         case 'spopar':
             return I18N::translateContext('spouse’s parent', 'mother/father-in-law');
         case 'sposib':
             return I18N::translateContext('spouse’s sibling', 'brother/sister-in-law');
         case 'wifbro':
             return I18N::translateContext('wife’s brother', 'brother-in-law');
         case 'wifchi':
             return I18N::translateContext('wife’s child', 'step-child');
         case 'wifdau':
             return I18N::translateContext('wife’s daughter', 'step-daughter');
         case 'wiffat':
             return I18N::translateContext('wife’s father', 'father-in-law');
         case 'wifmot':
             return I18N::translateContext('wife’s mother', 'mother-in-law');
         case 'wifsib':
             return I18N::translateContext('wife’s sibling', 'brother/sister-in-law');
         case 'wifsis':
             return I18N::translateContext('wife’s sister', 'sister-in-law');
         case 'wifson':
             return I18N::translateContext('wife’s son', 'step-son');
             // Level Three relationships
             // I have commented out some of the unknown-sex relationships that are unlikely to to occur.
             // Feel free to add them in, if you think they might be needed
         // Level Three relationships
         // I have commented out some of the unknown-sex relationships that are unlikely to to occur.
         // Feel free to add them in, if you think they might be needed
         case 'brochichi':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s child’s child', 'great-nephew/niece');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s child’s child', 'great-nephew/niece');
             }
         case 'brochidau':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s child’s daughter', 'great-niece');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s child’s daughter', 'great-niece');
             }
         case 'brochison':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s child’s son', 'great-nephew');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s child’s son', 'great-nephew');
             }
         case 'brodauchi':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s daughter’s child', 'great-nephew/niece');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s daughter’s child', 'great-nephew/niece');
             }
         case 'brodaudau':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s daughter’s daughter', 'great-niece');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s daughter’s daughter', 'great-niece');
             }
         case 'brodauhus':
             return I18N::translateContext('brother’s daughter’s husband', 'nephew-in-law');
         case 'brodauson':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s daughter’s son', 'great-nephew');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s daughter’s son', 'great-nephew');
             }
         case 'brosonchi':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s son’s child', 'great-nephew/niece');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s son’s child', 'great-nephew/niece');
             }
         case 'brosondau':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s son’s daughter', 'great-niece');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s son’s daughter', 'great-niece');
             }
         case 'brosonson':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) brother’s son’s son', 'great-nephew');
             } else {
                 return I18N::translateContext('(a woman’s) brother’s son’s son', 'great-nephew');
             }
         case 'brosonwif':
             return I18N::translateContext('brother’s son’s wife', 'niece-in-law');
         case 'browifbro':
             return I18N::translateContext('brother’s wife’s brother', 'brother-in-law');
         case 'browifsib':
             return I18N::translateContext('brother’s wife’s sibling', 'brother/sister-in-law');
         case 'browifsis':
             return I18N::translateContext('brother’s wife’s sister', 'sister-in-law');
         case 'chichichi':
             return I18N::translateContext('child’s child’s child', 'great-grandchild');
         case 'chichidau':
             return I18N::translateContext('child’s child’s daughter', 'great-granddaughter');
         case 'chichison':
             return I18N::translateContext('child’s child’s son', 'great-grandson');
         case 'chidauchi':
             return I18N::translateContext('child’s daughter’s child', 'great-grandchild');
         case 'chidaudau':
             return I18N::translateContext('child’s daughter’s daughter', 'great-granddaughter');
         case 'chidauhus':
             return I18N::translateContext('child’s daughter’s husband', 'granddaughter’s husband');
         case 'chidauson':
             return I18N::translateContext('child’s daughter’s son', 'great-grandson');
         case 'chisonchi':
             return I18N::translateContext('child’s son’s child', 'great-grandchild');
         case 'chisondau':
             return I18N::translateContext('child’s son’s daughter', 'great-granddaughter');
         case 'chisonson':
             return I18N::translateContext('child’s son’s son', 'great-grandson');
         case 'chisonwif':
             return I18N::translateContext('child’s son’s wife', 'grandson’s wife');
         case 'dauchichi':
             return I18N::translateContext('daughter’s child’s child', 'great-grandchild');
         case 'dauchidau':
             return I18N::translateContext('daughter’s child’s daughter', 'great-granddaughter');
         case 'dauchison':
             return I18N::translateContext('daughter’s child’s son', 'great-grandson');
         case 'daudauchi':
             return I18N::translateContext('daughter’s daughter’s child', 'great-grandchild');
         case 'daudaudau':
             return I18N::translateContext('daughter’s daughter’s daughter', 'great-granddaughter');
         case 'daudauhus':
             return I18N::translateContext('daughter’s daughter’s husband', 'granddaughter’s husband');
         case 'daudauson':
             return I18N::translateContext('daughter’s daughter’s son', 'great-grandson');
         case 'dauhusfat':
             return I18N::translateContext('daughter’s husband’s father', 'son-in-law’s father');
         case 'dauhusmot':
             return I18N::translateContext('daughter’s husband’s mother', 'son-in-law’s mother');
         case 'dauhuspar':
             return I18N::translateContext('daughter’s husband’s parent', 'son-in-law’s parent');
         case 'dausonchi':
             return I18N::translateContext('daughter’s son’s child', 'great-grandchild');
         case 'dausondau':
             return I18N::translateContext('daughter’s son’s daughter', 'great-granddaughter');
         case 'dausonson':
             return I18N::translateContext('daughter’s son’s son', 'great-grandson');
         case 'dausonwif':
             return I18N::translateContext('daughter’s son’s wife', 'grandson’s wife');
         case 'fatbrochi':
             return I18N::translateContext('father’s brother’s child', 'first cousin');
         case 'fatbrodau':
             return I18N::translateContext('father’s brother’s daughter', 'first cousin');
         case 'fatbroson':
             return I18N::translateContext('father’s brother’s son', 'first cousin');
         case 'fatbrowif':
             return I18N::translateContext('father’s brother’s wife', 'aunt');
         case 'fatfatbro':
             return I18N::translateContext('father’s father’s brother', 'great-uncle');
         case 'fatfatfat':
             return I18N::translateContext('father’s father’s father', 'great-grandfather');
         case 'fatfatmot':
             return I18N::translateContext('father’s father’s mother', 'great-grandmother');
         case 'fatfatpar':
             return I18N::translateContext('father’s father’s parent', 'great-grandparent');
         case 'fatfatsib':
             return I18N::translateContext('father’s father’s sibling', 'great-aunt/uncle');
         case 'fatfatsis':
             return I18N::translateContext('father’s father’s sister', 'great-aunt');
         case 'fatmotbro':
             return I18N::translateContext('father’s mother’s brother', 'great-uncle');
         case 'fatmotfat':
             return I18N::translateContext('father’s mother’s father', 'great-grandfather');
         case 'fatmotmot':
             return I18N::translateContext('father’s mother’s mother', 'great-grandmother');
         case 'fatmotpar':
             return I18N::translateContext('father’s mother’s parent', 'great-grandparent');
         case 'fatmotsib':
             return I18N::translateContext('father’s mother’s sibling', 'great-aunt/uncle');
         case 'fatmotsis':
             return I18N::translateContext('father’s mother’s sister', 'great-aunt');
         case 'fatparbro':
             return I18N::translateContext('father’s parent’s brother', 'great-uncle');
         case 'fatparfat':
             return I18N::translateContext('father’s parent’s father', 'great-grandfather');
         case 'fatparmot':
             return I18N::translateContext('father’s parent’s mother', 'great-grandmother');
         case 'fatparpar':
             return I18N::translateContext('father’s parent’s parent', 'great-grandparent');
         case 'fatparsib':
             return I18N::translateContext('father’s parent’s sibling', 'great-aunt/uncle');
         case 'fatparsis':
             return I18N::translateContext('father’s parent’s sister', 'great-aunt');
         case 'fatsischi':
             return I18N::translateContext('father’s sister’s child', 'first cousin');
         case 'fatsisdau':
             return I18N::translateContext('father’s sister’s daughter', 'first cousin');
         case 'fatsishus':
             return I18N::translateContext('father’s sister’s husband', 'uncle');
         case 'fatsisson':
             return I18N::translateContext('father’s sister’s son', 'first cousin');
         case 'fatwifchi':
             return I18N::translateContext('father’s wife’s child', 'step-sibling');
         case 'fatwifdau':
             return I18N::translateContext('father’s wife’s daughter', 'step-sister');
         case 'fatwifson':
             return I18N::translateContext('father’s wife’s son', 'step-brother');
         case 'husbrowif':
             return I18N::translateContext('husband’s brother’s wife', 'sister-in-law');
         case 'hussishus':
             return I18N::translateContext('husband’s sister’s husband', 'brother-in-law');
         case 'motbrochi':
             return I18N::translateContext('mother’s brother’s child', 'first cousin');
         case 'motbrodau':
             return I18N::translateContext('mother’s brother’s daughter', 'first cousin');
         case 'motbroson':
             return I18N::translateContext('mother’s brother’s son', 'first cousin');
         case 'motbrowif':
             return I18N::translateContext('mother’s brother’s wife', 'aunt');
         case 'motfatbro':
             return I18N::translateContext('mother’s father’s brother', 'great-uncle');
         case 'motfatfat':
             return I18N::translateContext('mother’s father’s father', 'great-grandfather');
         case 'motfatmot':
             return I18N::translateContext('mother’s father’s mother', 'great-grandmother');
         case 'motfatpar':
             return I18N::translateContext('mother’s father’s parent', 'great-grandparent');
         case 'motfatsib':
             return I18N::translateContext('mother’s father’s sibling', 'great-aunt/uncle');
         case 'motfatsis':
             return I18N::translateContext('mother’s father’s sister', 'great-aunt');
         case 'mothuschi':
             return I18N::translateContext('mother’s husband’s child', 'step-sibling');
         case 'mothusdau':
             return I18N::translateContext('mother’s husband’s daughter', 'step-sister');
         case 'mothusson':
             return I18N::translateContext('mother’s husband’s son', 'step-brother');
         case 'motmotbro':
             return I18N::translateContext('mother’s mother’s brother', 'great-uncle');
         case 'motmotfat':
             return I18N::translateContext('mother’s mother’s father', 'great-grandfather');
         case 'motmotmot':
             return I18N::translateContext('mother’s mother’s mother', 'great-grandmother');
         case 'motmotpar':
             return I18N::translateContext('mother’s mother’s parent', 'great-grandparent');
         case 'motmotsib':
             return I18N::translateContext('mother’s mother’s sibling', 'great-aunt/uncle');
         case 'motmotsis':
             return I18N::translateContext('mother’s mother’s sister', 'great-aunt');
         case 'motparbro':
             return I18N::translateContext('mother’s parent’s brother', 'great-uncle');
         case 'motparfat':
             return I18N::translateContext('mother’s parent’s father', 'great-grandfather');
         case 'motparmot':
             return I18N::translateContext('mother’s parent’s mother', 'great-grandmother');
         case 'motparpar':
             return I18N::translateContext('mother’s parent’s parent', 'great-grandparent');
         case 'motparsib':
             return I18N::translateContext('mother’s parent’s sibling', 'great-aunt/uncle');
         case 'motparsis':
             return I18N::translateContext('mother’s parent’s sister', 'great-aunt');
         case 'motsischi':
             return I18N::translateContext('mother’s sister’s child', 'first cousin');
         case 'motsisdau':
             return I18N::translateContext('mother’s sister’s daughter', 'first cousin');
         case 'motsishus':
             return I18N::translateContext('mother’s sister’s husband', 'uncle');
         case 'motsisson':
             return I18N::translateContext('mother’s sister’s son', 'first cousin');
         case 'parbrowif':
             return I18N::translateContext('parent’s brother’s wife', 'aunt');
         case 'parfatbro':
             return I18N::translateContext('parent’s father’s brother', 'great-uncle');
         case 'parfatfat':
             return I18N::translateContext('parent’s father’s father', 'great-grandfather');
         case 'parfatmot':
             return I18N::translateContext('parent’s father’s mother', 'great-grandmother');
         case 'parfatpar':
             return I18N::translateContext('parent’s father’s parent', 'great-grandparent');
         case 'parfatsib':
             return I18N::translateContext('parent’s father’s sibling', 'great-aunt/uncle');
         case 'parfatsis':
             return I18N::translateContext('parent’s father’s sister', 'great-aunt');
         case 'parmotbro':
             return I18N::translateContext('parent’s mother’s brother', 'great-uncle');
         case 'parmotfat':
             return I18N::translateContext('parent’s mother’s father', 'great-grandfather');
         case 'parmotmot':
             return I18N::translateContext('parent’s mother’s mother', 'great-grandmother');
         case 'parmotpar':
             return I18N::translateContext('parent’s mother’s parent', 'great-grandparent');
         case 'parmotsib':
             return I18N::translateContext('parent’s mother’s sibling', 'great-aunt/uncle');
         case 'parmotsis':
             return I18N::translateContext('parent’s mother’s sister', 'great-aunt');
         case 'parparbro':
             return I18N::translateContext('parent’s parent’s brother', 'great-uncle');
         case 'parparfat':
             return I18N::translateContext('parent’s parent’s father', 'great-grandfather');
         case 'parparmot':
             return I18N::translateContext('parent’s parent’s mother', 'great-grandmother');
         case 'parparpar':
             return I18N::translateContext('parent’s parent’s parent', 'great-grandparent');
         case 'parparsib':
             return I18N::translateContext('parent’s parent’s sibling', 'great-aunt/uncle');
         case 'parparsis':
             return I18N::translateContext('parent’s parent’s sister', 'great-aunt');
         case 'parsishus':
             return I18N::translateContext('parent’s sister’s husband', 'uncle');
         case 'parspochi':
             return I18N::translateContext('parent’s spouse’s child', 'step-sibling');
         case 'parspodau':
             return I18N::translateContext('parent’s spouse’s daughter', 'step-sister');
         case 'parsposon':
             return I18N::translateContext('parent’s spouse’s son', 'step-brother');
         case 'sibchichi':
             return I18N::translateContext('sibling’s child’s child', 'great-nephew/niece');
         case 'sibchidau':
             return I18N::translateContext('sibling’s child’s daughter', 'great-niece');
         case 'sibchison':
             return I18N::translateContext('sibling’s child’s son', 'great-nephew');
         case 'sibdauchi':
             return I18N::translateContext('sibling’s daughter’s child', 'great-nephew/niece');
         case 'sibdaudau':
             return I18N::translateContext('sibling’s daughter’s daughter', 'great-niece');
         case 'sibdauhus':
             return I18N::translateContext('sibling’s daughter’s husband', 'nephew-in-law');
         case 'sibdauson':
             return I18N::translateContext('sibling’s daughter’s son', 'great-nephew');
         case 'sibsonchi':
             return I18N::translateContext('sibling’s son’s child', 'great-nephew/niece');
         case 'sibsondau':
             return I18N::translateContext('sibling’s son’s daughter', 'great-niece');
         case 'sibsonson':
             return I18N::translateContext('sibling’s son’s son', 'great-nephew');
         case 'sibsonwif':
             return I18N::translateContext('sibling’s son’s wife', 'niece-in-law');
         case 'sischichi':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s child’s child', 'great-nephew/niece');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s child’s child', 'great-nephew/niece');
             }
         case 'sischidau':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s child’s daughter', 'great-niece');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s child’s daughter', 'great-niece');
             }
         case 'sischison':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s child’s son', 'great-nephew');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s child’s son', 'great-nephew');
             }
         case 'sisdauchi':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s daughter’s child', 'great-nephew/niece');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s daughter’s child', 'great-nephew/niece');
             }
         case 'sisdaudau':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s daughter’s daughter', 'great-niece');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s daughter’s daughter', 'great-niece');
             }
         case 'sisdauhus':
             return I18N::translateContext('sisters’s daughter’s husband', 'nephew-in-law');
         case 'sisdauson':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s daughter’s son', 'great-nephew');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s daughter’s son', 'great-nephew');
             }
         case 'sishusbro':
             return I18N::translateContext('sister’s husband’s brother', 'brother-in-law');
         case 'sishussib':
             return I18N::translateContext('sister’s husband’s sibling', 'brother/sister-in-law');
         case 'sishussis':
             return I18N::translateContext('sister’s husband’s sister', 'sister-in-law');
         case 'sissonchi':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s son’s child', 'great-nephew/niece');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s son’s child', 'great-nephew/niece');
             }
         case 'sissondau':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s son’s daughter', 'great-niece');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s son’s daughter', 'great-niece');
             }
         case 'sissonson':
             if ($sex1 === 'M') {
                 return I18N::translateContext('(a man’s) sister’s son’s son', 'great-nephew');
             } else {
                 return I18N::translateContext('(a woman’s) sister’s son’s son', 'great-nephew');
             }
         case 'sissonwif':
             return I18N::translateContext('sisters’s son’s wife', 'niece-in-law');
         case 'sonchichi':
             return I18N::translateContext('son’s child’s child', 'great-grandchild');
         case 'sonchidau':
             return I18N::translateContext('son’s child’s daughter', 'great-granddaughter');
         case 'sonchison':
             return I18N::translateContext('son’s child’s son', 'great-grandson');
         case 'sondauchi':
             return I18N::translateContext('son’s daughter’s child', 'great-grandchild');
         case 'sondaudau':
             return I18N::translateContext('son’s daughter’s daughter', 'great-granddaughter');
         case 'sondauhus':
             return I18N::translateContext('son’s daughter’s husband', 'granddaughter’s husband');
         case 'sondauson':
             return I18N::translateContext('son’s daughter’s son', 'great-grandson');
         case 'sonsonchi':
             return I18N::translateContext('son’s son’s child', 'great-grandchild');
         case 'sonsondau':
             return I18N::translateContext('son’s son’s daughter', 'great-granddaughter');
         case 'sonsonson':
             return I18N::translateContext('son’s son’s son', 'great-grandson');
         case 'sonsonwif':
             return I18N::translateContext('son’s son’s wife', 'grandson’s wife');
         case 'sonwiffat':
             return I18N::translateContext('son’s wife’s father', 'daughter-in-law’s father');
         case 'sonwifmot':
             return I18N::translateContext('son’s wife’s mother', 'daughter-in-law’s mother');
         case 'sonwifpar':
             return I18N::translateContext('son’s wife’s parent', 'daughter-in-law’s parent');
         case 'wifbrowif':
             return I18N::translateContext('wife’s brother’s wife', 'sister-in-law');
         case 'wifsishus':
             return I18N::translateContext('wife’s sister’s husband', 'brother-in-law');
             // Some “special case” level four relationships that have specific names in certain languages
         // Some “special case” level four relationships that have specific names in certain languages
         case 'fatfatbrowif':
             return I18N::translateContext('father’s father’s brother’s wife', 'great-aunt');
         case 'fatfatsibspo':
             return I18N::translateContext('father’s father’s sibling’s spouse', 'great-aunt/uncle');
         case 'fatfatsishus':
             return I18N::translateContext('father’s father’s sister’s husband', 'great-uncle');
         case 'fatmotbrowif':
             return I18N::translateContext('father’s mother’s brother’s wife', 'great-aunt');
         case 'fatmotsibspo':
             return I18N::translateContext('father’s mother’s sibling’s spouse', 'great-aunt/uncle');
         case 'fatmotsishus':
             return I18N::translateContext('father’s mother’s sister’s husband', 'great-uncle');
         case 'fatparbrowif':
             return I18N::translateContext('father’s parent’s brother’s wife', 'great-aunt');
         case 'fatparsibspo':
             return I18N::translateContext('father’s parent’s sibling’s spouse', 'great-aunt/uncle');
         case 'fatparsishus':
             return I18N::translateContext('father’s parent’s sister’s husband', 'great-uncle');
         case 'motfatbrowif':
             return I18N::translateContext('mother’s father’s brother’s wife', 'great-aunt');
         case 'motfatsibspo':
             return I18N::translateContext('mother’s father’s sibling’s spouse', 'great-aunt/uncle');
         case 'motfatsishus':
             return I18N::translateContext('mother’s father’s sister’s husband', 'great-uncle');
         case 'motmotbrowif':
             return I18N::translateContext('mother’s mother’s brother’s wife', 'great-aunt');
         case 'motmotsibspo':
             return I18N::translateContext('mother’s mother’s sibling’s spouse', 'great-aunt/uncle');
         case 'motmotsishus':
             return I18N::translateContext('mother’s mother’s sister’s husband', 'great-uncle');
         case 'motparbrowif':
             return I18N::translateContext('mother’s parent’s brother’s wife', 'great-aunt');
         case 'motparsibspo':
             return I18N::translateContext('mother’s parent’s sibling’s spouse', 'great-aunt/uncle');
         case 'motparsishus':
             return I18N::translateContext('mother’s parent’s sister’s husband', 'great-uncle');
         case 'parfatbrowif':
             return I18N::translateContext('parent’s father’s brother’s wife', 'great-aunt');
         case 'parfatsibspo':
             return I18N::translateContext('parent’s father’s sibling’s spouse', 'great-aunt/uncle');
         case 'parfatsishus':
             return I18N::translateContext('parent’s father’s sister’s husband', 'great-uncle');
         case 'parmotbrowif':
             return I18N::translateContext('parent’s mother’s brother’s wife', 'great-aunt');
         case 'parmotsibspo':
             return I18N::translateContext('parent’s mother’s sibling’s spouse', 'great-aunt/uncle');
         case 'parmotsishus':
             return I18N::translateContext('parent’s mother’s sister’s husband', 'great-uncle');
         case 'parparbrowif':
             return I18N::translateContext('parent’s parent’s brother’s wife', 'great-aunt');
         case 'parparsibspo':
             return I18N::translateContext('parent’s parent’s sibling’s spouse', 'great-aunt/uncle');
         case 'parparsishus':
             return I18N::translateContext('parent’s parent’s sister’s husband', 'great-uncle');
         case 'fatfatbrodau':
             return I18N::translateContext('father’s father’s brother’s daughter', 'first cousin once removed ascending');
         case 'fatfatbroson':
             return I18N::translateContext('father’s father’s brother’s son', 'first cousin once removed ascending');
         case 'fatfatbrochi':
             return I18N::translateContext('father’s father’s brother’s child', 'first cousin once removed ascending');
         case 'fatfatsisdau':
             return I18N::translateContext('father’s father’s sister’s daughter', 'first cousin once removed ascending');
         case 'fatfatsisson':
             return I18N::translateContext('father’s father’s sister’s son', 'first cousin once removed ascending');
         case 'fatfatsischi':
             return I18N::translateContext('father’s father’s sister’s child', 'first cousin once removed ascending');
         case 'fatmotbrodau':
             return I18N::translateContext('father’s mother’s brother’s daughter', 'first cousin once removed ascending');
         case 'fatmotbroson':
             return I18N::translateContext('father’s mother’s brother’s son', 'first cousin once removed ascending');
         case 'fatmotbrochi':
             return I18N::translateContext('father’s mother’s brother’s child', 'first cousin once removed ascending');
         case 'fatmotsisdau':
             return I18N::translateContext('father’s mother’s sister’s daughter', 'first cousin once removed ascending');
         case 'fatmotsisson':
             return I18N::translateContext('father’s mother’s sister’s son', 'first cousin once removed ascending');
         case 'fatmotsischi':
             return I18N::translateContext('father’s mother’s sister’s child', 'first cousin once removed ascending');
         case 'motfatbrodau':
             return I18N::translateContext('mother’s father’s brother’s daughter', 'first cousin once removed ascending');
         case 'motfatbroson':
             return I18N::translateContext('mother’s father’s brother’s son', 'first cousin once removed ascending');
         case 'motfatbrochi':
             return I18N::translateContext('mother’s father’s brother’s child', 'first cousin once removed ascending');
         case 'motfatsisdau':
             return I18N::translateContext('mother’s father’s sister’s daughter', 'first cousin once removed ascending');
         case 'motfatsisson':
             return I18N::translateContext('mother’s father’s sister’s son', 'first cousin once removed ascending');
         case 'motfatsischi':
             return I18N::translateContext('mother’s father’s sister’s child', 'first cousin once removed ascending');
         case 'motmotbrodau':
             return I18N::translateContext('mother’s mother’s brother’s daughter', 'first cousin once removed ascending');
         case 'motmotbroson':
             return I18N::translateContext('mother’s mother’s brother’s son', 'first cousin once removed ascending');
         case 'motmotbrochi':
             return I18N::translateContext('mother’s mother’s brother’s child', 'first cousin once removed ascending');
         case 'motmotsisdau':
             return I18N::translateContext('mother’s mother’s sister’s daughter', 'first cousin once removed ascending');
         case 'motmotsisson':
             return I18N::translateContext('mother’s mother’s sister’s son', 'first cousin once removed ascending');
         case 'motmotsischi':
             return I18N::translateContext('mother’s mother’s sister’s child', 'first cousin once removed ascending');
     }
     // Some “special case” level five relationships that have specific names in certain languages
     if (preg_match('/^(mot|fat|par)fatbro(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandfather’s brother’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatbro(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandfather’s brother’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatbro(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandfather’s brother’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatsis(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandfather’s sister’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatsis(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandfather’s sister’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatsis(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandfather’s sister’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatsib(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandfather’s sibling’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatsib(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandfather’s sibling’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)fatsib(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandfather’s sibling’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motbro(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandmother’s brother’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motbro(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandmother’s brother’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motbro(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandmother’s brother’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motsis(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandmother’s sister’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motsis(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandmother’s sister’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motsis(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandmother’s sister’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motsib(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandmother’s sibling’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motsib(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandmother’s sibling’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)motsib(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandmother’s sibling’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parbro(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandparent’s brother’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parbro(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandparent’s brother’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parbro(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandparent’s brother’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parsis(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandparent’s sister’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parsis(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandparent’s sister’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parsis(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandparent’s sister’s grandchild', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parsib(son|dau|chi)dau$/', $path)) {
         return I18N::translateContext('grandparent’s sibling’s granddaughter', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parsib(son|dau|chi)son$/', $path)) {
         return I18N::translateContext('grandparent’s sibling’s grandson', 'second cousin');
     } elseif (preg_match('/^(mot|fat|par)parsib(son|dau|chi)chi$/', $path)) {
         return I18N::translateContext('grandparent’s sibling’s grandchild', 'second cousin');
     }
     // Look for generic/pattern relationships.
     if (preg_match('/^((?:mot|fat|par)+)(bro|sis|sib)$/', $path, $match)) {
         // siblings of direct ancestors
         $up = strlen($match[1]) / 3;
         $bef_last = substr($path, -6, 3);
         switch ($up) {
             case 3:
                 switch ($sex2) {
                     case 'M':
                         if ($bef_last === 'fat') {
                             return I18N::translateContext('great-grandfather’s brother', 'great-great-uncle');
                         } elseif ($bef_last === 'mot') {
                             return I18N::translateContext('great-grandmother’s brother', 'great-great-uncle');
                         } else {
                             return I18N::translateContext('great-grandparent’s brother', 'great-great-uncle');
                         }
                     case 'F':
                         return I18N::translate('great-great-aunt');
                     default:
                         return I18N::translate('great-great-aunt/uncle');
                 }
             case 4:
                 switch ($sex2) {
                     case 'M':
                         if ($bef_last === 'fat') {
                             return I18N::translateContext('great-great-grandfather’s brother', 'great-great-great-uncle');
                         } elseif ($bef_last === 'mot') {
                             return I18N::translateContext('great-great-grandmother’s brother', 'great-great-great-uncle');
                         } else {
                             return I18N::translateContext('great-great-grandparent’s brother', 'great-great-great-uncle');
                         }
                     case 'F':
                         return I18N::translate('great-great-great-aunt');
                     default:
                         return I18N::translate('great-great-great-aunt/uncle');
                 }
             case 5:
                 switch ($sex2) {
                     case 'M':
                         if ($bef_last === 'fat') {
                             return I18N::translateContext('great-great-great-grandfather’s brother', 'great ×4 uncle');
                         } elseif ($bef_last === 'mot') {
                             return I18N::translateContext('great-great-great-grandmother’s brother', 'great ×4 uncle');
                         } else {
                             return I18N::translateContext('great-great-great-grandparent’s brother', 'great ×4 uncle');
                         }
                     case 'F':
                         return I18N::translate('great ×4 aunt');
                     default:
                         return I18N::translate('great ×4 aunt/uncle');
                 }
             case 6:
                 switch ($sex2) {
                     case 'M':
                         if ($bef_last === 'fat') {
                             return I18N::translateContext('great ×4 grandfather’s brother', 'great ×5 uncle');
                         } elseif ($bef_last === 'mot') {
                             return I18N::translateContext('great ×4 grandmother’s brother', 'great ×5 uncle');
                         } else {
                             return I18N::translateContext('great ×4 grandparent’s brother', 'great ×5 uncle');
                         }
                     case 'F':
                         return I18N::translate('great ×5 aunt');
                     default:
                         return I18N::translate('great ×5 aunt/uncle');
                 }
             case 7:
                 switch ($sex2) {
                     case 'M':
                         if ($bef_last === 'fat') {
                             return I18N::translateContext('great ×5 grandfather’s brother', 'great ×6 uncle');
                         } elseif ($bef_last === 'mot') {
                             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':
                                 return I18N::translate('great ×%s aunt', I18N::number($up - 1));
                             default:
                                 return I18N::translate('great ×%s aunt/uncle', I18N::number($up - 1));
                         }
                 }
         }
     }
     if (preg_match('/^(?:bro|sis|sib)((?:son|dau|chi)+)$/', $path, $match)) {
         // direct descendants of siblings
         $down = strlen($match[1]) / 3 + 1;
         // Add one, as we count generations from the common ancestor
         $first = substr($path, 0, 3);
         switch ($down) {
             case 4:
                 switch ($sex2) {
                     case 'M':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-grandson', 'great-great-nephew');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-grandson', 'great-great-nephew');
                         } else {
                             return I18N::translateContext('(a woman’s) great-great-nephew', 'great-great-nephew');
                         }
                     case 'F':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-granddaughter', 'great-great-niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-granddaughter', 'great-great-niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great-great-niece', 'great-great-niece');
                         }
                     default:
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-grandchild', 'great-great-nephew/niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-grandchild', 'great-great-nephew/niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great-great-nephew/niece', 'great-great-nephew/niece');
                         }
                 }
             case 5:
                 switch ($sex2) {
                     case 'M':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-great-grandson', 'great-great-great-nephew');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-great-grandson', 'great-great-great-nephew');
                         } else {
                             return I18N::translateContext('(a woman’s) great-great-great-nephew', 'great-great-great-nephew');
                         }
                     case 'F':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-great-granddaughter', 'great-great-great-niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-great-granddaughter', 'great-great-great-niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great-great-great-niece', 'great-great-great-niece');
                         }
                     default:
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-great-grandchild', 'great-great-great-nephew/niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-great-grandchild', 'great-great-great-nephew/niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great-great-great-nephew/niece', 'great-great-great-nephew/niece');
                         }
                 }
             case 6:
                 switch ($sex2) {
                     case 'M':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-great-great-grandson', 'great ×4 nephew');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-great-great-grandson', 'great ×4 nephew');
                         } else {
                             return I18N::translateContext('(a woman’s) great ×4 nephew', 'great ×4 nephew');
                         }
                     case 'F':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-great-great-granddaughter', 'great ×4 niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-great-great-granddaughter', 'great ×4 niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great ×4 niece', 'great ×4 niece');
                         }
                     default:
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great-great-great-grandchild', 'great ×4 nephew/niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great-great-great-grandchild', 'great ×4 nephew/niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great ×4 nephew/niece', 'great ×4 nephew/niece');
                         }
                 }
             case 7:
                 switch ($sex2) {
                     case 'M':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great ×4 grandson', 'great ×5 nephew');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great ×4 grandson', 'great ×5 nephew');
                         } else {
                             return I18N::translateContext('(a woman’s) great ×5 nephew', 'great ×5 nephew');
                         }
                     case 'F':
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great ×4 granddaughter', 'great ×5 niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great ×4 granddaughter', 'great ×5 niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great ×5 niece', 'great ×5 niece');
                         }
                     default:
                         if ($first === 'bro' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) brother’s great ×4 grandchild', 'great ×5 nephew/niece');
                         } elseif ($first === 'sis' && $sex1 === 'M') {
                             return I18N::translateContext('(a man’s) sister’s great ×4 grandchild', 'great ×5 nephew/niece');
                         } else {
                             return I18N::translateContext('(a woman’s) great ×5 nephew/niece', 'great ×5 nephew/niece');
                         }
                 }
             default:
                 // Different languages have different rules for naming generations.
                 // An English great ×12 nephew is a Polish great ×11 nephew.
                 //
                 // Need to find out which languages use which rules.
                 switch (WT_LOCALE) {
                     case 'pl':
                         // Source: Lukasz Wilenski
                         switch ($sex2) {
                             case 'M':
                                 if ($first === 'bro' && $sex1 === 'M') {
                                     return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
                                 } elseif ($first === 'sis' && $sex1 === 'M') {
                                     return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
                                 } else {
                                     return I18N::translateContext('(a woman’s) great ×%s nephew', 'great ×%s nephew', I18N::number($down - 3));
                                 }
                             case 'F':
                                 if ($first === 'bro' && $sex1 === 'M') {
                                     return I18N::translateContext('(a man’s) brother’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
                                 } elseif ($first === 'sis' && $sex1 === 'M') {
                                     return I18N::translateContext('(a man’s) sister’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
                                 } else {
                                     return I18N::translateContext('(a woman’s) great ×%s niece', 'great ×%s niece', I18N::number($down - 3));
                                 }
                             default:
                                 if ($first === 'bro' && $sex1 === 'M') {
                                     return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandchild', 'great ×%s nephew/niece', I18N::number($down - 3));
                                 } elseif ($first === 'sis' && $sex1 === 'M') {
                                     return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandchild', 'great ×%s nephew/niece', I18N::number($down - 3));
                                 } else {
                                     return I18N::translateContext('(a woman’s) great ×%s nephew/niece', 'great ×%s nephew/niece', I18N::number($down - 3));
                                 }
                         }
                     case 'he':
                         // Source: Meliza Amity
                         switch ($sex2) {
                             case 'M':
                                 return I18N::translate('great ×%s nephew', I18N::number($down - 1));
                             case 'F':
                                 return I18N::translate('great ×%s niece', I18N::number($down - 1));
                             default:
                                 return I18N::translate('great ×%s nephew/niece', I18N::number($down - 1));
                         }
                     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 nephew', I18N::number($down - 2));
                             case 'F':
                                 return I18N::translate('great ×%s niece', I18N::number($down - 2));
                             default:
                                 return I18N::translate('great ×%s nephew/niece', I18N::number($down - 2));
                         }
                 }
         }
     }
     if (preg_match('/^((?:mot|fat|par)*)$/', $path, $match)) {
         // direct ancestors
         $up = strlen($match[1]) / 3;
         switch ($up) {
             case 4:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great-great-grandfather');
                     case 'F':
                         return I18N::translate('great-great-grandmother');
                     default:
                         return I18N::translate('great-great-grandparent');
                 }
             case 5:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great-great-great-grandfather');
                     case 'F':
                         return I18N::translate('great-great-great-grandmother');
                     default:
                         return I18N::translate('great-great-great-grandparent');
                 }
             case 6:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×4 grandfather');
                     case 'F':
                         return I18N::translate('great ×4 grandmother');
                     default:
                         return I18N::translate('great ×4 grandparent');
                 }
             case 7:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×5 grandfather');
                     case 'F':
                         return I18N::translate('great ×5 grandmother');
                     default:
                         return I18N::translate('great ×5 grandparent');
                 }
             case 8:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×6 grandfather');
                     case 'F':
                         return I18N::translate('great ×6 grandmother');
                     default:
                         return I18N::translate('great ×6 grandparent');
                 }
             case 9:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×7 grandfather');
                     case 'F':
                         return I18N::translate('great ×7 grandmother');
                     default:
                         return I18N::translate('great ×7 grandparent');
                 }
             default:
                 // Different languages have different rules for naming generations.
                 // An English great ×12 grandfather is a Danish great ×11 grandfather.
                 //
                 // Need to find out which languages use which rules.
                 switch (WT_LOCALE) {
                     case 'da':
                         // Source: Patrick Sorensen
                         switch ($sex2) {
                             case 'M':
                                 return I18N::translate('great ×%s grandfather', I18N::number($up - 3));
                             case 'F':
                                 return I18N::translate('great ×%s grandmother', I18N::number($up - 3));
                             default:
                                 return I18N::translate('great ×%s grandparent', I18N::number($up - 3));
                         }
                     case 'it':
                         // Source: Michele Locati
                     // Source: Michele Locati
                     case 'es':
                         // Source: Wes Groleau
                         switch ($sex2) {
                             case 'M':
                                 return I18N::translate('great ×%s grandfather', I18N::number($up));
                             case 'F':
                                 return I18N::translate('great ×%s grandmother', I18N::number($up));
                             default:
                                 return I18N::translate('great ×%s grandparent', I18N::number($up));
                         }
                     case 'fr':
                         // Source: Jacqueline Tetreault
                     // Source: Jacqueline Tetreault
                     case 'fr_CA':
                         switch ($sex2) {
                             case 'M':
                                 return I18N::translate('great ×%s grandfather', I18N::number($up - 1));
                             case 'F':
                                 return I18N::translate('great ×%s grandmother', I18N::number($up - 1));
                             default:
                                 return I18N::translate('great ×%s grandparent', I18N::number($up - 1));
                         }
                     case 'nn':
                         // Source: Hogne Røed Nilsen (https://bugs.launchpad.net/webtrees/+bug/1168553)
                     // Source: Hogne Røed Nilsen (https://bugs.launchpad.net/webtrees/+bug/1168553)
                     case 'nb':
                         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 grandfather', I18N::number($up - 3));
                             case 'F':
                                 return I18N::translate('great ×%s grandmother', I18N::number($up - 3));
                             default:
                                 return I18N::translate('great ×%s grandparent', I18N::number($up - 3));
                         }
                     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 grandfather', I18N::number($up - 2));
                             case 'F':
                                 return I18N::translate('great ×%s grandmother', I18N::number($up - 2));
                             default:
                                 return I18N::translate('great ×%s grandparent', I18N::number($up - 2));
                         }
                 }
         }
     }
     if (preg_match('/^((?:son|dau|chi)*)$/', $path, $match)) {
         // direct descendants
         $up = strlen($match[1]) / 3;
         switch ($up) {
             case 4:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great-great-grandson');
                     case 'F':
                         return I18N::translate('great-great-granddaughter');
                     default:
                         return I18N::translate('great-great-grandchild');
                 }
             case 5:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great-great-great-grandson');
                     case 'F':
                         return I18N::translate('great-great-great-granddaughter');
                     default:
                         return I18N::translate('great-great-great-grandchild');
                 }
             case 6:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×4 grandson');
                     case 'F':
                         return I18N::translate('great ×4 granddaughter');
                     default:
                         return I18N::translate('great ×4 grandchild');
                 }
             case 7:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×5 grandson');
                     case 'F':
                         return I18N::translate('great ×5 granddaughter');
                     default:
                         return I18N::translate('great ×5 grandchild');
                 }
             case 8:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×6 grandson');
                     case 'F':
                         return I18N::translate('great ×6 granddaughter');
                     default:
                         return I18N::translate('great ×6 grandchild');
                 }
             case 9:
                 switch ($sex2) {
                     case 'M':
                         return I18N::translate('great ×7 grandson');
                     case 'F':
                         return I18N::translate('great ×7 granddaughter');
                     default:
                         return I18N::translate('great ×7 grandchild');
                 }
             default:
                 // Different languages have different rules for naming generations.
                 // An English great ×12 grandson is a Danish great ×11 grandson.
                 //
                 // Need to find out which languages use which rules.
                 switch (WT_LOCALE) {
                     case 'nn':
                         // Source: Hogne Røed Nilsen
                     // Source: Hogne Røed Nilsen
                     case 'nb':
                     case 'da':
                         // Source: Patrick Sorensen
                         switch ($sex2) {
                             case 'M':
                                 return I18N::translate('great ×%s grandson', I18N::number($up - 3));
                             case 'F':
                                 return I18N::translate('great ×%s granddaughter', I18N::number($up - 3));
                             default:
                                 return I18N::translate('great ×%s grandchild', I18N::number($up - 3));
                         }
                     case 'it':
                         // Source: Michele Locati
                     // Source: Michele Locati
                     case 'es':
                         // Source: Wes Groleau (adding doesn’t change behavior, but needs to be better researched)
                     // Source: Wes Groleau (adding doesn’t change behavior, but needs to be better researched)
                     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 grandson', I18N::number($up - 2));
                             case 'F':
                                 return I18N::translate('great ×%s granddaughter', I18N::number($up - 2));
                             default:
                                 return I18N::translate('great ×%s grandchild', I18N::number($up - 2));
                         }
                 }
         }
     }
     if (preg_match('/^((?:mot|fat|par)+)(?:bro|sis|sib)((?:son|dau|chi)+)$/', $path, $match)) {
         // cousins in English
         $ascent = $match[1];
         $descent = $match[2];
         $up = strlen($ascent) / 3;
         $down = strlen($descent) / 3;
         $cousin = min($up, $down);
         // Moved out of switch (en/default case) so that
         $removed = abs($down - $up);
         // Spanish (and other languages) can use it, too.
         // Different languages have different rules for naming cousins.  For example,
         // an English “second cousin once removed” is a Polish “cousin of 7th degree”.
         //
         // Need to find out which languages use which rules.
         switch (WT_LOCALE) {
             case 'pl':
                 // Source: Lukasz Wilenski
                 return self::cousinName($up + $down + 2, $sex2);
             case 'it':
                 // Source: Michele Locati.  See italian_cousins_names.zip
                 // http://webtrees.net/forums/8-translation/1200-great-xn-grandparent?limit=6&start=6
                 return self::cousinName($up + $down - 3, $sex2);
             case 'es':
                 // Source: Wes Groleau.  See http://UniGen.us/Parentesco.html & http://UniGen.us/Parentesco-D.html
                 if ($down == $up) {
                     return self::cousinName($cousin, $sex2);
                 } elseif ($down < $up) {
                     return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sib' . $descent, null, null));
                 } else {
                     switch ($sex2) {
                         case 'M':
                             return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('bro' . $descent, null, null));
                         case 'F':
                             return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sis' . $descent, null, null));
                         default:
                             return self::cousinName2($cousin + 1, $sex2, self::getRelationshipNameFromPath('sib' . $descent, null, null));
                     }
                 }
             case 'en_AU':
                 // See: http://en.wikipedia.org/wiki/File:CousinTree.svg
             // See: http://en.wikipedia.org/wiki/File:CousinTree.svg
             case 'en_GB':
             case 'en_US':
             default:
                 switch ($removed) {
                     case 0:
                         return self::cousinName($cousin, $sex2);
                     case 1:
                         if ($up > $down) {
                             /* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
                             return I18N::translate('%s once removed ascending', self::cousinName($cousin, $sex2));
                         } else {
                             /* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
                             return I18N::translate('%s once removed descending', self::cousinName($cousin, $sex2));
                         }
                     case 2:
                         if ($up > $down) {
                             /* I18N: %s=“fifth cousin”, etc. */
                             return I18N::translate('%s twice removed ascending', self::cousinName($cousin, $sex2));
                         } else {
                             /* I18N: %s=“fifth cousin”, etc. */
                             return I18N::translate('%s twice removed descending', self::cousinName($cousin, $sex2));
                         }
                     case 3:
                         if ($up > $down) {
                             /* I18N: %s=“fifth cousin”, etc. */
                             return I18N::translate('%s three times removed ascending', self::cousinName($cousin, $sex2));
                         } else {
                             /* I18N: %s=“fifth cousin”, etc. */
                             return I18N::translate('%s three times removed descending', self::cousinName($cousin, $sex2));
                         }
                     default:
                         if ($up > $down) {
                             /* I18N: %1$s=“fifth cousin”, etc., %2$s>=4 */
                             return I18N::translate('%1$s %2$s times removed ascending', self::cousinName($cousin, $sex2), I18N::number($removed));
                         } else {
                             /* I18N: %1$s=“fifth cousin”, etc., %2$s>=4 */
                             return I18N::translate('%1$s %2$s times removed descending', self::cousinName($cousin, $sex2), I18N::number($removed));
                         }
                 }
         }
     }
     // Split the relationship into sub-relationships, e.g., third-cousin’s great-uncle.
     // Try splitting at every point, and choose the path with the shorted translated name.
     $relationship = null;
     $path1 = substr($path, 0, 3);
     $path2 = substr($path, 3);
     while ($path2) {
         $tmp = I18N::translate('%1$s’s %2$s', self::getRelationshipNameFromPath($path1, null, null), self::getRelationshipNameFromPath($path2, null, null));
         if (!$relationship || strlen($tmp) < strlen($relationship)) {
             $relationship = $tmp;
         }
         $path1 .= substr($path2, 0, 3);
         $path2 = substr($path2, 3);
     }
     return $relationship;
 }
Beispiel #8
0
        $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>';
Beispiel #9
0
 /**
  * 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;
 }
 /**
  * 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;
     }
 }
Beispiel #11
0
 /**
  * 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);
     }
 }
Beispiel #12
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">
Beispiel #13
0
 /**
  * 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';
     }
 }
 /** {@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>';
 }
 /**
  * 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;
     }
 }
 /**
  * Print the page footer, using the theme
  * Note that popup windows are deprecated
  */
 public function pageFooterPopupWindow()
 {
     echo Theme::theme()->footerContainerPopupWindow() . '<!--[if lt IE 9]><script src="' . WT_JQUERY_JS_URL . '"></script><![endif]-->' . '<!--[if gte IE 9]><!--><script src="' . WT_JQUERY2_JS_URL . '"></script><!--<![endif]-->' . '<script src="' . WT_JQUERYUI_JS_URL . '">"</script>' . '<script src="' . WT_WEBTREES_JS_URL . '">"</script>' . $this->getJavascript() . Theme::theme()->hookFooterExtraJavascript() . (WT_DEBUG_SQL ? Database::getQueryLog() : '') . '</body>' . '</html>' . PHP_EOL . '<!-- webtrees: ' . WT_VERSION . ' -->' . '<!-- Execution time: ' . I18N::number(microtime(true) - WT_START_TIME, 3) . ' seconds -->' . '<!-- Memory: ' . I18N::number(memory_get_peak_usage(true) / 1024) . ' KB -->' . '<!-- SQL queries: ' . I18N::number(Database::getQueryCount()) . ' -->';
 }
 /**
  * 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>';
 }
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
define('WT_SCRIPT_NAME', 'admin_trees_config.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE));
$calendars = array('none' => I18N::translate('No calendar conversion')) + Date::calendarNames();
$french_calendar_start = new Date('22 SEP 1792');
$french_calendar_end = new Date('31 DEC 1805');
$gregorian_calendar_start = new Date('15 OCT 1582');
$hide_show = array(0 => I18N::translate('hide'), 1 => I18N::translate('show'));
$surname_list_styles = array('style1' => I18N::translate('list'), 'style2' => I18N::translate('table'), 'style3' => I18N::translate('tag cloud'));
$layouts = array(0 => I18N::translate('Portrait'), 1 => I18N::translate('Landscape'));
$one_to_nine = array();
for ($n = 1; $n <= 9; ++$n) {
    $one_to_nine[$n] = I18N::number($n);
}
$formats = array('' => I18N::translate('none'), 'markdown' => I18N::translate('markdown'));
$source_types = array(0 => I18N::translate('none'), 1 => I18N::translate('facts'), 2 => I18N::translate('records'));
$no_yes = array(0 => I18N::translate('no'), 1 => I18N::translate('yes'));
$PRIVACY_CONSTANTS = array('none' => I18N::translate('Show to visitors'), 'privacy' => I18N::translate('Show to members'), 'confidential' => I18N::translate('Show to managers'), 'hidden' => I18N::translate('Hide from everyone'));
$privacy = array(Auth::PRIV_PRIVATE => I18N::translate('Show to visitors'), Auth::PRIV_USER => I18N::translate('Show to members'), Auth::PRIV_NONE => I18N::translate('Show to managers'), Auth::PRIV_HIDE => I18N::translate('Hide from everyone'));
$tags = array_unique(array_merge(explode(',', $WT_TREE->getPreference('INDI_FACTS_ADD')), explode(',', $WT_TREE->getPreference('INDI_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('FAM_FACTS_ADD')), explode(',', $WT_TREE->getPreference('FAM_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('NOTE_FACTS_ADD')), explode(',', $WT_TREE->getPreference('NOTE_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('SOUR_FACTS_ADD')), explode(',', $WT_TREE->getPreference('SOUR_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('REPO_FACTS_ADD')), explode(',', $WT_TREE->getPreference('REPO_FACTS_UNIQUE')), array('SOUR', 'REPO', 'OBJE', '_PRIM', 'NOTE', 'SUBM', 'SUBN', '_UID', 'CHAN')));
$all_tags = array();
foreach ($tags as $tag) {
    if ($tag) {
        $all_tags[$tag] = GedcomTag::getLabel($tag);
    }
}
uasort($all_tags, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
$resns = Database::prepare("SELECT default_resn_id, tag_type, xref, resn" . " FROM `##default_resn`" . " LEFT JOIN `##name` ON (gedcom_id=n_file AND xref=n_id AND n_num=0)" . " WHERE gedcom_id=?" . " ORDER BY xref IS NULL, n_sort, xref, tag_type")->execute(array($WT_TREE->getTreeId()))->fetchAll();
Beispiel #19
0
    /**
     * Check places for missing data, etc.
     */
    private function adminPlaceCheck()
    {
        global $WT_TREE;
        $gedcom_id = Filter::get('gedcom_id', null, $WT_TREE->getTreeId());
        $country = Filter::get('country', '.+', 'XYZ');
        $state = Filter::get('state', '.+', 'XYZ');
        $matching = Filter::getBool('matching');
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Google Maps™'))->pageHeader();
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>

		<ul class="nav nav-tabs nav-justified" role="tablist">
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_config" role="tab">
					<?php 
        echo I18N::translate('Google Maps™ preferences');
        ?>
				</a>
			</li>
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_places">
					<?php 
        echo I18N::translate('Geographic data');
        ?>
				</a>
			</li>
			<li role="presentation" class="active">
				<a href="#">
					<?php 
        echo I18N::translate('Place check');
        ?>
				</a>
			</li>
		</ul>
		<?php 
        echo '<h2>', I18N::translate('Place check'), '</h2>';
        // User options
        $rows = Database::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")->fetchAssoc();
        echo '<form name="placecheck" class="form form-inline">';
        echo '<input type="hidden" name="mod" value="', $this->getName(), '">';
        echo '<input type="hidden" name="mod_action" value="admin_placecheck">';
        echo '<div class="form-group">';
        echo '<label for="gedcom_id">', I18N::translate('Family tree'), '</label> ';
        echo FunctionsEdit::selectEditControl('gedcom_id', Tree::getIdList(), null, $gedcom_id, ' onchange="this.form.submit();" class="form-control"'), ' ';
        echo '<label for="country">', I18N::translate('Country'), '</label> ';
        echo '<select name="country" onchange="this.form.submit();" class="form-control"> ';
        echo '<option value="XYZ">', I18N::translate('All'), '</option>';
        foreach ($rows as $id => $place) {
            echo '<option value="', Filter::escapeHtml($place), '" ';
            if ($place == $country) {
                echo 'selected';
                $par_id = $id;
            }
            echo '>', Filter::escapeHtml($place), '</option>';
        }
        echo '</select> ';
        if ($country != 'XYZ') {
            echo '<label for="state">', I18N::translate('Subdivision'), '</label> ';
            echo '<select name="state" onchange="this.form.submit();" class="form-control">';
            echo '<option value="XYZ">', I18N::translate('All'), '</option>';
            $places = Database::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")->execute(array($par_id))->fetchOneColumn();
            foreach ($places as $place) {
                echo '<option value="', Filter::escapeHtml($place), '" ', $place == $state ? 'selected' : '', '>', Filter::escapeHtml($place), '</option>';
            }
            echo '</select> ';
        }
        echo '<div class="checkbox-inline">';
        echo '<label for="matching">';
        echo '<input type="checkbox" name="matching" value="1" onchange="this.form.submit();" ', $matching ? 'checked' : '', '>';
        echo I18N::translate('Include fully matched places');
        echo '</label>';
        echo '</div></div>';
        echo '</form>';
        echo '<hr>';
        //Select all '2 PLAC ' tags in the file and create array
        $place_list = array();
        $ged_data = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?")->execute(array("%\n2 PLAC %", $gedcom_id))->fetchOneColumn();
        foreach ($ged_data as $ged_datum) {
            preg_match_all('/\\n2 PLAC (.+)/', $ged_datum, $matches);
            foreach ($matches[1] as $match) {
                $place_list[$match] = true;
            }
        }
        $ged_data = Database::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?")->execute(array("%\n2 PLAC %", $gedcom_id))->fetchOneColumn();
        foreach ($ged_data as $ged_datum) {
            preg_match_all('/\\n2 PLAC (.+)/', $ged_datum, $matches);
            foreach ($matches[1] as $match) {
                $place_list[$match] = true;
            }
        }
        // Unique list of places
        $place_list = array_keys($place_list);
        // Apply_filter
        if ($country == 'XYZ') {
            $filter = '.*$';
        } else {
            $filter = preg_quote($country) . '$';
            if ($state != 'XYZ') {
                $filter = preg_quote($state) . ', ' . $filter;
            }
        }
        $place_list = preg_grep('/' . $filter . '/', $place_list);
        //sort the array, limit to unique values, and count them
        usort($place_list, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
        $i = count($place_list);
        //calculate maximum no. of levels to display
        $x = 0;
        $max = 0;
        while ($x < $i) {
            $levels = explode(",", $place_list[$x]);
            $parts = count($levels);
            if ($parts > $max) {
                $max = $parts;
            }
            $x++;
        }
        $x = 0;
        //scripts for edit, add and refresh
        ?>
		<script>
			function edit_place_location(placeid) {
				window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs);
				return false;
			}

			function add_place_location(placeid) {
				window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs);
				return false;
			}
		</script>
		<?php 
        //start to produce the display table
        echo '<table class="table table-bordered table-condensed table-hover"><thead><tr>';
        echo '<th rowspan="3">', I18N::translate('Place'), '</th>';
        echo '<th colspan="', $max * 3, '">', I18N::translate('Geographic data'), '</th></tr>';
        echo '<tr>';
        for ($cols = 0; $cols < $max; ++$cols) {
            if ($cols == 0) {
                echo '<th colspan="3">', I18N::translate('Country'), '</th>';
            } else {
                echo '<th colspan="3">', I18N::translate('Level'), ' ', $cols + 1, '</th>';
            }
        }
        echo '</tr><tr>';
        for ($cols = 0; $cols < $max; ++$cols) {
            echo '<th>', GedcomTag::getLabel('PLAC'), '</th>';
            echo '<th>', I18N::translate('Latitude'), '</th>';
            echo '<th>', I18N::translate('Longitude'), '</th>';
        }
        echo '</tr></thead><tbody>';
        $countrows = 0;
        $matched = array();
        while ($x < $i) {
            $placestr = '';
            $levels = explode(', ', $place_list[$x]);
            $parts = count($levels);
            $levels = array_reverse($levels);
            $placestr .= '<a href="placelist.php?action=show';
            foreach ($levels as $pindex => $ppart) {
                $placestr .= '&amp;parent[' . $pindex . ']=' . urlencode($ppart);
            }
            $placestr .= '">' . $place_list[$x] . "</a>";
            $gedplace = '<tr><td>' . $placestr . '</td>';
            $z = 0;
            $id = 0;
            $level = 0;
            $matched[$x] = 0;
            // used to exclude places where the gedcom place is matched at all levels
            $mapstr_edit = '<a href="#" dir="auto" onclick="edit_place_location(\'';
            $mapstr_add = '<a href="#" dir="auto" onclick="add_place_location(\'';
            $mapstr3 = '';
            $mapstr4 = '';
            $mapstr5 = '\')" title=\'';
            $mapstr6 = '\' >';
            $mapstr7 = '\')">';
            $mapstr8 = '</a>';
            $plac = array();
            $lati = array();
            $long = array();
            while ($z < $parts) {
                if ($levels[$z] == '') {
                    $levels[$z] = 'unknown';
                    // GoogleMap module uses "unknown" while GEDCOM uses , ,
                }
                $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1);
                // add the necessary prefix/postfix values to the place name
                foreach ($placelist as $key => $placename) {
                    $row = Database::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($z, $id, $placename))->fetchOneRow(PDO::FETCH_ASSOC);
                    if (!empty($row['pl_id'])) {
                        $row['pl_placerequested'] = $levels[$z];
                        // keep the actual place name that was requested so we can display that instead of what is in the db
                        break;
                    }
                }
                if ($row['pl_id'] != '') {
                    $id = $row['pl_id'];
                }
                if ($row['pl_place'] != '') {
                    $placestr2 = $mapstr_edit . $id . "&amp;level=" . $level . $mapstr3 . $mapstr5 . I18N::translate('Zoom=') . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8;
                    if ($row['pl_place'] === 'unknown') {
                        $matched[$x]++;
                    }
                } else {
                    if ($levels[$z] === 'unknown') {
                        $placestr2 = $mapstr_add . $id . "&amp;level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . I18N::translate('unknown') . "</strong>" . $mapstr8;
                        $matched[$x]++;
                    } else {
                        $placestr2 = $mapstr_add . $id . "&amp;place_name=" . urlencode($levels[$z]) . "&amp;level=" . $level . $mapstr3 . $mapstr7 . '<span class="danger">' . $levels[$z] . '</span>' . $mapstr8;
                        $matched[$x]++;
                    }
                }
                $plac[$z] = '<td>' . $placestr2 . '</td>';
                if ($row['pl_lati'] == '0' && $row['pl_long'] == '0') {
                    $lati[$z] = '<td class="danger">0</td>';
                } elseif ($row['pl_lati'] != '') {
                    $lati[$z] = '<td>' . $row['pl_lati'] . '</td>';
                } else {
                    $lati[$z] = '<td class="danger"><i class="fa fa-warning"></i></td>';
                    $matched[$x]++;
                }
                if ($row['pl_lati'] == '0' && $row['pl_long'] == '0') {
                    $long[$z] = '<td class="danger">0</td>';
                } elseif ($row['pl_long'] != '') {
                    $long[$z] = '<td>' . $row['pl_long'] . '</td>';
                } else {
                    $long[$z] = '<td class="danger"><i class="fa fa-warning"></i></td>';
                    $matched[$x]++;
                }
                $level++;
                $mapstr3 = $mapstr3 . "&amp;parent[" . $z . "]=" . Filter::escapeJs($row['pl_placerequested']);
                $mapstr4 = $mapstr4 . "&amp;parent[" . $z . "]=" . Filter::escapeJs($levels[$z]);
                $z++;
            }
            if ($matching) {
                $matched[$x] = 1;
            }
            if ($matched[$x] != 0) {
                echo $gedplace;
                $z = 0;
                while ($z < $max) {
                    if ($z < $parts) {
                        echo $plac[$z];
                        echo $lati[$z];
                        echo $long[$z];
                    } else {
                        echo '<td></td>';
                        echo '<td></td>';
                        echo '<td></td>';
                    }
                    $z++;
                }
                echo '</tr>';
                $countrows++;
            }
            $x++;
        }
        echo '</tbody>';
        echo '<tfoot>';
        echo '<tr>';
        echo '<th colspan="', 1 + 3 * $max, '">', I18N::translate('Total places: %s', I18N::number($countrows)), '</th>';
        echo '</tr>';
        echo '</tfoot>';
        echo '</table>';
    }
    /**
     * 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;
        }
    }
					<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';
Beispiel #22
0
				</tr>
				<tr>
					<td class="descriptionbox">
						<?php 
echo '<label>', I18N::translate('Generations'), '</label>';
?>
					</td>
					<td class="optionbox">
						<select name="PEDIGREE_GENERATIONS">
							<?php 
for ($i = 2; $i <= $MAX_PEDIGREE_GENERATIONS; $i++) {
    echo '<option value="', $i, '" ';
    if ($i == $controller->generations) {
        echo 'selected';
    }
    echo '>', I18N::number($i), '</option>';
}
?>
						</select>
					</td>
				</tr>
				<tr>
					<td class="descriptionbox">
						<?php 
echo '<label>', I18N::translate('Show details'), '</label>';
?>
					</td>
					<td class="optionbox">
						<?php 
echo FunctionsEdit::twoStateCheckbox('show_full', $controller->showFull());
?>
Beispiel #23
0
 $show = $falpha || $show_all_firstnames === 'yes' ? 'indi' : 'none';
 $list = array();
 foreach ($givn_initials as $givn_initial => $count) {
     switch ($givn_initial) {
         case '@':
             $html = I18N::translateContext('Unknown given name', '…');
             break;
         default:
             $html = Filter::escapeHtml($givn_initial);
             break;
     }
     if ($count) {
         if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') {
             $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
         } else {
             $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
         }
     } else {
         $list[] = $html;
     }
 }
 // Search spiders don't get the "show all" option as the other links give them everything.
 if (!Auth::isSearchEngine()) {
     if ($show_all_firstnames === 'yes') {
         $list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
     } else {
         $list[] = '<a href="' . $url . '&amp;show_all_firstnames=yes">' . I18N::translate('All') . '</a>';
     }
 }
 if ($show_all === 'no') {
     echo '<h2 class="center">', I18N::translate('Individuals with surname %s', $legend), '</h2>';
Beispiel #24
0
     }
     echo ' type="text" name="vars[', Filter::escapeHtml($input['name']), ']" id="', Filter::escapeHtml($input['name']), '" value="', Filter::escapeHtml($input['default']), '" style="direction: ltr;">';
 }
 if ($input['type'] == 'checkbox') {
     echo '<input type="checkbox" name="vars[', Filter::escapeHtml($input['name']), ']" id="', Filter::escapeHtml($input['name']), '" value="1" ';
     echo $input['default'] == '1' ? 'checked' : '';
     echo '>';
 }
 if ($input['type'] == 'select') {
     echo '<select name="vars[', Filter::escapeHtml($input['name']), ']" id="', Filter::escapeHtml($input['name']), '_var">';
     $options = preg_split('/[|]+/', $input['options']);
     foreach ($options as $option) {
         $opt = explode('=>', $option);
         list($value, $display) = $opt;
         if (preg_match('/^I18N::number\\((.+)\\)$/', $display, $match)) {
             $display = I18N::number($match[1]);
         } elseif (preg_match('/^I18N::translate\\(\'(.+)\'\\)$/', $display, $match)) {
             $display = I18N::translate($match[1]);
         } elseif (preg_match('/^I18N::translateContext\\(\'(.+)\', *\'(.+)\'\\)$/', $display, $match)) {
             $display = I18N::translateContext($match[1], $match[2]);
         }
         echo '<option value="', Filter::escapeHtml($value), '" ';
         if ($opt[0] == $input['default']) {
             echo 'selected';
         }
         echo '>', Filter::escapeHtml($display), '</option>';
     }
     echo '</select>';
 }
 if (isset($input['lookup'])) {
     echo '<input type="hidden" name="type[', Filter::escapeHtml($input['name']), ']" value="', Filter::escapeHtml($input['lookup']), '">';
Beispiel #25
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        if ($this->data->get('has_sosa', false)) {
            $table_id = $this->data->get('table_id');
            ?>
   
        
		<div id="sosa-fam-list" class="sosa-list">
			<table id="<?php 
            echo $table_id;
            ?>
">
				<thead>
					<tr>
						<th colspan="24">
							<div class="btn-toolbar">
								<div class="btn-group">
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="N"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show individuals who are alive or couples where both partners are alive.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Both alive');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="W"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples where only the female partner is deceased.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Widower');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="H"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples where only the male partner is deceased.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Widow');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="Y"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show individuals who are dead or couples where both partners are deceased.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Both dead');
            ?>
									</button>
								</div>
								<div class="btn-group">
									<button
										type="button"
										data-filter-column="23"
										data-filter-value="R"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show “roots” couples or individuals.  These individuals may also be called “patriarchs”.  They are individuals who have no parents recorded in the database.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Roots');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="23"
										data-filter-value="L"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show “leaves” couples or individuals.  These are individuals who are alive but have no children recorded in the database.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Leaves');
            ?>
									</button>
								</div>
								<div class="btn-group">
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="U"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples with an unknown marriage date.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('MARR');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="YES"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples who married more than 100 years ago.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('MARR');
            ?>
&gt;100
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="Y100"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples who married within the last 100 years.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('MARR');
            ?>
&lt;=100
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="D"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show divorced couples.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('DIV');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="M"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples where either partner married more than once.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Multiple marriages');
            ?>
									</button>
								</div>
							</div>
						</th>
					</tr>
					<tr>
						<th><?php 
            echo I18N::translate('Sosa');
            ?>
</th>
						<th>SOSA</th>
						<th><?php 
            echo GedcomTag::getLabel('GIVN');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('SURN');
            ?>
</th>
						<th>HUSB:GIVN_SURN</th>
						<th>HUSB:SURN_GIVN</th>
						<th><?php 
            echo GedcomTag::getLabel('AGE');
            ?>
</th>
						<th>AGE</th>
						<th><?php 
            echo GedcomTag::getLabel('GIVN');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('SURN');
            ?>
</th>
						<th>WIFE:GIVN_SURN</th>
						<th>WIFE:SURN_GIVN</th>
						<th><?php 
            echo GedcomTag::getLabel('AGE');
            ?>
</th>
						<th>AGE</th>
						<th><?php 
            echo GedcomTag::getLabel('MARR');
            ?>
</th>
						<th>MARR:DATE</th>
						<th><?php 
            echo GedcomTag::getLabel('PLAC');
            ?>
</th>';
						<?php 
            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                ?>
						<th><i class="icon-source" title="<?php 
                echo I18N::translate('Sourced marriage');
                ?>
" border="0"></i></th>
						<th>SORT_MARRSC</th>
						<?php 
            } else {
                ?>
						<th>&nbsp;</th>
						<th></th>
						<?php 
            }
            ?>
						<th><i class="icon-children" title="<?php 
            echo I18N::translate('Children');
            ?>
"></i></th>
						<th>NCHI</th>
						<th>MARR</th>
						<th>DEAT</th>
						<th>TREE</th>
					</tr>
				</thead>
				<tbody>
			
			<?php 
            foreach ($this->data->get('sosa_list') as $sosa => $family) {
                /** @var \Fisharebest\Webtrees\Family $person */
                //PERSO Create decorator for Family
                $dfamily = new Family($family);
                $husb = $family->getHusband();
                if (is_null($husb)) {
                    $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree());
                }
                $dhusb = new \MyArtJaub\Webtrees\Individual($husb);
                $wife = $family->getWife();
                if (is_null($wife)) {
                    $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree());
                }
                $dwife = new \MyArtJaub\Webtrees\Individual($wife);
                $mdate = $family->getMarriageDate();
                if ($family->isPendingAddtion()) {
                    $class = ' class="new"';
                } elseif ($family->isPendingDeletion()) {
                    $class = ' class="old"';
                } else {
                    $class = '';
                }
                ?>
			
        		<tr <?php 
                echo $class;
                ?>
>
        			<td class="transparent"><?php 
                echo I18N::translate('%1$d/%2$d', $sosa, ($sosa + 1) % 10);
                ?>
</td>
        			<td class="transparent"><?php 
                echo $sosa;
                ?>
</td>
        			<!--  HUSBAND -->
        			<td colspan="2">
        			<?php 
                foreach ($husb->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $husb)) . '"';
                    }
                    if ($num == $husb->getPrimaryName()) {
                        $class = ' class="name2"';
                        $sex_image = $husb->getSexImage();
                        list($surn, $givn) = explode(',', $name['sort']);
                    } else {
                        $class = '';
                        $sex_image = '';
                    }
                    ?>
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $husb->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dhusb->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $husb->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<!-- Dummy column to match colspan in header -->
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<?php 
                $hdate = $husb->getBirthDate();
                ?>
            		<td><?php 
                Date::getAge($hdate, $mdate, 2);
                ?>
</td>
            		<td><?php 
                Date::getAge($hdate, $mdate, 1);
                ?>
</td>
            		<!--  WIFE -->
        			<td colspan="2">
        			<?php 
                foreach ($wife->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $wife)) . '"';
                    }
                    if ($num == $wife->getPrimaryName()) {
                        $class = ' class="name2"';
                        $sex_image = $wife->getSexImage();
                        list($surn, $givn) = explode(',', $name['sort']);
                    } else {
                        $class = '';
                        $sex_image = '';
                    }
                    ?>
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $wife->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dwife->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $wife->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<!-- Dummy column to match colspan in header -->
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<?php 
                $wdate = $wife->getBirthDate();
                ?>
            		<td><?php 
                Date::getAge($wdate, $mdate, 2);
                ?>
</td>
            		<td><?php 
                Date::getAge($wdate, $mdate, 1);
                ?>
</td>
            		<td><?php 
                if ($marriage_dates = $family->getAllMarriageDates()) {
                    foreach ($marriage_dates as $n => $marriage_date) {
                        if ($n) {
                            echo '<br>';
                        }
                        ?>
        					<div><?php 
                        echo $marriage_date->display(true);
                        ?>
</div>
        				<?php 
                    }
                } elseif ($family->getFacts('_NMR')) {
                    echo I18N::translate('no');
                } elseif ($family->getFacts('MARR')) {
                    echo I18N::translate('yes');
                } else {
                    echo '&nbsp;';
                }
                ?>
            		</td>
            		<td><?php 
                echo $marriage_dates ? $marriage_date->julianDay() : 0;
                ?>
</td>
            		<td><?php 
                foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) {
                    $tmp = new Place($marriage_place, $family->getTree());
                    if ($n) {
                        ?>
<br><?php 
                    }
                    ?>
        				<a href="'<?php 
                    echo $tmp->getURL();
                    ?>
" title="<?php 
                    echo strip_tags($tmp->getFullName());
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName());
                    ?>
        				</a>
        			<?php 
                }
                ?>
        			</td>
        			<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    $isMSourced = $dfamily->isMarriageSourced();
                    ?>
				   	<td><?php 
                    echo FunctionsPrint::formatIsSourcedIcon('E', $isMSourced, 'MARR', 1, 'medium');
                    ?>
</td>
					<td><?php 
                    echo $isMSourced;
                    ?>
</td>
					<?php 
                } else {
                    ?>
					<td>&nbsp;</td>
					<td></td>
					<?php 
                }
                ?>
					<?php 
                $nchi = $family->getNumberOfChildren();
                ?>
					<td><?php 
                echo I18N::number($nchi);
                ?>
</td>
					<td><?php 
                echo $nchi;
                ?>
</td>
					<td><?php 
                if (!$mdate->isOK()) {
                    echo 'U';
                } else {
                    if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) {
                        echo 'Y100';
                    } else {
                        echo 'YES';
                    }
                }
                if ($family->getFacts(WT_EVENTS_DIV)) {
                    echo 'D';
                }
                if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) {
                    echo 'M';
                }
                ?>
					</td>
					<td><?php 
                if ($husb->isDead() && $wife->isDead()) {
                    echo 'Y';
                }
                if ($husb->isDead() && !$wife->isDead()) {
                    if ($wife->getSex() == 'F') {
                        echo 'H';
                    }
                    if ($wife->getSex() == 'M') {
                        echo 'W';
                    }
                    // male partners
                }
                if (!$husb->isDead() && $wife->isDead()) {
                    if ($husb->getSex() == 'M') {
                        echo 'W';
                    }
                    if ($husb->getSex() == 'F') {
                        echo 'H';
                    }
                    // female partners
                }
                if (!$husb->isDead() && !$wife->isDead()) {
                    echo 'N';
                }
                ?>
        			</td>
        			<td><?php 
                if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) {
                    echo 'R';
                } elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) {
                    echo 'L';
                } else {
                    echo '&nbsp;';
                }
                ?>
			         </td>
				</tr>
        	<?php 
            }
            ?>
        	</tbody>
        	<tfoot>
				<tr>
					<th colspan="24">
						<div class="btn-toolbar">
							<div class="btn-group">
								<button type="button" class="ui-state-default btn-toggle-parents">
									<?php 
            echo I18N::translate('Show parents');
            ?>
								</button>
								<button id="btn-toggle-statistics-<?php 
            echo $table_id;
            ?>
" type="button" class="ui-state-default btn-toggle-statistics">
									<?php 
            echo I18N::translate('Show statistics charts');
            ?>
								</button>
							</div>
						</div>
					</th>
				</tr>
			</tfoot>
        	</table>
				<div id="fam_list_table-charts_<?php 
            echo $table_id;
            ?>
" style="display:none">
					<table class="list-charts">
						<tr>
							<td><?php 
            echo $this->data->get('chart_births');
            ?>
</td>
							<td><?php 
            echo $this->data->get('chart_marriages');
            ?>
</td>
						</tr>
						<tr>
							<td colspan="2"><?php 
            echo $this->data->get('chart_ages');
            ?>
</td>
						</tr>
					</table>
				</div>
			</div>
		<?php 
        } else {
            ?>
        <p class="warning"><?php 
            echo I18N::translate('No family has been found for generation %d', $this->data->get('generation'));
            ?>
</p>
        <?php 
        }
    }
Beispiel #26
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        if ($this->data->get('has_sosa', false)) {
            $table_id = $this->data->get('table_id');
            ?>
   
        
        <div id="sosa-indi-list" class="sosa-list">
        	<table id="<?php 
            echo $table_id;
            ?>
">
				<thead>
    				<tr>
    					<th colspan="22">
    						<div class="btn-toolbar">
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="18"
    									data-filter-value="M"
    									title="<?php 
            echo I18N::translate('Show only males.');
            ?>
"
    									type="button"
    								><?php 
            echo Individual::sexImage('M', 'large');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="18"
    									data-filter-value="F"
    									title="<?php 
            echo I18N::translate('Show only females.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo Individual::sexImage('F', 'large');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="18"
    									data-filter-value="U"
    									title="<?php 
            echo I18N::translate('Show only individuals for whom the gender is not known.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo Individual::sexImage('U', 'large');
            ?>
    								</button>
    							</div>
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="N"
    									title="<?php 
            echo I18N::translate('Show individuals who are alive or couples where both partners are alive.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Alive');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="Y"
    									title="<?php 
            echo I18N::translate('Show individuals who are dead or couples where both partners are deceased.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Dead');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="YES"
    									title="<?php 
            echo I18N::translate('Show individuals who died more than 100 years ago.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('DEAT');
            ?>
&gt;100
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="Y100"
    									title="<?php 
            echo I18N::translate('Show individuals who died within the last 100 years.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('DEAT');
            ?>
&lt;=100
    								</button>
    							</div>
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="19"
    									data-filter-value="YES"
    									title="<?php 
            echo I18N::translate('Show individuals born more than 100 years ago.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('BIRT');
            ?>
&gt;100
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="19"
    									data-filter-value="Y100"
    									title="<?php 
            echo I18N::translate('Show individuals born within the last 100 years.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('BIRT');
            ?>
&lt;=100
    								</button>
    							</div>
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="21"
    									data-filter-value="R"
    									title="<?php 
            echo I18N::translate('Show “roots” couples or individuals.  These individuals may also be called “patriarchs”.  They are individuals who have no parents recorded in the database.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Roots');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="21"
    									data-filter-value="L"
    									title="<?php 
            echo I18N::translate('Show “leaves” couples or individuals.  These are individuals who are alive but have no children recorded in the database.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Leaves');
            ?>
    								</button>
    							</div>
    						</div>
    					</th>
    				</tr>
					<tr>
						<th><?php 
            echo I18N::translate('Sosa');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('INDI');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('GIVN');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('SURN');
            ?>
</th>
						<th>GIVN</th>
						<th>SURN</th>
						<th><?php 
            echo GedcomTag::getLabel('BIRT');
            ?>
</th>
						<th>SORT_BIRT</th>
						<th><?php 
            echo GedcomTag::getLabel('PLAC');
            ?>
</th>
						<?php 
            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                ?>
						<th><i class="icon-source" title="<?php 
                echo I18N::translate('Sourced birth');
                ?>
" border="0"></i></th>
						<th>SORT_BIRTSC</th>
						<?php 
            } else {
                ?>
						<th></th>
						<th></th>
						<?php 
            }
            ?>
						<th><?php 
            echo GedcomTag::getLabel('DEAT');
            ?>
</th>
						<th>SORT_DEAT</th>
						<th><?php 
            echo GedcomTag::getLabel('AGE');
            ?>
</th>
						<th>AGE</th>
						<th><?php 
            echo GedcomTag::getLabel('PLAC');
            ?>
</th>
						<?php 
            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                ?>
						<th><i class="icon-source" title="<?php 
                echo I18N::translate('Sourced death');
                ?>
" border="0"></i></th>
						<th>SORT_DEATSC</th>
						<?php 
            } else {
                ?>
						<th></th>
						<th></th>
						<?php 
            }
            ?>
						<th>SEX</th>
						<th>BIRT</th>
						<th>DEAT</th>
						<th>TREE</th>
					</tr>
				</thead>
			<tbody>
			
			<?php 
            foreach ($this->data->get('sosa_list') as $sosa => $person) {
                /** @var \Fisharebest\Webtrees\Individual $person */
                if ($person->isPendingAddtion()) {
                    $class = ' class="new"';
                } elseif ($person->isPendingDeletion()) {
                    $class = ' class="old"';
                } else {
                    $class = '';
                }
                $dperson = new \MyArtJaub\Webtrees\Individual($person);
                ?>
			
        		<tr <?php 
                echo $class;
                ?>
>
        			<td class="transparent"><?php 
                echo $sosa;
                ?>
</td>
        			<td class="transparent"><?php 
                echo $person->getXref();
                ?>
</td>
        			<td colspan="2">
        			<?php 
                foreach ($person->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $person)) . '"';
                    }
                    if ($num == $person->getPrimaryName()) {
                        $class = ' class="name2"';
                        $sex_image = $person->getSexImage();
                        list($surn, $givn) = explode(',', $name['sort']);
                    } else {
                        $class = '';
                        $sex_image = '';
                    }
                    ?>
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $person->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $person->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<td>
            		<?php 
                if ($birth_dates = $person->getAllBirthDates()) {
                    foreach ($birth_dates as $num => $birth_date) {
                        if ($num) {
                            ?>
<br/><?php 
                        }
                        ?>
    						<?php 
                        echo $birth_date->display(true);
                    }
                } else {
                    $birth_date = new Date('');
                    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
                        $birth_date = $person->getEstimatedBirthDate();
                        echo $birth_date->display(true);
                    } else {
                        echo '&nbsp;';
                    }
                    $birth_dates[0] = new Date('');
                }
                ?>
            		</td>
            		<td><?php 
                echo $birth_date->julianDay();
                ?>
</td>
        			<td>
        			<?php 
                foreach ($person->getAllBirthPlaces() as $n => $birth_place) {
                    $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
                    if ($n) {
                        ?>
<br><?php 
                    }
                    ?>
        				<a href="'<?php 
                    echo $tmp->getURL();
                    ?>
" title="<?php 
                    echo strip_tags($tmp->getFullName());
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName());
                    ?>
        				</a>
        			<?php 
                }
                ?>
        			</td>
        			<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    $isBSourced = $dperson->isBirthSourced();
                    ?>
				   	<td><?php 
                    echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium');
                    ?>
</td>
					<td><?php 
                    echo $isBSourced;
                    ?>
</td>
					<?php 
                } else {
                    ?>
					<td>&nbsp;</td>
					<td></td>
					<?php 
                }
                ?>
					<td>
					<?php 
                if ($death_dates = $person->getAllDeathDates()) {
                    foreach ($death_dates as $num => $death_date) {
                        if ($num) {
                            ?>
<br/><?php 
                        }
                        ?>
					 		<?php 
                        echo $death_date->display(true);
                    }
                } else {
                    $death_date = $person->getEstimatedDeathDate();
                    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) {
                        echo $death_date->display(true);
                    } elseif ($person->isDead()) {
                        echo I18N::translate('yes');
                        $death_date = new Date('');
                    } else {
                        echo '&nbsp;';
                        $death_date = new Date('');
                    }
                    $death_dates[0] = new Date('');
                }
                ?>
			         </td>
			         <td><?php 
                echo $death_date->julianDay();
                ?>
</td>
			         <td><?php 
                echo Date::getAge($birth_dates[0], $death_dates[0], 2);
                ?>
</td>
			         <td><?php 
                echo Date::getAge($birth_dates[0], $death_dates[0], 1);
                ?>
</td>
			         <td>
        			 <?php 
                foreach ($person->getAllDeathPlaces() as $n => $death_place) {
                    $tmp = new Place($death_place, $person->getTree());
                    if ($n) {
                        ?>
<br><?php 
                    }
                    ?>
        				<a href="'<?php 
                    echo $tmp->getURL();
                    ?>
" title="<?php 
                    echo strip_tags($tmp->getFullName());
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName());
                    ?>
        				</a>
        			<?php 
                }
                ?>
        			</td>
        			<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    $isDSourced = $dperson->isDeathSourced();
                    ?>
				   	<td><?php 
                    echo FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium');
                    ?>
</td>
					<td><?php 
                    echo $isDSourced;
                    ?>
</td>
					<?php 
                } else {
                    ?>
					<td>&nbsp;</td>
					<td></td>
					<?php 
                }
                ?>
					<td><?php 
                echo $person->getSex();
                ?>
</td>
					<td>
					<?php 
                if (!$person->canShow() || Date::compare($birth_date, new Date(date('Y') - 100)) > 0) {
                    echo 'Y100';
                } else {
                    echo 'YES';
                }
                ?>
        			</td>
        			<td>
        			<?php 
                if (Date::compare($death_dates[0], new Date(date('Y') - 100)) > 0) {
                    echo 'Y100';
                } elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) {
                    echo 'YES';
                } else {
                    echo 'N';
                }
                ?>
			         </td>
			         <td>
					<?php 
                if (!$person->getChildFamilies()) {
                    echo 'R';
                } elseif (!$person->isDead() && $person->getNumberOfChildren() < 1) {
                    echo 'L';
                } else {
                    echo '&nbsp;';
                }
                ?>
					</td>
				</tr>
        	<?php 
            }
            ?>
        	</tbody>
        	<tfoot>
				<tr>
					<th class="ui-state-default" colspan="22">
						<div class="center">
							<?php 
            echo I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', I18N::number($this->data->get('sosa_count')), I18N::number($this->data->get('sosa_theo')), I18N::percentage($this->data->get('sosa_ratio'), 2));
            ?>
							<?php 
            if ($this->data->get('sosa_hidden') > 0) {
                echo '[' . I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))) . ']';
            }
            ?>
						</div>
					</th>
				</tr>
				<tr>
					<th colspan="22">
						<div class="btn-toolbar">
							<div class="btn-group">
								<button type="button" class="ui-state-default btn-toggle-parents">
									<?php 
            echo I18N::translate('Show parents');
            ?>
								</button>
								<button id="btn-toggle-statistics-<?php 
            echo $table_id;
            ?>
" type="button" class="ui-state-default btn-toggle-statistics">
									<?php 
            echo I18N::translate('Show statistics charts');
            ?>
								</button>
							</div>
						</div>
					</th>
				</tr>
			</tfoot>
        	</table>
				<div id="indi_list_table-charts_<?php 
            echo $table_id;
            ?>
" style="display:none">
					<table class="list-charts">
						<tr>
							<td><?php 
            echo $this->data->get('chart_births');
            ?>
</td>
							<td><?php 
            echo $this->data->get('chart_deaths');
            ?>
</td>
						</tr>
						<tr>
							<td colspan="2"><?php 
            echo $this->data->get('chart_ages');
            ?>
</td>
						</tr>
					</table>
				</div>
			</div>
		<?php 
        }
    }
Beispiel #27
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)));
     }
 }
Beispiel #28
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 
Beispiel #29
0
    }
    echo '<h2>', I18N::translate('Checking server capacity'), '</h2>';
    // Previously, we tried to determine the maximum value that we could set for these values.
    // However, this is unreliable, especially on servers with custom restrictions.
    // Now, we just show the default values.  These can (hopefully!) be changed using the
    // site settings page.
    $memory_limit = ini_get('memory_limit');
    if (substr_compare($memory_limit, 'M', -1) === 0) {
        $memory_limit = substr($memory_limit, 0, -1);
    } elseif (substr_compare($memory_limit, 'K', -1) === 0) {
        $memory_limit = substr($memory_limit, 0, -1) / 1024;
    } elseif (substr_compare($memory_limit, 'G', -1) === 0) {
        $memory_limit = substr($memory_limit, 0, -1) * 1024;
    }
    $max_execution_time = ini_get('max_execution_time');
    echo '<p>', I18N::translate('The memory and CPU time requirements depend on the number of individuals in your family tree.'), '<br>', I18N::translate('The following list shows typical requirements.'), '</p><p>', I18N::translate('Small systems (500 individuals): 16–32 MB, 10–20 seconds'), '<br>', I18N::translate('Medium systems (5,000 individuals): 32–64 MB, 20–40 seconds'), '<br>', I18N::translate('Large systems (50,000 individuals): 64–128 MB, 40–80 seconds'), '</p>', $memory_limit < 32 || $max_execution_time > 0 && $max_execution_time < 20 ? '<p class="bad">' : '<p class="good">', I18N::translate('This server’s memory limit is %s MB and its CPU time limit is %s seconds.', I18N::number($memory_limit), I18N::number($max_execution_time)), '</p><p>', I18N::translate('If you try to exceed these limits, you may experience server time-outs and blank pages.'), '</p><p>', I18N::translate('If your server’s security policy permits it, you will be able to request increased memory or CPU time using the webtrees administration page.  Otherwise, you will need to contact your server’s administrator.'), '</p>';
    if (!$errors) {
        echo '<br><hr><input type="submit" id="btncontinue" value="', I18N::translate('continue'), '">';
    }
    echo '</form></body></html>';
    return;
}
////////////////////////////////////////////////////////////////////////////////
// Step two - The data folder needs to be writable
////////////////////////////////////////////////////////////////////////////////
$text1 = uniqid();
$text2 = '';
try {
    file_put_contents(WT_DATA_DIR . 'test.txt', $text1);
    $text2 = file_get_contents(WT_DATA_DIR . 'test.txt');
    unlink(WT_DATA_DIR . 'test.txt');
Beispiel #30
0
 /**
  * get image properties
  *
  * @param string $which     specify either 'main' or 'thumb'
  * @param int    $addWidth  amount to add to width
  * @param int    $addHeight amount to add to height
  *
  * @return array
  */
 public function getImageAttributes($which = 'main', $addWidth = 0, $addHeight = 0)
 {
     $THUMBNAIL_WIDTH = $this->tree->getPreference('THUMBNAIL_WIDTH');
     $var = $which . 'imagesize';
     if (!empty($this->{$var})) {
         return $this->{$var};
     }
     $imgsize = array();
     if ($this->fileExists($which)) {
         try {
             $imgsize = getimagesize($this->getServerFilename($which));
             if (is_array($imgsize) && !empty($imgsize['0'])) {
                 // this is an image
                 $imgsize[0] = $imgsize[0] + 0;
                 $imgsize[1] = $imgsize[1] + 0;
                 $imgsize['adjW'] = $imgsize[0] + $addWidth;
                 // adjusted width
                 $imgsize['adjH'] = $imgsize[1] + $addHeight;
                 // adjusted height
                 $imageTypes = array('', 'GIF', 'JPG', 'PNG', 'SWF', 'PSD', 'BMP', 'TIFF', 'TIFF', 'JPC', 'JP2', 'JPX', 'JB2', 'SWC', 'IFF', 'WBMP', 'XBM');
                 $imgsize['ext'] = $imageTypes[0 + $imgsize[2]];
                 // this is for display purposes, always show non-adjusted info
                 $imgsize['WxH'] = I18N::translate('%1$s × %2$s pixels', I18N::number($imgsize['0']), I18N::number($imgsize['1']));
                 $imgsize['imgWH'] = ' width="' . $imgsize['adjW'] . '" height="' . $imgsize['adjH'] . '" ';
                 if ($which == 'thumb' && $imgsize['0'] > $THUMBNAIL_WIDTH) {
                     // don’t let large images break the dislay
                     $imgsize['imgWH'] = ' width="' . $THUMBNAIL_WIDTH . '" ';
                 }
             }
         } catch (\ErrorException $ex) {
             // Not an image, or not a valid image?
             $imgsize = false;
         }
     }
     if (!is_array($imgsize) || empty($imgsize['0'])) {
         // this is not an image, OR the file doesn’t exist OR it is a url
         $imgsize[0] = 0;
         $imgsize[1] = 0;
         $imgsize['adjW'] = 0;
         $imgsize['adjH'] = 0;
         $imgsize['ext'] = '';
         $imgsize['mime'] = '';
         $imgsize['WxH'] = '';
         $imgsize['imgWH'] = '';
         if ($this->isExternal()) {
             // don’t let large external images break the dislay
             $imgsize['imgWH'] = ' width="' . $THUMBNAIL_WIDTH . '" ';
         }
     }
     if (empty($imgsize['mime'])) {
         // this is not an image, OR the file doesn’t exist OR it is a url
         // set file type equal to the file extension - can’t use parse_url because this may not be a full url
         $exp = explode('?', $this->file);
         $imgsize['ext'] = strtoupper(pathinfo($exp[0], PATHINFO_EXTENSION));
         // all mimetypes we wish to serve with the media firewall must be added to this array.
         $mime = array('DOC' => 'application/msword', 'MOV' => 'video/quicktime', 'MP3' => 'audio/mpeg', 'PDF' => 'application/pdf', 'PPT' => 'application/vnd.ms-powerpoint', 'RTF' => 'text/rtf', 'SID' => 'image/x-mrsid', 'TXT' => 'text/plain', 'XLS' => 'application/vnd.ms-excel', 'WMV' => 'video/x-ms-wmv');
         if (empty($mime[$imgsize['ext']])) {
             // if we don’t know what the mimetype is, use something ambiguous
             $imgsize['mime'] = 'application/octet-stream';
             if ($this->fileExists($which)) {
                 // alert the admin if we cannot determine the mime type of an existing file
                 // as the media firewall will be unable to serve this file properly
                 Log::addMediaLog('Media Firewall error: >Unknown Mimetype< for file >' . $this->file . '<');
             }
         } else {
             $imgsize['mime'] = $mime[$imgsize['ext']];
         }
     }
     $this->{$var} = $imgsize;
     return $this->{$var};
 }