Exemplo n.º 1
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $result = '';
     $result .= $this->addSingleLineFieldToXml($request->getVal('source'), 'source');
     $result .= $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname');
     $result .= $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace');
     $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $subjects = $request->getArray('subject', array());
     $sourceType = $request->getVal('source_type', '');
     $result = $this->addSingleLineFieldToXml($sourceType, 'source_type') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Periodical', 'Manuscript collection', 'Website', 'Miscellaneous', 'MySource')) ? $this->addMultiLineFieldToXml($request->getVal('authors', ''), 'formatAuthor') : '') . $this->addSingleLineFieldToXml($request->getVal('source_title', ''), 'source_title') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Manuscript collection', 'Website', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('subtitle', ''), 'subtitle') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Periodical', 'Manuscript collection', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('publisher', ''), 'publisher') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Manuscript collection', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('date_issued', ''), 'date_issued') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Government / Church records', 'Newspaper', 'Periodical', 'Manuscript collection', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('place_issued', ''), 'place_issued') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('series_name', ''), 'series_name') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('volumes', ''), 'volumes') : '') . (!$sourceType || in_array($sourceType, array('Article', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('pages', ''), 'pages') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('references', ''), 'references') : '') . $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname') . $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace') . $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year') . $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year') . $this->addMultiLineFieldToXml($subjects, 'formatSubject') . (in_array('Ethnic/Cultural', $subjects) ? $this->addSingleLineFieldToXml($request->getVal('ethnicity', ''), 'ethnicity') : '') . (in_array('Church records', $subjects) ? $this->addSingleLineFieldToXml($request->getVal('religion', ''), 'religion') : '') . (in_array('Occupation', $subjects) ? $this->addSingleLineFieldToXml($request->getVal('occupation', ''), 'occupation') : '');
     for ($i = 0; $request->getVal("repository_id{$i}"); $i++) {
         $title = trim($request->getVal("repository_title{$i}"));
         $location = trim($request->getVal("repository_location{$i}"));
         $availability = trim($request->getVal("availability{$i}"));
         if ($title || $location) {
             $result .= $this->addMultiAttrFieldToXml(array('title' => $title, 'source_location' => $location, 'availability' => $availability), 'repository');
         }
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $result = '';
     // !!! +title, +date_issued, -publication_info, -call_number, type->format, -abbrev, +ethnicity, +religion, +occupation, +category
     // !!! author format=lastname, given name(s)
     if ($this->isGedcomPage) {
         list($mysourcePrefix, $mysourceTitle, $mysourceSuffix) = MySource::splitGedcomMySourceTitle($this->titleString);
         $mysourceTitle = $request->getVal('mysource_title', '') ? $request->getVal('mysource_title', '') : $mysourceTitle;
         $mysourceTitle = mb_strtoupper(mb_substr($mysourceTitle, 0, 1)) . mb_substr($mysourceTitle, 1);
         $result .= $this->addSingleLineFieldToXml($mysourceTitle, 'title');
         $this->titleString = $mysourcePrefix . $mysourceTitle . $mysourceSuffix;
         $this->title = Title::newFromText($this->titleString, NS_MYSOURCE);
     }
     $result .= $this->addSingleLineFieldToXml($this->cleanUrl($request->getVal('url', '')), 'url');
     //      $result .= $this->addMultiLineFieldToXml($request->getVal('altNames', ''), 'formatAltNameXML');
     $result .= $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace');
     $result .= $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname');
     $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('abbrev', ''), 'abbrev');
     $result .= $this->addSingleLineFieldToXml($request->getVal('author', ''), 'author');
     $result .= $this->addSingleLineFieldToXml($request->getVal('pubInfo', ''), 'publication_info');
     $result .= $this->addSingleLineFieldToXml($request->getVal('callNumber', ''), 'call_number');
     $result .= $this->addSingleLineFieldToXml($request->getVal('type', ''), 'type');
     $result .= $this->addSingleLineFieldToXml($request->getVal('repoName', ''), 'repository_name');
     $result .= $this->addSingleLineFieldToXml($request->getVal('repoAddr', ''), 'repository_addr');
     return $result;
 }
Exemplo n.º 4
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $result = '';
     if ($this->isSubpage) {
         $result .= $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname');
         $result .= $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace');
         $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
         $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     } else {
         $placesToCorrect = array();
         for ($i = 0; $request->getVal("researching_id{$i}"); $i++) {
             $place = trim($request->getVal("researching_place{$i}"));
             if ($place && mb_strpos($place, '|') === false) {
                 $placesToCorrect[] = $place;
             }
         }
         $correctedPlaceTitles = PlaceSearcher::correctPlaceTitles($placesToCorrect);
         for ($i = 0; $request->getVal("researching_id{$i}"); $i++) {
             $surname = StructuredData::standardizeNameCase(trim($request->getVal("researching_surname{$i}")), false);
             $place = trim($request->getVal("researching_place{$i}"));
             if ($surname || $place) {
                 // if you change this, you must also change FamilyTreeAjaxFunctions
                 if ($place) {
                     $correctedPlace = @$correctedPlaceTitles[$place];
                     if ($correctedPlace) {
                         $place = $correctedPlace;
                     }
                 }
                 $result .= $this->addMultiAttrFieldToXml(array('surname' => $surname, 'place' => $place), 'researching');
             }
         }
     }
     return $result;
 }