Exemplo n.º 1
0
 /**
  * print a family descendancy
  *
  * @param WT_Individual $person
  * @param WT_Family     $family
  * @param int           $depth the descendancy depth to show
  *
  * @return void
  */
 function print_family_descendancy(WT_Individual $person, WT_Family $family, $depth)
 {
     global $WT_IMAGES, $Dindent, $personcount;
     // print marriage info
     echo '<li>';
     echo '<img src="', $WT_IMAGES['spacer'], '" height="2" width="', $Dindent + 4, '" alt="">';
     echo '<span class="details1" style="white-space:nowrap;">';
     echo "<a href=\"#\" onclick=\"expand_layer('" . $family->getXref() . $personcount . "'); return false;\" class=\"top\"><i id=\"" . $family->getXref() . $personcount . "_img\" class=\"icon-minus\" title=\"" . WT_I18N::translate('View family') . "\"></i></a>";
     if ($family->canShow()) {
         foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
             echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>';
         }
     }
     echo '</span>';
     // print spouse
     $spouse = $family->getSpouse($person);
     echo '<ul style="list-style:none; display:block;" id="' . $family->getXref() . $personcount . '">';
     echo '<li>';
     echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td>';
     print_pedigree_person($spouse, 1, 0, $personcount);
     echo '</td>';
     // check if spouse has parents and add an arrow
     echo '<td>&nbsp;</td>';
     echo '<td>';
     if ($spouse) {
         foreach ($spouse->getChildFamilies() as $cfamily) {
             foreach ($cfamily->getSpouses() as $parent) {
                 print_url_arrow($parent->getXref() . $personcount . $person->getXref(), '?rootid=' . $parent->getXref() . '&amp;generations=' . $this->generations . '&amp;chart_style=' . $this->chart_style . '&amp;show_full=' . $this->show_full . '&amp;box_width=' . $this->box_width . '&amp;ged=' . WT_GEDURL, WT_I18N::translate('Start at parents'), 2);
                 $personcount++;
                 // only show the arrow for one of the parents
                 break;
             }
         }
     }
     if ($this->show_full) {
         echo '<br><br>&nbsp;';
     }
     echo '</td></tr>';
     // children
     $children = $family->getChildren();
     echo '<tr><td colspan="3" class="details1" >&nbsp;&nbsp;';
     if ($children) {
         echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children);
     } else {
         // Distinguish between no children (NCHI 0) and no recorded
         // children (no CHIL records)
         if (strpos($family->getGedcom(), '\\n1 NCHI 0')) {
             echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children);
         } else {
             echo WT_I18N::translate('No children');
         }
     }
     echo '</td></tr></table>';
     echo '</li>';
     if ($depth > 1) {
         foreach ($children as $child) {
             $personcount++;
             $this->print_child_descendancy($child, $depth - 1);
         }
     }
     echo '</ul>';
     echo '</li>';
 }
Exemplo n.º 2
0
/**
 * print the parents table for a family
 *
 * @param WT_Family $family family gedcom ID
 * @param int       $sosa   child sosa number
 * @param string    $label  indi label (descendancy booklet)
 * @param string    $parid  parent ID (descendancy booklet)
 * @param string    $gparid gd-parent ID (descendancy booklet)
 * @param int       $personcount
 */
function print_family_parents(WT_Family $family, $sosa = 0, $label = '', $parid = '', $gparid = '', $personcount = 1)
{
    global $pbwidth, $pbheight, $WT_IMAGES;
    $husb = $family->getHusband();
    if ($husb) {
        echo '<a name="', $husb->getXref(), '"></a>';
    } else {
        $husb = new WT_Individual('M', "0 @M@ INDI\n1 SEX M", null, WT_GED_ID);
    }
    $wife = $family->getWife();
    if ($wife) {
        echo '<a name="', $wife->getXref(), '"></a>';
    } else {
        $wife = new WT_Individual('F', "0 @F@ INDI\n1 SEX F", null, WT_GED_ID);
    }
    if ($sosa) {
        echo '<p class="name_head">', $family->getFullName(), '</p>';
    }
    /**
     * husband side
     */
    echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">";
    echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
    if ($parid) {
        if ($husb->getXref() == $parid) {
            print_sosa_number($label);
        } else {
            print_sosa_number($label, "", "blank");
        }
    } elseif ($sosa) {
        print_sosa_number($sosa * 2);
    }
    if ($husb->isNew()) {
        echo '<td valign="top" class="facts_value new">';
    } elseif ($husb->isOld()) {
        echo '<td valign="top" class="facts_value old">';
    } else {
        echo '<td valign="top">';
    }
    print_pedigree_person($husb, 1, 2, $personcount);
    echo "</td></tr></table>";
    echo "</td>";
    // husband’s parents
    $hfam = $husb->getPrimaryChildFamily();
    if ($hfam) {
        // remove the|| test for $sosa
        echo "<td rowspan=\"2\"><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>";
        echo "<td><img class=\"line5\" src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>";
        // husband’s father
        if ($hfam && $hfam->getHusband()) {
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
            if ($sosa > 0) {
                print_sosa_number($sosa * 4, $hfam->getHusband()->getXref(), "down");
            }
            if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) {
                print_sosa_number(trim(substr($label, 0, -3), ".") . ".");
            }
            echo "<td valign=\"top\">";
            print_pedigree_person(WT_Individual::getInstance($hfam->getHusband()->getXref()), 1, 4, $personcount);
            echo "</td></tr></table>";
        } elseif ($hfam && !$hfam->getHusband()) {
            // here for empty box for grandfather
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
            echo '<td valign="top">';
            print_pedigree_person($hfam->getHusband());
            echo '</td></tr></table>';
        }
        echo "</td>";
    }
    if ($hfam && $sosa != -1) {
        echo '<td valign="middle" rowspan="2">';
        print_url_arrow($hfam->getXref(), $sosa == 0 ? '?famid=' . $hfam->getXref() . '&amp;ged=' . WT_GEDURL : '#' . $hfam->getXref(), $hfam->getXref(), 1);
        echo '</td>';
    }
    if ($hfam) {
        // remove the|| test for $sosa
        // husband’s mother
        echo "</tr><tr><td><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>";
        if ($hfam && $hfam->getWife()) {
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
            if ($sosa > 0) {
                print_sosa_number($sosa * 4 + 1, $hfam->getWife()->getXref(), "down");
            }
            if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) {
                print_sosa_number(trim(substr($label, 0, -3), ".") . ".");
            }
            echo '<td valign="top">';
            print_pedigree_person(WT_Individual::getInstance($hfam->getWife()->getXref()), 1, 5, $personcount);
            echo '</td></tr></table>';
        } elseif ($hfam && !$hfam->getWife()) {
            // here for empty box for grandmother
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
            echo '<td valign="top">';
            print_pedigree_person($hfam->getWife());
            echo '</td></tr></table>';
        }
        echo '</td>';
    }
    echo '</tr></table>';
    if ($sosa && $family->canShow()) {
        foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
            echo '<a href="', $family->getHtmlUrl(), '" class="details1">';
            echo str_repeat('&nbsp;', 10);
            echo $fact->summary();
            echo '</a>';
        }
    } else {
        echo '<br>';
    }
    /**
     * wife side
     */
    echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">";
    echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>";
    if ($parid) {
        if ($wife->getXref() == $parid) {
            print_sosa_number($label);
        } else {
            print_sosa_number($label, "", "blank");
        }
    } elseif ($sosa) {
        print_sosa_number($sosa * 2 + 1);
    }
    if ($wife->isNew()) {
        echo '<td valign="top" class="facts_value new">';
    } elseif ($wife->isOld()) {
        echo '<td valign="top" class="facts_value old">';
    } else {
        echo '<td valign="top">';
    }
    print_pedigree_person($wife, 1, 3, $personcount);
    echo "</td></tr></table>";
    echo "</td>";
    // wife’s parents
    $hfam = $wife->getPrimaryChildFamily();
    if ($hfam) {
        // remove the|| test for $sosa
        echo "<td rowspan=\"2\"><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>";
        echo "<td><img class=\"line5\" src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>";
        // wife’s father
        if ($hfam && $hfam->getHusband()) {
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>";
            if ($sosa > 0) {
                print_sosa_number($sosa * 4 + 2, $hfam->getHusband()->getXref(), "down");
            }
            if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) {
                print_sosa_number(trim(substr($label, 0, -3), ".") . ".");
            }
            echo "<td valign=\"top\">";
            print_pedigree_person(WT_Individual::getInstance($hfam->getHusband()->getXref()), 1, 6, $personcount);
            echo "</td></tr></table>";
        } elseif ($hfam && !$hfam->getHusband()) {
            // here for empty box for grandfather
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
            echo '<td valign="top">';
            print_pedigree_person($hfam->getHusband());
            echo '</td></tr></table>';
        }
        echo "</td>";
    }
    if ($hfam && $sosa != -1) {
        echo '<td valign="middle" rowspan="2">';
        print_url_arrow($hfam->getXref(), $sosa == 0 ? '?famid=' . $hfam->getXref() . '&amp;ged=' . WT_GEDURL : '#' . $hfam->getXref(), $hfam->getXref(), 1);
        echo '</td>';
    }
    if ($hfam) {
        // remove the|| test for $sosa
        // wife’s mother
        echo "</tr><tr><td><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>";
        if ($hfam && $hfam->getWife()) {
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>";
            if ($sosa > 0) {
                print_sosa_number($sosa * 4 + 3, $hfam->getWife()->getXref(), "down");
            }
            if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) {
                print_sosa_number(trim(substr($label, 0, -3), ".") . ".");
            }
            echo "<td valign=\"top\">";
            print_pedigree_person(WT_Individual::getInstance($hfam->getWife()->getXref()), 1, 7, $personcount);
            echo "</td></tr></table>";
        } elseif ($hfam && !$hfam->getWife()) {
            // here for empty box for grandmother
            echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>";
            echo '<td valign="top">';
            print_pedigree_person($hfam->getWife());
            echo '</td></tr></table>';
        }
        echo '</td>';
    }
    echo "</tr></table>";
}
Exemplo n.º 3
0
    private function drawFamily(WT_Family $family, $title)
    {
        global $controller, $SHOW_PRIVATE_RELATIONSHIPS;
        ?>
		<tr>
			<td class="center" colspan="2">
				<a class="famnav_title" href="<?php 
        echo $family->getHtmlUrl();
        ?>
">
					<?php 
        echo $title;
        ?>
				</a>
			</td>
		</tr>
		<?php 
        $access_level = $SHOW_PRIVATE_RELATIONSHIPS ? WT_PRIV_HIDE : WT_USER_ACCESS_LEVEL;
        $facts = array_merge($family->getFacts('HUSB', false, $access_level), $family->getFacts('WIFE', false, $access_level));
        foreach ($facts as $fact) {
            $spouse = $fact->getTarget();
            if ($this->isPerson($spouse)) {
                $menu = new WT_Menu(get_close_relationship_name($controller->record, $spouse));
                $menu->addClass('', 'submenu flyout');
                $menu->addSubMenu(new WT_Menu($this->getParents($spouse)));
                ?>
				<tr>
					<td class="facts_label">
						<?php 
                echo $menu->getMenu();
                ?>
					</td>
					<td class="center <?php 
                echo $controller->getPersonStyle($spouse);
                ?>
 nam">
						<a class="famnav_link" href="<?php 
                echo $spouse->getHtmlUrl();
                ?>
">
							<?php 
                echo $spouse->getFullName();
                ?>
						</a>
						<div class="font9">
							<?php 
                echo $spouse->getLifeSpan();
                ?>
						</div>
					</td>
				</tr>
				<?php 
            }
        }
        foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
            $child = $fact->getTarget();
            if ($this->isPerson($child)) {
                $menu = new WT_Menu(get_close_relationship_name($controller->record, $child));
                $menu->addClass('', 'submenu flyout');
                $menu->addSubMenu(new WT_Menu($this->getFamily($child)));
                ?>
				<tr>
					<td class="facts_label">
						<?php 
                echo $menu->getMenu();
                ?>
					</td>
					<td class="center <?php 
                echo $controller->getPersonStyle($child);
                ?>
 nam">
						<a class="famnav_link" href="<?php 
                echo $child->getHtmlUrl();
                ?>
">
							<?php 
                echo $child->getFullName();
                ?>
						</a>
						<div class="font9">
							<?php 
                echo $child->getLifeSpan();
                ?>
						</div>
					</td>
				</tr>
				<?php 
            }
        }
    }
Exemplo n.º 4
0
    function printFamily(WT_Family $family, $type, $label)
    {
        global $controller;
        global $personcount;
        // TODO: use a unique id instead?
        global $SHOW_PRIVATE_RELATIONSHIPS;
        if ($SHOW_PRIVATE_RELATIONSHIPS) {
            $access_level = WT_PRIV_HIDE;
        } else {
            $access_level = WT_USER_ACCESS_LEVEL;
        }
        ?>
		<table>
			<tr>
				<td>
					<i class="icon-cfamily"></i>
				</td>
				<td>
					<span class="subheaders"> <?php 
        echo $label;
        ?>
 </span> -
					<a href="<?php 
        echo $family->getHtmlUrl();
        ?>
"><?php 
        echo WT_I18N::translate('View family');
        ?>
</a>
				</td>
			</tr>
		</table>
		<table class="facts_table">
		<?php 
        ///// HUSB /////
        $found = false;
        foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
            $found |= !$fact->isOld();
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                if ($fact->isNew()) {
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
					<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
					</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">&nbsp;</td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'HUSB');"><?php 
            echo WT_I18N::translate('Add a husband to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// WIFE /////
        $found = false;
        foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                $found |= !$fact->isOld();
                if ($fact->isNew()) {
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
				</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">&nbsp;</td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'WIFE');"><?php 
            echo WT_I18N::translate('Add a wife to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// MARR /////
        $found = false;
        $prev = new WT_Date('');
        foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
            $found |= !$fact->isOld();
            if ($fact->isNew()) {
                $class = ' new';
            } elseif ($fact->isOld()) {
                $class = ' old';
            } else {
                $class = '';
            }
            ?>
			<tr>
				<td class="facts_label">
					&nbsp;
				</td>
				<td class="facts_value<?php 
            echo $class;
            ?>
">
					<?php 
            echo WT_Gedcom_Tag::getLabelValue($fact->getTag(), $fact->getDate()->Display(false) . ' — ' . $fact->getPlace()->getFullName());
            ?>
				</td>
			</tr>
			<?php 
            if (!$prev->isOK() && $fact->getDate()->isOK()) {
                $prev = $fact->getDate();
            }
        }
        if (!$found && $family->canShow() && $family->canEdit()) {
            // Add a new marriage
            ?>
			<tr>
				<td class="facts_label">
					&nbsp;
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_new_record('<?php 
            echo $family->getXref();
            ?>
', 'MARR');">
						<?php 
            echo WT_I18N::translate('Add marriage details');
            ?>
					</a>
				</td>
			</tr>
			<?php 
        }
        ///// CHIL /////
        $child_number = 0;
        foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                if ($fact->isNew()) {
                    $child_number++;
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $child_number++;
                    $class = 'facts_label';
                }
                $next = new WT_Date('');
                foreach ($person->getFacts(WT_EVENTS_BIRT) as $bfact) {
                    if ($bfact->getDate()->isOK()) {
                        $next = $bfact->getDate();
                        break;
                    }
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo self::ageDifference($prev, $next, $child_number);
                ?>
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
				</tr>
				<?php 
                $prev = $next;
            }
        }
        // Re-order children / add a new child
        if ($family->canEdit()) {
            if ($type == 'FAMS') {
                $child_u = WT_I18N::translate('Add a new son or daughter');
                $child_m = WT_I18N::translate('son');
                $child_f = WT_I18N::translate('daughter');
            } else {
                $child_u = WT_I18N::translate('Add a new brother or sister');
                $child_m = WT_I18N::translate('brother');
                $child_f = WT_I18N::translate('sister');
            }
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            if (count($family->getChildren()) > 1) {
                ?>
					<a href="#" onclick="reorder_children('<?php 
                echo $family->getXref();
                ?>
');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php 
                echo WT_I18N::translate('Re-order children');
                ?>
</a>
					<?php 
            }
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
');"><?php 
            echo $child_u;
            ?>
</a>
					<span style='white-space:nowrap;'>
						<a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','M');"></a>
						<a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','F');"></a>
					</span>
				</td>
			</tr>
			<?php 
        }
        echo '</table>';
        return;
    }
Exemplo n.º 5
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);
    }