Revision 0af3ce28
Added by Andreas Kohlbecker almost 8 years ago
modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
355 | 355 |
|
356 | 356 |
// ===================== END of Tagged Text functions ================== // |
357 | 357 |
|
358 |
/** |
|
359 |
* Returns the currently classification tree in use. |
|
360 |
*/ |
|
361 |
function get_current_classification_uuid() { |
|
362 |
if (isset($_SESSION['cdm']['taxonomictree_uuid']) && is_uuid($_SESSION['cdm']['taxonomictree_uuid'])) { |
|
363 |
return $_SESSION['cdm']['taxonomictree_uuid']; |
|
364 |
} |
|
365 |
else { |
|
366 |
return variable_get(CDM_TAXONOMICTREE_UUID, FALSE); |
|
367 |
} |
|
368 |
} |
|
369 |
|
|
370 | 358 |
/** |
371 | 359 |
* Lists the classifications a taxon belongs to |
372 | 360 |
* |
... | ... | |
463 | 451 |
return $structured_description_featureTree; |
464 | 452 |
} |
465 | 453 |
|
466 |
/** |
|
467 |
* @todo Please document this function. |
|
468 |
* @see http://drupal.org/node/1354 |
|
469 |
*/ |
|
470 |
function switch_to_taxonomictree_uuid($taxonomictree_uuid) { |
|
471 |
$_SESSION['cdm']['taxonomictree_uuid'] = $taxonomictree_uuid; |
|
472 |
} |
|
473 |
|
|
474 |
/** |
|
475 |
* @todo Please document this function. |
|
476 |
* @see http://drupal.org/node/1354 |
|
477 |
*/ |
|
478 |
function reset_taxonomictree_uuid($taxonomictree_uuid) { |
|
479 |
unset($_SESSION['cdm']['taxonomictree_uuid']); |
|
480 |
} |
|
481 | 454 |
|
482 | 455 |
/** |
483 | 456 |
* @todo Please document this function. |
... | ... | |
932 | 905 |
// $hook has been supplied |
933 | 906 |
// handle $hook either as compose ot theme hook |
934 | 907 |
// pass through theme or comose hook |
908 |
// compose hooks can be called without data, therefore |
|
909 |
// passing the $uri in this case is not always a requirement |
|
935 | 910 |
|
911 |
if($uri && $uri != 'NULL') { |
|
936 | 912 |
// do a security check since the $uri will be passed |
937 | 913 |
// as absolute URI to cdm_ws_get() |
938 |
if( !_is_cdm_ws_uri($uri)) {
|
|
939 |
drupal_set_message( |
|
940 |
'Invalid call of proxy_content() with callback parameter \'' . $hook . '\' and URI:' . $uri, |
|
941 |
'error' |
|
942 |
);
|
|
943 |
return '';
|
|
944 |
} |
|
914 |
if (!_is_cdm_ws_uri($uri)) {
|
|
915 |
drupal_set_message(
|
|
916 |
'Invalid call of proxy_content() with callback parameter \'' . $hook . '\' and URI:' . $uri,
|
|
917 |
'error'
|
|
918 |
); |
|
919 |
return ''; |
|
920 |
}
|
|
945 | 921 |
|
946 |
$obj = cdm_ws_get($uri, NULL, $post_data, $request_method, TRUE); |
|
922 |
$obj = cdm_ws_get($uri, NULL, $post_data, $request_method, TRUE); |
|
923 |
} else { |
|
924 |
$obj = NULL; |
|
925 |
} |
|
947 | 926 |
|
948 | 927 |
$reponse_data = NULL; |
949 | 928 |
|
... | ... | |
1024 | 1003 |
*/ |
1025 | 1004 |
function setvalue_session() { |
1026 | 1005 |
if ($_REQUEST['var'] && strlen($_REQUEST['var']) > 4) { |
1027 |
$keys = substr($_REQUEST['var'], 1, strlen($_REQUEST['var']) - 2); |
|
1028 |
$keys = explode('][', $keys);
|
|
1006 |
$var_keys = substr($_REQUEST['var'], 1, strlen($_REQUEST['var']) - 2);
|
|
1007 |
$var_keys = explode('][', $var_keys);
|
|
1029 | 1008 |
} |
1030 | 1009 |
else { |
1031 | 1010 |
return; |
... | ... | |
1035 | 1014 |
// Prevent from malicous tags. |
1036 | 1015 |
$val = strip_tags($val); |
1037 | 1016 |
|
1038 |
$var = &$_SESSION; |
|
1039 |
$i = 0; |
|
1040 |
foreach ($keys as $key) { |
|
1041 |
$hasMoreKeys = ++$i < count($var);
|
|
1042 |
if ($hasMoreKeys && (!isset($var[$key]) || !is_array($var[$key]))) {
|
|
1043 |
$var[$key] = array(); |
|
1017 |
$session_var = &$_SESSION;
|
|
1018 |
//$i = 0;
|
|
1019 |
foreach ($var_keys as $key) {
|
|
1020 |
// $hasMoreKeys = ++$i < count($session);
|
|
1021 |
if (!isset($session_var[$key]) || !is_array($session_var[$key])) {
|
|
1022 |
$session_var[$key] = array();
|
|
1044 | 1023 |
} |
1045 |
$var = &$var[$key];
|
|
1024 |
$session_var = &$session_var[$key];
|
|
1046 | 1025 |
} |
1047 |
$var = $val; |
|
1026 |
$session_var = $val;
|
|
1048 | 1027 |
if (isset($_REQUEST['destination'])) { |
1049 | 1028 |
drupal_goto($_REQUEST['destination']); |
1050 | 1029 |
} |
... | ... | |
1333 | 1312 |
|
1334 | 1313 |
if ($response == NULL) { |
1335 | 1314 |
// Error handing. |
1336 |
if (is_uuid($_SESSION['cdm']['taxonomictree_uuid'])) { |
|
1337 |
// Delete the session value and try again with the default. |
|
1338 |
unset($_SESSION['cdm']['taxonomictree_uuid']); |
|
1339 |
return cdm_ws_taxonomy_pathFromRoot($taxon_uuid); |
|
1340 |
} |
|
1341 |
else { |
|
1315 |
// if (is_uuid($_SESSION['cdm']['taxonomictree_uuid'])) {
|
|
1316 |
// // Delete the session value and try again with the default.
|
|
1317 |
// unset($_SESSION['cdm']['taxonomictree_uuid']);
|
|
1318 |
// return cdm_ws_taxonomy_pathFromRoot($taxon_uuid);
|
|
1319 |
// }
|
|
1320 |
// else {
|
|
1342 | 1321 |
// Check if taxonomictree_uuid is valid. |
1343 | 1322 |
$test = cdm_ws_get(cdm_compose_taxonomy_root_level_path(), NULL, NULL, 'GET', TRUE); |
1344 | 1323 |
if ($test == NULL) { |
1345 | 1324 |
// The default set by the admin seems to be invalid or is not even set. |
1346 | 1325 |
drupal_set_message(_no_classfication_uuid_message(), 'warning'); |
1347 | 1326 |
} |
1348 |
} |
|
1327 |
// }
|
|
1349 | 1328 |
} |
1350 | 1329 |
|
1351 | 1330 |
return $response; |
... | ... | |
2286 | 2265 |
} |
2287 | 2266 |
|
2288 | 2267 |
/** |
2289 |
* Provides the list of availbale classifications in form of an options array.
|
|
2268 |
* Provides the list of available classifications in form of an options array.
|
|
2290 | 2269 |
* |
2291 | 2270 |
* The options array is suitable for drupal form API elements that allow multiple choices. |
2292 | 2271 |
* @see http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#options |
Also available in: Unified diff
#5887 #5852 classification breadcrumbs navigation implemented