Project

General

Profile

« Previous | Next » 

Revision 8ff851c6

Added by Andreas Kohlbecker over 14 years ago

Framework to tread and use cdm entities as real Drupal nodes. Example implementation for taxon.

View differences:

modules/cdm_dataportal/cdm_dataportal.module
11 11
 *
12 12
 */
13 13

  
14
require_once('node_types.php');
14 15
require_once('cdm_dataportal.theme.php');
15 16

  
17

  
16 18
define(CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE, 25);
17 19

  
18 20
/* ====================== hook implementations ====================== */
......
89 91
   
90 92
    $items[] = array(
91 93
      'path' => 'cdm_dataportal/taxon',
92
      'callback' => 'cdm_dataportal_view_taxon',
94
      'callback' => 'cdm_dataportal_taxon_page_view',
93 95
      'access' => true,
94 96
      'type' => MENU_CALLBACK,
95 97
    // expected callback arguments: uuid
......
149 151
       $items[] = array(
150 152
      'path' => 'cdm_dataportal/taxon/'.arg(2),
151 153
      'title' => theme('cdm_taxonpage_tab', 'General'),
152
      'callback' => 'cdm_dataportal_view_taxon',
154
      'callback' => 'cdm_dataportal_taxon_page_view',
153 155
      'access' => true,
154 156
      'type' => MENU_CALLBACK,
155 157
      'weight' => 1,
......
160 162
      $items[] = array(
161 163
      'path' => 'cdm_dataportal/taxon/'.arg(2).'/description',
162 164
      'title' => theme('cdm_taxonpage_tab', 'General'),
163
      'callback' => 'cdm_dataportal_view_taxon',
165
      'callback' => 'cdm_dataportal_taxon_page_view',
164 166
      'access' => true,
165 167
      'type' => MENU_DEFAULT_LOCAL_TASK,
166 168
      'weight' => 2,
......
171 173
      $items[] = array(
172 174
      'path' => 'cdm_dataportal/taxon/'.arg(2).'/synonymy',
173 175
      'title' => theme('cdm_taxonpage_tab', 'Synonymy'),
174
      'callback' => 'cdm_dataportal_view_taxon',
176
      'callback' => 'cdm_dataportal_taxon_page_view',
175 177
      'access' => true,
176 178
      'type' => MENU_LOCAL_TASK,
177 179
      'weight' => 3,
......
182 184
      $items[] = array(
183 185
      'path' => 'cdm_dataportal/taxon/'.arg(2).'/images',
184 186
      'title' => theme('cdm_taxonpage_tab', 'Images'),
185
      'callback' => 'cdm_dataportal_view_taxon',
187
      'callback' => 'cdm_dataportal_taxon_page_view',
186 188
      'access' => true,
187 189
      'type' => MENU_LOCAL_TASK,
188 190
      'weight' => 4,
......
677 679
  
678 680
  $form['cdm_dataportal']['layout']['findtaxa']['cdm_dataportal_findtaxa_show_synonym_thumbnails'] = array(
679 681
    '#type' => 'checkbox',
680
    '#title' => t('Show media thumbnails for syonyms'),
682
    '#title' => t('Show media thumbnails for synonyms'),
681 683
    '#default_value' => variable_get('cdm_dataportal_findtaxa_show_synonym_thumbnails', 0),
682 684
    '#description' => t('')
683 685
  );
......
874 876
 *  - Full list of synonyms homotypic synonyms on top, followed by the
875 877
 *    heterotypic and finally followed by misapplied names.
876 878
 *    The list is ordered historically.
877
 *  - All facts associated with the very taxon concept and taxon name.
879
 *  - All description associated with the taxon.
878 880
 *
879
 * @param String $uuid the UUID of the taxon
881
 * @param $uuid
882
 * @param $chapter name of the part to display,
883
 *         valid values are: 'description', 'images', 'synonymy', 'all'
884
 * @return unknown_type
880 885
 */
881
function cdm_dataportal_view_taxon($uuid, $chapter = null){
886
function cdm_dataportal_taxon_page_view($uuid, $chapter = 'all'){
882 887
  
883 888
    // display the page for the taxon defined by $uuid
889
    $taxonpage = cdm_dataportal_taxon_view($uuid, $chapter); 
890
    return cdm_node_show(NODETYPE_TAXON, $uuid, $taxonpage->title , $taxonpage->content);
891
}
892

  
893
/**
894
 * @param $uuid
895
 * @param $chapter name of the part to display,
896
 *         valid values are: 'description', 'images', 'synonymy', 'all'
897
 * @return unknown_type
898
 */
899
function cdm_dataportal_taxon_view($uuid, $chapter = 'all'){
900
  
884 901
    $taxon = cdm_ws_get(CDM_WS_TAXON, $uuid);
885 902
    if(!$taxon){
886 903
      drupal_set_title(t('Taxon does not exist'));
......
888 905
    }
889 906
    _cdm_dataportal_set_currentSecUuid($taxon->sec->uuid);
890 907
    
891
    drupal_set_title(theme('cdm_taxon_page_title', $taxon));
892
    $out = theme('cdm_taxon_page_general', $taxon, $chapter);
893
    
894
    return $out;
895
  /*}*/
908
    $taxonpage->title = theme('cdm_taxon_page_title', $taxon);
909
    $taxonpage->content = theme('cdm_taxon_page_general', $taxon, $chapter);
910

  
911
    return $taxonpage;
896 912
}
897 913

  
914

  
898 915
function cdm_dataportal_view_search_advanced(){
899 916
  
900 917
  drupal_set_title(t('Advanced Search'));
......
1362 1379

  
1363 1380
    //returned value
1364 1381
    return $metadata_caption;
1365

  
1366 1382
}

Also available in: Unified diff