You are here

public function FeedsOAIHTTPFetcher::sourceFormValidate in Feeds OAI-PMH Fetcher and Parser 6

Same name and namespace in other branches
  1. 7 FeedsOAIHTTPFetcher.inc \FeedsOAIHTTPFetcher::sourceFormValidate()

Override parent::sourceFormValidate().

Overrides FeedsHTTPFetcher::sourceFormValidate

File

./FeedsOAIHTTPFetcher.inc, line 315

Class

FeedsOAIHTTPFetcher
Fetcher class for OAI-PMH repository webservices.

Code

public function sourceFormValidate(&$values) {

  // TODO: Check that start date <= repository's reported earliest_timestamp
  // Check that start date <= end date
  if ($values['use_dates']) {
    $from_timestamp = $this
      ->dateFieldToTimestamp($values['dates']['from']);
    $until_timestamp = $this
      ->dateFieldToTimestamp($values['dates']['to']);
    if ($from_timestamp > $until_timestamp) {
      form_set_error('feeds][source', t('The ending date must be later than the starting date'));
    }
  }

  // Check for restart option.
  if ($values['restart']) {
    variable_del('feeds_oai:resumptionToken:' . $values['set'] . ':' . $values['source']);
    variable_del('feeds_oai:from:' . $values['set'] . ':' . $values['source']);
    unset($values['restart']);
    drupal_set_message(t('Import for this repository/set has been reset, ignoring any previous imports.'));
  }
}