Пример #1
0
    /**
     * Create a family on the census navigator.
     *
     * @param CensusInterface $census
     * @param Family          $family
     * @param Individual      $head
     *
     * @return string
     */
    public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head)
    {
        $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>';
        foreach ($family->getSpouses() as $spouse) {
            $menu = new Menu(Functions::getCloseRelationshipName($head, $spouse));
            foreach ($spouse->getChildFamilies() as $grandparents) {
                foreach ($grandparents->getSpouses() as $grandparent) {
                    $submenu = new Menu(Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");'));
                    $submenu->addClass('submenuitem', '');
                    $menu->addSubmenu($submenu);
                    $menu->addClass('', 'submenu');
                }
            }
            ?>
			<tr>
				<td class="optionbox">
					<?php 
            echo $menu->getMenu();
            ?>
				</td>
				<td class="facts_value nowrap">
					<a href="#" onclick="return appendCensusRow('<?php 
            echo Filter::escapeJs(self::censusTableRow($census, $spouse, $head));
            ?>
');">
						<?php 
            echo $spouse->getFullName();
            ?>
					</a>
				</td>
				<td class="facts_value">
					<?php 
            if ($head !== $spouse) {
                ?>
						<a href="edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=<?php 
                echo $spouse->getXref();
                ?>
&amp;gedcom=<?php 
                echo $spouse->getTree()->getNameUrl();
                ?>
&amp;census=<?php 
                echo get_class($census);
                ?>
">
							<?php 
                echo $headImg2;
                ?>
						</a>
					<?php 
            }
            ?>
				</td>
			</tr>
			<?php 
        }
        foreach ($family->getChildren() as $child) {
            $menu = new Menu(Functions::getCloseRelationshipName($head, $child));
            foreach ($child->getSpouseFamilies() as $spouse_family) {
                foreach ($spouse_family->getSpouses() as $spouse_family_spouse) {
                    if ($spouse_family_spouse != $child) {
                        $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");'));
                        $submenu->addClass('submenuitem', '');
                        $menu->addSubmenu($submenu);
                        $menu->addClass('', 'submenu');
                    }
                }
                foreach ($spouse_family->getChildren() as $spouse_family_child) {
                    $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");'));
                    $submenu->addClass('submenuitem', '');
                    $menu->addSubmenu($submenu);
                    $menu->addClass('', 'submenu');
                }
            }
            ?>
			<tr>
				<td class="optionbox">
					<?php 
            echo $menu->getMenu();
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="return appendCensusRow('<?php 
            echo Filter::escapeJs(self::censusTableRow($census, $child, $head));
            ?>
');">
						<?php 
            echo $child->getFullName();
            ?>
					</a>
				</td>
				<td class="facts_value">
					<?php 
            if ($head !== $child) {
                ?>
						<a href="edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=<?php 
                echo $child->getXref();
                ?>
&amp;gedcom=<?php 
                echo $child->getTree()->getNameUrl();
                ?>
&amp;census=<?php 
                echo get_class($census);
                ?>
">
							<?php 
                echo $headImg2;
                ?>
						</a>
					<?php 
            }
            ?>
				</td>
			</tr>
			<?php 
        }
        echo '<tr><td><br></td></tr>';
    }
Пример #2
0
/**
 * Display family members with clickable links
 *
 * @param Family     $family
 * @param Individual $individual
 */
function print_navigator_family(Family $family, Individual $individual)
{
    foreach ($family->getSpouses() as $spouse) {
        ?>
		<tr class="fact_value">
			<td class="facts_value">
				<a href="edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=<?php 
        echo $spouse->getXref();
        ?>
&amp;gedcom=<?php 
        echo $spouse->getTree()->getNameUrl();
        ?>
">
					<i class="headimg vmiddle icon-button_head"></i>
				</a>
			</td>
			<td class="facts_value" >
				<a href="#" onclick="opener.insertRowToTable('<?php 
        echo $spouse->getXref();
        ?>
', '<?php 
        echo Filter::escapeJs($spouse->getFullName());
        ?>
', '', '', '', '', '', '', '', '');">
					<?php 
        echo $spouse === $individual ? '<b>' : '';
        ?>
					<?php 
        echo $spouse->getFullName();
        ?>
 <?php 
        echo $spouse->getLifeSpan();
        ?>
					<?php 
        echo $spouse === $individual ? '</b>' : '';
        ?>
				</a>
			</td>
		<tr>
	<?php 
    }
    foreach ($family->getChildren() as $child) {
        ?>
		<tr>
			<td class="facts_value" >
				<a href="edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=<?php 
        echo $child->getXref();
        ?>
&amp;gedcom=<?php 
        echo $child->getTree()->getNameUrl();
        ?>
">
					<i class="headimg vmiddle icon-button_head"></i>
				</a>
			</td>
			<td class="facts_value">
				<a href="#" onclick="opener.insertRowToTable('<?php 
        echo $child->getXref();
        ?>
', '<?php 
        echo Filter::escapeJs($child->getFullName());
        ?>
', '', '', '', '', '', '', '', '');">
					<?php 
        echo $child === $individual ? '<b>' : '';
        ?>
					<?php 
        echo $child->getFullName();
        ?>
 <?php 
        echo $child->getLifeSpan();
        ?>
				<?php 
        echo $child === $individual ? '</b>' : '';
        ?>
				</a>
			</td>
		</tr>
	<?php 
    }
}
 /**
  * Get the events of children and grandchildren.
  *
  * @param Individual $person
  * @param Family     $family
  * @param string     $option
  * @param string     $relation
  *
  * @return Fact[]
  */
 private static function childFacts(Individual $person, Family $family, $option, $relation)
 {
     global $controller;
     $SHOW_RELATIVES_EVENTS = $person->getTree()->getPreference('SHOW_RELATIVES_EVENTS');
     $facts = array();
     // Only include events between birth and death
     $birt_date = $controller->record->getEstimatedBirthDate();
     $deat_date = $controller->record->getEstimatedDeathDate();
     // Deal with recursion.
     switch ($option) {
         case '_CHIL':
             // Add grandchildren
             foreach ($family->getChildren() as $child) {
                 foreach ($child->getSpouseFamilies() as $cfamily) {
                     switch ($child->getSex()) {
                         case 'M':
                             foreach (self::childFacts($person, $cfamily, '_GCHI', 'son') as $fact) {
                                 $facts[] = $fact;
                             }
                             break;
                         case 'F':
                             foreach (self::childFacts($person, $cfamily, '_GCHI', 'dau') as $fact) {
                                 $facts[] = $fact;
                             }
                             break;
                         default:
                             foreach (self::childFacts($person, $cfamily, '_GCHI', 'chi') as $fact) {
                                 $facts[] = $fact;
                             }
                             break;
                     }
                 }
             }
             break;
     }
     // For each child in the family
     foreach ($family->getChildren() as $child) {
         if ($child->getXref() == $person->getXref()) {
             // We are not our own sibling!
             continue;
         }
         // add child’s birth
         if (strpos($SHOW_RELATIVES_EVENTS, '_BIRT' . str_replace('_HSIB', '_SIBL', $option)) !== false) {
             foreach ($child->getFacts(WT_EVENTS_BIRT) as $fact) {
                 $sgdate = $fact->getDate();
                 // Always show _BIRT_CHIL, even if the dates are not known
                 if ($option == '_CHIL' || $sgdate->isOK() && Date::compare($birt_date, $sgdate) <= 0 && Date::compare($sgdate, $deat_date) <= 0) {
                     if ($option == '_GCHI' && $relation == 'dau') {
                         // Convert the event to a close relatives event.
                         $rela_fact = clone $fact;
                         $rela_fact->setTag('_' . $fact->getTag() . '_GCH1');
                         $facts[] = $rela_fact;
                     } elseif ($option == '_GCHI' && $relation == 'son') {
                         // Convert the event to a close relatives event.
                         $rela_fact = clone $fact;
                         $rela_fact->setTag('_' . $fact->getTag() . '_GCH2');
                         $facts[] = $rela_fact;
                     } else {
                         // Convert the event to a close relatives event.
                         $rela_fact = clone $fact;
                         $rela_fact->setTag('_' . $fact->getTag() . $option);
                         $facts[] = $rela_fact;
                     }
                 }
             }
         }
         // add child’s death
         if (strpos($SHOW_RELATIVES_EVENTS, '_DEAT' . str_replace('_HSIB', '_SIBL', $option)) !== false) {
             foreach ($child->getFacts(WT_EVENTS_DEAT) as $fact) {
                 $sgdate = $fact->getDate();
                 if ($sgdate->isOK() && Date::compare($birt_date, $sgdate) <= 0 && Date::compare($sgdate, $deat_date) <= 0) {
                     if ($option == '_GCHI' && $relation == 'dau') {
                         // Convert the event to a close relatives event.
                         $rela_fact = clone $fact;
                         $rela_fact->setTag('_' . $fact->getTag() . '_GCH1');
                         $facts[] = $rela_fact;
                     } elseif ($option == '_GCHI' && $relation == 'son') {
                         // Convert the event to a close relatives event.
                         $rela_fact = clone $fact;
                         $rela_fact->setTag('_' . $fact->getTag() . '_GCH2');
                         $facts[] = $rela_fact;
                     } else {
                         // Convert the event to a close relatives event.
                         $rela_fact = clone $fact;
                         $rela_fact->setTag('_' . $fact->getTag() . $option);
                         $facts[] = $rela_fact;
                     }
                 }
             }
         }
         // add child’s marriage
         if (strstr($SHOW_RELATIVES_EVENTS, '_MARR' . str_replace('_HSIB', '_SIBL', $option))) {
             foreach ($child->getSpouseFamilies() as $sfamily) {
                 foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
                     $sgdate = $fact->getDate();
                     if ($sgdate->isOK() && Date::compare($birt_date, $sgdate) <= 0 && Date::compare($sgdate, $deat_date) <= 0) {
                         if ($option == '_GCHI' && $relation == 'dau') {
                             // Convert the event to a close relatives event.
                             $rela_fact = clone $fact;
                             $rela_fact->setTag('_' . $fact->getTag() . '_GCH1');
                             $facts[] = $rela_fact;
                         } elseif ($option == '_GCHI' && $relation == 'son') {
                             // Convert the event to a close relatives event.
                             $rela_fact = clone $fact;
                             $rela_fact->setTag('_' . $fact->getTag() . '_GCH2');
                             $facts[] = $rela_fact;
                         } else {
                             // Convert the event to a close relatives event.
                             $rela_fact = clone $fact;
                             $rela_fact->setTag('_' . $fact->getTag() . $option);
                             $facts[] = $rela_fact;
                         }
                     }
                 }
             }
         }
     }
     return $facts;
 }
Пример #4
0
 /**
  * print the children table for a family
  *
  * @param Family $family family
  * @param string $childid child ID
  * @param int $sosa child sosa number
  * @param string $label indi label (descendancy booklet)
  * @param int $show_cousins display cousins on chart
  * @param int $show_full large or small box
  */
 public static function printFamilyChildren(Family $family, $childid = '', $sosa = 0, $label = '', $show_cousins = 0, $show_full = 1)
 {
     if ($show_full) {
         $bheight = Theme::theme()->parameter('chart-box-y');
     } else {
         $bheight = Theme::theme()->parameter('compact-chart-box-y');
     }
     $pbheight = $bheight + 14;
     $children = $family->getChildren();
     $numchil = count($children);
     echo '<table border="0" cellpadding="0" cellspacing="2"><tr>';
     if ($sosa > 0) {
         echo '<td></td>';
     }
     echo '<td><span class="subheaders">';
     if ($numchil == 0) {
         echo I18N::translate('No children');
     } else {
         echo I18N::plural('%s child', '%s children', $numchil, $numchil);
     }
     echo '</span>';
     if ($sosa == 0 && Auth::isEditor($family->getTree())) {
         echo '<br>';
         echo "<a href=\"#\" onclick=\"return add_child_to_family('", $family->getXref(), "', 'U');\">" . I18N::translate('Add a child to this family') . "</a>";
         echo ' <a class="icon-sex_m_15x15" href="#" onclick="return add_child_to_family(\'', $family->getXref(), '\', \'M\');" title="', I18N::translate('son'), '"></a>';
         echo ' <a class="icon-sex_f_15x15" href="#" onclick="return add_child_to_family(\'', $family->getXref(), '\', \'F\');" title="', I18N::translate('daughter'), '"></a>';
         echo '<br><br>';
     }
     echo '</td>';
     if ($sosa > 0) {
         echo '<td></td><td></td>';
     }
     echo '</tr>';
     $nchi = 1;
     if ($children) {
         foreach ($children as $child) {
             echo '<tr>';
             if ($sosa != 0) {
                 if ($child->getXref() == $childid) {
                     self::printSosaNumber($sosa, $childid);
                 } elseif (empty($label)) {
                     self::printSosaNumber("");
                 } else {
                     self::printSosaNumber($label . $nchi++ . ".");
                 }
             }
             if ($child->isPendingAddtion()) {
                 echo '<td valign="middle" class="new">';
             } elseif ($child->isPendingDeletion()) {
                 echo '<td valign="middle" class="old">';
             } else {
                 echo '<td valign="middle">';
             }
             FunctionsPrint::printPedigreePerson($child, $show_full);
             echo "</td>";
             if ($sosa != 0) {
                 // loop for all families where current child is a spouse
                 $famids = $child->getSpouseFamilies();
                 $maxfam = count($famids) - 1;
                 for ($f = 0; $f <= $maxfam; $f++) {
                     $famid_child = $famids[$f]->getXref();
                     // multiple marriages
                     if ($f > 0) {
                         echo '</tr><tr><td></td>';
                         echo '<td valign="top"';
                         if (I18N::direction() === 'rtl') {
                             echo ' align="left">';
                         } else {
                             echo ' align="right">';
                         }
                         //find out how many cousins there are to establish vertical line on second families
                         $fchildren = $famids[$f]->getChildren();
                         $kids = count($fchildren);
                         $Pheader = ($bheight - 1) * $kids;
                         $PBadj = 6;
                         // default
                         if ($show_cousins > 0) {
                             if ($kids) {
                                 $PBadj = max(0, $Pheader / 2 + $kids * 4.5);
                             }
                         }
                         if ($f == $maxfam) {
                             echo "<img height=\"" . ($bheight / 2 + $PBadj) . "px\"";
                         } else {
                             echo "<img height=\"" . $pbheight . "px\"";
                         }
                         echo " width=\"3\" src=\"" . Theme::theme()->parameter('image-vline') . "\" alt=\"\">";
                         echo "</td>";
                     }
                     echo "<td class=\"details1\" valign=\"middle\" align=\"center\">";
                     $spouse = $famids[$f]->getSpouse($child);
                     $marr = $famids[$f]->getFirstFact('MARR');
                     $div = $famids[$f]->getFirstFact('DIV');
                     if ($marr) {
                         // marriage date
                         echo $marr->getDate()->minimumDate()->format('%Y');
                         // divorce date
                         if ($div) {
                             echo '–', $div->getDate()->minimumDate()->format('%Y');
                         }
                     }
                     echo "<br><img width=\"100%\" class=\"line5\" height=\"3\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\">";
                     echo "</td>";
                     // spouse information
                     echo "<td style=\"vertical-align: center;";
                     if (!empty($divrec)) {
                         echo " filter:alpha(opacity=40);opacity:0.4;\">";
                     } else {
                         echo "\">";
                     }
                     FunctionsPrint::printPedigreePerson($spouse, $show_full);
                     echo "</td>";
                     // cousins
                     if ($show_cousins) {
                         self::printCousins($famid_child, $show_full);
                     }
                 }
             }
             echo "</tr>";
         }
     } elseif ($sosa < 1) {
         // message 'no children' except for sosa
         if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) {
             echo '<tr><td><i class="icon-childless"></i> ' . I18N::translate('This family remained childless') . '</td></tr>';
         }
     }
     echo "</table><br>";
 }
Пример #5
0
    /**
     * Format a family.
     *
     * @param Family $family
     * @param string $title
     */
    private function drawFamily(Family $family, $title)
    {
        global $controller;
        ?>
		<tr>
			<td class="center" colspan="2">
				<a class="famnav_title" href="<?php 
        echo $family->getHtmlUrl();
        ?>
">
					<?php 
        echo $title;
        ?>
				</a>
			</td>
		</tr>
		<?php 
        foreach ($family->getSpouses() as $spouse) {
            $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $spouse));
            $menu->addClass('', 'submenu flyout');
            $menu->addSubmenu(new 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->getChildren() as $child) {
            $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $child));
            $menu->addClass('', 'submenu flyout');
            $menu->addSubmenu(new 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 
        }
    }
Пример #6
0
    /**
     * Print a family group.
     *
     * @param Family $family
     * @param string $type
     * @param string $label
     */
    private function printFamily(Family $family, $type, $label)
    {
        global $controller;
        if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) {
            $access_level = Auth::PRIV_HIDE;
        } else {
            $access_level = Auth::accessLevel($family->getTree());
        }
        ?>
		<table>
			<tr>
				<td>
					<i class="icon-cfamily"></i>
				</td>
				<td>
					<span class="subheaders"> <?php 
        echo $label;
        ?>
</span>
					<a class="noprint" href="<?php 
        echo $family->getHtmlUrl();
        ?>
"> - <?php 
        echo I18N::translate('View this family');
        ?>
</a>
				</td>
			</tr>
		</table>
		<table class="facts_table">
		<?php 
        ///// HUSB /////
        $found = false;
        foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
            $found |= !$fact->isPendingDeletion();
            $person = $fact->getTarget();
            if ($person instanceof Individual) {
                if ($fact->isPendingAddition()) {
                    $class = 'facts_label new';
                } elseif ($fact->isPendingDeletion()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
					<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo Functions::getCloseRelationshipName($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                echo Theme::theme()->individualBoxLarge($person);
                ?>
					</td>
					</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label"></td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'HUSB');"><?php 
            echo 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 Individual) {
                $found |= !$fact->isPendingDeletion();
                if ($fact->isPendingAddition()) {
                    $class = 'facts_label new';
                } elseif ($fact->isPendingDeletion()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo Functions::getCloseRelationshipName($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                echo Theme::theme()->individualBoxLarge($person);
                ?>
					</td>
				</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label"></td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'WIFE');"><?php 
            echo I18N::translate('Add a wife to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// MARR /////
        $found = false;
        $prev = new Date('');
        foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) {
            $found |= !$fact->isPendingDeletion();
            if ($fact->isPendingAddition()) {
                $class = ' new';
            } elseif ($fact->isPendingDeletion()) {
                $class = ' old';
            } else {
                $class = '';
            }
            ?>
			<tr>
				<td class="facts_label">
				</td>
				<td class="facts_value<?php 
            echo $class;
            ?>
">
					<?php 
            echo GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $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">
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_new_record('<?php 
            echo $family->getXref();
            ?>
', 'MARR');">
						<?php 
            echo 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 Individual) {
                if ($fact->isPendingAddition()) {
                    $child_number++;
                    $class = 'facts_label new';
                } elseif ($fact->isPendingDeletion()) {
                    $class = 'facts_label old';
                } else {
                    $child_number++;
                    $class = 'facts_label';
                }
                $next = new Date('');
                foreach ($person->getFacts(WT_EVENTS_BIRT, true) 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 Functions::getCloseRelationshipName($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                echo Theme::theme()->individualBoxLarge($person);
                ?>
					</td>
				</tr>
				<?php 
                $prev = $next;
            }
        }
        // Re-order children / add a new child
        if ($family->canEdit()) {
            if ($type == 'FAMS') {
                $add_child_text = I18N::translate('Add a son or daughter');
            } else {
                $add_child_text = I18N::translate('Add a brother or sister');
            }
            ?>
			<tr class="noprint">
				<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 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 $add_child_text;
            ?>
</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;
    }
 /**
  * Recursive function to traverse the tree
  *
  * @param Family|null $family
  * @param int         $level
  */
 public function addFamilyDescendancy(Family $family = null, $level = PHP_INT_MAX)
 {
     if (!$family) {
         return;
     }
     foreach ($family->getSpouses() as $spouse) {
         $this->addClipping($spouse);
     }
     foreach ($family->getChildren() as $child) {
         $this->addClipping($child);
         foreach ($child->getSpouseFamilies() as $child_family) {
             $this->addClipping($child_family);
             if ($level > 0) {
                 $this->addFamilyDescendancy($child_family, $level - 1);
                 // recurse on the childs family
             }
         }
     }
 }
Пример #8
0
 /**
  * Display descendants.
  *
  * @param Family $family
  * @param int    $generations
  *
  * @return string
  */
 public function loadChildren(Family $family, $generations)
 {
     $out = '';
     if ($family->canShow()) {
         $children = $family->getChildren();
         if ($children) {
             foreach ($children as $child) {
                 $out .= $this->getPersonLi($child, $generations - 1);
             }
         } else {
             $out .= '<li class="sb_desc_none">' . I18N::translate('No children') . '</li>';
         }
     }
     if ($out) {
         return '<ul>' . $out . '</ul>';
     } else {
         return '';
     }
 }
Пример #9
0
 /**
  * print a family descendancy
  *
  * @param Individual $person
  * @param Family     $family
  * @param int        $depth the descendancy depth to show
  */
 private function printFamilyDescendancy(Individual $person, Family $family, $depth)
 {
     $uid = Uuid::uuid4();
     // create a unique ID
     // print marriage info
     echo '<li>';
     echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent') + 4, '">';
     echo '<span class="details1">';
     echo "<a href=\"#\" onclick=\"expand_layer('" . $uid . "'); return false;\" class=\"top\"><i id=\"" . $uid . "_img\" class=\"icon-minus\" title=\"" . I18N::translate('View this 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 id="' . $uid . '" class="generation">';
     echo '<li>';
     echo '<table><tr><td>';
     FunctionsPrint::printPedigreePerson($spouse, $this->showFull());
     echo '</td>';
     // check if spouse has parents and add an arrow
     echo '<td></td>';
     echo '<td>';
     if ($spouse) {
         foreach ($spouse->getChildFamilies() as $cfamily) {
             foreach ($cfamily->getSpouses() as $parent) {
                 FunctionsCharts::printUrlArrow('?rootid=' . $parent->getXref() . '&amp;generations=' . $this->generations . '&amp;chart_style=' . $this->chart_style . '&amp;show_full=' . $this->showFull() . '&amp;ged=' . $parent->getTree()->getNameUrl(), I18N::translate('Start at parents'), 2);
                 // only show the arrow for one of the parents
                 break;
             }
         }
     }
     if ($this->showFull()) {
         echo '<br><br>&nbsp;';
     }
     echo '</td></tr>';
     // children
     $children = $family->getChildren();
     echo '<tr><td colspan="3" class="details1" >&nbsp;&nbsp;';
     if ($children) {
         echo GedcomTag::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 GedcomTag::getLabel('NCHI') . ': ' . count($children);
         } else {
             echo I18N::translate('No children');
         }
     }
     echo '</td></tr></table>';
     echo '</li>';
     if ($depth > 1) {
         foreach ($children as $child) {
             $this->printChildDescendancy($child, $depth - 1);
         }
     }
     echo '</ul>';
     echo '</li>';
 }