Project

General

Profile

« Previous | Next » 

Revision 34dd7be9

Added by Andreas Kohlbecker about 11 years ago

paging for specimens implemented, common pager functions modified also for taxon search

View differences:

7.x/modules/cdm_dataportal/cdm_dataportal.module
1477 1477
  return theme('cdm_search_results', array(
1478 1478
    'pager' => $taxonPager,
1479 1479
    'path' => 'cdm_dataportal/search/results/taxon',
1480
    'query_parameters' => $_REQUEST,
1481 1480
    ));
1482 1481
}
1483 1482

  
7.x/modules/cdm_dataportal/cdm_dataportal.search.php
431 431

  
432 432
  $form_params = array();
433 433

  
434
  if (is_array($_REQUEST['search'])) {
434
  if (isset($_REQUEST['search']) && is_array($_REQUEST['search'])) {
435 435
    array_deep_copy($_REQUEST['search'], $form_params);
436 436
  }
437

  
438
  if (isset($_REQUEST['pager']) && is_array($_REQUEST['pager'])) {
439
    $form_params = array_merge($form_params, $_REQUEST['pager']);
440
  }
441

  
437 442
  $form_params['query'] = trim($_REQUEST['query']);
438 443

  
439 444
  // --- handle geographic range
7.x/modules/cdm_dataportal/includes/pages.inc
39 39
  $relationship_choice['direct'] = get_selection($relationship_choice['direct']);
40 40
  $relationship_choice['invers'] = get_selection($relationship_choice['invers']);
41 41

  
42
  $by_associatedtaxon_query = http_build_query(array(
43
      'relationshipsInvers' => implode(',', $relationship_choice['invers']),
44
      'relationships' => implode(',', $relationship_choice['direct']),
45
      'pageSize' => null // all hits in one page
46
      )
47
    );
42
  $by_associatedtaxon_query_parameters = array(
43
      'relationshipsInvers' => implode(',', $relationship_choice['invers']),
44
      'relationships' => implode(',', $relationship_choice['direct']),
45
  );
46

  
47
  if (isset($_REQUEST['pager']) && is_array($_REQUEST['pager'])) {
48
    $by_associatedtaxon_query_parameters = array_merge($by_associatedtaxon_query_parameters, $_REQUEST['pager']);
49
  }
50

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

  
49 53
  $pager = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON,
50 54
      null,
......
192 196
    }
193 197
  }
194 198

  
195
  $render_array['specimen_list'] = $specimen_table;
199
  $render_array['specimen_list'] = $specimen_table;
200
  $render_array['pager'] = markup_to_render_array(
201
      theme('cdm_pager', array(
202
          'pager' => $pager,
203
          'path' => $_REQUEST['q'],
204
          'parameters' => $_REQUEST,
205
      )),
206
      10 // weight
207
  );
196 208

  
197 209
  RenderHints::popFromRenderStack();
198 210
  return $render_array;
7.x/modules/cdm_dataportal/theme/cdm_dataportal.common.theme
443 443
  $path = $variables['path'];
444 444
  $parameters = $variables['parameters'];
445 445
  $attributes = $variables['attributes'];
446

  
446 447
  $out = '';
447
  $parameters['search']['pageNumber'] = $linkIndex;
448
  $parameters['pager']['pageNumber'] = $linkIndex;
448 449
  if ($linkIndex == $pager->currentIndex) {
449 450
    $out = '<strong>' . $text . '</strong>';
450 451
  }
7.x/modules/cdm_dataportal/theme/cdm_dataportal.page.theme
182 182
                "The 'FeatureTree' for the generation of natural language representations is not configured correctly,"
183 183
                ." please select a 'FeatureTree' in the !settings",
184 184
                array(
185
              		'!settings' => l(t('CDM Dataportal Settings'), 'admin/config/cdm_dataportal/layout/taxon'))
186
              		),
187
              	'warning');
185
                  '!settings' => l(t('CDM Dataportal Settings'), 'admin/config/cdm_dataportal/layout/taxon'))
186
                  ),
187
                'warning');
188 188
            } else {
189 189
              $taxonDescription->elements = NULL;
190 190
              $taxonDescription->elements = array(
......
367 367
    $special_annotations_array[] = $taxon->name;
368 368
    $special_annotations_array[] = $taxon;
369 369
    $accepted_name .= theme('cdm_annotations_as_footnotekeys', array(
370
    		'cdmBase_list' => $special_annotations_array,
371
    		'footnote_list_key' => RenderHints::getRenderPath() . '-annotations')
372
    	);
370
        'cdmBase_list' => $special_annotations_array,
371
        'footnote_list_key' => RenderHints::getRenderPath() . '-annotations')
372
      );
373 373
  }
374 374

  
375 375
  // --- Render homotypic synonymy group
......
422 422
 *     objects (currently this function can only handle taxon instances =>
423 423
 *     TODO)
424 424
 *   - path: The target path for the pager links, this will usually point to
425
 *     'cdm_dataportal/search/results/taxon'.
426
 *   - query_parameters: The query parameters to be used in the pager links.
425
 *     'cdm_dataportal/search/results/taxon'
427 426
 *
428 427
 * @ingroup themeable
429 428
 */
430 429
function theme_cdm_search_results($variables) {
431 430
  $pager = $variables['pager'];
432
  $path = $variables['path'];
433
  $query_parameters = $variables['query_parameters'];
434
  $freetextSearchResults = array();
431
  $path = $variables['path'];
432

  
433
  $freetextSearchResults = array();
434

  
435 435
  // The $query_parameters must not contain the 'q' parameter
436 436
  // since this would conflict with the desired target $path.
437 437
  // unset($search_params['q']);
......
486 486
    $out .= theme('cdm_pager', array(
487 487
        'pager' => $pager,
488 488
        'path' => $path,
489
        'parameters' => $query_parameters,
489
        'parameters' => $_REQUEST,
490 490
    ));
491 491
  }
492 492
  else {
7.x/modules/cdm_dataportal/theme/theme_registry.inc
235 235
      // Themes in cdm_dataportal.taxon.theme.
236 236
      'cdm_search_results' => array('variables' => array(
237 237
          'pager' => NULL,
238
          'path' => NULL,
239
          'query_parameters' => NULL,
238
          'path' => NULL
240 239
      )),
241 240
      'cdm_taxonRelationships' => array('variables' => array('taxonRelationships' => NULL, 'focusedTaxon' => NULL)),
242 241
      'cdm_acceptedFor' => array('variables' => array()),
7.x/themes/palmweb_2/template.php
388 388
function palmweb_2_cdm_search_results($variables){
389 389
  $pager = $variables['pager'];
390 390
  $path = $variables['path'];
391
  $query_parameters = $variables['query_parameters'];
392 391
  $out = '';
393 392

  
394 393
  $showThumbnails = isset($_SESSION['pageoption']['searchtaxa']['showThumbnails']) ? $_SESSION['pageoption']['searchtaxa']['showThumbnails'] : 0;
......
437 436
    $out .= theme('cdm_pager', array(
438 437
      'pager' => $pager,
439 438
      'path' => $path,
440
      'parameters' => $query_parameters,
439
      'parameters' => $_REQUEST,
441 440
    ));
442 441
  }
443 442
  else {

Also available in: Unified diff