/** * {@inheritDoc} * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() */ public function getSidebarContent() { global $controller; ob_start(); $root = $controller->getSignificantIndividual(); if ($root) { $dindi = new Individual($root); if (!$dindi->canDisplayIsSourced()) { echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>'; } else { echo ' <table class="issourcedtable"> <tr> <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td> <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1) . '</td> </tr> <tr> <td class="slabel">' . GedcomTag::getLabel('BIRT') . '</td> <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1) . '</td> </tr>'; $fams = $root->getSpouseFamilies(); ($ct = count($fams)) > 1 ? $nb = 1 : ($nb = ' '); foreach ($fams as $fam) { $dfam = new Family($fam); echo ' <tr> <td class="slabel right"> <a href="' . $fam->getHtmlUrl() . '"> ' . GedcomTag::getLabel('MARR'); if ($ct > 1) { echo ' ', $nb; $nb++; } echo ' </a> </td> <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dfam->isMarriageSourced(), 'MARR', 1) . '</td> </tr>'; } if ($root->isDead()) { echo ' <tr> <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td> <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1) . '</td> </tr>'; } echo '</table>'; } } return ob_get_clean(); }
/** * Return HTML Code to display individual in non structured list (e.g. Patronymic Lineages) * * @param \Fisharebest\Webtrees\Individual $individual Individual to print * @param bool $isStrong Bolden the name ? * @return string HTML Code for individual item */ public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) { $html = ''; $tag = 'em'; if ($isStrong) { $tag = 'strong'; } if ($individual && $individual->canShow()) { $dindi = new Individual($individual); $html = $individual->getSexImage(); $html .= '<a class="list_item" href="' . $individual->getHtmlUrl() . '" title="' . I18N::translate('Informations for individual %s', $individual->getXref()) . '">'; $html .= '<' . $tag . '>' . $individual->getFullName() . '</' . $tag . '> (' . $individual->getXref() . ') '; $html .= FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); $html .= ' <span><small><em>' . $dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10) . '</em></small></span>'; $html .= ' <span><small><em>' . $dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10) . '</em></small></span>'; $html .= '</a>'; } else { $html .= '<span class=\\"list_item\\"><' . $tag . '>' . I18N::translate('Private') . '</' . $tag . '></span>'; } return $html; }
/** * {@inhericDoc} * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() */ public function hRecordNameAppend(GedcomRecord $grec) { if ($grec instanceof \Fisharebest\Webtrees\Individual) { // Only apply to individuals $dindi = new Individual($grec); return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); } return ''; }
/** * {@inheritDoc} * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() */ public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { $res = ''; $dindi = new Individual($ctrlIndi->getSignificantIndividual()); $titles = $dindi->getTitles(); if (count($titles) > 0) { $res = ' <dl> <dt class="label">' . I18N::translate('Titles') . '</dt>'; foreach ($titles as $title => $props) { $res .= '<dd class="field">' . $title . ' ' . FunctionsPrint::getListFromArray($props) . '</dd>'; } $res .= '</dl>'; } return array('indi-header-titles', $res); }
/** * Return the dispersion analysis tables. * Two arrays are returned : * - the General analysis, which returns the number of ancestors for each place found, plus 4 additional indicators : * - knownsum : Number of known places * - unknown : Number of unknown places * - max : Maximum count of ancestors within a place * - other : Other places (not in the top level area) * - the Generations analysis, which returns the number of ancestors for each place found for each generation, plus 3 additional indicators within each generation : * - sum : Number of known places * - unknown : Number of unknown places * - other : Other places (not in the top level area) * * @param array $sosalist List of all sosas * @return array Array of the general and generations table */ public function getAnalysisResults($sosalist) { $placesDispGeneral = null; $placesDispGenerations = null; if ($sosalist && count($sosalist) > 0) { $placesDispGeneral['knownsum'] = 0; $placesDispGeneral['unknown'] = 0; $placesDispGeneral['max'] = 0; $placesDispGeneral['places'] = array(); foreach ($sosalist as $sosaid => $gens) { $sosa = Individual::getIntance($sosaid, $this->tree); $place = $sosa->getSignificantPlace(); $genstab = explode(',', $gens); $isUnknown = true; if ($sosa->getDerivedRecord()->canShow() && !is_null($place)) { $levels = array_reverse(array_map('trim', explode(',', $place))); if (count($levels) >= $this->analysis_level) { $toplevelvalues = array(); if ($this->hasMap() && ($toplevelvalue = $this->options->getMap()->getTopLevelName())) { $toplevelvalues = array_map('trim', explode(',', strtolower($toplevelvalue))); } if (!$this->hasMap() || is_null($this->options->getMapLevel()) || $this->options->getMap()->getTopLevelName() == '*' || $this->options->getMapLevel() <= $this->analysis_level && $this->options->getMapLevel() > 0 && count($levels) >= $this->options->getMapLevel() && in_array(strtolower($levels[$this->options->getMapLevel() - 1]), $toplevelvalues)) { $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level)); if (isset($placesDispGeneral['places'][$placest])) { $placesDispGeneral['places'][$placest] += 1; } else { $placesDispGeneral['places'][$placest] = 1; } if ($placesDispGeneral['places'][$placest] > $placesDispGeneral['max']) { $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest]; } foreach ($genstab as $gen) { if (isset($placesDispGenerations[$gen]['places'][$placest])) { $placesDispGenerations[$gen]['places'][$placest] += 1; } else { $placesDispGenerations[$gen]['places'][$placest] = 1; } if (isset($placesDispGenerations[$gen]['sum'])) { $placesDispGenerations[$gen]['sum'] += 1; } else { $placesDispGenerations[$gen]['sum'] = 1; } } } else { if (isset($placesDispGeneral['other'])) { $placesDispGeneral['other'] += 1; } else { $placesDispGeneral['other'] = 1; } foreach ($genstab as $gen) { if (isset($placesDispGenerations[$gen]['other'])) { $placesDispGenerations[$gen]['other'] += 1; } else { $placesDispGenerations[$gen]['other'] = 1; } } } $placesDispGeneral['knownsum'] += 1; $isUnknown = false; } } if ($isUnknown) { $placesDispGeneral['unknown'] += 1; foreach ($genstab as $gen) { if (isset($placesDispGenerations[$gen]['unknown'])) { $placesDispGenerations[$gen]['unknown'] += 1; } else { $placesDispGenerations[$gen]['unknown'] = 1; } } } } } return array($placesDispGeneral, $placesDispGenerations); }