60 |
60 |
'type' => MENU_CALLBACK,
|
61 |
61 |
);
|
62 |
62 |
|
63 |
|
$items[] = array('path' => 'admin/settings/cdm_dataportal/clear_cache',
|
64 |
|
'title' => t('Empty CDM Taxontree Cache'),
|
65 |
|
'callback' => 'cdm_taxontree_cache_clear',
|
66 |
|
'access' => user_access('administer cdm_dataportal'),
|
67 |
|
'weight' => 2,
|
68 |
|
'type' => MENU_NORMAL_ITEM,
|
69 |
|
);
|
|
63 |
} else {
|
70 |
64 |
|
|
65 |
if(variable_get('cdm_taxontree_cache', 0)){
|
|
66 |
$items[] = array('path' => 'admin/settings/cdm_dataportal/clear_cache',
|
|
67 |
'title' => t('Empty CDM Taxontree Cache'),
|
|
68 |
'callback' => 'cdm_taxontree_cache_clear',
|
|
69 |
'access' => user_access('administer cdm_dataportal'),
|
|
70 |
'weight' => 2,
|
|
71 |
'type' => MENU_NORMAL_ITEM,
|
|
72 |
);
|
|
73 |
}
|
|
74 |
|
71 |
75 |
}
|
72 |
76 |
return $items;
|
73 |
77 |
}
|
74 |
78 |
|
|
79 |
function cdm_taxontree_cache_get($term){
|
|
80 |
if(variable_get('cdm_taxontree_cache', 0)){
|
|
81 |
return cache_get($term,'cache_cdm_taxontree');
|
|
82 |
}
|
|
83 |
}
|
|
84 |
|
|
85 |
function cdm_taxontree_cache_set($term, $child_terms){
|
|
86 |
if(variable_get('cdm_taxontree_cache', 0)){
|
|
87 |
return cache_set($term,'cache_cdm_taxontree', serialize($child_terms));
|
|
88 |
}
|
|
89 |
}
|
|
90 |
|
75 |
91 |
/**
|
76 |
|
* function to empty the cdm_taxontree cache table in case of changes in taxa
|
|
92 |
* function to empty the cdm_taxontree cache table
|
77 |
93 |
*
|
78 |
94 |
*/
|
79 |
95 |
function cdm_taxontree_cache_clear() {
|
... | ... | |
550 |
566 |
$term_collection = array();
|
551 |
567 |
// get child terms from cache
|
552 |
568 |
foreach($child_terms as $key => $term){
|
553 |
|
if(!$children = cache_get($term,'cache_cdm_taxontree')){
|
|
569 |
if(!$children = cdm_taxontree_cache_get($term,'cache_cdm_taxontree')){
|
554 |
570 |
// no data in cache? add some!
|
555 |
571 |
$child_terms = _cdm_taxontree_get_all_children($child_terms,TRUE);
|
556 |
572 |
// add parent term
|
... | ... | |
559 |
575 |
$child_terms[$key] = $key;
|
560 |
576 |
}
|
561 |
577 |
|
562 |
|
cache_set($term,'cache_cdm_taxontree',serialize($child_terms));
|
|
578 |
cdm_taxontree_cache_set($term,'cache_cdm_taxontree',serialize($child_terms));
|
563 |
579 |
$children = $child_terms;
|
564 |
580 |
}
|
565 |
581 |
else{
|
... | ... | |
1363 |
1379 |
// disable filterswitch
|
1364 |
1380 |
$show_filter_switch = false;
|
1365 |
1381 |
|
|
1382 |
} else if(module_exists('cdm_dataportal')){
|
|
1383 |
$node_name = cdm_dataportal_shortname_of($node);
|
|
1384 |
$path = cdm_dataportal_taxon_path($node->uuid);
|
1366 |
1385 |
} else {
|
1367 |
|
$node_name = cdm_dataportal_shortname_of($node);
|
1368 |
|
$path = cdm_dataportal_taxon_path($node->uuid);
|
|
1386 |
$node_name = "module cdm_dataportal missing";
|
|
1387 |
$path = "";
|
1369 |
1388 |
}
|
1370 |
1389 |
|
1371 |
1390 |
if($filterIncludes){
|
... | ... | |
1389 |
1408 |
if(!$is_leaf && !$is_expanded && $filter_class != 'filter_excluded'){
|
1390 |
1409 |
if($node->tid){
|
1391 |
1410 |
$ahah_url = url('cdm_taxontree/taxonomy/children/'.$node->tid.'/'.$node->vid.'/cdm_taxontree/'.($nextLevelIncluded ? 1 : 0).'/'.($show_filter_switch ? 1 : 0).'/'.$tree_node_callback);
|
1392 |
|
} else {
|
|
1411 |
} else if(module_exists('cdm_dataportal')) {
|
1393 |
1412 |
$ws_url = cdm_compose_url(CDM_WS_TREENODE_CHILDREN, array($node->uuid));
|
1394 |
1413 |
$ahah_url = url('cdm_api/proxy/'.urlencode($ws_url).'/cdm_taxontree/'.($nextLevelIncluded ? 1 : 0).'/'.($show_filter_switch ? 1 : 0).'/'.$tree_node_callback);
|
1395 |
1414 |
}
|
... | ... | |
1425 |
1444 |
}
|
1426 |
1445 |
|
1427 |
1446 |
function theme_cdm_taxontree_node_filter_switch(&$node, $filter_class){
|
|
1447 |
if(!module_exists('cdm_dataportal')) {
|
|
1448 |
return '';
|
|
1449 |
}
|
|
1450 |
|
1428 |
1451 |
$out = '';
|
1429 |
|
|
1430 |
1452 |
switch($filter_class){
|
1431 |
1453 |
case 'filter_included':
|
1432 |
1454 |
$filter_icon = 'visible_implicit_small.gif';
|
relaxing module dependency, cdm_taxontree_cache fixes