Example #1
0
 private function addEventsToRequestData(&$requestData, &$keepKeys, &$count, $stdEventTypes, &$birthFound, &$christeningFound, &$deathFound, &$burialFound, &$marriageFound, &$notesMap, &$imagesMap, &$sourcesMap, $elements, &$noteAdoptions, &$sourceAdoptions, &$imageAdoptions)
 {
     if (is_array($elements)) {
         foreach ($elements as $element) {
             if (@$keepKeys[$element['key']]) {
                 if ($count < count($stdEventTypes)) {
                     $count = count($stdEventTypes);
                 }
                 $type = $element['type'];
                 if ($type == Person::$BIRTH_TAG) {
                     if (!$birthFound) {
                         $i = array_search($type, Person::$STD_EVENT_TYPES);
                         $birthFound = true;
                     } else {
                         $type = Person::$ALT_BIRTH_TAG;
                         $i = $count;
                         $count++;
                     }
                 } else {
                     if ($type == Person::$CHR_TAG) {
                         if (!$christeningFound) {
                             $i = array_search($type, Person::$STD_EVENT_TYPES);
                             $christeningFound = true;
                         } else {
                             $type = Person::$ALT_CHR_TAG;
                             $i = $count;
                             $count++;
                         }
                     } else {
                         if ($type == Person::$DEATH_TAG) {
                             if (!$deathFound) {
                                 $i = array_search($type, Person::$STD_EVENT_TYPES);
                                 $deathFound = true;
                             } else {
                                 $type = Person::$ALT_DEATH_TAG;
                                 $i = $count;
                                 $count++;
                             }
                         } else {
                             if ($type == Person::$BUR_TAG) {
                                 if (!$burialFound) {
                                     $i = array_search($type, Person::$STD_EVENT_TYPES);
                                     $burialFound = true;
                                 } else {
                                     $type = Person::$ALT_BUR_TAG;
                                     $i = $count;
                                     $count++;
                                 }
                             } else {
                                 if ($type == Family::$MARRIAGE_TAG) {
                                     if (!$marriageFound) {
                                         $i = array_search($type, Family::$STD_EVENT_TYPES);
                                         $marriageFound = true;
                                     } else {
                                         $type = Family::$ALT_MARRIAGE_TAG;
                                         $i = $count;
                                         $count++;
                                     }
                                 } else {
                                     $i = $count;
                                     $count++;
                                 }
                             }
                         }
                     }
                 }
                 $notes = $this->addAdoptions($element['key'], ESINHandler::mapSourcesImagesNotes($notesMap, $element['notes']), $noteAdoptions);
                 $images = $this->addAdoptions($element['key'], ESINHandler::mapSourcesImagesNotes($imagesMap, $element['images']), $imageAdoptions);
                 $sources = $this->addAdoptions($element['key'], ESINHandler::mapSourcesImagesNotes($sourcesMap, $element['sources']), $sourceAdoptions);
                 ESINHandler::addEventToRequestData($requestData, $i, $type, $element['date'], $element['place'], $element['description'], $sources, $images, $notes);
             }
         }
     }
 }