Esempio n. 1
0
 private function getNonmergedPages()
 {
     global $wgUser;
     $output = '';
     if ($this->namespace == 'Family') {
         $sk =& $wgUser->getSkin();
         $mergingPeople = array();
         for ($m = 1; $m < count($this->data); $m++) {
             for ($p = 0; $p < count($this->data[$m]); $p++) {
                 $titleString = $this->data[$m][$p]['title'];
                 $mergingPeople[$titleString] = 1;
             }
         }
         $nonmergedPeople = array();
         for ($p = 0; $p < count($this->data[0]); $p++) {
             foreach ($this->data[0][$p]['husbands'] as $temp) {
                 if (!@$mergingPeople[$temp['title']]) {
                     $nonmergedPeople[$temp['title']] = 1;
                 }
             }
             foreach ($this->data[0][$p]['wives'] as $temp) {
                 if (!@$mergingPeople[$temp['title']]) {
                     $nonmergedPeople[$temp['title']] = 1;
                 }
             }
             foreach ($this->data[0][$p]['children'] as $temp) {
                 if (!@$mergingPeople[$temp['title']]) {
                     $nonmergedPeople[$temp['title']] = 1;
                 }
             }
         }
         foreach ($nonmergedPeople as $k => $v) {
             $titleLink = '';
             if (GedcomUtil::isGedcomTitle($k)) {
                 $xml = GedcomUtil::getGedcomXml($this->gedcomData, $k);
                 if (!(string) $xml['match']) {
                     $titleLink = 'Person:' . htmlspecialchars($k);
                 }
             } else {
                 $t = Title::newFromText($k, NS_PERSON);
                 $titleLink = $sk->makeLinkObj($t);
             }
             if ($titleLink) {
                 $output .= '<li>' . $titleLink . '</li>';
             }
         }
         if ($output) {
             $output = '<ul>' . $output . '</ul>';
         }
     }
     return $output;
 }
Esempio n. 2
0
 public static function readFamilyData($titleString, &$data, &$gedcomData, $includeRelativeData = false, $includeNonCompareData = false, $revid = 0, $timestamp = '')
 {
     $children = array();
     $data['familyTitle'][] = $titleString;
     if (GedcomUtil::isGedcomTitle($titleString)) {
         $title = null;
         $data['Exists'] = true;
         $xml = GedcomUtil::getGedcomXml($gedcomData, $titleString);
         $data['GedcomMatchTitle'] = (string) $xml['match'];
         $contents = GedcomUtil::getGedcomContents($gedcomData, $titleString);
     } else {
         $title = Title::newFromText($titleString, NS_FAMILY);
         $data['Exists'] = $title->exists();
         $p = new Family($titleString);
         $p->loadPage($revid);
         if ($revid) {
             $data['Revid'][] = $revid;
         }
         // for consistency with readPersonData
         $xml = $p->getPageXml();
         $contents = $p->getPageContents();
     }
     $husbandFound = $wifeFound = false;
     if ($includeRelativeData) {
         CompareForm::initPersonData('husband', $data);
         CompareForm::initPersonData('wife', $data);
     }
     if (isset($xml)) {
         foreach ($xml->event_fact as $ef) {
             $type = (string) $ef['type'];
             if ($type == Family::$MARRIAGE_TAG || $type == Family::$ALT_MARRIAGE_TAG) {
                 CompareForm::getDatePlace($ef, 'Marriagedate', 'Marriageplace', $data);
             } else {
                 if ($includeNonCompareData) {
                     CompareForm::getOtherEvent($ef, '', $data);
                 }
             }
         }
         if ($includeNonCompareData) {
             CompareForm::getSINContents($xml, $contents, '', $data);
         }
         if ($includeRelativeData) {
             $husbandFound = CompareForm::readRelativeData('husband', $xml->husband, $data, $gedcomData, true, false, $includeNonCompareData, $timestamp);
             $wifeFound = CompareForm::readRelativeData('wife', $xml->wife, $data, $gedcomData, true, false, $includeNonCompareData, $timestamp);
             $i = 0;
             foreach ($xml->child as $c) {
                 $childTitle = (string) $c['title'];
                 if ($childTitle) {
                     $children[$i] = array();
                     CompareForm::initPersonData('child', $children[$i]);
                     if (GedcomUtil::isGedcomTitle($childTitle)) {
                         $childRevid = 0;
                     } else {
                         $t = Title::newFromText($childTitle, NS_PERSON);
                         $childRevid = $timestamp ? StructuredData::getRevidForTimestamp($t, $timestamp) : 0;
                     }
                     CompareForm::readPersonData('child', $childTitle, $children[$i], $gedcomData, false, false, true, $includeNonCompareData, $childRevid);
                     $i++;
                 }
             }
         } else {
             $data['husbandTitle'] = array();
             foreach ($xml->husband as $m) {
                 $data['husbandTitle'][] = (string) $m['title'];
             }
             $data['wifeTitle'] = array();
             foreach ($xml->wife as $m) {
                 $data['wifeTitle'][] = (string) $m['title'];
             }
             $data['childTitle'] = array();
             foreach ($xml->child as $m) {
                 $data['childTitle'][] = (string) $m['title'];
             }
         }
     } else {
         if ($title && StructuredData::isRedirect($contents)) {
             $data['Redirect'] = true;
         }
     }
     if ($includeRelativeData && (!$husbandFound || !$wifeFound)) {
         list($fg, $fs, $mg, $ms) = StructuredData::parseFamilyTitle($titleString);
         if (!$husbandFound) {
             if ($fg) {
                 $data['husbandGiven'][] = $fg;
             }
             if ($fs) {
                 $data['husbandSurname'][] = $fs;
             }
         }
         if (!$wifeFound) {
             if ($mg) {
                 $data['wifeGiven'][] = $mg;
             }
             if ($ms) {
                 $data['wifeSurname'][] = $ms;
             }
         }
     }
     $data['Nomerge'] = CompareForm::getNomergeTitleStrings($title);
     if ($title) {
         $data['Updatable'] = CompareForm::isUpdatable($title, $contents);
     }
     return $children;
 }
Esempio n. 3
0
 private function setFamilyMatchVars($gedcomData)
 {
     if ($gedcomData) {
         $xml = GedcomUtil::getGedcomXml($gedcomData, $this->pagetitle);
     } else {
         $f = new Family($this->pagetitle);
         $xml = $f->getPageXml();
     }
     if (isset($xml)) {
         // add match string
         foreach ($xml->husband as $h) {
             $this->husbandGivenname .= ($this->husbandGivenname ? ' ' : '') . (string) @$h['given'];
             $this->husbandSurname .= ($this->husbandSurname ? ' ' : '') . (string) @$h['surname'];
         }
         foreach ($xml->wife as $w) {
             $this->wifeGivenname .= ($this->wifeGivenname ? ' ' : '') . (string) @$w['given'];
             $this->wifeSurname .= ($this->wifeSurname ? ' ' : '') . (string) @$w['surname'];
         }
         foreach ($xml->event_fact as $ef) {
             $type = (string) $ef['type'];
             if ($type == Family::$MARRIAGE_TAG) {
                 $this->marriagedate = (string) @$ef['date'];
                 $this->marriageplace = (string) @$ef['place'];
                 $pos = strpos($this->marriageplace, '|');
                 if ($pos !== false) {
                     $this->marriageplace = substr($this->marriageplace, 0, $pos);
                 }
                 break;
             }
         }
     }
     if (!$this->husbandGivenname || !$this->husbandSurname || !$this->wifeGivenname || !$this->wifeSurname) {
         $t = Title::makeTitleSafe(NS_FAMILY, $this->pagetitle);
         if ($t) {
             list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($t->getText());
             if (!$this->husbandGivenname) {
                 $this->husbandGivenname = $hg;
             }
             if (!$this->husbandSurname) {
                 $this->husbandSurname = $hs;
             }
             if (!$this->wifeGivenname) {
                 $this->wifeGivenname = $wg;
             }
             if (!$this->wifeSurname) {
                 $this->wifeSurname = $ws;
             }
         }
     }
 }