예제 #1
0
파일: Fact.php 프로젝트: tunandras/webtrees
 /**
  * A one-line summary of the fact - for charts, etc.
  *
  * @return string
  */
 public function summary()
 {
     $attributes = array();
     $target = $this->getTarget();
     if ($target) {
         $attributes[] = $target->getFullName();
     } else {
         $value = $this->getValue();
         if ($value && $value != 'Y') {
             $attributes[] = '<span dir="auto">' . Filter::escapeHtml($value) . '</span>';
         }
         $date = $this->getDate();
         if ($this->getTag() == 'BIRT' && $this->getParent() instanceof Individual && $this->getParent()->getTree()->getPreference('SHOW_PARENTS_AGE')) {
             $attributes[] = $date->display() . FunctionsPrint::formatParentsAges($this->getParent(), $date);
         } else {
             $attributes[] = $date->display();
         }
         $place = $this->getPlace()->getShortName();
         if ($place) {
             $attributes[] = $place;
         }
     }
     $class = 'fact_' . $this->getTag();
     if ($this->isPendingAddition()) {
         $class .= ' new';
     } elseif ($this->isPendingDeletion()) {
         $class .= ' old';
     }
     return '<div class="' . $class . '">' . I18N::translate('<span class="label">%1$s:</span> <span class="field" dir="auto">%2$s</span>', $this->getLabel(), implode(' — ', $attributes)) . '</div>';
 }