Project

General

Profile

Revision 7965ef92

ID7965ef9295704bdd6dee088aeabe6363063618d3
Parent 267da0d1
Child d3f77ada

Added by Katja Luther about 2 years ago

add item list to table resolves the problem of rendering the description items

View differences:

modules/cdm_dataportal/includes/occurrences.inc
834 834
    $children = array();
835 835
    //we need one more item to contain the items of one level (fieldunit, derivate data etc.)
836 836
    foreach ($specimenOrObservations as &$specimenOrObservation) {
837
        $items['data'] = $specimenOrObservation->titleCache;
837
        $items['data'] = $specimenOrObservation->listLabel;
838 838
        $specimen = create_cdm_specimen_or_observation($specimenOrObservation);
839 839
        $children = array();
840 840
        $child = array();
......
878 878
            'type',
879 879
            'derivationEvent',
880 880
            'taxonRelatedDerivedUnits',
881
            'label',
881 882
            'titleCache',
883
            'listLabel',
882 884
            'protectedTitleCache',
883 885
            'derivedUnitMedia',
884 886
            'created',
......
916 918
        }
917 919

  
918 920
        $title = $type_label . ': ' . $specimenOrObservation->titleCache;
919
        $items['data'] = title;
921
        $items['data'] = $title;
920 922

  
921 923
        $groups = array();
922 924
        $items['children'] = $groups;
......
933 935
//                }
934 936
//                break;
935 937
                    /* ---- java.lang.Object --- */
936
                    case 'class':
937
                        if ($value != '' /* FieldUnit' */) {
938
                        //    @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value);
939
                        }
940

  
941
                        break;
942 938

  
943 939
                    case 'markers':
944 940
                       /* $dd_elements = array();
......
973 969

  
974 970
                    case 'preferredStableUri':
975 971

  
976
                       // @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), array(array('#markup' => cdm_external_uri($value, false))));
972
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), array(array('#markup' => cdm_external_uri($value, false))));
977 973
                        break;
978 974

  
979 975
                    case 'specimenTypeDesignations':
......
1014 1010
                                $dd_elements[$weight] = $taxon_html;
1015 1011
                            }
1016 1012
                            if (isset($determinationEvent->modifier)) {
1017
                                $dd_elements[$weight] .= cdm_term_representation($determinationEvent->modifier);
1018 1013
                            }
1019 1014
                            if ($timeperiod_string) {
1020 1015
                                $dd_elements[$weight] .= $glue . $timeperiod_string;
......
1031 1026
                        */
1032 1027
                        break;
1033 1028

  
1034
                    case 'descriptions':
1035
                        /*
1036
                        $occurrence_featureTree = cdm_get_occurrence_featureTree();
1037
                        $dd_elements = array();
1038

  
1039
                        foreach ($value as $description) {
1040
                            $description = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION, $description->uuid);
1041
//               if($description->imageGallery == TRUE) {
1042
//                 continue;
1043
//               }
1044
                            $elements_by_feature = _mergeFeatureTreeDescriptions($occurrence_featureTree->root->childNodes, $description->elements);
1045
                            $description_render_elements = _block_get_renderable_array(make_feature_block_list($elements_by_feature, null));
1046
                            $dd_elements[] = $description_render_elements;
1047
                            if ($description->isImageGallery) {
1048
                                $mediaList = array();
1049
                                if (is_array($description->elements)) {
1050
                                    $mediaList = $description->elements;
1051
                                }
1052
                                $gallery_html = '';
1053
                                if (count($mediaList) > 0) {
1054
                                    $gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);
1055
                                    $captionElements = array(
1056
                                        '#uri' => t('open media'),
1057
                                    );
1058

  
1059
                                    $gallery_html = compose_cdm_media_gallerie(array(
1060
                                        'mediaList' => $mediaList,
1061
                                        'galleryName' => $gallery_name,
1062
                                        'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
1063
                                        'cols' => $gallery_settings['cdm_dataportal_media_cols'],
1064
                                        'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null,
1065
                                        'captionElements' => $captionElements,
1066
                                        'mediaLinkType' => 'LIGHTBOX',
1067
                                        'alternativeMediaUri' => NULL,
1068
                                        'galleryLinkUri' => NULL,
1069
                                    ));
1070
                                }
1071

  
1072
                            }
1073
                        }
1074

  
1075
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
1076
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $gallery_html);
1077
                        */
1078
                        break;
1029
                    case 'listOfMedia':
1030
                        $gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);
1031
                        $captionElements = array(
1032
                            '#uri' => t('open media'),
1033
                        );
1034
                        $gallery_html = compose_cdm_media_gallerie(array(
1035
                            'mediaList' => $value,
1036
                            'galleryName' => $specimenOrObservation->label,
1037
                            'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
1038
                            'cols' => $gallery_settings['cdm_dataportal_media_cols'],
1039
                            'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null,
1040
                            'captionElements' => $captionElements,
1041
                            'mediaLinkType' => 'LIGHTBOX',
1042
                            'alternativeMediaUri' => NULL,
1043
                            'galleryLinkUri' => NULL,
1044
                        ));
1045

  
1046
                         @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $gallery_html);
1047
                         break;
1079 1048

  
1080 1049
                    case 'sources':
1081 1050
                        /*
......
1092 1061

  
1093 1062

  
1094 1063
                    case 'collection':
1095
                        /*
1064

  
1096 1065
                        $sub_dl_groups = array();
1097 1066
                        @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('code'), $value->code, NULL, 1);
1098 1067
                        @_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('codeStandard'), $value->codeStandard, NULL, 2);
......
1107 1076
                                array('#theme' => 'description_list', '#groups' => $sub_dl_groups)
1108 1077
                            )
1109 1078
                        );
1110
                        */
1079

  
1111 1080
                        break;
1112 1081

  
1113 1082
                    case 'storedUnder':
modules/cdm_dataportal/includes/pages.inc
76 76
    $specimensOrObservations = array_merge($type_specimens, $other_occurrences);
77 77

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

  
91 91
    // --- get map service HTTP query parameters
92 92

  
......
119 119

  
120 120
    // -------------------------------------------------------
121 121
    $render_array['map'] = $map_render_array;
122
    $cdm_dataportal_list_view = true;
122
    $cdm_dataportal_list_view = false;
123 123
    if(variable_get('cdm_dataportal_compressed_specimen_derivate_table')){
124 124

  
125 125
        //COMPRESSED SPECIMEN DERIVATE TABLE
......
153 153
        );
154 154
    }
155 155
    else if($cdm_dataportal_list_view){
156
        $specimen_table = array(
157
            '#theme' => 'table',
158
            '#weight' => 2,
159
            // prefix attributes and rows with '#' to let it pass toF the theme function,
160
            // otherwise it is handled as child render array
161
            '#attributes' => array('class' => 'specimens'),
162
            '#rows' => array(),
163
        );
156 164
        $specimen_array = create_specimen_array($specimensOrObservations);
157
        $render_array['specimen_list'] = array('#theme'=>'item_list', '#items'=>$specimen_array, '#type'=>'ul');
165

  
166
        foreach($specimen_array as $value){
167
            $renderArray = array(
168
                '#theme' => 'item_list',
169
                '#items' => array($value),
170
                '#type' => 'ul');
171
            $output = drupal_render($renderArray);
172
            $specimen_table['#rows'][] = array(
173
                // An array of table rows. Every row is an array of cells, or an associative array
174
                'data' => array($output),
175
                'class' =>  array(
176
                    'descriptionElement',
177
                    'descriptionElement_IndividualsAssociation'
178
                ),
179
            );
180
        }
181

  
182
        $render_array['specimen_list'] = $specimen_table;
158 183
      //  $render_array['specimen_list'] = $specimen_array;
159 184

  
160 185
    }
......
282 307
            10 // weight
283 308
        );
284 309
    }
310
    $render_array['pager'] = markup_to_render_array(
311
        theme('cdm_pager', array(
312
            'pager' => $pager,
313
            'path' => $_REQUEST['q'],
314
            'parameters' => $_REQUEST,
315
        )),
316
        10 // weight
317
    );
285 318
    RenderHints::popFromRenderStack();
286 319
    return $render_array;
287 320
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)