示例#1
0
 /**
  * print information for a name record
  *
  * @param WT_Fact $event the event object
  */
 function print_name_record(WT_Fact $event)
 {
     global $WT_TREE;
     $factrec = $event->getGedcom();
     // Create a dummy record, so we can extract the formatted NAME value from the event.
     $dummy = new WT_Individual('xref', "0 @xref@ INDI\n1 DEAT Y\n" . $factrec, null, WT_GED_ID);
     $all_names = $dummy->getAllNames();
     $primary_name = $all_names[0];
     $this->name_count++;
     if ($this->name_count > 1) {
         echo '<h3 class="name_two">', $dummy->getFullName(), '</h3>';
     }
     //Other names accordion element
     echo '<div class="indi_name_details';
     if ($event->isOld()) {
         echo ' old';
     }
     if ($event->isNew()) {
         echo ' new';
     }
     echo '">';
     echo '<div class="name1">';
     echo '<dl><dt class="label">', WT_I18N::translate('Name'), '</dt>';
     $dummy->setPrimaryName(0);
     echo '<dd class="field">', $dummy->getFullName();
     if ($this->name_count == 1) {
         if (Auth::isAdmin()) {
             $user = User::findByGenealogyRecord($WT_TREE, $this->record);
             if ($user) {
                 echo '<span> - <a class="warning" href="admin_users.php?filter=' . WT_Filter::escapeHtml($user->getUserName()) . '">' . WT_Filter::escapeHtml($user->getUserName()) . '</a></span>';
             }
         }
     }
     if ($this->record->canEdit() && !$event->isOld()) {
         echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('" . WT_I18N::translate('Are you sure you want to delete this fact?') . "', '" . $this->record->getXref() . "', '" . $event->getFactId() . "');\" title=\"" . WT_I18N::translate('Delete this name') . "\"><span class=\"link_text\">" . WT_I18N::translate('Delete this name') . "</span></a></div>";
         echo "<div class=\"editlink\"><a href=\"#\" class=\"editicon\" onclick=\"edit_name('" . $this->record->getXref() . "', '" . $event->getFactId() . "'); return false;\" title=\"" . WT_I18N::translate('Edit name') . "\"><span class=\"link_text\">" . WT_I18N::translate('Edit name') . "</span></a></div>";
     }
     echo '</dd>';
     echo '</dl>';
     echo '</div>';
     $ct = preg_match_all('/\\n2 (\\w+) (.*)/', $factrec, $nmatch, PREG_SET_ORDER);
     for ($i = 0; $i < $ct; $i++) {
         echo '<div>';
         $fact = $nmatch[$i][1];
         if ($fact != 'SOUR' && $fact != 'NOTE' && $fact != 'SPFX') {
             echo '<dl><dt class="label">', WT_Gedcom_Tag::getLabel($fact, $this->record), '</dt>';
             echo '<dd class="field">';
             // Before using dir="auto" on this field, note that Gecko treats this as an inline element but WebKit treats it as a block element
             if (isset($nmatch[$i][2])) {
                 $name = WT_Filter::escapeHtml($nmatch[$i][2]);
                 $name = str_replace('/', '', $name);
                 $name = preg_replace('/(\\S*)\\*/', '<span class="starredname">\\1</span>', $name);
                 switch ($fact) {
                     case 'TYPE':
                         echo WT_Gedcom_Code_Name::getValue($name, $this->record);
                         break;
                     case 'SURN':
                         // The SURN field is not necessarily the surname.
                         // Where it is not a substring of the real surname, show it after the real surname.
                         $surname = WT_Filter::escapeHtml($primary_name['surname']);
                         if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
                             echo $surname;
                         } else {
                             echo WT_I18N::translate('%1$s (%2$s)', $surname, $name);
                         }
                         break;
                     default:
                         echo $name;
                         break;
                 }
             }
             echo '</dd>';
             echo '</dl>';
         }
         echo '</div>';
     }
     if (preg_match("/\n2 SOUR/", $factrec)) {
         echo '<div id="indi_sour" class="clearfloat">', print_fact_sources($factrec, 2), '</div>';
     }
     if (preg_match("/\n2 NOTE/", $factrec)) {
         echo '<div id="indi_note" class="clearfloat">', print_fact_notes($factrec, 2), '</div>';
     }
     echo '</div>';
 }
示例#2
0
 private function getDescendantsHtml(WT_Individual $individual, WT_Family $parents = null)
 {
     // A person has many names.  Select the one that matches the searched surname
     $person_name = '';
     foreach ($individual->getAllNames() as $name) {
         list($surn1) = explode(",", $name['sort']);
         if (stripos($surn1, $this->surname) !== false || stripos($this->surname, $surn1) !== false || $this->soundex_std && WT_Soundex::compare(WT_Soundex::soundex_std($surn1), WT_Soundex::soundex_std($this->surname)) || $this->soundex_dm && WT_Soundex::compare(WT_Soundex::soundex_dm($surn1), WT_Soundex::soundex_dm($this->surname))) {
             $person_name = $name['full'];
             break;
         }
     }
     // No matching name?  Typically children with a different surname.  The tree stops here.
     if (!$person_name) {
         return '<li title="' . strip_tags($individual->getFullName()) . '">' . $individual->getSexImage() . '…</li>';
     }
     // Is this individual one of our ancestors?
     $sosa = array_search($individual, $this->ancestors, true);
     if ($sosa) {
         $sosa_class = 'search_hit';
         $sosa_html = ' <a class="details1 ' . $individual->getBoxStyle() . '" title="' . WT_I18N::translate('Sosa') . '" href="relationship.php?pid2=' . WT_USER_ROOT_ID . '&amp;pid1=' . $individual->getXref() . '">' . $sosa . '</a>' . self::sosaGeneration($sosa);
     } else {
         $sosa_class = '';
         $sosa_html = '';
     }
     // Generate HTML for this individual, and all their descendants
     $indi_html = $individual->getSexImage() . '<a class="' . $sosa_class . '" href="' . $individual->getHtmlUrl() . '">' . $person_name . '</a> ' . $individual->getLifeSpan() . $sosa_html;
     // If this is not a birth pedigree (e.g. an adoption), highlight it
     if ($parents) {
         $pedi = '';
         foreach ($individual->getFacts('FAMC') as $fact) {
             if ($fact->getTarget() === $parents) {
                 $pedi = $fact->getAttribute('PEDI');
                 break;
             }
         }
         if ($pedi && $pedi != 'birth') {
             $indi_html = '<span class="red">' . WT_Gedcom_Code_Pedi::getValue($pedi, $individual) . '</span> ' . $indi_html;
         }
     }
     // spouses and children
     $spouse_families = $individual->getSpouseFamilies();
     if ($spouse_families) {
         usort($spouse_families, array('WT_Family', 'compareMarrDate'));
         $fam_html = '';
         foreach ($spouse_families as $family) {
             $fam_html .= $indi_html;
             // Repeat the individual details for each spouse.
             $spouse = $family->getSpouse($individual);
             if ($spouse) {
                 $sosa = array_search($spouse, $this->ancestors, true);
                 if ($sosa) {
                     $sosa_class = 'search_hit';
                     $sosa_html = ' <a class="details1 ' . $spouse->getBoxStyle() . '" title="' . WT_I18N::translate('Sosa') . '" href="relationship.php?pid2=' . WT_USER_ROOT_ID . '&amp;pid1=' . $spouse->getXref() . '"> ' . $sosa . ' </a>' . self::sosaGeneration($sosa);
                 } else {
                     $sosa_class = '';
                     $sosa_html = '';
                 }
                 $marriage_year = $family->getMarriageYear();
                 if ($marriage_year) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . strip_tags($family->getMarriageDate()->Display()) . '"><i class="icon-rings"></i>' . $marriage_year . '</a>';
                 } elseif ($family->getFirstFact('MARR')) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . WT_Gedcom_Tag::getLabel('MARR') . '"><i class="icon-rings"></i></a>';
                 } elseif ($family->getFirstFact('_NMR')) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . WT_Gedcom_Tag::getLabel('_NMR') . '"><i class="icon-rings"></i></a>';
                 }
                 $fam_html .= ' ' . $spouse->getSexImage() . '<a class="' . $sosa_class . '" href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a> ' . $spouse->getLifeSpan() . ' ' . $sosa_html;
             }
             $fam_html .= '<ol>';
             foreach ($family->getChildren() as $child) {
                 $fam_html .= $this->getDescendantsHtml($child, $family);
             }
             $fam_html .= '</ol>';
         }
         return '<li>' . $fam_html . '</li>';
     } else {
         // No spouses - just show the individual
         return '<li>' . $indi_html . '</li>';
     }
 }
示例#3
0
 /**
  * Draw a person name preceded by sex icon, with parents as tooltip
  *
  * @param WT_Individual $individual an individual
  * @param string        $dashed     if = 'dashed' print dashed top border to separate multiple spuses
  *
  * @return string
  */
 private function drawPersonName(WT_Individual $individual, $dashed = '')
 {
     if ($this->all_partners === 'true') {
         $family = $individual->getPrimaryChildFamily();
         if ($family) {
             switch ($individual->getSex()) {
                 case 'M':
                     $title = ' title="' . strip_tags(WT_I18N::translate('Son of %s', $family->getFullName())) . '"';
                     break;
                 case 'F':
                     $title = ' title="' . strip_tags(WT_I18N::translate('Daughter of %s', $family->getFullName())) . '"';
                     break;
                 case 'U':
                     $title = ' title="' . strip_tags(WT_I18N::translate('Child of %s', $family->getFullName())) . '"';
                     break;
             }
         } else {
             $title = '';
         }
     } else {
         $title = '';
     }
     $sex = $individual->getSex();
     return '<div class="tv' . $sex . ' ' . $dashed . '"' . $title . '><a href="' . $individual->getHtmlUrl() . '"></a>' . $individual->getFullName() . ' <span class="dates">' . $individual->getLifeSpan() . '</span></div>';
 }
示例#4
0
    public function getFamilyLi(WT_Family $family, WT_Individual $person, $generations = 0)
    {
        $marryear = $family->getMarriageYear();
        $marr = $marryear ? '<i class="icon-rings"></i>' . $marryear : '';
        $fam = '<a href="' . $family->getHtmlUrl() . '" class="icon-button_family"></a>';
        $kids = $this->loadChildren($family, $generations);
        return sprintf('<li class="sb_desc_indi_li">
		                  <a class="sb_desc_indi" href="#"><i class="plusminus icon-minus"></i>%s %s %s</a>
		                  <a class="icon-button_indi" href="%s"></a>
		                  %s
		                  <div>%s</div>
		                </li>', $person->getSexImage(), $person->getFullName(), $marr, $person->getHtmlUrl(), $fam, $kids);
    }