echo '</ul>'; echo '</div>'; // close div="find-media-media" } } else { echo '<p>', WT_I18N::translate('No results found.'), '</p>'; } echo '</div>'; } // Output Places if ($type == "place") { echo '<div id="find-output">'; if (!$filter || $all) { $places = WT_Place::allPlaces(WT_GED_ID); } else { $places = WT_Place::findPlaces($filter, WT_GED_ID); } if ($places) { echo '<ul>'; foreach ($places as $place) { echo '<li><a href="#" onclick="pasteid(\'', WT_Filter::escapeJs($place->getGedcomName()), '\');">'; if (!$filter || $all) { echo $place->getReverseName(); // When displaying all names, sort/display by the country, then region, etc. } else { echo $place->getFullName(); // When we’ve searched for a place, sort by this place } echo '</a></li>'; } echo '</ul>
/** * print fact PLACe TEMPle STATus * * @param WT_Fact $event gedcom fact record * @param bool $anchor to print a link to placelist * @param bool $sub_records to print place subrecords * @param bool $lds to print LDS TEMPle and STATus * * @return string HTML */ function format_fact_place(WT_Fact $event, $anchor = false, $sub_records = false, $lds = false) { global $SEARCH_SPIDER; if ($anchor) { // Show the full place name, for facts/events tab if ($SEARCH_SPIDER) { $html = $event->getPlace()->getFullName(); } else { $html = '<a href="' . $event->getPlace()->getURL() . '">' . $event->getPlace()->getFullName() . '</a>'; } } else { // Abbreviate the place name, for chart boxes return ' - ' . $event->getPlace()->getShortName(); } if ($sub_records) { $placerec = get_sub_record(2, '2 PLAC', $event->getGedcom()); if (!empty($placerec)) { if (preg_match_all('/\\n3 (?:_HEB|ROMN) (.+)/', $placerec, $matches)) { foreach ($matches[1] as $match) { $wt_place = new WT_Place($match, WT_GED_ID); $html .= ' - ' . $wt_place->getFullName(); } } $map_lati = ""; $cts = preg_match('/\\d LATI (.*)/', $placerec, $match); if ($cts > 0) { $map_lati = $match[1]; $html .= '<br><span class="label">' . WT_Gedcom_Tag::getLabel('LATI') . ': </span>' . $map_lati; } $map_long = ''; $cts = preg_match('/\\d LONG (.*)/', $placerec, $match); if ($cts > 0) { $map_long = $match[1]; $html .= ' <span class="label">' . WT_Gedcom_Tag::getLabel('LONG') . ': </span>' . $map_long; } if ($map_lati && $map_long) { $map_lati = trim(strtr($map_lati, "NSEW,�", " - -. ")); // S5,6789 ==> -5.6789 $map_long = trim(strtr($map_long, "NSEW,�", " - -. ")); // E3.456� ==> 3.456 $html .= ' <a rel="nofollow" href="https://maps.google.com/maps?q=' . $map_lati . ',' . $map_long . '" class="icon-googlemaps" title="' . WT_I18N::translate('Google Maps™') . '"></a>'; $html .= ' <a rel="nofollow" href="https://www.bing.com/maps/?lvl=15&cp=' . $map_lati . '~' . $map_long . '" class="icon-bing" title="' . WT_I18N::translate('Bing Maps™') . '"></a>'; $html .= ' <a rel="nofollow" href="https://www.openstreetmap.org/#map=15/' . $map_lati . '/' . $map_long . '" class="icon-osm" title="' . WT_I18N::translate('OpenStreetMap™') . '"></a>'; } if (preg_match('/\\d NOTE (.*)/', $placerec, $match)) { $html .= '<br>' . print_fact_notes($placerec, 3); } } } if ($lds) { if (preg_match('/2 TEMP (.*)/', $event->getGedcom(), $match)) { $html .= '<br>' . WT_I18N::translate('LDS temple') . ': ' . WT_Gedcom_Code_Temp::templeName($match[1]); } if (preg_match('/2 STAT (.*)/', $event->getGedcom(), $match)) { $html .= '<br>' . WT_I18N::translate('Status') . ': ' . WT_Gedcom_Code_Stat::statusName($match[1]); if (preg_match('/3 DATE (.*)/', $event->getGedcom(), $match)) { $date = new WT_Date($match[1]); $html .= ', ' . WT_Gedcom_Tag::getLabel('STAT:DATE') . ': ' . $date->Display(false); } } } return $html; }
function format_fam_table($datalist) { global $GEDCOM, $SHOW_LAST_CHANGE, $SEARCH_SPIDER, $controller; $table_id = 'table-fam-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc"]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery("#' . $table_id . '").dataTable( { dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', ' . WT_I18N::datatablesI18N() . ', jQueryUI: true, autoWidth: false, processing: true, retrieve: true, columns: [ /* 0 husb givn */ {dataSort: 2}, /* 1 husb surn */ {dataSort: 3}, /* 2 GIVN,SURN */ {type: "unicode", visible: false}, /* 3 SURN,GIVN */ {type: "unicode", visible: false}, /* 4 age */ {dataSort: 5, class: "center"}, /* 5 AGE */ {type: "num", visible: false}, /* 6 wife givn */ {dataSort: 8}, /* 7 wife surn */ {dataSort: 9}, /* 8 GIVN,SURN */ {type: "unicode", visible: false}, /* 9 SURN,GIVN */ {type: "unicode", visible: false}, /* 10 age */ {dataSort: 11, class: "center"}, /* 11 AGE */ {type: "num", visible: false}, /* 12 marr date */ {dataSort: 13}, /* 13 MARR:DATE */ {visible: false}, /* 14 anniv */ {dataSort: 13, class: "center"}, /* 15 marr plac */ {type: "unicode"}, /* 16 children */ {dataSort: 17, class: "center"}, /* 17 NCHI */ {type: "num", visible: false}, /* 18 CHAN */ {dataSort: 19, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . '}, /* 19 CHAN_sort */ {visible: false}, /* 20 MARR */ {visible: false}, /* 21 DEAT */ {visible: false}, /* 22 TREE */ {visible: false} ], sorting: [[1, "asc"]], displayLength: 20, pagingType: "full_numbers" }); jQuery("#' . $table_id . '") /* Hide/show parents */ .on("click", ".btn-toggle-parents", function() { jQuery(this).toggleClass("ui-state-active"); jQuery(".parents", jQuery(this).closest("table").DataTable().rows().nodes()).slideToggle(); }) /* Hide/show statistics */ .on("click", ".btn-toggle-statistics", function() { jQuery(this).toggleClass("ui-state-active"); jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); }) /* Filter buttons in table header */ .on("click", "button[data-filter-column]", function() { var btn = $(this); // De-activate the other buttons in this button group btn.siblings().removeClass("ui-state-active"); // Apply (or clear) this filter var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); if (btn.hasClass("ui-state-active")) { btn.removeClass("ui-state-active"); col.search("").draw(); } else { btn.addClass("ui-state-active"); col.search(btn.data("filter-value")).draw(); } }); jQuery(".fam-list").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $stats = new WT_Stats($GEDCOM); $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; //-- init chart data for ($age = 0; $age <= $max_age; $age++) { $marr_by_age[$age] = ''; } for ($year = 1550; $year < 2030; $year += 10) { $birt_by_decade[$year] = ''; $marr_by_decade[$year] = ''; } $html = ' <div class="loading-image"> </div> <div class="fam-list"> <table id="' . $table_id . '"> <thead> <tr> <th colspan="23"> <div class="btn-toolbar"> <div class="btn-group"> <button type="button" data-filter-column="21" data-filter-value="N" class="ui-state-default" title="' . WT_I18N::translate('Show individuals who are alive or couples where both partners are alive.') . '" > ' . WT_I18N::translate('Both alive') . ' </button> <button type="button" data-filter-column="21" data-filter-value="W" class="ui-state-default" title="' . WT_I18N::translate('Show couples where only the female partner is deceased.') . '" > ' . WT_I18N::translate('Widower') . ' </button> <button type="button" data-filter-column="21" data-filter-value="H" class="ui-state-default" title="' . WT_I18N::translate('Show couples where only the male partner is deceased.') . '" > ' . WT_I18N::translate('Widow') . ' </button> <button type="button" data-filter-column="21" data-filter-value="Y" class="ui-state-default" title="' . WT_I18N::translate('Show individuals who are dead or couples where both partners are deceased.') . '" > ' . WT_I18N::translate('Both dead') . ' </button> </div> <div class="btn-group"> <button type="button" data-filter-column="22" data-filter-value="R" class="ui-state-default" title="' . WT_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.') . '" > ' . WT_I18N::translate('Roots') . ' </button> <button type="button" data-filter-column="22" data-filter-value="L" class="ui-state-default" title="' . WT_I18N::translate('Show “leaves” couples or individuals. These are individuals who are alive but have no children recorded in the database.') . '" > ' . WT_I18N::translate('Leaves') . ' </button> </div> <div class="btn-group"> <button type="button" data-filter-column="20" data-filter-value="U" class="ui-state-default" title="' . WT_I18N::translate('Show couples with an unknown marriage date.') . '" > ' . WT_Gedcom_Tag::getLabel('MARR') . ' </button> <button type="button" data-filter-column="20" data-filter-value="YES" class="ui-state-default" title="' . WT_I18N::translate('Show couples who married more than 100 years ago.') . '" > ' . WT_Gedcom_Tag::getLabel('MARR') . '>100 </button> <button type="button" data-filter-column="20" data-filter-value="Y100" class="ui-state-default" title="' . WT_I18N::translate('Show couples who married within the last 100 years.') . '" > ' . WT_Gedcom_Tag::getLabel('MARR') . '<=100 </button> <button type="button" data-filter-column="20" data-filter-value="D" class="ui-state-default" title="' . WT_I18N::translate('Show divorced couples.') . '" > ' . WT_Gedcom_Tag::getLabel('DIV') . ' </button> <button type="button" data-filter-column="20" data-filter-value="M" class="ui-state-default" title="' . WT_I18N::translate('Show couples where either partner married more than once.') . '" > ' . WT_I18N::translate('Multiple marriages') . ' </button> </div> </div> </th> </tr> <tr> <th>' . WT_Gedcom_Tag::getLabel('GIVN') . '</th> <th>' . WT_Gedcom_Tag::getLabel('SURN') . '</th> <th>HUSB:GIVN_SURN</th> <th>HUSB:SURN_GIVN</th> <th>' . WT_Gedcom_Tag::getLabel('AGE') . '</th> <th>AGE</th> <th>' . WT_Gedcom_Tag::getLabel('GIVN') . '</th> <th>' . WT_Gedcom_Tag::getLabel('SURN') . '</th> <th>WIFE:GIVN_SURN</th> <th>WIFE:SURN_GIVN</th> <th>' . WT_Gedcom_Tag::getLabel('AGE') . '</th> <th>AGE</th> <th>' . WT_Gedcom_Tag::getLabel('MARR') . '</th> <th>MARR:DATE</th> <th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th> <th>' . WT_Gedcom_Tag::getLabel('PLAC') . '</th> <th><i class="icon-children" title="' . WT_I18N::translate('Children') . '"></i></th> <th>NCHI</th> <th' . ($SHOW_LAST_CHANGE ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th> <th' . ($SHOW_LAST_CHANGE ? '' : '') . '>CHAN</th> <th>MARR</th> <th>DEAT</th> <th>TREE</th> </tr> </thead> <tfoot> <tr> <th colspan="23"> <div class="btn-toolbar"> <div class="btn-group"> <button type="button" class="ui-state-default btn-toggle-parents"> ' . WT_I18N::translate('Show parents') . ' </button> <button type="button" class="ui-state-default btn-toggle-statistics"> ' . WT_I18N::translate('Show statistics charts') . ' </button> </div> </div> </th> </tr> </tfoot> <tbody>'; $d100y = new WT_Date(date('Y') - 100); // 100 years ago foreach ($datalist as $family) { //-- Retrieve husband and wife $husb = $family->getHusband(); if (is_null($husb)) { $husb = new WT_Individual('H', '0 @H@ INDI', null, WT_GED_ID); } $wife = $family->getWife(); if (is_null($wife)) { $wife = new WT_Individual('W', '0 @W@ INDI', null, WT_GED_ID); } if (!$family->canShow()) { continue; } if ($family->isNew()) { $class = ' class="new"'; } elseif ($family->isOld()) { $class = ' class="old"'; } else { $class = ''; } $html .= '<tr' . $class . '>'; //-- Husband name(s) $html .= '<td colspan="2">'; foreach ($husb->getAllNames() as $num => $name) { if ($name['type'] == 'NAME') { $title = ''; } else { $title = 'title="' . strip_tags(WT_Gedcom_Tag::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 = ''; } // Only show married names if they are the name we are filtering by. if ($name['type'] != '_MARNM' || $num == $husb->getPrimaryName()) { $html .= '<a ' . $title . ' href="' . $family->getHtmlUrl() . '"' . $class . '>' . highlight_search_hits($name['full']) . '</a>' . $sex_image . '<br>'; } } // Husband parents $html .= $husb->getPrimaryParentsNames('parents details1', 'none'); $html .= '</td>'; // Dummy column to match colspan in header $html .= '<td style="display:none;"></td>'; //-- Husb GIVN // Use "AAAA" as a separator (instead of ",") as Javascript.localeCompare() ignores // punctuation and "ANN,ROACH" would sort after "ANNE,ROACH", instead of before it. // Similarly, @N.N. would sort as NN. $html .= '<td>' . WT_Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . WT_Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . '</td>'; $html .= '<td>' . WT_Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . WT_Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . '</td>'; $mdate = $family->getMarriageDate(); //-- Husband age $hdate = $husb->getBirthDate(); if ($hdate->isOK() && $mdate->isOK()) { if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) { $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); } $hage = WT_Date::getAge($hdate, $mdate, 0); if ($hage >= 0 && $hage <= $max_age) { $marr_by_age[$hage] .= $husb->getSex(); } } $html .= '<td>' . WT_Date::getAge($hdate, $mdate, 2) . '</td><td>' . WT_Date::getAge($hdate, $mdate, 1) . '</td>'; //-- Wife name(s) $html .= '<td colspan="2">'; foreach ($wife->getAllNames() as $num => $name) { if ($name['type'] == 'NAME') { $title = ''; } else { $title = 'title="' . strip_tags(WT_Gedcom_Tag::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 = ''; } // Only show married names if they are the name we are filtering by. if ($name['type'] != '_MARNM' || $num == $wife->getPrimaryName()) { $html .= '<a ' . $title . ' href="' . $family->getHtmlUrl() . '"' . $class . '>' . highlight_search_hits($name['full']) . '</a>' . $sex_image . '<br>'; } } // Wife parents $html .= $wife->getPrimaryParentsNames('parents details1', 'none'); $html .= '</td>'; // Dummy column to match colspan in header $html .= '<td style="display:none;"></td>'; //-- Wife GIVN //-- Husb GIVN // Use "AAAA" as a separator (instead of ",") as Javascript.localeCompare() ignores // punctuation and "ANN,ROACH" would sort after "ANNE,ROACH", instead of before it. // Similarly, @N.N. would sort as NN. $html .= '<td>' . WT_Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . WT_Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . '</td>'; $html .= '<td>' . WT_Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . WT_Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . '</td>'; $mdate = $family->getMarriageDate(); //-- Wife age $wdate = $wife->getBirthDate(); if ($wdate->isOK() && $mdate->isOK()) { if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) { $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); } $wage = WT_Date::getAge($wdate, $mdate, 0); if ($wage >= 0 && $wage <= $max_age) { $marr_by_age[$wage] .= $wife->getSex(); } } $html .= '<td>' . WT_Date::getAge($wdate, $mdate, 2) . '</td><td>' . WT_Date::getAge($wdate, $mdate, 1) . '</td>'; //-- Marriage date $html .= '<td>'; if ($marriage_dates = $family->getAllMarriageDates()) { foreach ($marriage_dates as $n => $marriage_date) { if ($n) { $html .= '<br>'; } $html .= '<div>' . $marriage_date->Display(!$SEARCH_SPIDER) . '</div>'; } if ($marriage_dates[0]->gregorianYear() >= 1550 && $marriage_dates[0]->gregorianYear() < 2030) { $marr_by_decade[(int) ($marriage_dates[0]->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); } } elseif ($family->getFacts('_NMR')) { $html .= WT_I18N::translate('no'); } elseif ($family->getFacts('MARR')) { $html .= WT_I18N::translate('yes'); } else { $html .= ' '; } $html .= '</td>'; //-- Event date (sortable)hidden by datatables code $html .= '<td>'; if ($marriage_dates) { $html .= $marriage_date->JD(); } else { $html .= 0; } $html .= '</td>'; //-- Marriage anniversary $html .= '<td>' . WT_Date::getAge($mdate, null, 2) . '</td>'; //-- Marriage place $html .= '<td>'; foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) { $tmp = new WT_Place($marriage_place, WT_GED_ID); if ($n) { $html .= '<br>'; } if ($SEARCH_SPIDER) { $html .= $tmp->getShortName(); } else { $html .= '<a href="' . $tmp->getURL() . '" title="' . strip_tags($tmp->getFullName()) . '">'; $html .= highlight_search_hits($tmp->getShortName()) . '</a>'; } } $html .= '</td>'; //-- Number of children $nchi = $family->getNumberOfChildren(); $html .= '<td>' . WT_I18N::number($nchi) . '</td><td>' . $nchi . '</td>'; //-- Last change if ($SHOW_LAST_CHANGE) { $html .= '<td>' . $family->LastChangeTimestamp() . '</td>'; } else { $html .= '<td> </td>'; } //-- Last change hidden sort column if ($SHOW_LAST_CHANGE) { $html .= '<td>' . $family->LastChangeTimestamp(true) . '</td>'; } else { $html .= '<td> </td>'; } //-- Sorting by marriage date $html .= '<td>'; if (!$family->canShow() || !$mdate->isOK()) { $html .= 'U'; } else { if (WT_Date::Compare($mdate, $d100y) > 0) { $html .= 'Y100'; } else { $html .= 'YES'; } } if ($family->getFacts(WT_EVENTS_DIV)) { $html .= 'D'; } if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) { $html .= 'M'; } $html .= '</td>'; //-- Sorting alive/dead $html .= '<td>'; if ($husb->isDead() && $wife->isDead()) { $html .= 'Y'; } if ($husb->isDead() && !$wife->isDead()) { if ($wife->getSex() == 'F') { $html .= 'H'; } if ($wife->getSex() == 'M') { $html .= 'W'; } // male partners } if (!$husb->isDead() && $wife->isDead()) { if ($husb->getSex() == 'M') { $html .= 'W'; } if ($husb->getSex() == 'F') { $html .= 'H'; } // female partners } if (!$husb->isDead() && !$wife->isDead()) { $html .= 'N'; } $html .= '</td>'; //-- Roots or Leaves $html .= '<td>'; if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { $html .= 'R'; } elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { $html .= 'L'; } else { $html .= ' '; } $html .= '</td> </tr>'; } $html .= ' </tbody> </table> <div id="fam_list_table-charts_' . $table_id . '" style="display:none"> <table class="list-charts"> <tr> <td> ' . print_chart_by_decade($birt_by_decade, WT_I18N::translate('Decade of birth')) . ' </td> <td> ' . print_chart_by_decade($marr_by_decade, WT_I18N::translate('Decade of marriage')) . ' </td> </tr> <tr> <td colspan="2"> ' . print_chart_by_age($marr_by_age, WT_I18N::translate('Age in year of marriage')) . ' </td> </tr> </table> </div> </div>'; return $html; }
function __construct() { global $WT_SESSION; parent::__construct(); $this->setPageTitle(WT_I18N::translate('Lifespans')); $this->colorindex = 0; $this->Fcolorindex = 0; $this->Mcolorindex = 0; $this->zoomfactor = 10; $this->color = "#0000FF"; $this->currentYear = date("Y"); $this->deathMod = 0; $this->endDate = $this->currentYear; // Request parameters $newpid = WT_Filter::get('newpid', WT_REGEX_XREF); $remove = WT_Filter::get('remove', WT_REGEX_XREF); $pids = WT_Filter::getArray('pids', WT_REGEX_XREF); $clear = WT_Filter::getBool('clear'); $addfam = WT_Filter::getBool('addFamily'); $place = WT_Filter::get('place'); $beginYear = WT_Filter::getInteger('beginYear', 0, date('Y') + 100, 0); $endYear = WT_Filter::getInteger('endYear', 0, date('Y') + 100, 0); if ($clear) { // Empty list $this->pids = array(); } elseif ($pids) { // List of specified records $this->pids = $pids; } elseif ($place) { // All records found in a place $wt_place = new WT_Place($place, WT_GED_ID); $this->pids = WT_DB::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")->execute(array($wt_place->getPlaceId(), WT_GED_ID))->fetchOneColumn(); $this->place = $place; } else { // Modify an existing list of records if (is_array($WT_SESSION->timeline_pids)) { $this->pids = $WT_SESSION->timeline_pids; } else { $this->pids = array(); } if ($remove) { foreach ($this->pids as $key => $value) { if ($value == $remove) { unset($this->pids[$key]); } } } elseif ($newpid) { $person = WT_Individual::getInstance($newpid); $this->addFamily($person, $addfam); } elseif (!$this->pids) { $this->addFamily($this->getSignificantIndividual(), false); } } $WT_SESSION->timeline_pids = $this->pids; $this->beginYear = $beginYear; $this->endYear = $endYear; if ($beginYear == 0 || $endYear == 0) { //-- cleanup user input $this->pids = array_unique($this->pids); //removes duplicates foreach ($this->pids as $key => $value) { if ($value != $remove) { $this->pids[$key] = $value; $person = WT_Individual::getInstance($value); // list of linked records includes families as well as individuals. if ($person) { $bdate = $person->getEstimatedBirthDate(); if ($bdate->isOK() && $person->canShow()) { $this->people[] = $person; } } } } } else { //--Finds if the begin year and end year textboxes are not empty //-- reset the people array when doing a year range search $this->people = array(); //Takes the begining year and end year passed by the postback and modifies them and uses them to populate //the time line //Variables to restrict the person boxes to the year searched. //--Searches for individuals who had an even between the year begin and end years $indis = self::search_indis_year_range($beginYear, $endYear); //--Populates an array of people that had an event within those years foreach ($indis as $person) { if (empty($searchplace) || in_array($person->getXref(), $this->pids)) { $bdate = $person->getEstimatedBirthDate(); if ($bdate->isOK() && $person->canShow()) { $this->people[] = $person; } } } $WT_SESSION->timeline_pids = null; } // Sort the array in order of birth year uasort($this->people, function (WT_Individual $a, WT_Individual $b) { return WT_Date::Compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); }); //If there is people in the array posted back this if occurs if (isset($this->people[0])) { //Find the maximum Death year and mimimum Birth year for each individual returned in the array. $bdate = $this->people[0]->getEstimatedBirthDate(); $ddate = $this->people[0]->getEstimatedDeathDate(); $this->timelineMinYear = $bdate->gregorianYear(); $this->timelineMaxYear = $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y'); foreach ($this->people as $value) { $bdate = $value->getEstimatedBirthDate(); $ddate = $value->getEstimatedDeathDate(); $this->timelineMinYear = min($this->timelineMinYear, $bdate->gregorianYear()); $this->timelineMaxYear = max($this->timelineMaxYear, $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y')); } if ($this->timelineMaxYear > $this->currentYear) { $this->timelineMaxYear = $this->currentYear; } } else { // Sets the default timeline length $this->timelineMinYear = date("Y") - 101; $this->timelineMaxYear = date("Y"); } }
/** * XML <GedcomValue> start element handler * * @param array $attrs an array of key value pairs for the attributes */ function GedcomValueSHandler($attrs) { // @deprecated global $currentElement, $gedrec, $fact, $desc; $id = ""; $match = array(); if (preg_match("/0 @(.+)@/", $gedrec, $match)) { $id = $match[1]; } if (isset($attrs['newline']) && $attrs['newline'] == "1") { $useBreak = "1"; } else { $useBreak = "0"; } $tag = $attrs['tag']; if (!empty($tag)) { if ($tag == "@desc") { $value = $desc; $value = trim($value); $currentElement->addText($value); } if ($tag == "@id") { $currentElement->addText($id); } else { $tag = str_replace("@fact", $fact, $tag); if (empty($attrs['level'])) { $temp = explode(" ", trim($gedrec)); $level = $temp[0]; if ($level == 0) { $level++; } } else { $level = $attrs['level']; } $truncate = ""; if (isset($attrs['truncate'])) { $truncate = $attrs['truncate']; } $tags = preg_split('/[: ]/', $tag); $value = get_gedcom_value($tag, $level, $gedrec, $truncate); switch (end($tags)) { case 'DATE': $tmp = new WT_Date($value); $value = $tmp->Display(); break; case 'PLAC': $tmp = new WT_Place($value, WT_GED_ID); $value = $tmp->getShortName(); break; } if ($useBreak == "1") { // Insert <br> when multiple dates exist. // This works around a TCPDF bug that incorrectly wraps RTL dates on LTR pages $value = str_replace('(', '<br>(', $value); $value = str_replace('<span dir="ltr"><br>', '<br><span dir="ltr">', $value); $value = str_replace('<span dir="rtl"><br>', '<br><span dir="rtl">', $value); if (substr($value, 0, 6) == '<br>') { $value = substr($value, 6); } } $currentElement->addText($value); } } }
} } echo '</ul></td></tr>'; echo '</table>'; } echo '<h4><a href="placelist.php?display=hierarchy">', WT_I18N::translate('Show places in hierarchy'), '</a></h4>'; break; case 'hierarchy': $all_modules = WT_Module::getActiveModules(); if (array_key_exists('googlemap', $all_modules)) { $gm_module = $all_modules['googlemap']; } else { $gm_module = null; } // Find this place and its ID $place = new WT_Place(implode(', ', array_reverse($parent)), WT_GED_ID); $place_id = $place->getPlaceId(); $child_places = $place->getChildPlaces(); $numfound = count($child_places); //-- if the number of places found is 0 then automatically redirect to search page if ($numfound == 0) { $action = 'show'; } echo '<h2>', $controller->getPageTitle(); // Breadcrumbs if ($place_id) { $parent_place = $place->getParentPlace(); while ($parent_place->getPlaceId()) { echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>'; $parent_place = $parent_place->getParentPlace(); }
function commonMarriagePlacesList() { $places = $this->_statsPlaces('FAM', 'MARR'); $top10 = array(); $i = 1; arsort($places); foreach ($places as $place => $count) { $tmp = new WT_Place($place, $this->_ged_id); $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; $top10[] = '<li>' . $place . ' - ' . WT_I18N::number($count) . '</li>'; if ($i++ == 10) { break; } } $top10 = join('', $top10); return '<ul>' . $top10 . '</ul>'; }
// Fetch all data, regardless of privacy $rows = get_OBJE_rows($term); // Filter for privacy foreach ($rows as $row) { $media = WT_Media::getInstance($row->xref, $row->gedcom_id, $row->gedcom); if ($media->canShowName()) { $data[] = array('value' => $row->xref, 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName()); } } echo json_encode($data); exit; case 'PLAC': // Place names (with hierarchy), that include the search term // Do not filter by privacy. Place names on their own do not identify individuals. $data = array(); foreach (WT_Place::findPlaces($term, WT_GED_ID) as $place) { $data[] = $place->getGedcomName(); } if (!$data && get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT')) { // No place found? Use an external gazetteer $url = "http://api.geonames.org/searchJSON" . "?name_startsWith=" . urlencode($term) . "&lang=" . WT_LOCALE . "&fcode=CMTY&fcode=ADM4&fcode=PPL&fcode=PPLA&fcode=PPLC" . "&style=full" . "&username=" . get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT'); // try to use curl when file_get_contents not allowed if (ini_get('allow_url_fopen')) { $json = file_get_contents($url); } elseif (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $json = curl_exec($ch); curl_close($ch); } else {