Project

General

Profile

« Previous | Next » 

Revision df2eb131

Added by Andreas Kohlbecker about 4 years ago

ref #8771 unit test for significant figures of statistical values

View differences:

modules/cdm_dataportal/cdm_dataportal.module
2544 2544
}
2545 2545

  
2546 2546
/**
2547
 * Composes an HTML element class attribute value composed of
2548
 * the short-name of the cdm class and the uuid of the entity.
2549
 * This class attribute should be used wherever an cdm-entity is rendered.
2550
 *
2551
 * In case of Taxon entities or TaxonNodeDTOs the secReference is also added
2552
 * to the class attributes as 'sec_uuid:<uuid>'. In case of TaxonNodeDTOs the
2553
 * Taxon uuid is added also as taxon_uuid:<uuid>
2554
 *
2555
 * These according class selectors in css must be escaped, eg:
2556
 *    .cdm\:TextData
2557
 *
2558
 * @param $cdm_entity
2559
 *    A CDM entity, TaxonNodeDTO or TypedEntityReference
2560
 */
2561
function html_class_attribute_ref($cdm_entity) {
2562

  
2563
  $attributes = '';
2564
  if (is_cdm_entity($cdm_entity)) {
2565
    $attributes =  "cdm:" . $cdm_entity->class . " uuid:" . $cdm_entity->uuid;
2566
  } else if($cdm_entity->class == 'TypedEntityReference') {
2567
    $attributes =  "cdm:" . $cdm_entity->type . " uuid:" . $cdm_entity->uuid;
2568
  }
2569
  if($cdm_entity->class == 'TaxonNodeDto'){
2570
    $attributes .= " taxon_uuid:"  . $cdm_entity->taxonUuid . " sec_uuid:"  . $cdm_entity->secUuid;;
2571
  }
2572
  if($cdm_entity->class == 'Taxon' && isset($cdm_entity->sec->uuid)){
2573
    $attributes .= " sec_uuid:"  . $cdm_entity->sec->uuid;
2574
  }
2575
  return $attributes;
2576
}
2577

  
2578

  
2579
/**
2580 2547
 * Creates a short version of a taxonname.
2581 2548
 *
2582 2549
 * The short name is created by using the taggedTitle field of
modules/cdm_dataportal/includes/common.inc
30 30
 * @}
31 31
 */
32 32

  
33

  
34
/**
35
 * Composes an HTML element class attribute value composed of
36
 * the short-name of the cdm class and the uuid of the entity.
37
 * This class attribute should be used wherever an cdm-entity is rendered.
38
 *
39
 * In case of Taxon entities or TaxonNodeDTOs the secReference is also added
40
 * to the class attributes as 'sec_uuid:<uuid>'. In case of TaxonNodeDTOs the
41
 * Taxon uuid is added also as taxon_uuid:<uuid>
42
 *
43
 * These according class selectors in css must be escaped, eg:
44
 *    .cdm\:TextData
45
 *
46
 * @param $cdm_entity
47
 *    A CDM entity, TaxonNodeDTO or TypedEntityReference
48
 */
49
function html_class_attribute_ref($cdm_entity) {
50

  
51
  $attributes = '';
52
  if (is_cdm_entity($cdm_entity)) {
53
    $attributes =  "cdm:" . $cdm_entity->class . " uuid:" . $cdm_entity->uuid;
54
  } elseif (isset($cdm_entity->class)) {
55
    switch ($cdm_entity->class){
56
      case 'TypedEntityReference':
57
        $attributes =  "cdm:" . $cdm_entity->type . " uuid:" . $cdm_entity->uuid;
58
      break;
59
      case 'TaxonNodeDto':
60
        $attributes .= " taxon_uuid:"  . $cdm_entity->taxonUuid . " sec_uuid:"  . $cdm_entity->secUuid;;
61
      break;
62
      case 'Taxon':
63
        if(isset($cdm_entity->sec->uuid)){
64
        $attributes .= " sec_uuid:"  . $cdm_entity->sec->uuid;
65
      }
66
      break;
67
    }
68
  }
69

  
70
  return $attributes;
71
}
72

  
73

  
33 74
/**
34 75
 * Compose an render array from a CDM Marker object.
35 76
 *
......
263 304
 */
264 305
function statistical_values($stat_vals_arr, $unit = '') {
265 306

  
266
  static $xbar_equals = 'x&#x304='; // x&#x304 is x-bar
307
  static $xbar_equals = 'x&#772;='; // x&#772; is x-bar (http://www.personal.psu.edu/ejp10/blogs/gotunicode/2010/03/dealing-with-x-bar-x-and-p-hat.html)
267 308

  
268 309
  $min_max_markup = '';
269 310
  $other_vals_array = [];
......
350 391
    }
351 392
  }
352 393

  
353
  if(!$min_max_markup && $other_vals_array['Average']){
394
  if(!$min_max_markup && !empty($other_vals_array['Average'])){
354 395
    // this could be the case in which we only have one value for Average
355 396
    // this trivial case needs to be displayed a simpler way
356 397
    $min_max_markup = str_replace($xbar_equals, '' ,$other_vals_array['Average']);
......
494 535
 */
495 536
function compose_cdm_taxon_expert($taxon_node_agent_relation) {
496 537

  
538
  $agent_details = null;
539

  
497 540
  $label_suffix = ':';
498 541

  
499 542
  if($taxon_node_agent_relation->class == 'DefaultPagerImpl'){
......
730 773
}
731 774

  
732 775
function formatParams($params) {
776
    $paramString = null;
733 777
    if (is_array($params)){
734 778
        $keys =array_keys($params);
735 779
        $paramString = '';
......
743 787
}
744 788

  
745 789
function formatWSParams($params) {
790
  $paramString = null;
746 791
    if (is_array($params)){
747 792
        $keys =array_keys($params);
748 793
        $paramString = '';

Also available in: Unified diff