public function import() { if (!$this->record) { $this->record = new ExhibitPageBlock(); } $this->record->page_id = $this->responseData['page_id']; $this->record->layout = $this->responseData['layout']; $this->record->text = $this->responseData['text']; $this->record->order = $this->responseData['order']; $this->record->options = json_encode($this->responseData['options']); try { $this->record->save(true); $this->addOmekaApiImportRecordIdMap(); } catch (Exception $e) { _log($e); } $attachmentAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $this->endpointUri, 'ExhibitBlockAttachment'); $attachmentAdapter->setResourceProperties(array('file' => 'File', 'item' => 'Item')); foreach ($this->responseData['attachments'] as $order => $attachmentData) { $attachmentData['order'] = $order; $attachmentData['block_id'] = $this->record->id; $attachmentAdapter->resetResponseData($attachmentData); $attachmentAdapter->import(); } }
public function filterApiImportOmekaAdapters($adapters, $args) { // Sequence is important here. Need the types and their elements mapped in first // Then the profiles themselves, then bring in the multi-valued elements then their values $typesAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'UserProfilesType'); $typesAdapter->setResourceProperties(array('element_set' => 'ElementSet')); $adapters['user_profiles_types'] = $typesAdapter; $elementAdapter = new ApiImport_ResponseAdapter_Omeka_UserProfilesMulti(null, $args['endpointUri'], 'UserProfilesMultiElement'); $elementAdapter->setResourceProperties(array('element_set' => 'ElementSet')); $adapters['user_profiles_multielements'] = $elementAdapter; $profileAdapter = new ApiImport_ResponseAdapter_Omeka_UserProfilesProfile(null, $args['endpointUri'], 'UserProfilesProfile'); $adapters['user_profiles'] = $profileAdapter; $valueAdapter = new ApiImport_ResponseAdapter_Omeka_UserProfilesMulti(null, $args['endpointUri'], 'UserProfilesMultiValue'); $valueAdapter->setResourceProperties(array('profile_type' => 'UserProfilesType', 'multi' => 'UserProfilesMultiElement', 'profile' => 'UserProfilesProfile')); $adapters['user_profiles_multivalues'] = $valueAdapter; return $adapters; }
public function filterApiImportOmekaAdapters($adapters, $args) { if (strpos($args['endpointUri'], 'omeka.net') !== false) { $contributedItemAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'ContributionContributedItem'); $contributedItemAdapter->setResourceProperties(array('item' => 'Item')); $adapters['contributions'] = $contributedItemAdapter; $contributionTypeAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'ContributionType'); $contributionTypeAdapter->setResourceProperties(array('item_type' => 'ItemType')); $adapters['contribution_types'] = $contributionTypeAdapter; $contributionTypeElementsAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'ContributionTypeElement'); $contributionTypeElementsAdapter->setResourceProperties(array('element' => 'Element', 'type' => 'ContributionType')); $adapters['contribution_type_elements'] = $contributionTypeElementsAdapter; } else { $contributionContributorsAdapter = new ApiImport_ResponseAdapter_OmekaNet_ContributorsAdapter(null, $args['endpointUri'], 'User'); $adapters['contribution_contributors'] = $contributionContributorsAdapter; $contributedItemAdapter = new ApiImport_ResponseAdapter_OmekaNet_ContributedItemsAdapter(null, $args['endpointUri'], 'ContributionContributedItem'); $adapters['contribution_contributed_items'] = $contributedItemAdapter; $typesAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'ContributionType'); $typesAdapter->setResourceProperties(array('item_type' => 'ItemType')); $adapters['contribution_types'] = $typesAdapter; $typeElementsAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'ContributionTypeElement'); $typeElementsAdapter->setResourceProperties(array('type' => 'ContributionType', 'element' => 'Element')); $adapters['contribution_type_elements'] = $typeElementsAdapter; } return $adapters; }
public function filterApiImportOmekaAdapters($adapters, $args) { $geolocationAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter(null, $args['endpointUri'], 'Location'); $geolocationAdapter->setResourceProperties(array('item' => 'Item')); $adapters['geolocations'] = $geolocationAdapter; return $adapters; }