public function FeedsOAIHTTPFetcher::sourceFormValidate in Feeds OAI-PMH Fetcher and Parser 7
Same name and namespace in other branches
- 6 FeedsOAIHTTPFetcher.inc \FeedsOAIHTTPFetcher::sourceFormValidate()
Override parent::sourceFormValidate().
File
- ./
FeedsOAIHTTPFetcher.inc, line 322
Class
- FeedsOAIHTTPFetcher
- Fetcher class for OAI-PMH repository webservices.
Code
public function sourceFormValidate(&$values) {
require_once drupal_get_path('module', 'feeds_oai_pmh') . '/feeds_oai_pmh.inc';
$result = feeds_oai_pmh_identify($values['source']);
if ($result['status'] != 0) {
return;
}
// 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.'));
}
}