LongestLifeAge())+1; //-- init chart data for ($age=0; $age<=$max_age; $age++) $deat_by_age[$age]=""; for ($year=1550; $year<2030; $year+=10) $birt_by_decade[$year]=""; for ($year=1550; $year<2030; $year+=10) $deat_by_decade[$year]=""; //-- fieldset if ($option=="BIRT_PLAC" || $option=="DEAT_PLAC") { $filter=$legend; $legend=translate_fact(substr($option, 0, 4))." @ ".$legend; } if ($legend == "") $legend = i18n::translate('Individuals'); $legend = "\"\" ".$legend; echo "
", $legend, ""; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID echo '
'; //-- filter buttons echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo "
"; echo " "; echo " "; echo " "; echo " "; echo " "; //-- table header echo ""; echo ""; echo ""; if ($SHOW_ID_NUMBERS) echo ""; echo ''; echo ""; echo ""; if ($option=="sosa") echo ""; echo ""; if ($tiny) echo ""; echo ""; if ($tiny) echo ""; echo ""; if ($tiny) echo ""; echo ""; echo ""; if ($tiny && $SHOW_LAST_CHANGE) echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; //-- table body echo ""; $hidden = 0; $n = 0; $d100y=new GedcomDate(date('Y')-100); // 100 years ago $dateY = date("Y"); $unique_indis=array(); // Don't double-count indis with multiple names. foreach($datalist as $key => $value) { if (is_object($value)) { // Array of objects $person=$value; } elseif (!is_array($value)) { // Array of IDs $person = Person::getInstance($value); } else { // Array of search results $gid = $key; if (isset($value["gid"])) $gid = $value["gid"]; // from indilist if (isset($value[4])) $gid = $value[4]; // from indilist ALL $person = Person::getInstance($gid); } /* @var $person Person */ if (is_null($person)) continue; if ($person->getType() !== "INDI") continue; if (!$person->canDisplayName()) { $hidden++; continue; } $unique_indis[$person->getXref()]=true; //-- place filtering if ($option=="BIRT_PLAC" && strstr($person->getBirthPlace(), $filter)===false) continue; if ($option=="DEAT_PLAC" && strstr($person->getDeathPlace(), $filter)===false) continue; //-- Counter echo ""; echo ""; //-- Gedcom ID if ($SHOW_ID_NUMBERS) echo ''; //-- Indi name(s) $tdclass = "list_value_wrap"; if (!$person->isDead()) $tdclass .= " alive"; if (!$person->getChildFamilyIds()) $tdclass .= " patriarch"; echo "'; //-- GIVN/SURN echo ''; echo ''; //-- SOSA if ($option=='sosa') { echo ''; } //-- Birth date echo ''; //-- Birth anniversary if ($tiny) { echo ''; } //-- Birth place echo ''; //-- Number of children if ($tiny) { echo ""; } //-- Death date echo ""; //-- Death anniversary if ($tiny) { print "'; } //-- Age at death print ""; //-- Death place echo ''; //-- Last change if ($tiny && $SHOW_LAST_CHANGE) { echo ""; } //-- Sorting by gender echo ""; //-- Filtering by birth date echo ""; //-- Filtering by death date echo ""; //-- Roots or Leaves ? echo ""; echo "\n"; } echo ""; //-- table footer echo ""; echo ""; if ($SHOW_ID_NUMBERS) echo ""; // INDI:ID echo ""; echo ""; echo ""; if ($option=="sosa") echo ""; // SOSA echo ""; // BIRT:DATE if ($tiny) echo ""; // BIRT:Reminder echo ""; // BIRT:PLAC if ($tiny) echo ""; // Children echo ""; //DEAT:DATE, DEAT:Reminder, DEAT:AGE echo ""; // DEAT:PLAC if ($tiny && $SHOW_LAST_CHANGE) echo ""; // CHAN echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
INDI', i18n::translate('NAME'), 'GIVNSURNSosa", translate_fact('BIRT'), "\"",", translate_fact('PLAC'), "\"",", translate_fact('DEAT'), "\"",", translate_fact('AGE'), "", translate_fact('PLAC'), "", translate_fact('CHAN'), "SEXBIRTDEATTREE
", ++$n, "', $person->getXrefLink("_blank"), 'getListName()), "\">"; list($surn, $givn)=explode(',', $person->getSortName()); // If we're showing search results, then the highlighted name is not // necessarily the person's primary name. $primary=$person->getPrimaryName(); $names=$person->getAllNames(); foreach ($names as $num=>$name) { // Exclude duplicate names, which can occur when individuals have // multiple surnames, such as in Spain/Portugal $dupe_found=false; foreach ($names as $dupe_num=>$dupe_name) { if ($dupe_num>$num && $dupe_name['type']==$name['type'] && $dupe_name['full']==$name['full']) { // Take care not to skip the "primary" name if ($num==$primary) { $primary=$dupe_num; } $dupe_found=true; break; } } if ($dupe_found) { continue; } if ($title=$name['type']=='_MARNM') { $title='title="'.translate_fact('_MARNM').'"'; } else { $title=''; } if ($num==$primary) { $class='list_item name2'; $sex_image=$person->getSexImage(); list($surn, $givn)=explode(',', $name['sort']); } else { $class='list_item'; $sex_image=''; } echo '', PrintReady($name['list']), '', $sex_image, "
"; } // Indi parents echo $person->getPrimaryParentsNames("parents_$table_id details1", 'none'); echo '
', $givn, ',', $surn, '', $surn, ',', $givn, '', $key, ''; if ($birth_dates=$person->getAllBirthDates()) { foreach ($birth_dates as $num=>$birth_date) { if ($num) { echo '
', $birth_date->Display(!$SEARCH_SPIDER), '
'; } else { echo '
', str_replace('Display(!$SEARCH_SPIDER)), '
'; } } if ($birth_dates[0]->gregorianYear()>=1550 && $birth_dates[0]->gregorianYear()<2030) { $birt_by_decade[floor($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); } } else { $birth_date=$person->getEstimatedBirthDate(); $birth_jd=$birth_date->JD(); if ($SHOW_EST_LIST_DATES) { echo '
', str_replace('Display(!$SEARCH_SPIDER)), '
'; } else { echo ' '; // span needed for alive-in-year filter } $birth_dates[0]=new GedcomDate(''); } echo '
'; $bage =GedcomDate::GetAgeYears($birth_dates[0]); if (empty($bage)) { echo " "; } else { echo '', $bage, ''; } echo ''; if ($birth_places=$person->getAllBirthPlaces()) { foreach ($birth_places as $birth_place) { if ($SEARCH_SPIDER) { echo get_place_short($birth_place), ' '; } else { echo ''; } } } else { echo ' '; } echo '"; if (showFactDetails('NCHI', $person->getXref(), 'INDI')) { if($SEARCH_SPIDER) { echo $person->getNumberOfChildren(); } else { echo "getLinkUrl()), "\" class=\"list_item\" name=\"", $person->getNumberOfChildren(), "\">", $person->getNumberOfChildren(), ""; } } else { echo ' '; } echo ""; if ($death_dates=$person->getAllDeathDates()) { foreach ($death_dates as $num=>$death_date) { if ($num) { echo '
', $death_date->Display(!$SEARCH_SPIDER), '
'; } else if ($death_date->MinJD()!=0) { echo '
', str_replace('Display(!$SEARCH_SPIDER)), '
'; } } if ($death_dates[0]->gregorianYear()>=1550 && $death_dates[0]->gregorianYear()<2030) { $deat_by_decade[floor($death_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); } } else { $death_date=$person->getEstimatedDeathDate(); $death_jd=$death_date->JD(); if ($SHOW_EST_LIST_DATES) { echo '
', str_replace('Display(!$SEARCH_SPIDER)), '
'; } else if ($person->isDead()) { echo '
', i18n::translate('Yes'), '
'; } else { echo ' '; // span needed for alive-in-year filter } $death_dates[0]=new GedcomDate(''); } echo "
"; if ($death_dates[0]->isOK()) echo "", GedcomDate::GetAgeYears($death_dates[0]), ""; else echo " "; print '"; if ($birth_dates[0]->isOK() && $death_dates[0]->isOK()) { $age = GedcomDate::GetAgeYears($birth_dates[0], $death_dates[0]); $age_jd = $death_dates[0]->MinJD()-$birth_dates[0]->MinJD(); echo '', $age, ''; $deat_by_age[max(0, min($max_age, $age))] .= $person->getSex(); } else { echo ' '; } echo "'; if ($death_places=$person->getAllDeathPlaces()) { foreach ($death_places as $death_place) { if ($SEARCH_SPIDER) { echo get_place_short($death_place), ' '; } else { echo ''; } } } else { echo ' '; } echo '", $person->LastChangeTimestamp(empty($SEARCH_SPIDER)), ""; echo $person->getSex(); echo ""; if (!$person->canDisplayDetails() || GedcomDate::Compare($birth_dates[0], $d100y)>0) { echo "Y100"; } else { echo "YES"; } echo ""; if ($person->isDead()) { if (GedcomDate::Compare($death_dates[0], $d100y)>0) { echo "Y100"; } else { echo "YES"; } } else { echo "N"; } echo ""; if (!$person->getChildFamilyIds()) { echo "R"; // roots } elseif (!$person->isDead() && $person->getNumberOfChildren()<1) { echo "L"; // leaves } echo "
"; // NAME if (count($unique_indis)>1) { echo ' ', i18n::translate('GIVN'), '
'; } echo "
"; echo i18n::translate('Total individuals'), ' : ', count($unique_indis); if ($n!=count($unique_indis)) { echo '
', i18n::translate('Total Names'), ' : ', $n; } if ($hidden) echo "
", i18n::translate('Hidden'), " : ", $hidden, ""; echo "
GIVNSURN"; echo "SEXBIRTDEATTREE
\n"; echo "
"; //-- charts echo "
"; echo ""; echo "
"; print_chart_by_decade($birt_by_decade, i18n::translate('Decade of birth')); echo ""; print_chart_by_decade($deat_by_decade, i18n::translate('Decade of death')); echo "
"; print_chart_by_age($deat_by_age, i18n::translate('Age related to death year')); echo "
"; echo "
"; echo "
\n"; } /** * print a sortable table of families * * @param array $datalist contain families that were extracted from the database. * @param string $legend optional legend of the fieldset */ function print_fam_table($datalist, $legend="", $option="") { global $GEDCOM, $SHOW_ID_NUMBERS, $SHOW_LAST_CHANGE, $TEXT_DIRECTION; global $WT_IMAGE_DIR, $WT_IMAGES, $SEARCH_SPIDER; if ($option=="BIRT_PLAC" || $option=="DEAT_PLAC") return; if (count($datalist)<1) return; $tiny = (count($datalist)<=500); require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_family.php'; require_once WT_ROOT.'includes/classes/class_stats.php'; $stats = new 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]=""; for ($year=1550; $year<2030; $year+=10) $marr_by_decade[$year]=""; //-- fieldset if ($option=="MARR_PLAC") { $filter=$legend; $legend=translate_fact('MARR')." @ ".$legend; } if ($legend == "") $legend = i18n::translate('Families'); $legend = "\"\" ".$legend; echo "
", $legend, ""; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID echo '
'; //-- filter buttons echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo "
"; echo " "; echo " "; echo " "; echo " "; echo " "; //-- table header echo ""; echo ""; echo ""; if ($SHOW_ID_NUMBERS) echo ""; if ($SHOW_ID_NUMBERS) echo ""; echo ""; echo ""; echo ""; if ($SHOW_ID_NUMBERS) echo ""; echo ""; echo ""; echo ""; echo ""; if ($tiny) echo ""; echo ""; if ($tiny) echo ""; if ($tiny && $SHOW_LAST_CHANGE) echo ""; echo ""; echo ""; echo ""; echo "\n"; //-- table body echo "\n"; $hidden = 0; $num = 0; $d100y=new GedcomDate(date('Y')-100); // 100 years ago foreach($datalist as $key => $value) { if (is_object($value)) { // Array of objects $family=$value; } elseif (!is_array($value)) { // Array of IDs $family=Family::getInstance($value); } else { // Array of search results $gid = ""; if (isset($value["gid"])) $gid = $value["gid"]; if (isset($value["gedcom"])) $family = new Family($value["gedcom"]); else $family = Family::getInstance($gid); } if (is_null($family)) continue; if ($family->getType() !== "FAM") continue; //-- Retrieve husband and wife $husb = $family->getHusband(); if (is_null($husb)) $husb = new Person(''); $wife = $family->getWife(); if (is_null($wife)) $wife = new Person(''); if (!$husb->canDisplayName() || !$wife->canDisplayName()) { $hidden++; continue; } //-- place filtering if ($option=="MARR_PLAC" && strstr($family->getMarriagePlace(), $filter)===false) continue; //-- Counter echo ""; echo ""; //-- Family ID if ($SHOW_ID_NUMBERS) echo ''; //-- Husband ID if ($SHOW_ID_NUMBERS) echo ''; //-- Husband name(s) list($husb_name, $wife_name)=explode(' + ', $family->getSortName()); $names=$husb->getAllNames(); // The husband's primary/secondary name might not be the family's primary name foreach ($names as $n=>$name) { if ($name['sort']==$husb_name) { $husb->setPrimaryName($n); break; } } $n1=$husb->getPrimaryName(); $n2=$husb->getSecondaryName(); $tdclass = "list_value_wrap"; if (!$husb->isDead()) $tdclass .= " alive"; if (!$husb->getChildFamilyIds()) $tdclass .= " patriarch"; echo ""; //-- Husb GIVN list($surn, $givn)=explode(',', $husb->getSortName()); echo ''; $mdate=$family->getMarriageDate(); //-- Husband age echo ""; //-- Wife ID if ($SHOW_ID_NUMBERS) echo ''; //-- Wife name(s) $names=$wife->getAllNames(); // The husband's primary/secondary name might not be the family's primary name foreach ($names as $n=>$name) { if ($name['sort']==$wife_name) { $wife->setPrimaryName($n); break; } } $n1=$wife->getPrimaryName(); $n2=$wife->getSecondaryName(); $tdclass = "list_value_wrap"; if (!$wife->isDead()) $tdclass .= " alive"; if (!$wife->getChildFamilyIds()) $tdclass .= " patriarch"; echo ""; //-- Wife GIVN list($surn, $givn)=explode(',', $wife->getSortName()); echo ''; $mdate=$family->getMarriageDate(); //-- Wife age echo ""; //-- Marriage date echo ""; //-- Marriage anniversary if ($tiny) { echo ""; } //-- Marriage place echo ''; //-- Number of children if ($tiny) { echo ""; } //-- Last change if ($tiny && $SHOW_LAST_CHANGE) echo ''; //-- Sorting by marriage date echo ""; //-- Sorting alive/dead echo ""; //-- Roots or Leaves echo ""; echo "\n"; } echo ""; //-- table footer echo ""; echo ""; if ($SHOW_ID_NUMBERS) echo ""; // FAM:ID if ($SHOW_ID_NUMBERS) echo ""; // HUSB:ID echo ""; echo ""; echo ""; // HUSB:AGE if ($SHOW_ID_NUMBERS) echo ""; // WIFE:ID echo ""; echo ""; echo ""; // WIFE:AGE echo ""; // MARR:DATE, MARR:Reminder, MARR:PLAC if ($tiny) echo ""; // FAM:ChildrenCount if ($tiny && $SHOW_LAST_CHANGE) echo ""; // FAM:CHAN echo ""; echo ""; echo ""; echo ""; echo "
FAMINDI", i18n::translate('NAME'), "HUSB:GIVN", translate_fact('AGE'), "INDI", i18n::translate('NAME'), "WIFE:GIVN", translate_fact('AGE'), "", translate_fact('MARR'), "\"",", translate_fact('PLAC'), "\"",", translate_fact('CHAN'), "MARRDEATTREE
", ++$num, "', $family->getXrefLink("_blank"), '', $husb->getXrefLink("_blank"), '"; echo "getLinkUrl()), "\" class=\"list_item name2\" dir=\"", $TEXT_DIRECTION, "\">", PrintReady($names[$n1]['list']), ""; if ($tiny) echo $husb->getSexImage(); if ($n1!=$n2) { echo "
getLinkUrl()), "\" class=\"list_item\">", PrintReady($names[$n2]['list']), ""; } // Husband parents echo $husb->getPrimaryParentsNames("parents_$table_id details1", "none"); echo "
', $givn, '"; $hdate=$husb->getBirthDate(); if ($hdate->isOK()) { if ($hdate->gregorianYear()>=1550 && $hdate->gregorianYear()<2030) { $birt_by_decade[floor($hdate->gregorianYear()/10)*10] .= $husb->getSex(); } if ($mdate->isOK()) { $hage=GedcomDate::GetAgeYears($hdate, $mdate); $hage_jd = $mdate->MinJD()-$hdate->MinJD(); echo '', $hage, ''; $marr_by_age[max(0, min($max_age, $hage))] .= $husb->getSex(); } else { echo ' '; } } else { echo ' '; } echo "', $wife->getXrefLink("_blank"), '"; echo "getLinkUrl()), "\" class=\"list_item name2\" dir=\"", $TEXT_DIRECTION, "\">", PrintReady($names[$n1]['list']), ""; if ($tiny) echo $wife->getSexImage(); if ($n1!=$n2) { echo "
getLinkUrl()), "\" class=\"list_item\">", PrintReady($names[$n2]['list']), ""; } // Wife parents echo $wife->getPrimaryParentsNames("parents_$table_id details1", "none"); echo "
', $givn, '"; $wdate=$wife->getBirthDate(); if ($wdate->isOK()) { if ($wdate->gregorianYear()>=1550 && $wdate->gregorianYear()<2030) { $birt_by_decade[floor($wdate->gregorianYear()/10)*10] .= $wife->getSex(); } if ($mdate->isOK()) { $wage=GedcomDate::GetAgeYears($wdate, $mdate); $wage_jd = $mdate->MinJD()-$wdate->MinJD(); echo '', $wage, ''; $marr_by_age[max(0, min($max_age, $wage))] .= $wife->getSex(); } else { print " "; } } else { print " "; } echo ""; if ($marriage_dates=$family->getAllMarriageDates()) { foreach ($marriage_dates as $n=>$marriage_date) { if ($n) { echo '
', $marriage_date->Display(!$SEARCH_SPIDER), '
'; } else if ($marriage_date->MinJD()!=0) { echo '
', str_replace('Display(!$SEARCH_SPIDER)), '
'; } } if ($marriage_dates[0]->gregorianYear()>=1550 && $marriage_dates[0]->gregorianYear()<2030) { $marr_by_decade[floor($marriage_dates[0]->gregorianYear()/10)*10] .= $husb->getSex().$wife->getSex(); } } else if (get_sub_record(1, "1 _NMR", $family->getGedcomRecord())) { $hus = $family->getHusband(); $wif = $family->getWife(); if (empty($wif) && !empty($hus)) echo translate_fact('_NMR', $hus); else if (empty($hus) && !empty($wif)) echo translate_fact('_NMR', $wif); else echo translate_fact('_NMR'); } else if (get_sub_record(1, "1 _NMAR", $family->getGedcomRecord())) { $hus = $family->getHusband(); $wif = $family->getWife(); if (empty($wif) && !empty($hus)) echo translate_fact('_NMAR', $hus); else if (empty($hus) && !empty($wif)) echo translate_fact('_NMAR', $wif); else echo translate_fact('_NMAR'); } else { $factdetail = explode(' ', trim($family->getMarriageRecord())); if (isset($factdetail)) { if (count($factdetail) >= 3) { if (strtoupper($factdetail[2]) != "N") echo '
', i18n::translate('Yes'), '
'; else echo '
', i18n::translate('No'), '
'; } else echo ' '; } } echo "
"; $mage=GedcomDate::GetAgeYears($mdate); if (empty($mage)) echo " "; else echo "", $mage, ""; echo "'; if ($marriage_places=$family->getAllMarriagePlaces()) { foreach ($marriage_places as $marriage_place) { if ($SEARCH_SPIDER) { echo get_place_short($marriage_place), ' '; } else { echo ''; } } } else { echo ' '; } echo '"; if (showFactDetails('NCHI', $family->getXref(), 'FAM')) { if($SEARCH_SPIDER) { echo $family->getNumberOfChildren(); } else { echo "getLinkUrl()), "\" class=\"list_item\" name=\"", $family->getNumberOfChildren(), "\">", $family->getNumberOfChildren(), ""; } } else { echo ' '; } echo "', $family->LastChangeTimestamp(empty($SEARCH_SPIDER)), '"; if (!$family->canDisplayDetails() || !$mdate->isOK()) { echo "U"; } else { if (GedcomDate::Compare($mdate, $d100y)>0) { echo "Y100"; } else { echo "YES"; } } if ($family->isDivorced()) echo " DIV"; echo ""; 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"; echo ""; if (!$husb->getChildFamilyIds() && !$wife->getChildFamilyIds()) { echo "R"; // roots } elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren()<1) { echo "L"; // leaves } echo "
"; // HUSB:NAME if ($num>1) { echo ' ', i18n::translate('GIVN'), '
'; } echo "
"; echo i18n::translate('Total families'), " : ", $num; if ($hidden) echo "
", i18n::translate('Hidden'), " : ", $hidden, ""; echo "
HUSB:GIVN"; // WIFE:NAME echo ' ', i18n::translate('GIVN'), '
'; echo "
WIFE:GIVN"; echo "MARRDEATTREE
\n"; echo "
"; //-- charts echo "
"; echo ""; echo "
"; print_chart_by_decade($birt_by_decade, i18n::translate('Decade of birth')); echo ""; print_chart_by_decade($marr_by_decade, i18n::translate('Decade of marriage')); echo "
"; print_chart_by_age($marr_by_age, i18n::translate('Age in year of marriage')); echo "
"; echo "
"; echo "
\n"; } /** * print a sortable table of sources * * @param array $datalist contain sources that were extracted from the database. * @param string $legend optional legend of the fieldset */ function print_sour_table($datalist, $legend=null) { global $SHOW_ID_NUMBERS, $SHOW_LAST_CHANGE, $TEXT_DIRECTION; global $WT_IMAGE_DIR, $WT_IMAGES; if (count($datalist)<1) { return; } require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_source.php'; echo '
'; if ($legend) { echo $legend; } else { echo i18n::translate('Sources'); } echo ''; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ''; if ($SHOW_ID_NUMBERS) { echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if ($SHOW_LAST_CHANGE) { echo ''; } echo ''; //-- table body $t2=false; $n=0; foreach ($datalist as $key=>$value) { if (is_object($value)) { // Array of objects $source=$value; } elseif (!is_array($value)) { // Array of IDs $source=Source::getInstance($key); // from placelist if (is_null($source)) { $source=Source::getInstance($value); } unset($value); } else { // Array of search results $gid=''; if (isset($value['gid'])) { $gid=$value['gid']; } if (isset($value['gedcom'])) { $source=new Source($value['gedcom']); } else { $source=Source::getInstance($gid); } } if (!$source || !$source->canDisplayDetails()) { continue; } $link_url=encode_url($source->getLinkUrl()); //-- Counter echo ''; //-- Source ID if ($SHOW_ID_NUMBERS) { echo ''; } //-- Source name(s) $tmp=$source->getFullName(); echo ''; // alternate title in a new column $tmp=$source->getAddName(); if ($tmp) { echo ''; $t2=true; } else { echo ''; } //-- Author $tmp=$source->getAuth(); if ($tmp) { echo ''; } else { echo ''; } //-- Linked INDIs $tmp=$source->countLinkedIndividuals(); echo ''; //-- Linked FAMs $tmp=$source->countLinkedfamilies(); echo ''; //-- Linked OBJEcts $tmp=$source->countLinkedMedia(); echo ''; //-- Linked NOTEs $tmp=$source->countLinkedNotes(); echo ''; //-- Last change if ($SHOW_LAST_CHANGE) { print ''; } echo "\n"; } //-- table footer echo ''; if ($SHOW_ID_NUMBERS) { echo ''; } echo ''; if ($SHOW_LAST_CHANGE) { echo ''; } echo '
SOUR', translate_fact('TITL'), '', translate_fact('AUTH'), '', i18n::translate('Individuals'), '', i18n::translate('Families'), '', i18n::translate('Media'), '', i18n::translate('Shared Notes'), '', translate_fact('CHAN'), '
', ++$n, '', $source->getXrefLink(), '', PrintReady(htmlspecialchars($tmp)), '', PrintReady(htmlspecialchars($tmp)), ' ', $tmp, '', $tmp, '', $tmp, '', $tmp, ''.$source->LastChangeTimestamp(empty($SEARCH_SPIDER)).'
', i18n::translate('Total Sources'), ' : ', $n, '
'; // show TITLE2 col if not empty if ($t2) { echo <<< T2 T2; } } // BH print a sortable list of Shared Notes /** * print a sortable table of shared notes * * @param array $datalist contain shared notes that were extracted from the database. * @param string $legend optional legend of the fieldset */ function print_note_table($datalist, $legend=null) { global $SHOW_ID_NUMBERS, $SHOW_LAST_CHANGE, $TEXT_DIRECTION; global $WT_IMAGE_DIR, $WT_IMAGES; if (count($datalist)<1) { return; } require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_note.php'; if (!empty($WT_IMAGES["menu_note"]["small"])) { echo '
'; } else { echo '
'; } if ($legend) { echo $legend; } else { echo i18n::translate('Shared Notes'); } echo ''; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ''; if ($SHOW_ID_NUMBERS) { echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; if ($SHOW_LAST_CHANGE) { echo ''; } echo ''; //-- table body $n=0; foreach ($datalist as $note) { if (!$note->canDisplayDetails()) { continue; } $link_url=encode_url($note->getLinkUrl()); //-- Counter echo ''; //-- Shared Note ID if ($SHOW_ID_NUMBERS) { echo ''; } //-- Shared Note name(s) $tmp=$note->getFullName(); echo ''; //-- Linked INDIs $tmp=$note->countLinkedIndividuals(); echo ''; //-- Linked FAMs $tmp=$note->countLinkedfamilies(); echo ''; //-- Linked OBJEcts $tmp=$note->countLinkedMedia(); echo ''; //-- Linked SOURs $tmp=$note->countLinkedSources(); echo ''; //-- Last change if ($SHOW_LAST_CHANGE) { print ''; } echo "\n"; } //-- table footer echo ''; if ($SHOW_ID_NUMBERS) { echo ''; } echo ''; if ($SHOW_LAST_CHANGE) { echo ''; } echo '
NOTE', translate_fact('TITL'), '', i18n::translate('Individuals'), '', i18n::translate('Families'), '', i18n::translate('Media'), '', i18n::translate('Sources'), '', translate_fact('CHAN'), '
', ++$n, '', $note->getXrefLink(), '', PrintReady($tmp), '', $tmp, '', $tmp, '', $tmp, '', $tmp, ''.$note->LastChangeTimestamp(empty($SEARCH_SPIDER)).'
', i18n::translate('Total Shared Notes'), ' : ', $n, '
'; } /** * print a sortable table of repositories * * @param array $datalist contain repositories that were extracted from the database. * @param string $legend optional legend of the fieldset */ function print_repo_table($repos, $legend='') { global $SHOW_ID_NUMBERS, $SHOW_LAST_CHANGE, $TEXT_DIRECTION; global $WT_IMAGE_DIR, $WT_IMAGES, $SEARCH_SPIDER; if (!$repos) { return; } require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_repository.php'; echo '
'; if ($legend) { echo htmlspecialchars($legend); } else { echo i18n::translate('Repositories found'); } echo ''; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ''; if ($SHOW_ID_NUMBERS) { echo ''; } echo ''; echo ''; if ($SHOW_LAST_CHANGE) { echo ''; } echo ''; //-- table body $n=0; foreach ($repos as $repo) { //-- Counter echo ''; //-- REPO ID if ($SHOW_ID_NUMBERS) echo ''; //-- Repository name(s) $name = $repo->getFullName(); echo ''; //-- Linked SOURces $tmp=$repo->countLinkedSources(); echo ''; //-- Last change if ($SHOW_LAST_CHANGE) { echo ''; } echo ''; } echo '
REPO', i18n::translate('NAME'), '', i18n::translate('Sources'), '', translate_fact('CHAN'), '
', ++$n, '', $repo->getXrefLink(), '', PrintReady(htmlspecialchars($name)), ''; $addname=$repo->getAddName(); if ($addname) { echo '
', PrintReady(htmlspecialchars($addname)), ''; } echo '
', $tmp, '', $repo->LastChangeTimestamp(!$SEARCH_SPIDER), '
'; } /** * print a sortable table of media objects * * @param array $datalist contain media objects that were extracted from the database. * @param string $legend optional legend of the fieldset */ function print_media_table($datalist, $legend="") { global $SHOW_ID_NUMBERS, $SHOW_LAST_CHANGE, $TEXT_DIRECTION; global $WT_IMAGE_DIR, $WT_IMAGES, $SHOW_MEDIA_FILENAME; if (count($datalist)<1) return; require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_media.php'; if ($legend == "") $legend = i18n::translate('Media'); $legend = "\"\" ".$legend; echo "
", $legend, ""; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ""; echo ""; echo ""; if ($SHOW_ID_NUMBERS) echo ""; echo ""; echo ""; echo ""; echo ""; if ($SHOW_LAST_CHANGE) echo ""; echo "\n"; //-- table body $n = 0; foreach ($datalist as $key => $value) { if (is_object($value)) { // Array of objects $media=$value; } else { $media = new Media($value["GEDCOM"]); if (is_null($media)) $media = Media::getInstance($key); if (is_null($media)) continue; } //-- Counter echo ""; echo ""; //-- Object ID if ($SHOW_ID_NUMBERS) echo ''; //-- Object name(s) $name = $media->getFullName(); echo ""; //-- Linked INDIs $tmp=$media->countLinkedIndividuals(); echo ''; //-- Linked FAMs $tmp=$media->countLinkedfamilies(); echo ''; //-- Linked SOURces $tmp=$media->countLinkedSources(); echo ''; /* //-- Linked records foreach (array("INDI", "FAM", "SOUR") as $rectype) { $resu = array(); foreach ($value["LINKS"] as $k=>$v) { if ($v!=$rectype) continue; $record = GedcomRecord::getInstance($k); $txt = $record->getListName(); if ($SHOW_ID_NUMBERS) $txt .= " (".$k.")"; $resu[] = $txt; } sort($resu); echo ""; } */ //-- Last change if ($SHOW_LAST_CHANGE) print ""; echo "\n"; } echo "
OBJE", translate_fact('TITL'), "", i18n::translate('Individuals'), "", i18n::translate('Families'), "", i18n::translate('Sources'), "", translate_fact('CHAN'), "
", ++$n, "', $media->getXrefLink(), '"; echo "getLinkUrl()), "\" class=\"list_item name2\">", PrintReady($name), ""; if ($SHOW_MEDIA_FILENAME || WT_USER_IS_ADMIN) echo "
getLinkUrl()), "\">", basename($media->file), ""; //echo "
", $media->getFiletype(); //echo "  ", $media->width, "x", $media->height; //echo "  ", $media->getFilesize(), "kB"; print_fact_notes("1 NOTE ".$media->getNote(), 1); echo "
', $tmp, '', $tmp, '', $tmp, '"; foreach ($resu as $txt) echo "getLinkUrl()), "\" class=\"list_item\">", PrintReady("• ".$txt), "
"; echo "
".$media->LastChangeTimestamp(empty($SEARCH_SPIDER))."
\n"; echo "
\n"; } /** * print a tag cloud of surnames * print a sortable table of surnames * * @param array $datalist contain records that were extracted from the database. * @param string $target where to go after clicking a surname : INDI page or FAM page * @param string $listFormat presentation style: "style2 = sortable list, "style3" = cloud */ function print_surn_table($datalist, $target="INDI", $listFormat="") { global $GEDCOM, $TEXT_DIRECTION, $COMMON_NAMES_THRESHOLD; global $SURNAME_LIST_STYLE; if (count($datalist)<1) return; if (empty($listFormat)) $listFormat = $SURNAME_LIST_STYLE; if ($listFormat=="style3") { // Requested style is "cloud", where the surnames are a list of names (with links), // and the font size used for each name depends on the number of occurrences of this name // in the database - generally known as a 'tag cloud'. $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ""; //-- table body echo ""; echo ""; echo "\n"; //-- table footer echo "
"; //-- Calculate range for font sizing $max_tag = 0; $font_tag = 0; foreach($datalist as $key => $value) { if (!isset($value["name"])) break; if ($value["match"]>$max_tag) $max_tag = $value["match"]; } $font_tag = $max_tag / 6; //-- Print each name foreach($datalist as $key => $value) { if (!isset($value["name"])) break; $surn = $value["name"]; $url = ($target=="FAM") ? 'fam' : 'indi'; $url .= "list.php?ged={$GEDCOM}&surname={$surn}"; $url = encode_url($url); if (empty($surn) || trim("@".$surn, "_")=="@" || $surn=="@N.N.") $surn = i18n::translate('(unknown)'); $fontsize = ceil($value["match"]/$font_tag); if ($TEXT_DIRECTION=="ltr") { $title = PrintReady($surn." (".$value["match"].")"); $tag = PrintReady("".$surn." (".$value["match"].")"); } else { $title = PrintReady("(".$value["match"].") ".$surn); $tag = PrintReady("(".$value["match"].") ".$surn.""); } echo "{$tag}   "; } echo "
\n"; return; } // Requested style isn't "cloud". In this case, we'll produce a sortable list. require_once WT_ROOT.'js/sorttable.js.htm'; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; //-- table body $total = 0; $n = 0; foreach($datalist as $key => $value) { if (!isset($value["name"])) break; $surn = $value["name"]; $url = ($target=="FAM") ? 'fam' : 'indi'; $url .= "list.php?ged={$GEDCOM}&surname={$surn}"; $url = encode_url($url); //-- Counter echo ""; echo ""; //-- Surname if (empty($surn) or trim("@".$surn, "_")=="@" or $surn=="@N.N.") $surn = i18n::translate('(unknown)'); echo ""; //-- Surname count echo ""; $total += $value["match"]; echo "\n"; } //-- table footer echo ""; echo ""; echo ""; echo ""; echo "\n"; echo "
", translate_fact('SURN'), ""; if ($target=="FAM") echo i18n::translate('Spouses'); else echo i18n::translate('Individuals'); echo "
", ++$n, ""; echo "", PrintReady($surn), ""; echo " "; echo "{$value["match"]}"; echo "
  ", $total, "
\n"; } // Print a table of surnames. // @param $surnames array (of SURN, of array of SPFX_SURN, of array of PID) // @param $type string, indilist or famlist function format_surname_table($surnames, $type) { global $GEDCOM; require_once WT_ROOT.'js/sorttable.js.htm'; $table_id ='ID'.floor(microtime()*1000000); // sorttable requires a unique ID $html=''; $html.=''; $html.=''; $html.=''; // hidden column for sorting surnames $html.=''; $unique_surn=array(); $unique_indi=array(); $row_num=0; foreach ($surnames as $surn=>$surns) { // Each surname links back to the indi/fam surname list if ($surn) { $url=$type.'.php?surname='.urlencode($surn).'&ged='.urlencode($GEDCOM); } else { $url=$type.'.php?alpha=,&ged='.urlencode($GEDCOM); } // Row counter ++$row_num; $html.=''; // Surname $html.=''; // Hidden column for sorting surnames $html.=''; // Surname count $html.=''; } //-- table footer $html.=''; $html.=''; $html.=''; // hidden column for sorting surnames $html.='
'.i18n::translate('SURN').'SURN'; if ($type=='famlist') { $html.=i18n::translate('Spouses'); } else { $html.=i18n::translate('Individuals'); } $html.='
'.$row_num.''; // Uncomment this block if you want SMITH/Smith/smith merged. Note that when // such case variants exist, the actual one displayed is undefined. //$first_spfxsurn=null; //foreach ($surns as $spfxsurn=>$indis) { // if ($first_spfxsurn) { // if (utf8_strtoupper($spfxsurn)==utf8_strtoupper($first_spfxsurn)) { // $surns[$first_spfxsurn]=array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]); // unset ($surns[$spfxsurn]); // } // } else { // $first_spfxsurn=$spfxsurn; // } //} if (count($surns)==1) { // Single surname variant foreach ($surns as $spfxsurn=>$indis) { $html.=''.PrintReady($spfxsurn).''; $unique_surn[$spfxsurn]=true; foreach (array_keys($indis) as $pid) { $unique_indi[$pid]=true; } } } else { // Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. foreach ($surns as $spfxsurn=>$indis) { $html.=''.PrintReady($spfxsurn).'
'; $unique_surn[$spfxsurn]=true; foreach (array_keys($indis) as $pid) { $unique_indi[$pid]=true; } } } $html.='
'.htmlspecialchars($surn, ENT_COMPAT, 'UTF-8').''; if (count($surns)==1) { // Single surname variant foreach ($surns as $spfxsurn=>$indis) { $subtotal=count($indis); $html.=''.$subtotal.''; } } else { // Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. $subtotal=0; foreach ($surns as $spfxsurn=>$indis) { $subtotal+=count($indis); $html.=count($indis).'
'; } $html.=''.$subtotal.''; } $html.='
   '.i18n::translate('Total individuals').': '.count($unique_indi); $html.='
'.i18n::translate('Total Names').': '.count($unique_surn).'
'; return $html; } // Print a tagcloud of surnames. // @param $surnames array (of SURN, of array of SPFX_SURN, of array of PID) // @param $type string, indilist or famlist // @param $totals, boolean, show totals after each name function format_surname_tagcloud($surnames, $type, $totals) { global $TEXT_DIRECTION, $GEDCOM; // Requested style is "cloud", where the surnames are a list of names (with links), // and the font size used for each name depends on the number of occurrences of this name // in the database - generally known as a 'tag cloud'. $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header $html='
'; //-- Calculate range for font sizing $max_tag = 0; $font_tag = 0; foreach ($surnames as $surn=>$surns) { foreach ($surns as $spfxsurn=>$indis) { $max_tag=max($max_tag, count($indis)); } } $font_tag = $max_tag / 6; //-- Print each name foreach ($surnames as $surn=>$surns) { // Each surname links back to the indi/fam surname list if ($surn) { $url=$type.'.php?surname='.urlencode($surn).'&ged='.urlencode($GEDCOM); } else { $url=$type.'.php?alpha=,&ged='.urlencode($GEDCOM); } // If all the surnames are just case variants, then merge them into one // Comment out this block if you want SMITH listed separately from Smith $first_spfxsurn=null; foreach ($surns as $spfxsurn=>$indis) { if ($first_spfxsurn) { if (utf8_strtoupper($spfxsurn)==utf8_strtoupper($first_spfxsurn)) { $surns[$first_spfxsurn]=array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]); unset ($surns[$spfxsurn]); } } else { $first_spfxsurn=$spfxsurn; } } foreach ($surns as $spfxsurn=>$indis) { $count=count($indis); $fontsize = ceil($count/$font_tag); if ($totals) { $total='('.$count.')'; } else { $total=''; } if ($TEXT_DIRECTION=="ltr") { $tag = "".PrintReady($spfxsurn)." ".$total.""; } else { $tag = PrintReady("".getRLM().$total.getRLM()." ".$spfxsurn.""); } $html.=''.$tag.' '; } } $html.='
'; return $html; } // Print a list of surnames. // @param $surnames array (of SURN, of array of SPFX_SURN, of array of PID) // @param $style, 1=bullet list, 2=semicolon-separated list // @param $totals, boolean, show totals after each name function format_surname_list($surnames, $style, $totals) { global $TEXT_DIRECTION, $GEDCOM; $html=array(); foreach ($surnames as $surn=>$surns) { // Each surname links back to the indilist if ($surn) { $url='indilist.php?surname='.urlencode($surn).'&ged='.urlencode($GEDCOM); } else { $url='indilist.php?alpha=,&ged='.urlencode($GEDCOM); } // If all the surnames are just case variants, then merge them into one // Comment out this block if you want SMITH listed separately from Smith $first_spfxsurn=null; foreach ($surns as $spfxsurn=>$indis) { if ($first_spfxsurn) { if (utf8_strtoupper($spfxsurn)==utf8_strtoupper($first_spfxsurn)) { $surns[$first_spfxsurn]=array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]); unset ($surns[$spfxsurn]); } } else { $first_spfxsurn=$spfxsurn; } } $subhtml=''.implode(', ', array_keys($surns)).''; if ($totals) { $subtotal=0; foreach ($surns as $spfxsurn=>$indis) { $subtotal+=count($indis); } $subhtml.=' ['.$subtotal.']'; } $html[]=PrintReady($subhtml); } switch ($style) { case 1: return ''; case 2: return implode('; ', $html); } } /** * print a sortable table of recent changes * also called by mediaviewer to list records linked to a media * * @param array $datalist contain records that were extracted from the database. */ function print_changes_table($datalist, $showChange=true, $total='', $show_pgvu=true) { global $SHOW_ID_NUMBERS, $SHOW_MARRIED_NAMES, $TEXT_DIRECTION; if (count($datalist)<1) return; require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_gedcomrecord.php'; if (empty($total)) $total = i18n::translate('Total changes'); $indi = false; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID //-- table header echo ""; echo ""; //echo ""; if ($SHOW_ID_NUMBERS) echo ""; echo ""; echo ""; if ($showChange) { echo ""; if ($show_pgvu) { echo ""; } } echo "\n"; //-- table body $hidden = 0; $n = 0; $NMAX = 1000; foreach($datalist as $key => $value) { if ($n>=$NMAX) break; $record=GedcomRecord::getInstance($value); if (!$record) { $record=GedcomRecord::getInstance($key); if (!$record) { continue; } } // Privacy if (!$record->canDisplayDetails()) { $hidden++; continue; } //-- Counter echo ""; //echo ""; ++$n; //-- Record ID if ($SHOW_ID_NUMBERS) echo ''; //-- Record name(s) $name = $record->getFullName(); echo ""; //-- GIVN echo ""; if ($showChange) { //-- Last change date/time print ""; if ($show_pgvu) { //-- Last change user print ""; } } echo "\n"; } //-- table footer echo ""; //echo ""; if ($SHOW_ID_NUMBERS) echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
", i18n::translate('ID'), "", i18n::translate('Record'), "GIVN", translate_fact('CHAN'), "", translate_fact('_PGVU'), "
", ++$n, "', $record->getXrefLink(), '"; echo "getLinkUrl()), "\" class=\"list_item name2\" dir=\"", $TEXT_DIRECTION, "\">", PrintReady($name), ""; if ($record->getType()=="INDI") { echo $record->getSexImage(); $indi=true; } $addname=$record->getAddName(); if ($addname) { echo "
getLinkUrl()), "\" class=\"list_item\">", PrintReady($addname), ""; } if ($record->getType()=='INDI') { if ($SHOW_MARRIED_NAMES) { foreach ($record->getAllNames() as $name) { if ($name['type']=='_MARNM') { echo "
getLinkUrl()), "\" class=\"list_item\">", PrintReady($name['full']), ""; } } } echo $record->getPrimaryParentsNames("parents_$table_id details1", "none"); } echo "
"; $exp = explode(",", str_replace('<', ',', $name).","); echo $exp[1]; echo "".$record->LastChangeTimestamp(empty($SEARCH_SPIDER))."".$record->LastChangeUser(empty($SEARCH_SPIDER))."
"; if ($n>1 && $indi) { echo ' ', i18n::translate('GIVN'), '
'; } if ($indi) { echo "
"; } echo $total, ": ", $n; if ($hidden) echo "
", i18n::translate('Hidden'), " : ", $hidden, ""; if ($n>=$NMAX) echo "
", i18n::translate('Recent Changes'), " > ", $NMAX, ""; echo "
GIVN
\n"; } /** * print a sortable table of events * and generates hCalendar records * @see http://microformats.org/ * * @param array $datalist contain records that were extracted from the database. */ function print_events_table($startjd, $endjd, $events='BIRT MARR DEAT', $only_living=false, $allow_download=false, $sort_by_event=false) { global $TEXT_DIRECTION, $SERVER_URL; require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_gedcomrecord.php'; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID // Did we have any output? Did we skip anything? $output = 0; $filter = 0; $private = 0; $return = ''; $filtered_events = array(); foreach (get_events_list($startjd, $endjd, $events) as $value) { $record=$value['record']; //-- only living people ? if ($only_living) { if ($record->getType()=="INDI" && $record->isDead()) { $filter ++; continue; } if ($record->getType()=="FAM") { $husb = $record->getHusband(); if (is_null($husb) || $husb->isDead()) { $filter ++; continue; } $wife = $record->getWife(); if (is_null($wife) || $wife->isDead()) { $filter ++; continue; } } } // Privacy if (!$record->canDisplayDetails() || !showFactDetails($value['fact'], $value['id']) || FactViewRestricted($value['id'], $value['factrec'])) { $private ++; continue; } //-- Counter $output ++; if ($output==1) { //-- First table row: start table headers, etc. first $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= "\n"; } $value['name'] = $record->getListName(); $value['url'] = $record->getLinkUrl(); if ($record->getType()=="INDI") { $value['sex'] = $record->getSexImage(); } else { $value['sex'] = ''; } $filtered_events[] = $value; } // Now we've filtered the list, we can sort by event, if required if ($sort_by_event=="anniv") { uasort($filtered_events, 'event_sort'); } elseif ($sort_by_event) { uasort($filtered_events, 'event_sort_name'); } foreach($filtered_events as $value) { $return .= ""; // hCalendar:vevent //-- Record name(s) $name = $value['name']; if ($value['record']->getType()=="FAM") { $exp = explode("
", $name); $husb = $value['record']->getHusband(); if ($husb) $exp[0] .= $husb->getPrimaryParentsNames("parents_$table_id details1", "none"); $wife = $value['record']->getWife(); if ($wife) $exp[1] .= $wife->getPrimaryParentsNames("parents_$table_id details1", "none"); $name = implode("
", $exp); //
is better here than
} $return .= ""; //-- GIVN $return .= ""; //-- Event date $return .= ""; //-- Anniversary $return .= ""; //-- Event name $return .= ""; $return .= "\n"; } if ($output!=0) { //-- table footer $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= "
".i18n::translate('Record')."GIVN".translate_fact('DATE')."\"".i18n::translate('Anniversary')."\"".translate_fact('EVEN')."
"; $return .= "".PrintReady($name).""; if ($value['record']->getType()=="INDI") { $return .= $value['sex']; $return .= $value['record']->getPrimaryParentsNames("parents_$table_id details1", "none"); } $return .= ""; $exp = explode(",", str_replace('<', ',', $name).","); $return .= $exp[1]; $return .= ""; $return .= str_replace('Display(empty($SEARCH_SPIDER))); $return .= ""; $anniv = $value['anniv']; if ($anniv==0) $return .= ' '; else $return .= "{$anniv}"; if ($allow_download) { // hCalendar:dtstart and hCalendar:summary $return .= "Display(false, 'Ymd', array()))."\">"; $return .= "getFullName()))."\">"; } $return .= ""; $return .= "".translate_fact($value['fact']).""; // hCalendar:url $return .= " 
"; $return .= "
"; $return .= "
"; $return .= i18n::translate('Total events').": ".$output; if ($allow_download) { $uri = $SERVER_URL.basename($_SERVER["REQUEST_URI"]); $title = i18n::translate('Download file %s', 'hCal-events.ics'); $return .= "
\"".$title."\""; } $return .= "
\n"; } // Print a final summary message about restricted/filtered facts $summary = ""; if ($endjd==client_jd()) { // We're dealing with the Today's Events block if ($private!=0) { // We lost some output due to Privacy restrictions if ($output!=0) { $summary = i18n::translate('More events exist for today, but privacy restrictions prevent you from seeing them.'); } else { $summary = i18n::translate('Events exist for today, but privacy restrictions prevent you from seeing them.'); } } else if ($filter!=0) { // We lost some output due to filtering for living people if ($output==0) { $summary = i18n::translate('No events for living people exist for today.'); } } else { if ($output==0) { $summary = i18n::translate('No events exist for today.'); } } } else { // We're dealing with the Upcoming Events block if ($private!=0) { // We lost some output due to Privacy restrictions if ($output!=0) { if ($endjd==$startjd) { $summary = i18n::translate('More events exist for tomorrow, but privacy restrictions prevent you from seeing them.'); } else { $summary = i18n::translate('More events exist for the next %s days, but privacy restrictions prevent you from seeing them.', $endjd-$startjd+1); } } else { if ($endjd==$startjd) { $summary = i18n::translate('Events exist for tomorrow, but privacy restrictions prevent you from seeing them.'); } else { $summary = i18n::translate('Events exist for the next %s days, but privacy restrictions prevent you from seeing them.', $endjd-$startjd+1); } } } else if ($filter!=0) { // We lost some output due to filtering for living people if ($output==0) { if ($endjd==$startjd) { $summary = i18n::translate('No events for living people exist for tomorrow.'); } else { $summary = i18n::translate('No events for living people exist for the next %s days.', $endjd-$startjd+1); } } } else { if ($output==0) { if ($endjd==$startjd) { $summary = i18n::translate('No events exist for tomorrow.'); } else { $summary = i18n::translate('No events exist for the next %s days.', $endjd-$startjd+1); } } } } if ($summary!="") { $return .= "". $summary. ""; } return $return; } /** * print a list of events * * This performs the same function as print_events_table(), but formats the output differently. */ function print_events_list($startjd, $endjd, $events='BIRT MARR DEAT', $only_living=false, $sort_by_event=false) { global $TEXT_DIRECTION; // Did we have any output? Did we skip anything? $output = 0; $filter = 0; $private = 0; $return = ''; $filtered_events = array(); foreach (get_events_list($startjd, $endjd, $events) as $value) { $record = GedcomRecord::getInstance($value['id']); //-- only living people ? if ($only_living) { if ($record->getType()=="INDI" && $record->isDead()) { $filter ++; continue; } if ($record->getType()=="FAM") { $husb = $record->getHusband(); if (is_null($husb) || $husb->isDead()) { $filter ++; continue; } $wife = $record->getWife(); if (is_null($wife) || $wife->isDead()) { $filter ++; continue; } } } // Privacy if (!$record->canDisplayDetails() || !showFactDetails($value['fact'], $value['id']) || FactViewRestricted($value['id'], $value['factrec'])) { $private ++; continue; } $output ++; $value['name'] = $record->getListName(); $value['url'] = $record->getLinkUrl(); if ($record->getType()=="INDI") { $value['sex'] = $record->getSexImage(); } else { $value['sex'] = ''; } $filtered_events[] = $value; } // Now we've filtered the list, we can sort by event, if required if ($sort_by_event=="anniv") { uasort($filtered_events, 'event_sort'); } elseif ($sort_by_event) { uasort($filtered_events, 'event_sort_name'); } foreach($filtered_events as $value) { $return .= "".PrintReady($value['name'])."".$value['sex']; $return .= "
"; $return .= i18n::translate($value['fact']).' - '.$value['date']->Display(true); if ($value['anniv']!=0) $return .= " (" . i18n::translate('%s year anniversary', $value['anniv']).")"; if (!empty($value['plac'])) $return .= " - ".$value['plac'].""; $return .= "
"; } // Print a final summary message about restricted/filtered facts $summary = ""; if ($endjd==client_jd()) { // We're dealing with the Today's Events block if ($private!=0) { // We lost some output due to Privacy restrictions if ($output!=0) { $summary = i18n::translate('More events exist for today, but privacy restrictions prevent you from seeing them.'); } else { $summary = i18n::translate('Events exist for today, but privacy restrictions prevent you from seeing them.'); } } else if ($filter!=0) { // We lost some output due to filtering for living people if ($output==0) { $summary = i18n::translate('No events for living people exist for today.'); } } else { if ($output==0) { $summary = i18n::translate('No events exist for today.'); } } } else { // We're dealing with the Upcoming Events block if ($private!=0) { // We lost some output due to Privacy restrictions if ($output!=0) { if ($endjd==$startjd) { $summary = i18n::translate('More events exist for tomorrow, but privacy restrictions prevent you from seeing them.'); } else { $summary = i18n::translate('More events exist for the next %s days, but privacy restrictions prevent you from seeing them.', $endjd-$startjd+1); } } else { if ($endjd==$startjd) { $summary = i18n::translate('Events exist for tomorrow, but privacy restrictions prevent you from seeing them.'); } else { $summary = i18n::translate('Events exist for the next %s days, but privacy restrictions prevent you from seeing them.', $endjd-$startjd+1); } } } else if ($filter!=0) { // We lost some output due to filtering for living people if ($output==0) { if ($endjd==$startjd) { $summary = i18n::translate('No events for living people exist for tomorrow.'); } else { $summary = i18n::translate('No events for living people exist for the next %s days.', $endjd-$startjd+1); } } } else { if ($output==0) { if ($endjd==$startjd) { $summary = i18n::translate('No events exist for tomorrow.'); } else { $summary = i18n::translate('No events exist for the next %s days.', $endjd-$startjd+1); } } } } if ($summary!="") { $return .= "". $summary. ""; } return $return; } /** * print a chart by age using Google chart API * * @param array $data * @param string $title */ function print_chart_by_age($data, $title) { global $GEDCOM; global $view, $stylesheet, $print_stylesheet; $css = new cssparser(false); if ($view=="preview") { $css->Parse($print_stylesheet); } else { $css->Parse($stylesheet); } $color = $css->Get("body", "background-color"); $color = str_replace("#", "", $color); switch(strtoupper($color)) { case "": case "FFFFFF": case "WHITE": case "002540": case "004025": case "400025": // simply themes needs bright backgound $color="FFFFFF99"; // opacity break; } $count = 0; $agemax = 0; $vmax = 0; $avg = 0; foreach ($data as $age=>$v) { $n = strlen($v); $vmax = max($vmax, $n); $agemax = max($agemax, $age); $count += $n; $avg += $age*$n; } if ($count<1) return; $avg = round($avg/$count); $chart_url = "http://chart.apis.google.com/chart?cht=bvs"; // chart type $chart_url .= "&chs=725x150"; // size $chart_url .= "&chbh=3,2,2"; // bvg : 4,1,2 $chart_url .= "&chf=bg,s,".$color; //background color $chart_url .= "&chco=0000FF,FFA0CB,FF0000"; // bar color $chart_url .= "&chdl=".i18n::translate('Males')."|".i18n::translate('Females')."|".i18n::translate('Average age').": ".$avg; // legend & average age $chart_url .= "&chtt=".urlencode($title); // title $chart_url .= "&chxt=x,y,r"; // axis labels specification $chart_url .= "&chm=V,FF0000,0,".($avg-0.3).",1"; // average age line marker $chart_url .= "&chxl=0:|"; // label for ($age=0; $age<=$agemax; $age+=5) { $chart_url .= $age."|||||"; // x axis } $chart_url .= "|1:||".sprintf("%1.0f", $vmax/$count*100)." %"; // y axis $chart_url .= "|2:||"; $step = $vmax; for ($d=floor($vmax); $d>0; $d--) { if ($vmax<($d*10+1) && fmod($vmax, $d)==0) $step = $d; } if ($step==floor($vmax)) { for ($d=floor($vmax-1); $d>0; $d--) { if (($vmax-1)<($d*10+1) && fmod(($vmax-1), $d)==0) $step = $d; } } for ($n=$step; $n<$vmax; $n+=$step) { $chart_url .= $n."|"; } $chart_url .= $vmax." / ".$count; // r axis $chart_url .= "&chg=100,".round(100*$step/$vmax, 1).",1,5"; // grid $chart_url .= "&chd=s:"; // data : simple encoding from A=0 to 9=61 $CHART_ENCODING61 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for ($age=0; $age<=$agemax; $age++) { $chart_url .= $CHART_ENCODING61[floor(substr_count($data[$age], "M")*61/$vmax)]; } $chart_url .= ","; for ($age=0; $age<=$agemax; $age++) { $chart_url .= $CHART_ENCODING61[floor(substr_count($data[$age], "F")*61/$vmax)]; } echo "\"","; } /** * print a chart by decade using Google chart API * * @param array $data * @param string $title */ function print_chart_by_decade($data, $title) { global $view, $stylesheet, $print_stylesheet; $css = new cssparser(false); if ($view=="preview") $css->Parse($print_stylesheet); else $css->Parse($stylesheet); $color = $css->Get("body", "background-color"); $color = str_replace("#", "", $color); switch(strtoupper($color)) { case "": case "FFFFFF": case "WHITE": case "002540": case "004025": case "400025": // simply themes needs bright backgound $color="FFFFFF99"; // opacity break; } $count = 0; $vmax = 0; foreach ($data as $age=>$v) { $n = strlen($v); $vmax = max($vmax, $n); $count += $n; } if ($count<1) return; $chart_url = "http://chart.apis.google.com/chart?cht=bvs"; // chart type $chart_url .= "&chs=360x150"; // size $chart_url .= "&chbh=3,3"; // bvg : 4,1,2 $chart_url .= "&chf=bg,s,".$color; //background color $chart_url .= "&chco=0000FF,FFA0CB"; // bar color $chart_url .= "&chtt=".urlencode($title); // title $chart_url .= "&chxt=x,y,r"; // axis labels specification $chart_url .= "&chxl=0:|<|||"; // <1570 for ($y=1600; $y<2030; $y+=50) { $chart_url .= $y."|||||"; // x axis } $chart_url .= "|1:||".sprintf("%1.0f", $vmax/$count*100)." %"; // y axis $chart_url .= "|2:||"; $step = $vmax; for ($d=floor($vmax); $d>0; $d--) { if ($vmax<($d*10+1) && fmod($vmax, $d)==0) $step = $d; } if ($step==floor($vmax)) { for ($d=floor($vmax-1); $d>0; $d--) { if (($vmax-1)<($d*10+1) && fmod(($vmax-1), $d)==0) $step = $d; } } for ($n=$step; $n<$vmax; $n+=$step) { $chart_url .= $n."|"; } $chart_url .= $vmax." / ".$count; // r axis $chart_url .= "&chg=100,".round(100*$step/$vmax, 1).",1,5"; // grid $chart_url .= "&chd=s:"; // data : simple encoding from A=0 to 9=61 $CHART_ENCODING61 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for ($y=1570; $y<2030; $y+=10) { $chart_url .= $CHART_ENCODING61[floor(substr_count($data[$y], "M")*61/$vmax)]; } $chart_url .= ","; for ($y=1570; $y<2030; $y+=10) { $chart_url .= $CHART_ENCODING61[floor(substr_count($data[$y], "F")*61/$vmax)]; } echo "\"","; } /** * check string align direction depending on language and rtl config * * @param string $txt string argument * @return string left|right */ function get_align($txt) { global $TEXT_DIRECTION; if (!empty($txt)) { if ($TEXT_DIRECTION=="rtl" && !hasRTLText($txt) && hasLTRText($txt)) return "left"; if ($TEXT_DIRECTION=="ltr" && hasRTLText($txt) && !hasLTRText($txt)) return "right"; } if ($TEXT_DIRECTION=="rtl") return "right"; return "left"; } /** * load behaviour js data * to be called at the end just before tag * * @see http://bennolan.com/behaviour/ * @param none */ function load_behaviour() { require_once WT_ROOT.'js/prototype.js.htm'; require_once WT_ROOT.'js/behaviour.js.htm'; require_once WT_ROOT.'js/overlib.js.htm'; ?>