Project

General

Profile

« Previous | Next » 

Revision 30845bda

Added by Andreas Kohlbecker almost 8 years ago

ref #2985 implementing named area page to make area details like level accessible

View differences:

modules/cdm_dataportal/cdm_dataportal.module
414 414
    // Expected callback arguments: uuid.
415 415
  );
416 416

  
417
   // Optional callback arguments: page.
418
    //FIXME point to view/page method in this module
419
    $items['cdm_dataportal/specimen'] = array(
420
        'page callback' => 'cdm_dataportal_specimen_page_view',
421
        'access arguments' => array('access cdm content'),
422
        'type' => MENU_CALLBACK,
423
        // Expected callback arguments: uuid.
424
    );
417
  $items['cdm_dataportal/specimen'] = array(
418
      'page callback' => 'cdm_dataportal_specimen_page_view',
419
      'access arguments' => array('access cdm content'),
420
      'type' => MENU_CALLBACK,
421
      // Expected callback arguments: uuid.
422
  );
423

  
424
  $items['cdm_dataportal/named_area'] = array(
425
    'page callback' => 'cdm_dataportal_named_area_page_view',
426
    'access arguments' => array('access cdm content'),
427
    'type' => MENU_CALLBACK,
428
    // Expected callback arguments: uuid.
429
  );
425 430

  
426 431
  $items['cdm_dataportal/name'] = array(
427 432
    'page callback' => 'cdm_dataportal_name_page_view',
......
1615 1620
    return $specimenpage;
1616 1621
}
1617 1622

  
1623
/**
1624
 *
1625
 * Creates a named area view.
1626
 * @param string $uuid the UUID of the specimen
1627
 *  * @return object
1628
 *   An object with two fields:
1629
 *     - title: the page title
1630
 *     - content: the page content
1631
 */
1632

  
1633
function cdm_dataportal_named_area_view($uuid) {
1634
  $named_area = cdm_ws_get(CDM_WS_PORTAL_TERM, $uuid);
1635
  if (empty($named_area) || $named_area->class !== 'NamedArea') {
1636
    drupal_set_title(t('Named area does not exist'), PASS_THROUGH);
1637
    return FALSE;
1638
  }
1639
  $named_area_page = new stdClass();
1640

  
1641
  $named_area_page->title = $named_area->representation_L10n;
1642

  
1643
  // Render the specimen page.
1644
  $render_array = compose_cdm_named_area_page($uuid);
1645
  $named_area_page->content = drupal_render($render_array);
1646

  
1647
  return $named_area_page;
1648
}
1649

  
1650
function cdm_dataportal_named_area_page_view($uuid) {
1651

  
1652
  cdm_check_valid_portal_page();
1653

  
1654
  $named_area_page = cdm_dataportal_named_area_view($uuid);
1655
  if (!empty($named_area_page)) {
1656
    return cdm_node_show(NODETYPE_NAME, $uuid, $named_area_page->title, $named_area_page->content);
1657
  }
1658
  else {
1659
    return '';
1660
  }
1661

  
1662

  
1663
}
1664

  
1618 1665
/**
1619 1666
 * Returns a name page as a Drupal node ready to be renderized by Drupal.
1620 1667
 *
......
1905 1952
    }
1906 1953
}
1907 1954

  
1955
function path_to_named_area($uuid) {
1956

  
1957
  if (!$uuid) {
1958
    return FALSE;
1959
  }
1960
  else {
1961
    return 'cdm_dataportal/named_area/' . $uuid;
1962
  }
1963
}
1964

  
1908 1965
/**
1909 1966
 * Creates a URL to show a synonmy in the according taxon page.
1910 1967
 *

Also available in: Unified diff