Project

General

Profile

Revision 72d57201

ID72d57201d9c9b557895fd7ede7a277f84d1d9b76
Parent fb308159
Child b90ef618

Added by Katja Luther over 1 year ago

ref #8182: specimen tree is collapsable, blast result table with clickable details

View differences:

modules/cdm_dataportal/includes/pages.inc
159 159
        );
160 160
    }
161 161
    else if(variable_get('cdm_dataportal_specimen_derivate_tree')){
162

  
163
        $expand_icon = font_awesome_icon_markup(
164
            'fa-plus-square-o',
165
            array(
166
                'alt' => 'Show details',
167
                'class' => array('expand_icon')
168
            )
169
        );
170
        $collapse_icon = font_awesome_icon_markup(
171
            'fa-minus-square-o',
172
            array(
173
                'alt' => 'Show details',
174
                'class' => array('collapse_icon')
175
            )
176
        );
177
        $tableId = "specimen_tree_table";
162 178
        $specimen_table = array(
163 179
            '#theme' => 'table',
164 180
            '#weight' => 2,
165 181
            // prefix attributes and rows with '#' to let it pass toF the theme function,
166 182
            // otherwise it is handled as child render array
167
            '#attributes' => array('class' => 'specimens'),
183
            '#attributes' => array('class' => 'specimens',
184
                                    'id' => $tableId),
168 185
            '#rows' => array(),
169 186
        );
170 187
        $specimen_array = compose_specimen_array($specimensOrObservations);
171

  
188
        $rowcount = 0;
172 189
        foreach($specimen_array as $value){
173 190
            $renderArray = array(
174 191
                '#theme' => 'item_list',
175
                '#items' => array($value),
192
                '#items' => $value['children'],
176 193
                '#type' => 'ul');
177 194
            $output = drupal_render($renderArray);
178
//            $specimen_table['#rows'][] = array(
179
//                // An array of table rows. collabsible row
180
//                'data' => "",
181
//                'class' => array('expand_column')
182
//            );
195

  
183 196
            $specimen_table['#rows'][] = array(
184
                // An array of table rows. Every row is an array of cells, or an associative array
185
                'data' => array($output),
186
                'class' =>  array(
187
                    'descriptionElement',
188
                    'descriptionElement_IndividualsAssociation'
189
                ),
190
            );
197
                'data' =>array(
198
                    array(
199
                        'data' => $expand_icon . $collapse_icon,
200
                        'class' => array('summary_row_cell', 'summary_row_icon', 'expand_column')
201
                    ),
202
                    $value['data']),
191 203

  
204
                'id' => 'label' . $rowcount, // summary row id
205
                'class' => array('summary_row'),
206
            );
207
            $specimen_table['#rows'][] = array(
208
                'data' =>  array(
209
                        array(
210
                            'data' => "", //empty first column
211
                            'class' => array('expand_column')
212
                        ),
213
                        array(
214
                        'data' => $output
215

  
216
                        )
217
                    ),
218
                    'class' =>  array('detail_row')
219
//                'class' =>  array(
220
//                    'descriptionElement',
221
//                    'descriptionElement_IndividualsAssociation'
222
 //               ),
223
            );
224
            $rowcount++;
192 225

  
193 226
        }
227
        drupal_add_js_rowToggle("#".$tableId);
194 228

  
195 229
        $render_array['specimen_list'] = $specimen_table;
196 230

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)