Esempio n. 1
0
 /**
  * print the parents table for a family
  *
  * @param 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 $show_full large or small box
  */
 public static function printFamilyParents(Family $family, $sosa = 0, $label = '', $parid = '', $gparid = '', $show_full = 1)
 {
     if ($show_full) {
         $pbheight = Theme::theme()->parameter('chart-box-y') + 14;
     } else {
         $pbheight = Theme::theme()->parameter('compact-chart-box-y') + 14;
     }
     $husb = $family->getHusband();
     if ($husb) {
         echo '<a name="', $husb->getXref(), '"></a>';
     } else {
         $husb = new Individual('M', "0 @M@ INDI\n1 SEX M", null, $family->getTree());
     }
     $wife = $family->getWife();
     if ($wife) {
         echo '<a name="', $wife->getXref(), '"></a>';
     } else {
         $wife = new Individual('F', "0 @F@ INDI\n1 SEX F", null, $family->getTree());
     }
     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 border='0'><tr>";
     if ($parid) {
         if ($husb->getXref() == $parid) {
             self::printSosaNumber($label);
         } else {
             self::printSosaNumber($label, "", "blank");
         }
     } elseif ($sosa) {
         self::printSosaNumber($sosa * 2);
     }
     if ($husb->isPendingAddtion()) {
         echo '<td valign="top" class="facts_value new">';
     } elseif ($husb->isPendingDeletion()) {
         echo '<td valign="top" class="facts_value old">';
     } else {
         echo '<td valign="top">';
     }
     FunctionsPrint::printPedigreePerson($husb, $show_full);
     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=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-vline') . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>";
         echo "<td><img class=\"line5\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>";
         // husband’s father
         if ($hfam && $hfam->getHusband()) {
             echo "<table border='0'><tr>";
             if ($sosa > 0) {
                 self::printSosaNumber($sosa * 4, $hfam->getHusband()->getXref(), "down");
             }
             if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) {
                 self::printSosaNumber(trim(substr($label, 0, -3), ".") . ".");
             }
             echo "<td valign=\"top\">";
             FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full);
             echo "</td></tr></table>";
         } elseif ($hfam && !$hfam->getHusband()) {
             // Empty box for grandfather
             echo "<table border='0'><tr>";
             echo '<td valign="top">';
             FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full);
             echo '</td></tr></table>';
         }
         echo "</td>";
     }
     if ($hfam && $sosa != -1) {
         echo '<td valign="middle" rowspan="2">';
         self::printUrlArrow($sosa == 0 ? '?famid=' . $hfam->getXref() . '&amp;ged=' . $hfam->getTree()->getNameUrl() : '#' . $hfam->getXref(), $hfam->getXref(), 1);
         echo '</td>';
     }
     if ($hfam) {
         // husband’s mother
         echo "</tr><tr><td><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>";
         if ($hfam && $hfam->getWife()) {
             echo "<table border='0'><tr>";
             if ($sosa > 0) {
                 self::printSosaNumber($sosa * 4 + 1, $hfam->getWife()->getXref(), "down");
             }
             if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) {
                 self::printSosaNumber(trim(substr($label, 0, -3), ".") . ".");
             }
             echo '<td valign="top">';
             FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full);
             echo '</td></tr></table>';
         } elseif ($hfam && !$hfam->getWife()) {
             // Empty box for grandmother
             echo "<table border='0'><tr>";
             echo '<td valign="top">';
             FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full);
             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><tr>";
     if ($parid) {
         if ($wife->getXref() == $parid) {
             self::printSosaNumber($label);
         } else {
             self::printSosaNumber($label, "", "blank");
         }
     } elseif ($sosa) {
         self::printSosaNumber($sosa * 2 + 1);
     }
     if ($wife->isPendingAddtion()) {
         echo '<td valign="top" class="facts_value new">';
     } elseif ($wife->isPendingDeletion()) {
         echo '<td valign="top" class="facts_value old">';
     } else {
         echo '<td valign="top">';
     }
     FunctionsPrint::printPedigreePerson($wife, $show_full);
     echo "</td></tr></table>";
     echo "</td>";
     // wife’s parents
     $hfam = $wife->getPrimaryChildFamily();
     if ($hfam) {
         echo "<td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-vline') . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>";
         echo "<td><img class=\"line5\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>";
         // wife’s father
         if ($hfam && $hfam->getHusband()) {
             echo "<table><tr>";
             if ($sosa > 0) {
                 self::printSosaNumber($sosa * 4 + 2, $hfam->getHusband()->getXref(), "down");
             }
             if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) {
                 self::printSosaNumber(trim(substr($label, 0, -3), ".") . ".");
             }
             echo "<td valign=\"top\">";
             FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full);
             echo "</td></tr></table>";
         } elseif ($hfam && !$hfam->getHusband()) {
             // Empty box for grandfather
             echo "<table border='0'><tr>";
             echo '<td valign="top">';
             FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full);
             echo '</td></tr></table>';
         }
         echo "</td>";
     }
     if ($hfam && $sosa != -1) {
         echo '<td valign="middle" rowspan="2">';
         self::printUrlArrow($sosa == 0 ? '?famid=' . $hfam->getXref() . '&amp;ged=' . $hfam->getTree()->getNameUrl() : '#' . $hfam->getXref(), $hfam->getXref(), 1);
         echo '</td>';
     }
     if ($hfam) {
         // wife’s mother
         echo "</tr><tr><td><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>";
         if ($hfam && $hfam->getWife()) {
             echo "<table><tr>";
             if ($sosa > 0) {
                 self::printSosaNumber($sosa * 4 + 3, $hfam->getWife()->getXref(), "down");
             }
             if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) {
                 self::printSosaNumber(trim(substr($label, 0, -3), ".") . ".");
             }
             echo "<td valign=\"top\">";
             FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full);
             echo "</td></tr></table>";
         } elseif ($hfam && !$hfam->getWife()) {
             // Empty box for grandmother
             echo "<table border='0'><tr>";
             echo '<td valign="top">';
             FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full);
             echo '</td></tr></table>';
         }
         echo '</td>';
     }
     echo "</tr></table>";
 }
Esempio n. 2
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 '';
     }
 }
Esempio n. 3
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;
    }
 /**
  * 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>';
 }