Ejemplo n.º 1
0
 /**
  * Startup activity
  *
  * @param GedcomRecord|null $record
  */
 public function __construct(GedcomRecord $record = null)
 {
     $this->record = $record;
     // Automatically fix broken links
     if ($this->record && $this->record->canEdit()) {
         $broken_links = 0;
         foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
             if (!$fact->isPendingDeletion() && $fact->getTarget() === null) {
                 $this->record->deleteFact($fact->getFactId(), false);
                 FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
                 $broken_links = true;
             }
         }
         foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
             // These can be links or inline. Only delete links.
             if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
                 $this->record->deleteFact($fact->getFactId(), false);
                 FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
                 $broken_links = true;
             }
         }
         if ($broken_links) {
             // Reload the updated family
             $this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree());
         }
     }
     parent::__construct();
     // We want robots to index this page
     $this->setMetaRobots('index,follow');
     // Set a page title
     if ($this->record) {
         if ($this->record->canShowName()) {
             // e.g. "John Doe" or "1881 Census of Wales"
             $this->setPageTitle($this->record->getFullName());
         } else {
             // e.g. "Individual" or "Source"
             $record = $this->record;
             $this->setPageTitle(GedcomTag::getLabel($record::RECORD_TYPE));
         }
     } else {
         // No such record
         $this->setPageTitle(I18N::translate('Private'));
     }
 }
Ejemplo n.º 2
0
 /**
  * Print a “Family Book” for an individual
  *
  * @param Individual $person
  * @param int    $descent_steps
  */
 public function printFamilyBook(Individual $person, $descent_steps)
 {
     if ($descent_steps == 0 || !$person->canShowName()) {
         return;
     }
     $families = $person->getSpouseFamilies();
     if ($families) {
         echo '<h3>', I18N::translate('Family of %s', $person->getFullName()), '</h3>', '<table class="t0"><tr><td class="tdmid">';
         $this->dgenerations = $this->generations;
         $this->printDescendency($person, 1);
         echo '</td><td class="tdmid">';
         $this->printPersonPedigree($person, 1);
         echo '</td></tr></table><br><br><hr style="page-break-after:always;"><br><br>';
         foreach ($families as $family) {
             foreach ($family->getChildren() as $child) {
                 $this->printFamilyBook($child, $descent_steps - 1);
             }
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Format a family.
  *
  * @param Individual $person
  *
  * @return string
  */
 private function getFamily(Individual $person)
 {
     $html = '';
     if ($person->canShowName()) {
         foreach ($person->getSpouseFamilies() as $family) {
             $spouse = $family->getSpouse($person);
             $html .= $this->getHTML($spouse, true);
             $children = $family->getChildren();
             if (count($children) > 0) {
                 $html .= "<ul class='clist'>";
                 foreach ($children as $child) {
                     $html .= '<li>' . $this->getHTML($child) . '</li>';
                 }
                 $html .= '</ul>';
             }
         }
     }
     if (!$html) {
         $html = sprintf(self::MSG, I18N::translate('none'));
     }
     return sprintf(self::TTL, I18N::translate('Family')) . $html;
 }
Ejemplo n.º 4
0
 /**
  * Display an individual in a box - for charts, etc.
  *
  * @param Individual $individual
  *
  * @return string
  */
 public function individualBoxLarge(Individual $individual)
 {
     $personBoxClass = array_search($individual->getSex(), array('person_box' => 'M', 'person_boxF' => 'F', 'person_boxNN' => 'U'));
     if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
         $thumbnail = $individual->displayImage();
     } else {
         $thumbnail = '';
     }
     $content = '<span class="namedef name1">' . $individual->getFullName() . '</span>';
     $icons = '';
     if ($individual->canShowName()) {
         $content = '<a href="' . $individual->getHtmlUrl() . '">' . $content . '</a>' . '<div class="namedef name2">' . $individual->getAddName() . '</div>';
         $icons = '<div class="noprint icons">' . '<span class="iconz icon-zoomin" title="' . I18N::translate('Zoom in/out on this box.') . '"></span>' . '<div class="itr"><i class="icon-pedigree"></i><div class="popup">' . '<ul class="' . $personBoxClass . '">' . implode('', $this->individualBoxMenu($individual)) . '</ul>' . '</div>' . '</div>' . '</div>';
     }
     return '<div data-pid="' . $individual->getXref() . '" class="person_box_template ' . $personBoxClass . ' box-style2">' . $icons . '<div class="chart_textbox" style="max-height:' . $this->parameter('chart-box-y') . 'px;">' . $thumbnail . $content . '<div class="inout2 details2">' . $this->individualBoxFacts($individual) . '</div>' . '</div>' . '<div class="inout"></div>' . '</div>';
 }