Revision e3001c8d
Added by Andreas Kohlbecker almost 11 years ago
7.x/modules/cdm_dataportal/cdm_dataportal.module | ||
---|---|---|
1368 | 1368 |
} |
1369 | 1369 |
|
1370 | 1370 |
/** |
1371 |
* Generates an object ready to be transformated to a node. |
|
1372 |
* |
|
1373 |
* This is a preparation in order to show it as a Drupal node. |
|
1374 |
* |
|
1375 |
* @param string $taxon_name_uuid |
|
1376 |
* |
|
1377 |
* @return mixed |
|
1378 |
* The object with the page content and title. |
|
1379 |
*/ |
|
1380 |
function cdm_dataportal_name_view($taxon_name_uuid, $taxon_to_hide_uuid, $synonym_uuid = NULL) { |
|
1371 |
* View function for a TaxonNameBase page. |
|
1372 |
* |
|
1373 |
* The name page lists all taxa for which the name specified by the |
|
1374 |
* $taxon_name_uuid is being used. I case there is only one name the |
|
1375 |
* page automatically redirects ti the according taxon page. Otherwise |
|
1376 |
* the list of names is displayed. |
|
1377 |
* |
|
1378 |
* The parameter $taxon_to_hide_uuid allows to exclude a taxon from the |
|
1379 |
* list of taxa. This is useful for example when referencing from a taxon |
|
1380 |
* to the name page and the referring taxon should not be repeaded in the |
|
1381 |
* name page. |
|
1382 |
* |
|
1383 |
* |
|
1384 |
* @param UUID $taxon_name_uuid |
|
1385 |
* The uuid of the CDM TaxonNameBase to show a name page for |
|
1386 |
* @param UUID $taxon_to_hide_uuid |
|
1387 |
* A taxon which should not be displayed in the taxon list |
|
1388 |
* @param UUID $highlite_synonym_uuid |
|
1389 |
* Optinal parameter wich takes another taxon uuid, if given the |
|
1390 |
* target taxon pages will show the syonymy tab where the taxon |
|
1391 |
* refenrenced by the $highlite_synonym_uuid will be highlighted |
|
1392 |
* in case it is found on this page. |
|
1393 |
* |
|
1394 |
* @return object |
|
1395 |
* An object with two fields: |
|
1396 |
* - title: the page title |
|
1397 |
* - content: the page content |
|
1398 |
*/ |
|
1399 |
function cdm_dataportal_name_view($taxon_name_uuid, $taxon_to_hide_uuid, $highlite_synonym_uuid = NULL) { |
|
1381 | 1400 |
// Getting the full taxonname object from the server. |
1382 | 1401 |
$taxon_name = cdm_ws_get(CDM_WS_NAME, array($taxon_name_uuid)); |
1383 | 1402 |
if (!$taxon_name) { |
... | ... | |
1404 | 1423 |
} |
1405 | 1424 |
// Show the taxa list or go to the singular taxon. |
1406 | 1425 |
if (sizeof($taxon_pager->records) == 1) {// Single taxon case. |
1407 |
reset($taxon_pager->records); |
|
1408 |
$singleTaxon = $taxon_pager->records[0]; |
|
1426 |
$singleTaxon = array_pop($taxon_pager->records); |
|
1409 | 1427 |
if ($singleTaxon->class != "Taxon") { |
1410 | 1428 |
// It is a Synonym -> look for the accepted. |
1411 | 1429 |
$taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, array($singleTaxon->uuid, get_taxonomictree_uuid_selected())); |
1412 |
if (!empty($synonym_uuid)) { |
|
1413 |
drupal_goto('cdm_dataportal/taxon/' . $taxon[0]->uuid . '/synonymy', array('query' => array('highlite' => $synonym_uuid))); |
|
1430 |
if (!empty($highlite_synonym_uuid)) {
|
|
1431 |
drupal_goto('cdm_dataportal/taxon/' . $taxon[0]->uuid . '/synonymy', array('query' => array('highlite' => $highlite_synonym_uuid)));
|
|
1414 | 1432 |
} |
1415 | 1433 |
else { |
1416 | 1434 |
drupal_goto('cdm_dataportal/taxon/' . $taxon[0]->uuid . '/synonymy', array('query' => array('highlite' => $singleTaxon->uuid))); |
... | ... | |
1418 | 1436 |
} |
1419 | 1437 |
else { |
1420 | 1438 |
// It is an accepted taxon. |
1421 |
if (!empty($synonym_uuid)) { |
|
1422 |
drupal_goto('cdm_dataportal/taxon/' . $singleTaxon->uuid . '/synonymy', array('query' => array('highlite' => $synonym_uuid))); |
|
1439 |
if (!empty($highlite_synonym_uuid)) {
|
|
1440 |
drupal_goto('cdm_dataportal/taxon/' . $singleTaxon->uuid . '/synonymy', array('query' => array('highlite' => $highlite_synonym_uuid)));
|
|
1423 | 1441 |
} |
1424 | 1442 |
else { |
1425 | 1443 |
drupal_goto('cdm_dataportal/taxon/' . $singleTaxon->uuid); |
Also available in: Unified diff
fixing bug related to the name page