'OAI',
'page callback' => 'drupal_get_form',
'page arguments' => array('eaudoc_oai_admin_settings'),
'access callback'=>'user_access',
'access arguments' => array('eaudoc_admin'),
'type' => MENU_LOCAL_TASK,
'file' => 'eaudoc_oai.admin.inc',
'file path' => drupal_get_path('module', 'eaudoc_oai')
);
$items['admin/content/eaudoc/oai/export-all'] = array (
'title' => 'Force the export of all contents to OAI the store',
'page callback' => 'eaudoc_oai_admin_export_all',
'access callback'=>'user_access',
'access arguments' => array('eaudoc_admin'),
'type' => MENU_LOCAL_TASK,
'file' => 'eaudoc_oai.admin.inc',
'file path' => drupal_get_path('module', 'eaudoc_oai')
);
$items['admin/content/eaudoc/oai/export-pending'] = array (
'title' => 'Export all pending contents to OAI the store',
'page callback' => 'eaudoc_oai_admin_export_pending',
'access callback'=>'user_access',
'access arguments' => array('eaudoc_admin'),
'type' => MENU_LOCAL_TASK,
'file' => 'eaudoc_oai.admin.inc',
'file path' => drupal_get_path('module', 'eaudoc_oai')
);
$items['admin/content/eaudoc/oai/export-flush'] = array (
'title' => 'Flush OAI cache',
'page callback' => 'eaudoc_oai_flush_cache_page',
'access callback'=>'user_access',
'access arguments' => array('eaudoc_admin'),
'type' => MENU_LOCAL_TASK,
'file' => 'eaudoc_oai.admin.inc',
'file path' => drupal_get_path('module', 'eaudoc_oai')
);
$items['admin/content/eaudoc/oai/export-delete'] = array (
'title' => 'Delete OAI cache',
'page callback' => 'eaudoc_oai_delete_cache_page',
'access callback'=>'user_access',
'access arguments' => array('eaudoc_admin'),
'type' => MENU_LOCAL_TASK,
'file' => 'eaudoc_oai.admin.inc',
'file path' => drupal_get_path('module', 'eaudoc_oai')
);
$items['oai/debug'] = array (
'title' => 'debug',
'access' => TRUE,
'page callback' => 'eaudoc_oai_debug',
'access callback' => true,
'type' => MENU_LOCAL_TASK
);
return $items;
}
function eaudoc_oai_debug(){
$conf = eaudoc_oai_get_conf();
$entity = entity_load_single('node', 508062);
dsm($entity);
$xml = eaudoc_oai_node_export_xml($entity, 'PSE');
unlink($xml);
return 'debug';
}
function eaudoc_oai_node_export_xml($node, $format='DC'){
$conf = eaudoc_oai_get_conf();
$filename = 'node_'.$node->nid.'.xml';
// Export des fichiers selon le format souhaité
if ($format == 'DC'){
$file_path = $conf['oai_store_path'].'/dc'.'/eaudoc_dc_'.$filename;
//file_prepare_directory($dir_path, FILE_CREATE_DIRECTORY);
$xml = eaudoc_oai_xml_dc($node);
$xml->AsXML($file_path);
//entrepôt spécial du portail doc
$eaufrance = eaudoc_is_eaufrance($node);
if($eaufrance){
$file_path_eaufrance = $conf['oai_store_path'].'/dc_eaufrance'.'/eaudoc_dc_eaufrance_'.$filename;
$xml = eaudoc_oai_xml_dc($node, 'eaufrance');
$xml->AsXML($file_path_eaufrance);
}
}
elseif($format == 'PSE'){
$file_path = $conf['oai_store_path'].'/pse'.'/eaudoc_pse_'.$filename;
//file_prepare_directory($dir_path, FILE_CREATE_DIRECTORY);
$xml = eaudoc_oai_xml_pse($node);
$xml->AsXML($file_path);
//entrepôt spécial du portail doc
$eaufrance = eaudoc_is_eaufrance($node);
if($eaufrance){
$file_path_eaufrance = $conf['oai_store_path'].'/pse_eaufrance'.'/eaudoc_pse_eaufrance_'.$filename;
$xml = eaudoc_oai_xml_pse($node, 'eaufrance');
$xml->AsXML($file_path_eaufrance);
}
}
return $file_path;
}
/*=======================
TODO :
pour oai_dc et oai_pse : ajouter les liens des fichiers (ext ou upload) si ils sont gratuits
s'il est payant, on fait apparaitre le lien externe(mais surtout pas le lien interne)
dans tous les cas, on met le liens vers html vers la notice eaudoc en dc:identifier (metaHTML)
Tout ce qui est OIE/ : ne pas mettre les liens externes
Tout ce qui est rapport (gratuit): si auteur != OIEau et que le champs organisme = OIEau => supprimer le champ organisme
*/
function eaudoc_oai_xml_dc($node, $finalite = null){
//dsm($node);
/*
if($node->language!=''){$lang = $node->language;}
else{$lang = 'und';}
*/
$lang = 'und';
$sxml = "";
$xml = new SimpleXMLElement($sxml);
$xml->addChild('dc:title', $node->title, 'http://purl.org/dc/elements/1.1/');
if(!empty($node->field_dc_creator[$lang])){
foreach($node->field_dc_creator[$lang] as $creator){
$xml->addChild('dc:creator', $creator['value'], 'http://purl.org/dc/elements/1.1/');
}
}
//Mots clés
/* En dc on exporte pas ce champ
if(!empty($node->field_dc_subject[$lang])){
$vid = utils_taxonomy_getVidByLabel('theme');
foreach($node->field_dc_subject[$lang] as $subject){
$theme = utils_taxonomy_getLabelById(intval($subject['tid']), $vid, false, false);
if($theme!=''){
$xml->addChild('dc:subject', $theme, 'http://purl.org/dc/elements/1.1/');
}
}
}
*/
if(!empty($node->field_descripteurs[$lang])){
$vid = utils_taxonomy_getVidByLabel('thesaurus');
foreach($node->field_descripteurs[$lang] as $subject){
$theme = utils_taxonomy_getLabelById(intval($subject['tid']), $vid, false, false);
if($theme!=''){
$xml->addChild('dc:subject', $theme, 'http://purl.org/dc/elements/1.1/');
}
}
}
if(!empty($node->field_cand_desc[$lang])){
foreach($node->field_cand_desc[$lang] as $desc){
$xml->addChild('dc:subject', $desc['value'], 'http://purl.org/dc/elements/1.1/');
}
}
if (!empty($node->field_dc_description[$lang][0]['value'])){
$xml->addChild('dc:description', str_replace('&', 'et', $node->field_dc_description[$lang][0]['value']), 'http://purl.org/dc/elements/1.1/');
}
if($node->field_dc_publisher[$lang][0]['value']!=''){
//$xml->addChild('dc:publisher', 'INIST-CNRS (métadonnées)', 'http://purl.org/dc/elements/1.1/');
//$xml->addChild('dc:publisher', 'INIST-CNRS (document)', 'http://purl.org/dc/elements/1.1/');
foreach($node->field_dc_publisher[$lang] as $publisher){
if($publisher['value']!='') $xml->addChild('dc:publisher', $publisher['value'].' (document)', 'http://purl.org/dc/elements/1.1/');
}
}
$xml->addChild('dc:publisher', "Office International de l'Eau (métadonnées)", 'http://purl.org/dc/elements/1.1/');
if($node->field_date_publication[$lang][0]['value']!=''){
$xml->addChild('dc:date', substr($node->field_date_publication[$lang][0]['value'],0, 10), 'http://purl.org/dc/elements/1.1/');
}
if($node->field_dc_type[$lang][0]['tid']!=''){
$vid = utils_taxonomy_getVidByLabel('type_notice');
$type = utils_taxonomy_getLabelById(intval($node->field_dc_type[$lang][0]['tid']), $vid, false, false);
if($type!='') $xml->addChild('dc:type', $type, 'http://purl.org/dc/elements/1.1/');
}
$xml->addChild('dc:identifier', $node->field_dc_identifier[$lang][0]['value'], 'http://purl.org/dc/elements/1.1/');
//Gestion des doc internes payants ou pas
if(!empty($node->field_statut) && $node->field_statut[$lang][0]['value']!='Payant'){
//Cas particulier de la finalité "eaufrance" et type = article de périodique ou livre
if($finalite =='eaufrance' && in_array($node->field_dc_type[$lang][0]['tid'], array(2471, 2489))){
//Do nothing
}
else{
if($node->field_lien_ext_doc[$lang]){
foreach($node->field_lien_ext_doc[$lang] as $ext){
$ext_doc = $xml->addChild('dc:identifier', $ext['url'], 'http://purl.org/dc/elements/1.1/');
//$ext_doc->addAttribute('xsi:type', 'dct:URI', 'http://www.w3.org/2001/XMLSchema-instance');
}
}
if(isset($node->field_file_doc[$lang])){
foreach($node->field_file_doc[$lang] as $file){
$f = file_load($file['fid']);
if($f->uri!=''){
$url = file_create_url($f->uri);
$file = $xml->addChild('dc:identifier', $url, 'http://purl.org/dc/elements/1.1/');
//$file->addAttribute('xsi:type', 'dct:URI', 'http://www.w3.org/2001/XMLSchema-instance');
}
}
}
}
}
$metahtml = $xml->addChild('dc:identifier', url('node/'.$node->nid, array('absolute'=>true)), 'http://purl.org/dc/elements/1.1/');
//$metahtml->addAttribute('xsi:type', 'oai_pse:MetaHTML', 'http://www.w3.org/2001/XMLSchema-instance');
// $url = str_replace('&', '&', $node->field_notes['und'][0]['value']);
// $xml->addChild('dc:identifier', $url, 'http://purl.org/dc/elements/1.1/');
if($node->field_dc_langue[$lang][0]['value']!=''){
$xml->addChild('dc:language', substr($node->field_dc_langue[$lang][0]['value'], 0, 2), 'http://purl.org/dc/elements/1.1/');
}
$revue = utils_node_getLabelById($node->field_revue[$lang][0]['nid'], 'revue', false, false);
if (!empty($node->field_volume[$lang][0]['value'])){
$volume = ' Vol '.$node->field_volume[$lang][0]['value'];
}
if (!empty($node->field_num_revue[$lang][0]['value'])){
$num_revue = ' N° '.$node->field_num_revue[$lang][0]['value'];
}
if ($node->field_pages[$lang][0]['value'] != ' - '){
$page = ' Page '.$node->field_pages[$lang][0]['value'];
}else{
$page = '';
}
$source = $revue.$volume.$num_revue.$page;
if($source!=''){
$xml->addChild('dc:source', $source, 'http://purl.org/dc/elements/1.1/');
}
//Couverture geo - monde
if (!empty($node->field_zone_geo[$lang])){
$vid = utils_taxonomy_getVidByLabel('geo_desc');
foreach($node->field_zone_geo[$lang] as $geo){
$desc_geo = utils_taxonomy_getLabelById(intval($geo['tid']), $vid, false, false);
if($desc_geo!='') $xml->addChild('dc:coverage', $desc_geo, 'http://purl.org/dc/elements/1.1/');
}
}
//Couverture geo - France
if (!empty($node->field_dc_coverage_fr[$lang])){
foreach($node->field_dc_coverage_fr[$lang] as $geo){
if($geo['nid']!='' && $en = entity_load_single('node', $geo['nid'])){
$xml->addChild('dc:coverage', $en->title, 'http://purl.org/dc/elements/1.1/');
}
}
}
//Attention la valeur de ce champ n'est pas bonne => il s'agit du diffuseur des métadonnées et pas des droits relatifs au document.
/*
if($node->field_dc_rights[$lang][0]['tid']!=''){
$vid = utils_taxonomy_getVidByLabel('origine');
$rights = utils_taxonomy_getLabelById(intval($node->field_dc_rights[$lang][0]['tid']), $vid, false, false);
$xml->addChild('dc:rights', $rights, 'http://purl.org/dc/elements/1.1/');
}*/
//Si on a un article de périodique, on génére le dc:rights
if($node->field_dc_type[$lang][0]['tid']==2471){
if($node->field_dc_publisher['und'][0]['value']!=''){
$rights = '© '.$node->field_revue_annee['und'][0]['value'].' '.$node->field_dc_publisher['und'][0]['value'];
$xml->addChild('dc:rights', $rights, 'http://purl.org/dc/elements/1.1/');
}
}
return $xml;
}
function eaudoc_oai_xml_pse($node, $finalite = null){
/*
if($node->language!=''){$lang = $node->language;}
else{$lang = 'und';}
*/
$lang = 'und';
$sxml = '';
$xml = new SimpleXMLElement($sxml);
$xml->addChild('dc:title', strToNoAccent($node->title), 'http://purl.org/dc/elements/1.1/');
if($node->field_date_publication[$lang][0]['value']!=''){
$xml->addChild('dct:issued', substr($node->field_date_publication[$lang][0]['value'],0, 10), 'http://purl.org/dc/terms/');
}
if(!empty($node->field_dc_creator)){
foreach($node->field_dc_creator[$lang] as $creator){
$xml->addChild('dc:creator', $creator['value'], 'http://purl.org/dc/elements/1.1/');
}
}
if($node->field_dc_langue[$lang][0]['value']!=''){
//$xml->addChild('dc:language', substr($node->field_dc_langue[$lang][0]['value'], 0, 2), 'http://purl.org/dc/elements/1.1/');
$language = $xml->addChild('dc:language', $node->field_dc_langue[$lang][0]['value'], 'http://purl.org/dc/elements/1.1/');
$language->addAttribute('xsi:type', 'dct:ISO639-2', 'http://www.w3.org/2001/XMLSchema-instance');
}
if(!empty($node->field_dc_subject[$lang])){
$vid = utils_taxonomy_getVidByLabel('theme');
foreach($node->field_dc_subject[$lang] as $subject){
$theme = utils_taxonomy_getLabelById(intval($subject['tid']), $vid, false, false);
if($theme!=''){
$th = $xml->addChild('dc:subject', $theme, 'http://purl.org/dc/elements/1.1/');
$th->addAttribute('xsi:type', 'oai_pse:Theme', 'http://www.w3.org/2001/XMLSchema-instance');
}
}
}
if(!empty($node->field_descripteurs[$lang])){
$vid = utils_taxonomy_getVidByLabel('thesaurus');
foreach($node->field_descripteurs[$lang] as $subject){
$theme = utils_taxonomy_getLabelById(intval($subject['tid']), $vid, false, false);
if($theme!=''){
$xml->addChild('dc:subject', $theme, 'http://purl.org/dc/elements/1.1/');
}
}
}
if(!empty($node->field_cand_desc[$lang])){
foreach($node->field_cand_desc[$lang] as $desc){
$xml->addChild('dc:subject', $desc['value'], 'http://purl.org/dc/elements/1.1/');
}
}
if (!empty($node->field_dc_description[$lang][0]['value'])){
$resume = $xml->addChild('dc:description', str_replace('&', 'et', $node->field_dc_description[$lang][0]['value']), 'http://purl.org/dc/elements/1.1/');
$resume->addAttribute('xsi:type', 'oai_pse:Resume', 'http://www.w3.org/2001/XMLSchema-instance');
}
/*
$xml->addChild('dc:publisher', 'INIST-CNRS', 'http://purl.org/dc/elements/1.1/');
$publisher = $xml->addChild('dc:publisher', 'INIST-CNRS', 'http://purl.org/dc/elements/1.1/');
$publisher->addAttribute('xsi:type', 'oai_pse:MetaDiffuseur', 'http://www.w3.org/2001/XMLSchema-instance');
*/
//Document
if($node->field_dc_publisher[$lang][0]['value']!=''){
foreach($node->field_dc_publisher[$lang] as $publisher){
if($publisher['value']!=''){
$xml->addChild('dc:publisher', $publisher['value'], 'http://purl.org/dc/elements/1.1/');
}
}
}
//Métadonnées
$pub = $xml->addChild('dc:publisher', "Office International de l'Eau", 'http://purl.org/dc/elements/1.1/');
$pub->addAttribute('xsi:type', 'oai_pse:MetaDiffuseur', 'http://www.w3.org/2001/XMLSchema-instance');
/* Information fausse donc on ne la met plus (concerne le diffuseur des métadonnées)
$vid = utils_taxonomy_getVidByLabel('origine');
$rights = utils_taxonomy_getLabelById(intval($node->field_dc_rights[$lang][0]['tid']), $vid, false, false);
if($rights!='') $xml->addChild('dc:rights', $rights, 'http://purl.org/dc/elements/1.1/');
*/
//Si on a un article de périodique, on génére le dc:rights
if($node->field_dc_type[$lang][0]['tid']==2471){
if($node->field_dc_publisher['und'][0]['value']!=''){
$rights = '© '.$node->field_revue_annee['und'][0]['value'].' '.$node->field_dc_publisher['und'][0]['value'];
$xml->addChild('dc:rights', $rights, 'http://purl.org/dc/elements/1.1/');
}
}
if($node->field_dc_identifier[$lang][0]!='') $xml->addChild('dc:identifier', $node->field_dc_identifier[$lang][0]['value'], 'http://purl.org/dc/elements/1.1/');
if($node->field_issn[$lang][0]['value']){
$issn = $xml->addChild('dc:identifier', 'urn:ISSN:'.$node->field_issn[$lang][0]['value'], 'http://purl.org/dc/elements/1.1/');
$issn->addAttribute('xsi:type', 'dct:URI', 'http://www.w3.org/2001/XMLSchema-instance');
}
//Gestion des doc internes payants ou pas
if(!empty($node->field_statut) && $node->field_statut[$lang][0]['value']!='Payant'){
if($finalite =='eaufrance' && in_array($node->field_dc_type[$lang][0]['tid'], array(2471, 2489))){
//Do nothing
}
else{
if($node->field_lien_ext_doc[$lang]){
foreach($node->field_lien_ext_doc[$lang] as $ext){
$ext_doc = $xml->addChild('dc:identifier', $ext['url'], 'http://purl.org/dc/elements/1.1/');
$ext_doc->addAttribute('xsi:type', 'dct:URI', 'http://www.w3.org/2001/XMLSchema-instance');
}
}
if(isset($node->field_file_doc[$lang])){
foreach($node->field_file_doc[$lang] as $file){
$f = file_load($file['fid']);
if($f->uri!=''){
$url = file_create_url($f->uri);
$file = $xml->addChild('dc:identifier', $url, 'http://purl.org/dc/elements/1.1/');
$file->addAttribute('xsi:type', 'dct:URI', 'http://www.w3.org/2001/XMLSchema-instance');
}
}
}
}
}
/* URL : externe
$url = str_replace('&', '&', $node->field_notes[$lang][0]['value']);
$metahtml = $xml->addChild('dc:identifier', $url, 'http://purl.org/dc/elements/1.1/');
$metahtml->addAttribute('xsi:type', 'oai_pse:MetaHTML', 'http://www.w3.org/2001/XMLSchema-instance');
*/
$metahtml = $xml->addChild('dc:identifier', url('node/'.$node->nid, array('absolute'=>true)), 'http://purl.org/dc/elements/1.1/');
$metahtml->addAttribute('xsi:type', 'oai_pse:MetaHTML', 'http://www.w3.org/2001/XMLSchema-instance');
$revue = utils_node_getLabelById($node->field_revue[$lang][0]['nid'], 'revue', false, false);
if (!empty($node->field_volume[$lang][0]['value'])){
$volume = ' Vol '.$node->field_volume[$lang][0]['value'];
}
if (!empty($node->field_num_revue[$lang][0]['value'])){
$num_revue = ' N° '.$node->field_num_revue[$lang][0]['value'];
}
if ($node->field_pages[$lang][0]['value'] != ' - ' && $node->field_pages[$lang][0]['value']!=''){
$page = ' Page '.$node->field_pages[$lang][0]['value'];
}else{
$page = '';
}
$source = $revue.$volume.$num_revue.$page;
if($source!='') $xml->addChild('dc:source', $source, 'http://purl.org/dc/elements/1.1/');
//Couverture geo - monde
if (!empty($node->field_zone_geo[$lang])){
if($finalite =='eaufrance' && $node->field_zone_geo[$lang][0]['tid']==6776){
$spatial = $xml->addChild('dct:spatial', 'FXX', 'http://purl.org/dc/terms/');
$spatial->addAttribute('xsi:type', 'oai_pse:CodeNational', 'http://www.w3.org/2001/XMLSchema-instance');
}
else{
$vid = utils_taxonomy_getVidByLabel('geo_desc');
foreach($node->field_zone_geo[$lang] as $geo){
$desc_geo = utils_taxonomy_getLabelById(intval($geo['tid']), $vid, false, false);
if($desc_geo!='') $xml->addChild('dc:coverage', $desc_geo, 'http://purl.org/dc/elements/1.1/');
}
}
}
//Couverture geo - France
if (!empty($node->field_dc_coverage_fr[$lang])){
foreach($node->field_dc_coverage_fr[$lang] as $geo){
if($geo['nid']!='' && $en = entity_load_single('node', $geo['nid'])){
if ($finalite !='eaufrance'){$xml->addChild('dc:coverage', $en->title, 'http://purl.org/dc/elements/1.1/');}
//Gestion des codes admin
switch($en->type){
case 'region':
$typeCd = 'oai_pse:CodeRegion';
break;
case 'departement':
$typeCd = 'oai_pse:CodeDepartement';
break;
case 'commune':
$typeCd = 'oai_pse:CodeCommune';
break;
default:
$typeCd = '';
}
$code = $en->field_sandre_nomenclature['und'][0]['value'];
if($code!='' ){
$spatial = $xml->addChild('dct:spatial', $code, 'http://purl.org/dc/terms/');
if($typeCd!='') $spatial->addAttribute('xsi:type', $typeCd, 'http://www.w3.org/2001/XMLSchema-instance');
}
}
}
}
return $xml;
}
function eaudoc_oai_entity_insert($entity, $type) {
// For our purposes there's really no difference between insert and update.
return eaudoc_oai_entity_update($entity, $type);
}
function eaudoc_oai_entity_update($entity, $type){
list($id, $vid, $bundle) = entity_extract_ids($type, $entity);
if($type=='node'){
if (eaudoc_oai_entity_should_export($entity, $type)) {
//Generation de la notice OAI
$path_dc = eaudoc_oai_node_export_xml($entity, 'DC');
$path_pse = eaudoc_oai_node_export_xml($entity, 'PSE');
// If we haven't seen this entity before it may not be there, so merge
// instead of update.
db_merge('eaudoc_oai')
->key(array(
'entity_type' => $type,
'entity_id' => $id,
))
->fields(array(
'bundle' => $bundle,
'status' => 1,
'changed' => REQUEST_TIME,
'dc_path' => $path_dc,
'pse_path' =>$path_pse,
))
->execute();
}
else{
db_merge('eaudoc_oai')
->key(array(
'entity_type' => $type,
'entity_id' => $id,
))
->fields(array(
'bundle' => $bundle,
'status' => -1,
'changed' => REQUEST_TIME,
'dc_path' => '',
'pse_path' =>'',
))
->execute();
}
}
}
function eaudoc_oai_entity_delete($entity, $entity_type) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
if($entity_type=='node'){
//Delete files in data store
$r = db_select('eaudoc_oai', 'oai')
->fields('oai')
->condition('entity_type', $entity_type)
->condition('entity_id', $id)
->execute()
->fetchAssoc();
if($r){
unlink($r['dc_path']);
unlink($r['pse_path']);
}
//Delete the line in the DB
db_delete('eaudoc_oai')
->condition('entity_type', $entity_type)
->condition('entity_id', $id)
->execute();
}
}
//Permet de savoir une notice est exportable ou pas
function eaudoc_oai_entity_should_export($entity, $type) {
$conf = eaudoc_oai_get_conf();
list($id, $vid, $bundle) = entity_extract_ids($type, $entity);
if ($bundle && isset($conf['content_type']) && in_array($bundle, $conf['content_type'])) {
//ev 2019/10/29 ne jamais exporté si Payant (vu avec EM)
if ($entity->field_statut['und'][0]['value'] == 'Payant') {
// dsm('Payant');
return false;
}
//Vérification de la phase de validation de la notice doc
//Si validée alors on peut l'exporter
if(isset($entity->field_phase_notice)){
if(!empty($entity->field_phase_notice) && $entity->field_phase_notice['und'][0]['value']=='Validée'){
//On vérifie que le champ "field_dc_identifier" commence par OIE/ ou par INIST/ IE/ ou RIOB
if(isset($entity->field_dc_identifier)){
if(!empty($entity->field_dc_identifier) && $entity->field_dc_identifier['und'][0]['value']!='') {
$dc_identifier_type = explode('/', str_replace('-', '/',strtoupper( $entity->field_dc_identifier['und'][0]['value'])));
if(in_array($dc_identifier_type[0], array('OIE', 'INIST', 'IE', 'RIOB'))){return TRUE;}
else{return FALSE;}
}
else{return FALSE;}
}
else{
return TRUE;
}
}
else{return FALSE;}
}
else{
return TRUE;
}
}
return FALSE;
}
//Permet de savoir si une notice doit être intégrée à l'entrepot eaufrance pour le portail documentaire
function eaudoc_is_eaufrance($node){
//Pour aller dans eaufrance, le type de document doit être dans les tid suivants:
if(isset($node->field_dc_type) && !empty($node->field_dc_type) && in_array( $node->field_dc_type['und'][0]['tid'], array(2511, 2502, 2489, 2471, 2466, 2494, 6904, 6905, 6901, 6900, 2476, 6902, 2480))){
$field_dc_identifier = explode('/', strtoupper($node->field_dc_identifier['und'][0]['value']));
//Le code doit aussi commencer par OIE
if($field_dc_identifier[0]=='OIE') return true;
return false;
}
return false;
}
//Fonction de chargement de la configuration du module
function eaudoc_oai_get_conf(){
return variable_get('eaudoc_oai_configurations', array());
}
//Fonction d'enregistrement de la configuration du module
function eaudoc_oai_set_conf($conf){
return variable_set('eaudoc_oai_configurations', $conf);
}