Project

General

Profile

« Previous | Next » 

Revision f19f47fa

Added by Andreas Kohlbecker over 9 years ago

basic implementation of #4314 (taxon page: display of bibliography in a block on the taxon page)

View differences:

7.x/modules/cdm_dataportal/cdm_api/cdm_api.module
267 267
  return $profile_featureTree;
268 268
}
269 269

  
270
/**

271
 * Returns the chosen FeatureTree for SpecimenDescriptions.

272
 *

273
 * The FeatureTree returned is the one that has been set in the

274
 * dataportal settings (layout->taxon:specimen).

275
 * When the chosen FeatureTree is not found in the database,

276
 * the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned.

277
 *

278
 * @return mixed

279
 *   A cdm FeatureTree object.

280
 */
281
function cdm_get_occurrence_featureTree() {

270
/**
271
 * Returns the chosen FeatureTree for SpecimenDescriptions.
272
 *
273
 * The FeatureTree returned is the one that has been set in the
274
 * dataportal settings (layout->taxon:specimen).
275
 * When the chosen FeatureTree is not found in the database,
276
 * the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned.
277
 *
278
 * @return mixed
279
 *   A cdm FeatureTree object.
280
 */
281
function cdm_get_occurrence_featureTree() {
282 282
  static $occurrence_featureTree;
283 283

  
284 284
  if($occurrence_featureTree == NULL) {
......
290 290
      $occurrence_featureTree = cdm_ws_get(CDM_WS_FEATURETREE, UUID_DEFAULT_FEATURETREE);
291 291
    }
292 292
  }
293
  return $occurrence_featureTree;

293
  return $occurrence_featureTree;
294 294
}
295 295

  
296 296
/**
......
316 316
  return $options;
317 317
}
318 318

  
319
/**

320
 * Returns the FeatureTree for structured descriptions

321
 *

322
 * The FeatureTree returned is the one that has been set in the

323
 * dataportal settings (layout->taxon:profile).

324
 * When the chosen FeatureTree is not found in the database,

325
 * the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned.

326
 *

327
 * @return mixed

328
 *   A cdm FeatureTree object.

329
 */

330
function get_structured_description_featureTree() {

331
  static $structured_description_featureTree;

332

  
319
/**
320
 * Returns the FeatureTree for structured descriptions
321
 *
322
 * The FeatureTree returned is the one that has been set in the
323
 * dataportal settings (layout->taxon:profile).
324
 * When the chosen FeatureTree is not found in the database,
325
 * the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned.
326
 *
327
 * @return mixed
328
 *   A cdm FeatureTree object.
329
 */
330
function get_structured_description_featureTree() {
331
  static $structured_description_featureTree;
332

  
333 333
  if($structured_description_featureTree == NULL) {
334
    $structured_description_featureTree = cdm_ws_get(

335
        CDM_WS_FEATURETREE,

336
        variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE)

337
    );

338
    if (!$structured_description_featureTree) {

339
      $structured_description_featureTree = cdm_ws_get(

340
          CDM_WS_FEATURETREE,

341
          UUID_DEFAULT_FEATURETREE

342
      );

334
    $structured_description_featureTree = cdm_ws_get(
335
        CDM_WS_FEATURETREE,
336
        variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE)
337
    );
338
    if (!$structured_description_featureTree) {
339
      $structured_description_featureTree = cdm_ws_get(
340
          CDM_WS_FEATURETREE,
341
          UUID_DEFAULT_FEATURETREE
342
      );
343 343
    }
344
  }

345
  return $structured_description_featureTree;

344
  }
345
  return $structured_description_featureTree;
346 346
}
347 347

  
348 348
/**
......
2069 2069

  
2070 2070
  // now set the labels
2071 2071
  //   for none
2072
  if ($add_none_option) {

2073
    $taxonomic_tree_options['NONE'] = t('-- None --');

2072
  if ($add_none_option) {
2073
    $taxonomic_tree_options['NONE'] = t('-- None --');
2074 2074
  }
2075 2075

  
2076 2076
  //   for default_classification
......
2152 2152
 *
2153 2153
 * An object is considered a cdm entity if it has a string field $object->class
2154 2154
 * with at least 3 characters and if it has a valid uuid in $object->uuid.
2155
 * The function is null save.
2155 2156
 *
2156 2157
 * @author a.kohlbecker <a.kohlbecker@bgbm.org>
2157 2158
 *
......
2162 2163
 *   True if the object is a cdm entity.
2163 2164
 */
2164 2165
function is_cdm_entity($object) {
2165
  return is_string($object->class) && strlen($object->class) > 2 && is_string($object->uuid) && is_uuid($object->uuid);
2166
  return isset($object->class) && is_string($object->class) && strlen($object->class) > 2 && is_string($object->uuid) && is_uuid($object->uuid);
2166 2167
}
2167 2168

  
2168 2169
/**
7.x/modules/cdm_dataportal/cdm_dataportal.module
25 25
module_load_include('inc', 'cdm_dataportal', 'includes/common');
26 26
module_load_include('inc', 'cdm_dataportal', 'includes/pages');
27 27
module_load_include('inc', 'cdm_dataportal', 'includes/media');
28
module_load_include('inc', 'cdm_dataportal', 'includes/maps');

29
module_load_include('inc', 'cdm_dataportal', 'includes/occurrences');

28
module_load_include('inc', 'cdm_dataportal', 'includes/maps');
29
module_load_include('inc', 'cdm_dataportal', 'includes/occurrences');
30 30
module_load_include('inc', 'cdm_dataportal', 'includes/descriptions');
31 31
module_load_include('inc', 'cdm_dataportal', 'includes/pre-drupal8');
32 32

  
......
274 274

  
275 275
/* ====================== hook implementations ====================== */
276 276
/**
277
 * Implements hook_permission().
 *
277
 * Implements hook_permission().
278
 *
278 279
 * Valid permissions for this module.
279 280
 *
280 281
 * @return array
......
296 297
}
297 298

  
298 299
/**
299
 * Implements hook_menu().
 */
300
 * Implements hook_menu().
301
 */
300 302
function cdm_dataportal_menu() {
301 303
  $items = array();
302 304

  
......
887 889
  }
888 890
  if (!isset($media[$taxon->uuid])) {
889 891

  
890
    // --- GET Images --- //

891
    $mediaQueryParameters = array(

892
        "type" => "ImageFile",

893
    );

894

  
895
    $relationship_choice = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));

896
    $mediaQueryParameters['relationships'] = implode(',', get_selection($relationship_choice['direct']));

892
    // --- GET Images --- //
893
    $mediaQueryParameters = array(
894
        "type" => "ImageFile",
895
    );
896

  
897
    $relationship_choice = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));
898
    $mediaQueryParameters['relationships'] = implode(',', get_selection($relationship_choice['direct']));
897 899
    $mediaQueryParameters['relationshipsInvers'] = implode(',', get_selection($relationship_choice['invers']));
898 900

  
899 901
    $taxon_media_filter_choice = variable_get(CDM_TAXON_MEDIA_FILTER, unserialize(CDM_TAXON_MEDIA_FILTER_DEFAULT));
......
901 903
    $mediaQueryParameters['includeOccurrences'] = (boolean) $taxon_media_filter_choice['includeOccurrences'] != 0;
902 904
    $mediaQueryParameters['includeTaxonNameDescriptions'] = (boolean) $taxon_media_filter_choice['includeTaxonNameDescriptions'] != 0;
903 905

  
904
    $ws_endpoint = NULL;

906
    $ws_endpoint = NULL;
905 907
    if ( variable_get('cdm_images_include_children', 0) == 0) {
906 908
      $ws_endpoint = CDM_WS_PORTAL_TAXON_MEDIA;
907 909
    } else {
908 910
      $ws_endpoint = CDM_WS_PORTAL_TAXON_SUBTREE_MEDIA;
909 911
    }
910

  
911
    $media[$taxon->uuid] = cdm_ws_get($ws_endpoint,

912
        array(

913
            $taxon->uuid,

914
        ),

912

  
913
    $media[$taxon->uuid] = cdm_ws_get($ws_endpoint,
914
        array(
915
            $taxon->uuid,
916
        ),
915 917
        queryString($mediaQueryParameters)
916 918
       );
917 919
  }
......
930 932
function _load_occurences_for_taxon($taxon){
931 933

  
932 934
  static $occurences = NULL;
933

  
934
  if(!isset($occurences)) {

935
    $occurences = array();

936
  }

935

  
936
  if(!isset($occurences)) {
937
    $occurences = array();
938
  }
937 939

  
938 940
  if (!isset($occurences[$taxon->uuid])){
939 941

  
940 942
    $relationship_choice = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));
941 943
    $relationship_choice['direct'] = get_selection($relationship_choice['direct']);
942
    $relationship_choice['invers'] = get_selection($relationship_choice['invers']);

943

  
944
    $by_associatedtaxon_query = http_build_query(array(

945
        'relationshipsInvers' => implode(',', $relationship_choice['invers']),

946
        'relationships' => implode(',', $relationship_choice['direct']),

947
        'pageSize' => null // all hits in one page

948
    )

949
    );

950

  
951
    $pager = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON,

952
        null,

953
        $by_associatedtaxon_query . '&taxonUuid=' . $taxon->uuid

954
    );

955

  
956

  
957
    if(isset($pager->records[0])){

958
      $occurences[$taxon->uuid] =  $pager->records;

959
    }

960
  }

944
    $relationship_choice['invers'] = get_selection($relationship_choice['invers']);
945

  
946
    $by_associatedtaxon_query = http_build_query(array(
947
        'relationshipsInvers' => implode(',', $relationship_choice['invers']),
948
        'relationships' => implode(',', $relationship_choice['direct']),
949
        'pageSize' => null // all hits in one page
950
    )
951
    );
952

  
953
    $pager = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON,
954
        null,
955
        $by_associatedtaxon_query . '&taxonUuid=' . $taxon->uuid
956
    );
957

  
958

  
959
    if(isset($pager->records[0])){
960
      $occurences[$taxon->uuid] =  $pager->records;
961
    }
962
  }
961 963
  return $occurences[$taxon->uuid];
962 964
}
963 965
 */
......
1023 1025
 *
1024 1026
 */
1025 1027
function markup_to_render_array($html, $weight = 0) {
1026
  return array(

1028
  return array(
1027 1029
          '#markup' => $html,
1028 1030
          '#weight' => $weight,
1029 1031
      );
......
1046 1048
    return;
1047 1049
  }
1048 1050
  if ($polytomousKeyNode->class != "PolytomousKeyNode") {
1049
    drupal_set_message(_load_polytomousKeySubGraph() . t('invalid type given.'), 'error');
1051
    drupal_set_message('_load_polytomousKeySubGraph(): ' . t('invalid type given.'), 'error');
1050 1052
    return;
1051 1053
  }
1052 1054
  if (!is_uuid($polytomousKeyNode->uuid)) {
1053
    drupal_set_message(_load_polytomousKeySubGraph() . t('invalid type given.'), 'error');
1055
    drupal_set_message('_load_polytomousKeySubGraph(): ' . t('invalid type given.'), 'error');
1054 1056
    return;
1055 1057
  }
1056 1058

  
......
1363 1365

  
1364 1366
  $taxonPager = cdm_dataportal_search_execute();
1365 1367

  
1366
  $showThumbnails = do_showThumbnails();

1367

  
1368
  $setSessionUri = url('cdm_api/setvalue/session', array(

1369
      'query' => array('var' => '[pageoption][searchtaxa][showThumbnails]', 'val' => ''),

1370
  ));

1371

  
1372
  drupal_add_js('jQuery(document).ready(function() {

1373

  
1374
      // init

1375
      if(' . $showThumbnails . ' == 1){

1376
      jQuery(\'.media_gallery\').show(20);

1377
  } else {

1378
      jQuery(\'.media_gallery\').hide(20);

1379
  }

1380
      // add change hander

1381
      jQuery(\'#showThumbnails\').change(

1382
      function(event){

1383
      var state = 0;

1384
      if(jQuery(this).is(\':checked\')){

1385
      jQuery(\'.media_gallery\').show(20);

1386
      state = 1;

1387
  } else {

1388
      jQuery(\'.media_gallery\').hide(20);

1389
  }

1390
      // store state in session variable

1391
      var uri = \'' . $setSessionUri . '\' + state;

1392
      jQuery.get(uri);

1393
  });

1368
  $showThumbnails = do_showThumbnails();
1369

  
1370
  $setSessionUri = url('cdm_api/setvalue/session', array(
1371
      'query' => array('var' => '[pageoption][searchtaxa][showThumbnails]', 'val' => ''),
1372
  ));
1373

  
1374
  drupal_add_js('jQuery(document).ready(function() {
1375

  
1376
      // init
1377
      if(' . $showThumbnails . ' == 1){
1378
      jQuery(\'.media_gallery\').show(20);
1379
  } else {
1380
      jQuery(\'.media_gallery\').hide(20);
1381
  }
1382
      // add change hander
1383
      jQuery(\'#showThumbnails\').change(
1384
      function(event){
1385
      var state = 0;
1386
      if(jQuery(this).is(\':checked\')){
1387
      jQuery(\'.media_gallery\').show(20);
1388
      state = 1;
1389
  } else {
1390
      jQuery(\'.media_gallery\').hide(20);
1391
  }
1392
      // store state in session variable
1393
      var uri = \'' . $setSessionUri . '\' + state;
1394
      jQuery.get(uri);
1395
  });
1394 1396
  });',
1395
  array('type' => "inline", 'scope' => JS_DEFAULT));

1396

  
1397
  array('type' => "inline", 'scope' => JS_DEFAULT));
1398

  
1397 1399
  drupal_set_title(t('Search results'), PASS_THROUGH);
1398 1400

  
1399 1401
  return theme('cdm_search_results', array(
......
1436 1438
            $search_gallery_settings['cdm_dataportal_show_thumbnail_captions'] > 0
1437 1439
            )
1438 1440
         ? 1 : 0;
1439

  
1441

  
1440 1442
       drupal_array_set_nested_value($_SESSION, array('pageoption', 'searchtaxa', 'showThumbnails'), $showThumbnails);
1441 1443
    }
1442
    $showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails'];

1443
    if (!is_numeric($showThumbnails)) {

1444
      $showThumbnails = 1;

1445
    }

1444
    $showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails'];
1445
    if (!is_numeric($showThumbnails)) {
1446
      $showThumbnails = 1;
1447
    }
1446 1448
  }
1447 1449

  
1448 1450
  return $showThumbnails;
......
1652 1654
 *
1653 1655
 * @param $cdmEntity
1654 1656
 */
1655
function html_class_atttibute_ref($cdmEntity) {
1657
function html_class_attribute_ref($cdmEntity) {
1656 1658

  
1657 1659
  if (is_cdm_entity($cdmEntity)) {
1658 1660
    return "cdm:" . $cdmEntity->class . " uuid:" . $cdmEntity->uuid;
......
1830 1832

  
1831 1833
  $metadata_caption = array(
1832 1834
    'title' => '',// Media_metadata and media.
1833
    'artist' => '',// Media_metadata and media.
    'rights',// Media_metadata and media.
    'location',// Media_metadata.
1835
    'artist' => '',// Media_metadata and media.
1836
    'rights',// Media_metadata and media.
1837
    'location',// Media_metadata.
1834 1838
    'filename' => '',// Media.
1835 1839
    'mediacreated' => '',// Media.
1836 1840
    'description' => '',
......
2098 2102
 *   of an other type. A TextData element holding a multilanguageText or a
2099 2103
 *   source reference is considered to be not empty.
2100 2104
 */
2101
function hasFeatureNodeDescriptionElements($featureNode) {
2105
function has_feature_node_description_elements($featureNode) {
2102 2106

  
2103 2107
  if (isset($featureNode->descriptionElements) && is_array($featureNode->descriptionElements) && count($featureNode->descriptionElements) > 0) {
2104 2108
    if(!isset($featureNode->descriptionElements['#type'])){ // #type is used to identify e.g. DTO elements: '#type' => 'DTO'
......
2111 2115
  }
2112 2116
  else if (isset($featureNode->childNodes) && is_array($featureNode->childNodes)) {
2113 2117
    foreach ($featureNode->childNodes as $child) {
2114
      if (hasFeatureNodeDescriptionElements($child)) {
2118
      if (has_feature_node_description_elements($child)) {
2115 2119
        return TRUE;
2116 2120
      }
2117 2121
    }
7.x/modules/cdm_dataportal/classes/footnotemanager.php
84 84
   * @param $theme
85 85
   * @param $themeArguments
86 86
   *
87
   * @return unknown_type
87
   * @return FootnoteKey
88 88
   */
89 89
  public static function addNewFootnote($footnoteListKey, $object = NULL, $theme = NULL, $themeArguments = array()) {
90 90
    if (!$object) {
7.x/modules/cdm_dataportal/includes/common.inc
1 1
<?php
2
/**

3
 * @file

4
 * Functions for dealing with CDM entities from the package model.common

5
 *

6
 * @copyright

7
 *   (C) 2007-2012 EDIT

8
 *   European Distributed Institute of Taxonomy

9
 *   http://www.e-taxonomy.eu

10
 *

11
 *   The contents of this module are subject to the Mozilla

12
 *   Public License Version 1.1.

13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html

14
 *

15
 * @author

16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>

2
/**
3
 * @file
4
 * Functions for dealing with CDM entities from the package model.common
5
 *
6
 * @copyright
7
 *   (C) 2007-2012 EDIT
8
 *   European Distributed Institute of Taxonomy
9
 *   http://www.e-taxonomy.eu
10
 *
11
 *   The contents of this module are subject to the Mozilla
12
 *   Public License Version 1.1.
13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html
14
 *
15
 * @author
16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
17 17
 */
18 18

  
19 19
/**
......
48 48
      // ---- generic
49 49
      //  these entries should be common to all cdm enitiy render arrays
50 50
      '#theme' => 'cdm_marker', // TODO   add alternative theme funcitons: 'cdm_marker_' . marker.type.label
51
      '#attributes' => array('class' => html_class_atttibute_ref($marker)),
51
      '#attributes' => array('class' => html_class_attribute_ref($marker)),
52 52

  
53 53
      // ---- individual
54 54
      '#label' => $marker->markerType->representation_L10n . ': ' . (($marker->flag !== TRUE ? t('yes') : t('no'))),
7.x/modules/cdm_dataportal/includes/descriptions.inc
8 8
 */
9 9
function cdm_modifers_representations($iModifieable, $glue = ', ') {
10 10
  $modifiers_strings = array();
11
  if (isset($iModifieable->modifiers)) {

12
    foreach ($iModifieable->modifiers as $modifier) {

13
      $modifiers_strings[] = cdm_term_representation($modifier);

14
    }

11
  if (isset($iModifieable->modifiers)) {
12
    foreach ($iModifieable->modifiers as $modifier) {
13
      $modifiers_strings[] = cdm_term_representation($modifier);
14
    }
15 15
  }
16 16
  return implode(', ', $modifiers_strings);
17 17
}
......
107 107
function cdm_feature_node_toc_items($feature_nodes) {
108 108
  $items = array();
109 109

  
110
  // we better cache here since drupal_get_query_parameters has no internal static cache variable
111
  $http_request_params = drupal_get_query_parameters();
112

  
113 110
  foreach ($feature_nodes as $node) {
114 111

  
115
    if (isset($node->descriptionElements['#type']) || hasFeatureNodeDescriptionElements($node)) {
112
    if (isset($node->descriptionElements['#type']) || has_feature_node_description_elements($node)) {
116 113

  
117
      $featureRepresentation = isset($node->feature->representation_L10n) ? $node->feature->representation_L10n : 'Feature';
114
      $feature_name = isset($node->feature->representation_L10n) ? $node->feature->representation_L10n : 'Feature';
115
      $class_attributes = 'feature-toc-item-' . $node->feature->uuid;
118 116
      //TODO HACK to implement images for taxa, should be removed.
119 117
      if ($node->feature->uuid != UUID_IMAGE) {
120
        $items[] = array(
121
          'data' => l(
122
                theme('cdm_feature_name', array('feature_name' => $featureRepresentation)),
123
                $_GET['q'],
124
                array(
125
                    'attributes' => array('class' => array('toc')),
126
                    'fragment' => generalizeString($featureRepresentation),
127
                    'query' => $http_request_params
128
                )
129
            ),
130
          'class' => array('feature-toc-item-' . $node->feature->uuid),
118
        $items[] = toc_list_item(
119
          theme(
120
            'cdm_feature_name',
121
            array('feature_name' => $feature_name))
122
          ,
123
          array('class' => $class_attributes)
131 124
        );
132 125
      }
133 126
    }
......
138 131
  return $items;
139 132
}
140 133

  
134
/**
135
 * Prepares an empty Drupal block for displaying description elements of a specific CDM Feature.
136
 *
137
 * The block can also be used for pseudo Features like a bibliography. Pseudo features are
138
 * derived from other data on the fly and so not exist as such in the cdm data. In case
139
 * of pseudo features the $feature is left empty
140
 *
141
 * @param $feature_name
142
 *    A label describing the feature, usually the localized feature representation.
143
 * @param $feature
144
 *    The CDM Feature for which the block is created. (optional)
145
 * @return object
146
 *    A Drupal block object
147
 */
148
function feature_block($feature_name, $feature = null) {
149
  $block = new stdclass(); // Empty object.
150
  $block->module = 'cdm_dataportal';
151
  $block->delta = generalizeString($feature_name);
152
  $block->region = null;
153
  $block->subject = '<a name="' . $block->delta . '"></a><span class="' . html_class_attribute_ref($feature) . '">'
154
    . theme('cdm_feature_name', array('feature_name' => $feature_name))
155
    . '</span>';
156
  $block->module = "cdm_dataportal-feature";
157
  $block->content = '';
158
  return $block;
159
}
160

  
161
/**
162
 * Creates a list item for a table of content, suitable as data element for a themed list
163
 *
164
 * @see theme_list()
165
 *
166
 * @param $label
167
 * @param $http_request_params
168
 * @param $attributes
169
 * @return array
170
 */
171
function toc_list_item($label, $attributes = array()) {
172

  
173
  // we better cache here since drupal_get_query_parameters has no internal static cache variable
174
  $http_request_params = drupal_static('http_request_params', drupal_get_query_parameters());
175

  
176
  $item =  array(
177
    'data' => l(
178
      $label,
179
      $_GET['q'],
180
      array(
181
        'attributes' => array('class' => array('toc')),
182
        'fragment' => generalizeString($label),
183
        'query' => $http_request_params
184
      )
185
    )
186
  );
187
  $item['attributes'] = $attributes;
188
  return $item;
189
}
190

  
141 191
/**
142 192
 * Creates the footnotes for the given CDM DescriptionElement instance.
143 193
 *
......
151 201
 */
152 202
function cdm_create_description_element_footnotes($description_element, $separator = ','){
153 203

  
204

  
154 205
  // Annotations as footnotes.
155 206
  $footNoteKeys = cdm_annotations_as_footnotekeys($description_element);
207

  
156 208
  // Source references as footnotes.
157 209
  foreach ($description_element->sources as $source) {
158 210
    if (_is_original_source_type($source)) {
159
      $fn_key = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_OriginalSource', array(
211
      $fn_key = FootnoteManager::addNewFootnote(original_source_footnote_list_key(), theme('cdm_OriginalSource', array(
160 212
          'source' => $source,
161 213
          'doLink' => FALSE,
162 214
      )));
......
173 225
  return $footnoteKeyListStr;
174 226
}
175 227

  
228
/**
229
 *
230
 * @return string the footnote_list_key
231
 */
232
function original_source_footnote_list_key($key_suggestion = null) {
233
  if(!$key_suggestion){
234
    $key_suggestion = RenderHints::getFootnoteListKey();
235
  }
236
  $footnote_list_key = variable_get(BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE,  1) == 1 ? 'BIBLIOGRAPHY' : $key_suggestion;
237
  return $footnote_list_key;
238
}
239

  
7.x/modules/cdm_dataportal/includes/occurrences.inc
1 1
<?php
2
/**

3
 * @file

4
 * Functions for dealing with CDM entities of type SpeciemenOrOccurrences

5
 *

6
 * @copyright

7
 *   (C) 2007-2012 EDIT

8
 *   European Distributed Institute of Taxonomy

9
 *   http://www.e-taxonomy.eu

10
 *

11
 *   The contents of this module are subject to the Mozilla

12
 *   Public License Version 1.1.

13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html

14
 *

15
 * @author

16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>

2
/**
3
 * @file
4
 * Functions for dealing with CDM entities of type SpeciemenOrOccurrences
5
 *
6
 * @copyright
7
 *   (C) 2007-2012 EDIT
8
 *   European Distributed Institute of Taxonomy
9
 *   http://www.e-taxonomy.eu
10
 *
11
 *   The contents of this module are subject to the Mozilla
12
 *   Public License Version 1.1.
13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html
14
 *
15
 * @author
16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
17 17
 */
18 18

  
19
/**

20
 * Compose an render array from a CDM DerivedUnitFacade object.

21
 *

22
 * compose_hook() implementation

19
/**
20
 * Compose an render array from a CDM DerivedUnitFacade object.
21
 *
22
 * compose_hook() implementation
23 23
 *
24 24
 * @param object $specimenOrObservation
25 25
 *   the CDM instance of type SpecimenOrObservation to compose
......
33 33
 *   $specimenOrObservation has been added to
34 34
 *
35 35
 * @ingroup compose
36
 */

36
 */
37 37
function compose_cdm_specimenOrObservation($specimenOrObservation, &$derivatives = null) {
38 38

  
39 39
  $exclude_occurrence_fields = &drupal_static(__FUNCTION__);
40 40
  if (!isset($exclude_occurrence_fields)) {
41 41
     $exclude_occurrence_fields = array(
42 42
        'derivationEvents',
43
        'extensions', // TODO ignored for now, how to handle extensions?

43
        'extensions', // TODO ignored for now, how to handle extensions?
44 44
        'titleCache',
45
        'protectedTitleCache',

45
        'protectedTitleCache',
46 46
        'derivedUnitMedia',
47 47
        'created',
48 48
        'publish',
49 49
        'updated',
50 50
        'class',
51 51
        'uuid',
52
       ''

52
       ''
53 53
    );
54 54
  }
55 55

  
......
65 65

  
66 66
  $descriptions = null;
67 67
  $derivedFrom = null;
68

  
68

  
69 69
  if (is_object($specimenOrObservation)) {
70 70

  
71 71
    // request again for deeper initialization
......
88 88
      }
89 89
    }
90 90

  
91
    $title = $type_label . ': '. $specimenOrObservation->titleCache;

91
    $title = $type_label . ': '. $specimenOrObservation->titleCache;
92 92

  
93 93
    $groups = array();
94 94
    // --- add initialized fields
95
    foreach (get_object_vars($specimenOrObservation) as $field => $value) {

96
      if (!in_array($field, $exclude_occurrence_fields) && ($value && (!is_object($value) || isset($value->class)))) {

95
    foreach (get_object_vars($specimenOrObservation) as $field => $value) {
96
      if (!in_array($field, $exclude_occurrence_fields) && ($value && (!is_object($value) || isset($value->class)))) {
97 97
        switch ($field) {
98 98

  
99 99
          /* ---- java.lang.Object --- */
......
110 110
            }
111 111
            @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
112 112
            break;
113

  
113

  
114 114

  
115 115
          case 'annotations':
116 116
            $dd_elements = array();
......
143 143
            break;
144 144

  
145 145
          case 'determinations':
146
            $dd_elements = array();

146
            $dd_elements = array();
147 147
            $glue = ', ';
148 148

  
149 149
            foreach  ($value as $determinationEvent){
......
156 156
              while (array_key_exists($weight, $dd_elements)) {
157 157
                $weight .= '0';
158 158
              }
159
              $taxon_name = cdm_ws_get(CDM_WS_TAXON . '/$0/name', $determinationEvent->taxon->uuid);

160
              $taxon_html = theme('cdm_taxonName',

161
                  array(

162
                      'taxonName' => $taxon_name,

163
                      'nameLink' => path_to_taxon($determinationEvent->taxon->uuid),

159
              $taxon_name = cdm_ws_get(CDM_WS_TAXON . '/$0/name', $determinationEvent->taxon->uuid);
160
              $taxon_html = theme('cdm_taxonName',
161
                  array(
162
                      'taxonName' => $taxon_name,
163
                      'nameLink' => path_to_taxon($determinationEvent->taxon->uuid),
164 164
                  )
165 165
              );
166 166
              $dd_elements[$weight] = $taxon_html;
......
172 172
              }
173 173
              if (isset($determinationEvent->actor->titleCache)) {
174 174
                $dd_elements[$weight] .= $glue . $determinationEvent->actor->titleCache;
175
              }

176
              if (isset($determinationEvent->description)) {

175
              }
176
              if (isset($determinationEvent->description)) {
177 177
                $dd_elements[$weight] .= $glue . $determinationEvent->description;
178
              }

178
              }
179 179
            }
180 180
            ksort($dd_elements);
181
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('determinations'), $dd_elements);

181
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('determinations'), $dd_elements);
182 182
            break;
183 183

  
184
          case 'descriptions':

184
          case 'descriptions':
185 185
            $descriptions = $value;
186 186
            $occurrence_featureTree = cdm_get_occurrence_featureTree();
187 187
            $dd_elements = array();
......
192 192
//                 continue;
193 193
//               }
194 194
              $elements_by_feature = _mergeFeatureTreeDescriptions($occurrence_featureTree->root->childNodes, $description->elements);
195
              $rendered_description = theme(

196
                 'cdm_feature_nodes',

195
              $rendered_description = theme(
196
                 'cdm_feature_nodes',
197 197
                 array('mergedFeatureNodes' => $elements_by_feature)
198 198
              );
199 199
              $description_render_elements = array();
......
202 202
              $dd_elements[] = $description_render_elements;
203 203
            }
204 204

  
205
            @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);

205
            @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
206 206
            break;
207 207

  
208 208
          case 'sources':
......
213 213
              @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
214 214
              break;
215 215

  
216

  
216

  
217 217
          /* ---- DerivedUnitBase --- */
218 218
          case 'derivedFrom':
219 219
            $derivedFrom = $value;
220
            break;

220
            break;
221 221

  
222 222
          case 'collection':
223 223
            $sub_dl_groups = array();
224
            @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('code'), $value->code, NULL, 1);

224
            @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('code'), $value->code, NULL, 1);
225 225
            @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('codeStandard'),  $value->codeStandard, NULL, 2);
226 226
            @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('institute'), $value->institute, NULL, 3);
227 227
            @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('townOrLocation'), $value->townOrLocation, NULL, 4);
......
233 233
                    array('#markup' => $value->titleCache),
234 234
                    array('#theme' => 'description_list', '#groups' => $sub_dl_groups)
235 235
                )
236
            );

236
            );
237 237
            break;
238 238

  
239 239
            case 'storedUnder':
......
258 258
          case 'gatheringEvent':
259 259
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('collector'), $value->actor->titleCache);
260 260
            @_description_list_group_add($groups, t('Gathering time'), timePeriodToString($value->timeperiod));
261
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('description'), $value->description);

261
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('description'), $value->description);
262 262
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('locality'), $value->locality->text);
263 263
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('country'), $value->country->representation_L10n);
264 264
            @_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingMethod'), $value->collectingMethod);
......
275 275
            }
276 276
            if (isset($value->exactLocation)) {
277 277
              $sub_dl_groups = array();
278
              @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('errorRadius'), $value->exactLocation->errorRadius, ' m', 1);

278
              @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('errorRadius'), $value->exactLocation->errorRadius, ' m', 1);
279 279
              @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('longitude'), round($value->exactLocation->longitude, 7), '°', 2);
280 280
              @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('latitude'), round($value->exactLocation->latitude, 7), '°', 3);
281 281
              if (isset($value->exactLocation->referenceSystem)) {
282 282
                @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('referenceSystem'), $value->exactLocation->referenceSystem->representation_L10n, '', 4);
283 283
              }
284

  
285
              @_description_list_group_add($groups, cdm_occurrence_field_name_label('exactLocation'),

286
                  array(

287
                      array('#markup' => $value->exactLocation->sexagesimalString),

288
                      array(

289
                          '#theme' => 'description_list',

290
                          '#groups' => $sub_dl_groups

291
                      ),

284

  
285
              @_description_list_group_add($groups, cdm_occurrence_field_name_label('exactLocation'),
286
                  array(
287
                      array('#markup' => $value->exactLocation->sexagesimalString),
288
                      array(
289
                          '#theme' => 'description_list',
290
                          '#groups' => $sub_dl_groups
291
                      ),
292 292
                  )
293 293
              );
294
            }

295
            break;

296

  
294
            }
295
            break;
296

  
297 297
          default:
298 298
            if(is_object($value) || is_array($value)){
299
              drupal_set_message("Unhandled type in compose_cdm_specimenOrObservation() for field " . $field, "warning");

299
              drupal_set_message("Unhandled type in compose_cdm_specimenOrObservation() for field " . $field, "warning");
300 300
            } else {
301 301
              _description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value);
302 302
            }
303

  
304
        }

305

  
306
      }

303

  
304
        }
305

  
306
      }
307 307
    } // END of loop over $derivedUnitFacade fields
308 308

  
309 309

  
......
311 311
    uasort($groups, 'element_sort');
312 312

  
313 313
    $occurrence_elements = array(
314
        '#title' => $title,

315
        '#theme' => 'description_list',

314
        '#title' => $title,
315
        '#theme' => 'description_list',
316 316
        '#groups' => $groups,
317
        '#attributes' => array('class' => html_class_atttibute_ref($specimenOrObservation)),

317
        '#attributes' => array('class' => html_class_attribute_ref($specimenOrObservation)),
318 318
    );
319 319
    $derivatives[] = $occurrence_elements;
320 320
    // all footnotes which has been assembled so far (e.g. from typeDesignations) to here
7.x/modules/cdm_dataportal/includes/pages.inc
1 1
<?php
2
/**

3
 * @file

4
 * Page functions.

5
 *

6
 * @copyright

7
 *   (C) 2007-2012 EDIT

8
 *   European Distributed Institute of Taxonomy

9
 *   http://www.e-taxonomy.eu

10
 *

11
 *   The contents of this module are subject to the Mozilla

12
 *   Public License Version 1.1.

2
/**
3
 * @file
4
 * Page functions.
5
 *
6
 * @copyright
7
 *   (C) 2007-2012 EDIT
8
 *   European Distributed Institute of Taxonomy
9
 *   http://www.e-taxonomy.eu
10
 *
11
 *   The contents of this module are subject to the Mozilla
12
 *   Public License Version 1.1.
13 13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html
14 14
 *
15 15
 * @author
16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
17
 */
18

  
19

  
20
/**
21
 * Creates a render array representing the ocurrences associetad with the $taxon.
22
 *
23
 * The resulting render array contains two elements:
24
 *  - 'map': A map showing all point locations of the occurences is availabale
25
 *  - 'specimen_list': the list of occurences prepated as table for theme_table()
26
 *
27
 * @param object $taxon
28
 *   A cdm Taxon object
29
 * @return
30
 *   A render array suitable for drupal_render()
31
 *
17 32
 */
33
function cdm_dataportal_taxon_page_specimens($taxon) {
34

  
35
  $render_array = array();
36
  RenderHints::pushToRenderStack('taxon_page_specimens');
18 37

  
19

  
20
/**
21
 * Creates a render array representing the ocurrences associetad with the $taxon.
22
 *
23
 * The resulting render array contains two elements:
24
 *  - 'map': A map showing all point locations of the occurences is availabale
25
 *  - 'specimen_list': the list of occurences prepated as table for theme_table()
26
 *
27
 * @param object $taxon
28
 *   A cdm Taxon object
29
 * @return
30
 *   A render array suitable for drupal_render()
31
 *
32
 */
33
function cdm_dataportal_taxon_page_specimens($taxon) {
34

  
35
  $render_array = array();
36
  RenderHints::pushToRenderStack('taxon_page_specimens');
37

  
38
  $relationship_choice = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));
38
  $relationship_choice = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));
39 39
  $relationship_choice['direct'] = get_selection($relationship_choice['direct']);
40 40
  $relationship_choice['invers'] = get_selection($relationship_choice['invers']);
41 41

  
......
50 50

  
51 51
  $by_associatedtaxon_query = http_build_query($by_associatedtaxon_query_parameters);
52 52

  
53
  $pager = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON,

54
      null,

55
      $by_associatedtaxon_query . '&taxonUuid=' . $taxon->uuid

56
  );

53
  $pager = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON,
54
      null,
55
      $by_associatedtaxon_query . '&taxonUuid=' . $taxon->uuid
56
  );
57 57

  
58
  $specimensOrObservations = array();

59
  if(isset($pager->records[0])){

60
    $specimensOrObservations =  $pager->records;

58
  $specimensOrObservations = array();
59
  if(isset($pager->records[0])){
60
    $specimensOrObservations =  $pager->records;
61 61
  }
62 62

  
63 63
  // order occurrences by date but types should be on top of the list
......
71 71
      $other_occurrences[] = $occurrence;
72 72
    }
73 73
  }
74
  $specimensOrObservations = array_merge($type_specimens, $other_occurrences);

75

  
76
  // Collect media (fieldObjectMedia, derivedUnitMedia) and add as a custom field

77
  // $occurrence->_fieldObjectMedia

78
  foreach ($specimensOrObservations as &$occurrence) {

79
    $occurrence->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array(

80
        $occurrence->uuid,

81
        'fieldObjectMedia',

82
    ));

83
    $occurrence->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array(

84
        $occurrence->uuid,

85
        'derivedUnitMedia',

86
    ));

87
  }

88

  
89
  // --- get map service HTTP query paramaters

90
  if (count($specimensOrObservations) > 0) {

91
    $occurrence_query = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid,  $by_associatedtaxon_query);

92

  
93
    if( isset($occurrence_query->String) ) {

94
      $occurrence_query = $occurrence_query->String;

74
  $specimensOrObservations = array_merge($type_specimens, $other_occurrences);
75

  
76
  // Collect media (fieldObjectMedia, derivedUnitMedia) and add as a custom field
77
  // $occurrence->_fieldObjectMedia
78
  foreach ($specimensOrObservations as &$occurrence) {
79
    $occurrence->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array(
80
        $occurrence->uuid,
81
        'fieldObjectMedia',
82
    ));
83
    $occurrence->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array(
84
        $occurrence->uuid,
85
        'derivedUnitMedia',
86
    ));
87
  }
88

  
89
  // --- get map service HTTP query paramaters
90
  if (count($specimensOrObservations) > 0) {
91
    $occurrence_query = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid,  $by_associatedtaxon_query);
92

  
93
    if( isset($occurrence_query->String) ) {
94
      $occurrence_query = $occurrence_query->String;
95 95
      $legend_format_query = null;
96
      $distribution_query = NULL;

97

  
98
      $render_array['map'] = compose_map($occurrence_query, $distribution_query, $legend_format_query);

99
    }

100
  }

101

  
102
  // --- generate the specimen list as table

103
  $specimen_table = array(

104
      '#theme' => 'table',

105
      '#weight' => 2,

106
      // prefix attributes and rows with '#' to let it pass to the theme function,

107
      // otherwise it is handled as child render array

108
      '#attributes' => array('class' => 'specimens'),

109
      '#rows' => array(),

110
  );

111

  
112
  if ($specimensOrObservations) {

113

  
114
    foreach ($specimensOrObservations as $specimenOrObservation) {

115

  
116
      $mediaList = array();

117
      if (is_array($specimenOrObservation->_fieldObjectMedia)) {

118
        $mediaList = array_merge($mediaList, $specimenOrObservation->_fieldObjectMedia);

119
      }

120
      if (is_array($specimenOrObservation->_derivedUnitMedia)) {

121
        $mediaList = array_merge($mediaList, $specimenOrObservation->_derivedUnitMedia);

96
      $distribution_query = NULL;
97

  
98
      $render_array['map'] = compose_map($occurrence_query, $distribution_query, $legend_format_query);
99
    }
100
  }
101

  
102
  // --- generate the specimen list as table
103
  $specimen_table = array(
104
      '#theme' => 'table',
105
      '#weight' => 2,
106
      // prefix attributes and rows with '#' to let it pass to the theme function,
107
      // otherwise it is handled as child render array
108
      '#attributes' => array('class' => 'specimens'),
109
      '#rows' => array(),
110
  );
111

  
112
  if ($specimensOrObservations) {
113

  
114
    foreach ($specimensOrObservations as $specimenOrObservation) {
115

  
116
      $mediaList = array();
117
      if (is_array($specimenOrObservation->_fieldObjectMedia)) {
118
        $mediaList = array_merge($mediaList, $specimenOrObservation->_fieldObjectMedia);
119
      }
120
      if (is_array($specimenOrObservation->_derivedUnitMedia)) {
121
        $mediaList = array_merge($mediaList, $specimenOrObservation->_derivedUnitMedia);
122 122
      }
123 123

  
124 124
      // typelabel will contain the typeStatus
......
128 128
        $type_status = array();
129 129
        foreach ($typeDesignationPager->records as $typeDesignation) {
130 130
          if (isset($typeDesignation->typeStatus->representation_L10n)){
131
            $type_status[] = $typeDesignation->typeStatus->representation_L10n;

132
          }

133
        }

131
            $type_status[] = $typeDesignation->typeStatus->representation_L10n;
132
          }
133
        }
134 134
        $type_label = implode(', ', $type_status);
135 135
        if($type_label){
136 136
          $type_label .= ': ' ;
137
        }

138
      }

137
        }
138
      }
139 139

  
140 140
      // --- Specimen entry as dynamic label:
141 141
      //     -> Dynabox for the specimenOrObservation
142
      $gallery_name = $specimenOrObservation->uuid;

142
      $gallery_name = $specimenOrObservation->uuid;
143 143

  
144 144
      $derived_unit_ws_request = cdm_compose_url(CDM_WS_OCCURRENCE, array( $specimenOrObservation->uuid));
145
      $label_html = cdm_dynabox(

146
          $specimenOrObservation->uuid,

147
          $type_label . $specimenOrObservation->titleCache,

148
          $derived_unit_ws_request,

149
          'cdm_specimenOrObservation', // the theme or compose function to use

145
      $label_html = cdm_dynabox(
146
          $specimenOrObservation->uuid,
147
          $type_label . $specimenOrObservation->titleCache,
148
          $derived_unit_ws_request,
149
          'cdm_specimenOrObservation', // the theme or compose function to use
150 150
          'Click for details',
151
          array('div','div'),

151
          array('div','div'),
152 152
          array(),
153
          'function(){ jQuery(\'#media_gallery_' . $gallery_name . '\').hide(); }', // open_callback

154
          'function(){ jQuery(\'#media_gallery_' . $gallery_name . '\').show(); }' // close_callback

155
      );

156

  
157
      // --- Render associated media.

158
      $gallery_html = '';

159
      if (count($mediaList) > 0) {

160
        $gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);

161
        $captionElements = array(

162
            '#uri' => t('open media'),

163
        );

164

  
165
        $gallery_html = theme('cdm_media_gallerie', array(

166
            'mediaList' => $mediaList,

167
            'galleryName' => $gallery_name,

168
            'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],

169
            'cols' => $gallery_settings['cdm_dataportal_media_cols'],

170
            'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null,

171
            'captionElements' => $captionElements,

172
            'mediaLinkType' => 'LIGHTBOX',

173
            'alternativeMediaUri' => NULL,

174
            'galleryLinkUri' => NULL,

175
        ));

176
      }

177

  
178
      $specimen_table['#rows'][] = array(

179
          // An array of table rows. Every row is an array of cells, or an associative array

180
          'data' => array(

181
              // Each cell can be either a string or an associative array

182
              $label_html . $gallery_html

183
          ),

184
          'class' =>  array(

185
              'descriptionElement',

186
              'descriptionElement_IndividualsAssociation'

187
          ),

188
      );

189
    }

190
  }

191

  
153
          'function(){ jQuery(\'#media_gallery_' . $gallery_name . '\').hide(); }', // open_callback
154
          'function(){ jQuery(\'#media_gallery_' . $gallery_name . '\').show(); }' // close_callback
155
      );
156

  
157
      // --- Render associated media.
158
      $gallery_html = '';
159
      if (count($mediaList) > 0) {
160
        $gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);
161
        $captionElements = array(
162
            '#uri' => t('open media'),
163
        );
164

  
165
        $gallery_html = theme('cdm_media_gallerie', array(
166
            'mediaList' => $mediaList,
167
            'galleryName' => $gallery_name,
168
            'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
169
            'cols' => $gallery_settings['cdm_dataportal_media_cols'],
170
            'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null,
171
            'captionElements' => $captionElements,
172
            'mediaLinkType' => 'LIGHTBOX',
173
            'alternativeMediaUri' => NULL,
174
            'galleryLinkUri' => NULL,
175
        ));
176
      }
177

  
178
      $specimen_table['#rows'][] = array(
179
          // An array of table rows. Every row is an array of cells, or an associative array
180
          'data' => array(
181
              // Each cell can be either a string or an associative array
182
              $label_html . $gallery_html
183
          ),
184
          'class' =>  array(
185
              'descriptionElement',
186
              'descriptionElement_IndividualsAssociation'
187
          ),
188
      );
189
    }
190
  }
191

  
192 192
  $render_array['specimen_list'] = $specimen_table;
193 193
  $render_array['pager'] = markup_to_render_array(
194 194
      theme('cdm_pager', array(
......
197 197
          'parameters' => $_REQUEST,
198 198
      )),
199 199
      10 // weight
200
  );

201

  
202
  RenderHints::popFromRenderStack();

203
  return $render_array;

200
  );
201

  
202
  RenderHints::popFromRenderStack();
203
  return $render_array;
204 204
}
205 205

  
206 206

  
......
316 316
          )
317 317
      );
318 318

  
319
      // 5. put all disitribution data into the distribution feature node
319
      // 5. put all distribution data into the distribution feature node
320 320
      if($distribution_text_data //if text data exists
321 321
      || ($distribution_info_dto && isset($distribution_info_dto->tree) && $distribution_info_dto->tree->rootElement->numberOfChildren>0) // OR if tree element has distribution elements
322 322
      || ($distribution_info_dto && !empty($distribution_info_dto->elements))) {  // OR if DTO has distribution elements
......
530 530
    $render_array['taxon_profile_image'] = markup_to_render_array('<div id="taxonProfileImage" style="width:' . $taxon_profile_image_settings['maxextend'] . 'px">' . $profile_image. '</div>', -101);
531 531
  }
532 532

  
533
  $toc = array(
534
      '#theme' => 'item_list',
535
      '#items' => cdm_feature_node_toc_items($merged_tree->root->childNodes),
536
      '#title' => t('Content'),
537
      '#weight' => -100,
538
      '#suffix' => '</div>',
539
      '#prefix'=> '<div id="page-toc">'
540
  );
541
  $render_array['taxon_description_feature_toc'] = $toc; //markup_to_render_array($toc_html);
542 533

  
543 534
  // Render the sections for each feature
544 535
  $render_array['taxon_description_features'] = markup_to_render_array(
......
548 539
      )
549 540
  );
550 541

  
542
  $toc = array(
543
    '#theme' => 'item_list',
544
    '#items' => cdm_feature_node_toc_items($merged_tree->root->childNodes),
545
    '#title' => t('Content'),
546
    '#weight' => -100,                  // move to the top
547
    '#suffix' => '</div>',
548
    '#prefix'=> '<div id="page-toc">'
549
  );
550
  $render_array['taxon_description_feature_toc'] = $toc; //markup_to_render_array($toc_html);
551

  
552

  
553
  if(variable_get(BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE, 1) == 1){
554
    $bibliography_block = feature_block(t('Bibliography'));
555
    $bibliography_block->content = FootnoteManager::renderFootnoteList('BIBLIOGRAPHY');
556
    $render_array['taxon_description_bibliography'] =  markup_to_render_array(
557
      theme('block',
558
        array(
559
          'elements' => array(
560
            '#block' => $bibliography_block,
561
            '#children' => $bibliography_block->content,
562
          )
563
        )
564
      ),
565
      100 // weight
566
    );
567
    $render_array['taxon_description_feature_toc']['#items'][] = toc_list_item('Bibliography', array('class' => 'bibliography'));
568
  }
569

  
570

  
551 571
  return $render_array;
552 572
}
553 573

  
......
609 629
        }
610 630
      }
611 631
    }
612
  }

632
  }
613 633
}
614 634

  
615 635

  
......
634 654

  
635 655
    $variables['element']['#link'] = $link;
636 656
  }
637
}
657
}
7.x/modules/cdm_dataportal/settings.php
29 29
}
30 30
define('ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT', serialize($annotationTypeKeys));
31 31

  
32
define('BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE', 'bibliography_for_original_source');
33

  
32 34
/* taxonRelationshipTypes */
33 35
define('CDM_TAXON_RELATIONSHIP_TYPES_DEFAULT', serialize(array(UUID_MISAPPLIED_NAME_FOR, UUID_INVALID_DESIGNATION_FOR)));
34 36

  
35 37

  
36 38

  
37 39
/* ---- MAP SETTING CONSTANTS ---- */
38
/**

39
 * @var array of URIs eg. http://edit.africamuseum.be"

40
 *   An options array

40
/**
41
 * @var array of URIs eg. http://edit.africamuseum.be"
42
 *   An options array
41 43
 */
42 44
define('EDIT_MAPSERVER_URI', serialize(
43 45
    array(
......
51 53
 * @var array of versions eg. "v1.2"
52 54
 *   An options array
53 55
 */
54
define('EDIT_MAPSERVER_VERSION', serialize(

56
define('EDIT_MAPSERVER_VERSION', serialize(
55 57
    array(
56 58
      'v1' => 'v1' ,
57 59
      'v1.1' => 'v1.1',
......
59 61
      'v1.2' => 'v1.2',
60 62
      'v1.3_dev' => 'v1.3_dev',
61 63
      'v1.4_dev' => 'v1.4_dev'
62
    )

64
    )
63 65
  )
64 66
);
65 67
define('EDIT_MAPSERVER_URI_DEFAULT', 'http://edit.africamuseum.be');
......
127 129

  
128 130
define('CDM_PART_DEFINITIONS', 'cdm-part-definitions');
129 131
define('CDM_PART_DEFINITIONS_DEFAULT', serialize(
130
  array(

131
      'ZoologicalName' => array(

132
  array(
133
      'ZoologicalName' => array(
132 134
        'namePart' => array('name' => TRUE),
133
        'nameAuthorPart' => array('name' => TRUE),

134
        'referencePart' => array('authors' => TRUE),

135
        'microreferencePart' => array('microreference' => TRUE),

136
        'statusPart' => array('status' => TRUE),

137
        'descriptionPart' => array('description' => TRUE),

138
      ),

135
        'nameAuthorPart' => array('name' => TRUE),
136
        'referencePart' => array('authors' => TRUE),
137
        'microreferencePart' => array('microreference' => TRUE),
138
        'statusPart' => array('status' => TRUE),
139
        'descriptionPart' => array('description' => TRUE),
140
      ),
139 141
      'BotanicalName'=> array(
140 142
        'namePart' => array('name' => TRUE),
141 143
        'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE),
......
143 145
        'referenceYearPart' => array('reference.year' => TRUE),
144 146
        'statusPart' => array('status' => TRUE),
145 147
        'descriptionPart' => array('description' => TRUE),
146
      ),

147
     '#DEFAULT' => array(

148
        'namePart' => array(

149
            'name' => TRUE

148
      ),
149
     '#DEFAULT' => array(
150
        'namePart' => array(
151
            'name' => TRUE
150 152
        ),
151 153
        'nameAuthorPart' => array(
152 154
            'name' => TRUE,
153 155
            'authors' => TRUE
154
        ),

155
        'referencePart' => array(

156
            'reference' => TRUE

157
        ),

158
        'microreferencePart' => array(

159
            'microreference' => TRUE,

160
        ),

161
        'statusPart' => array(

162
            'status' => TRUE,

163
        ),

164
        'descriptionPart' => array(

165
            'description' => TRUE,

166
        ),

167
      )

156
        ),
157
        'referencePart' => array(
158
            'reference' => TRUE
159
        ),
160
        'microreferencePart' => array(
161
            'microreference' => TRUE,
162
        ),
163
        'statusPart' => array(
164
            'status' => TRUE,
165
        ),
166
        'descriptionPart' => array(
167
            'description' => TRUE,
168
        ),
169
      )
168 170
    )
169 171
  )
170 172
);
171
define('CDM_NAME_RENDER_TEMPLATES', 'cdm-name-render-templates');

173
define('CDM_NAME_RENDER_TEMPLATES', 'cdm-name-render-templates');
172 174
define('CDM_NAME_RENDER_TEMPLATES_DEFAULT', serialize(
173
   array (

175
   array (
174 176
     'taxon_page_title,polytomousKey'=> array(
175 177
          'namePart' => array('#uri' => TRUE),
176 178
        ),
......
191 193
      '#DEFAULT' => array(
192 194
          'nameAuthorPart' => array('#uri' => TRUE),
193 195
          'referencePart' => TRUE,
194
       )

196
       )
195 197
    )
196 198
));
197 199

  
......
720 722
      '#description' => 'Check one or more MarkerTypes to define the "hide marked area" filter .',
721 723
  );
722 724

  
723
  $form['aggregation'] = array(

724
      '#type' => 'fieldset',

725
      '#title' => t('Aggregation of data'),

726
      '#collapsible' => FALSE,

725
  $form['aggregation'] = array(
726
      '#type' => 'fieldset',
727
      '#title' => t('Aggregation of data'),
728
      '#collapsible' => FALSE,
727 729
      '#description' => 'This section covers the different aspects of aggregating information.
728 730
          <p>
729
          </p>',

731
          </p>',
730 732
  );
731 733

  
732 734
  $form['aggregation'][CDM_TAXON_MEDIA_FILTER] = array(
......
746 748
          want to make use of the caching capabilities of the dataportal.',
747 749
  );
748 750

  
749
  $form['aggregation']['media_aggregation'] = array(

750
      '#type' => 'fieldset',

751
      '#title' => t('Media aggregation'),

752
      '#collapsible' => FALSE,

751
  $form['aggregation']['media_aggregation'] = array(
752
      '#type' => 'fieldset',
753
      '#title' => t('Media aggregation'),
754
      '#collapsible' => FALSE,
753 755
      '#collapsed' => TRUE,
754
      '#description' => t("The media aggregation is also affected by the settigs in \"<strong>Aggregation via taxon relationsships</strong>\" below."),

755

  
756
      '#description' => t("The media aggregation is also affected by the settigs in \"<strong>Aggregation via taxon relationsships</strong>\" below."),
757

  
756 758
  );
757
  $form['aggregation']['media_aggregation']['cdm_images_include_children'] = array(
758
      '#type' => 'select',
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff