1 |
37c1f19c
|
l.morris
|
<?php
|
2 |
|
|
// File extension for the CSV files in the DwC-A file.
|
3 |
|
|
define('FILE_EXTENSION', ".txt");
|
4 |
|
|
|
5 |
9c7f9ab7
|
Andreas Kohlbecker
|
/**
|
6 |
|
|
* Implements hook_menu().
|
7 |
37c1f19c
|
l.morris
|
*/
|
8 |
|
|
function dwca_export_menu(){
|
9 |
|
|
return array(
|
10 |
|
|
/*'admin/config/system/dwca_export' => array(
|
11 |
|
|
'title' => 'Darwin Core Archive export',
|
12 |
|
|
'description' => t('Create a DarwinCore Archive of this scratchpad.'),
|
13 |
|
|
'page callback' => 'drupal_get_form',
|
14 |
|
|
'page arguments' => array(
|
15 |
|
|
'dwca_export_config_form'
|
16 |
|
|
),
|
17 |
|
|
'access arguments' => array(
|
18 |
|
|
'access DwC-A export settings'
|
19 |
|
|
),
|
20 |
|
|
'file' => 'dwca_export.admin.inc',
|
21 |
|
|
'type' => MENU_NORMAL_ITEM
|
22 |
|
|
),*/
|
23 |
|
|
'dwca.zip' => array(
|
24 |
|
|
'page callback' => 'dwca_export_deliver_archive',
|
25 |
|
|
'access arguments' => array(
|
26 |
|
|
'access content'
|
27 |
|
|
),
|
28 |
|
|
'file' => 'dwca_export.admin.inc',
|
29 |
|
|
'type' => MENU_CALLBACK
|
30 |
|
|
)
|
31 |
|
|
);
|
32 |
|
|
}
|
33 |
|
|
|
34 |
d0c09d70
|
Andreas Kohlbecker
|
/**
|
35 |
|
|
* Implementation of hook_views_api()
|
36 |
|
|
*
|
37 |
|
|
* drupal will load dwca_export.views_default.inc when this hook is implemented
|
38 |
37c1f19c
|
l.morris
|
*/
|
39 |
|
|
function dwca_export_views_api(){
|
40 |
|
|
return array(
|
41 |
|
|
'api' => 3.0
|
42 |
|
|
);
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
/**
|
46 |
|
|
* Implements hook_dwca_export_module()
|
47 |
|
|
*/
|
48 |
|
|
function dwca_export_dwca_export(){
|
49 |
|
|
return TRUE;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
*
|
54 |
|
|
* Implements hook_cron().
|
55 |
|
|
*/
|
56 |
|
|
function dwca_export_cron(){
|
57 |
|
|
module_load_include('cron.inc', 'dwca_export');
|
58 |
|
|
_dwca_export_cron();
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
/**
|
62 |
|
|
* Implements hook_entity_insert()
|
63 |
|
|
*/
|
64 |
|
|
function dwca_export_entity_insert($entity, $type){
|
65 |
|
|
switch($type){
|
66 |
|
|
case 'taxonomy_term':
|
67 |
|
|
$biological_vids = variable_get('biological_vids', array());
|
68 |
|
|
if(isset($biological_vids[$entity->vid]) && $biological_vids[$entity->vid]){
|
69 |
|
|
variable_set('dwca_export_rebuild', TRUE);
|
70 |
|
|
}
|
71 |
|
|
break;
|
72 |
|
|
case 'node':
|
73 |
|
|
if($entity->type == 'spm' || $entity->type == 'biblio' || $entity->type == 'specimen_observation'){
|
74 |
|
|
variable_set('dwca_export_rebuild', TRUE);
|
75 |
|
|
}
|
76 |
|
|
}
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
/**
|
80 |
|
|
* Implements hook_entity_delete()
|
81 |
|
|
*/
|
82 |
|
|
function dwca_export_entity_delete($entity, $type){
|
83 |
|
|
dwca_export_entity_insert($entity, $type);
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
/**
|
87 |
|
|
* Implements hook_entity_update()
|
88 |
|
|
*/
|
89 |
|
|
function dwca_export_entity_update($entity, $type){
|
90 |
|
|
dwca_export_entity_insert($entity, $type);
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
/**
|
94 |
|
|
* Implements hook_permission()
|
95 |
|
|
*/
|
96 |
|
|
function dwca_export_permission(){
|
97 |
|
|
return array(
|
98 |
|
|
'administer dwca-export' => array(
|
99 |
|
|
'title' => t('Access dwca-export'),
|
100 |
|
|
'description' => t('Allows user to access DwC-A export configuration page and execute export of the DwC-A data.')
|
101 |
|
|
)
|
102 |
|
|
);
|
103 |
9c7f9ab7
|
Andreas Kohlbecker
|
}
|