Ejemplo n.º 1
0
 /**
  * Forat the parents of an individual.
  *
  * @param Individual $person
  *
  * @return string
  */
 private function getParents(Individual $person)
 {
     $father = null;
     $mother = null;
     $html = sprintf(self::TTL, I18N::translate('Parents'));
     $family = $person->getPrimaryChildFamily();
     if ($person->canShowName() && $family !== null) {
         $father = $family->getHusband();
         $mother = $family->getWife();
         $html .= $this->getHTML($father) . $this->getHTML($mother);
         // Can only have a step parent if one & only one parent found at this point
         if ($father instanceof Individual xor $mother instanceof Individual) {
             $stepParents = '';
             foreach ($person->getChildStepFamilies() as $family) {
                 if (!$father instanceof Individual) {
                     $stepParents .= $this->getHTML($family->getHusband());
                 } else {
                     $stepParents .= $this->getHTML($family->getWife());
                 }
             }
             if ($stepParents) {
                 $relationship = $father instanceof Individual ? I18N::translateContext("father’s wife", "step-mother") : I18N::translateContext("mother’s husband", "step-father");
                 $html .= sprintf(self::TTL, $relationship) . $stepParents;
             }
         }
     }
     if (!($father instanceof Individual || $mother instanceof Individual)) {
         $html .= sprintf(self::MSG, I18N::translateContext('unknown family', 'unknown'));
     }
     return $html;
 }