Revision b94b1aec
Added by Andreas Kohlbecker about 4 years ago
modules/cdm_dataportal/includes/common.inc | ||
---|---|---|
274 | 274 |
function statistical_values_array() { |
275 | 275 |
|
276 | 276 |
$min_max = [ |
277 |
'ExactValue' => NULL, |
|
277 | 278 |
'Min' => NULL, |
278 | 279 |
'TypicalLowerBoundary' => NULL, |
279 | 280 |
'TypicalUpperBoundary' => NULL, |
... | ... | |
281 | 282 |
'SampleSize' => NULL, |
282 | 283 |
'Average' => NULL, |
283 | 284 |
'Variance' => NULL, |
284 |
'StandardDeviation' => NULL, |
|
285 |
'ExactValue' => NULL |
|
285 |
'StandardDeviation' => NULL |
|
286 | 286 |
]; |
287 | 287 |
return $min_max; |
288 | 288 |
} |
... | ... | |
307 | 307 |
|
308 | 308 |
static $xbar_equals = 'x̄='; // x̄ is x-bar (http://www.personal.psu.edu/ejp10/blogs/gotunicode/2010/03/dealing-with-x-bar-x-and-p-hat.html) |
309 | 309 |
|
310 |
$exact_markup = ''; |
|
310 | 311 |
$min_max_markup = ''; |
311 | 312 |
$other_vals_array = []; |
312 | 313 |
|
313 |
if(statistical_values_is_numeric($stat_vals_arr['ExactValue'])){ |
|
314 |
// ExactValue has just been introduces as new statistical measure |
|
315 |
// --> translating ExactValue to TypicalLowerBoundary |
|
316 |
// TODO this is only a quick temporary solution which should be sofisticated |
|
317 |
$stat_vals_arr['TypicalLowerBoundary'] = $stat_vals_arr['ExactValue']; |
|
318 |
unset($stat_vals_arr['ExactValue']); |
|
319 |
} |
|
320 |
|
|
321 | 314 |
// --- sanitize values |
322 | 315 |
if(statistical_values_num_equals($stat_vals_arr, 'Min', 'TypicalLowerBoundary')){ |
323 | 316 |
$stat_vals_arr['Min'] = NULL; |
... | ... | |
378 | 371 |
|
379 | 372 |
if ($val_markup) { |
380 | 373 |
switch ($key) { |
374 |
case 'ExactValue': |
|
375 |
$exact_markup = $val_markup; |
|
376 |
break; |
|
381 | 377 |
// ---- min_max_element |
382 | 378 |
case 'Min': |
383 | 379 |
$min_max_markup .= "($val_markup–)"; |
... | ... | |
409 | 405 |
} |
410 | 406 |
} |
411 | 407 |
|
412 |
if(!$min_max_markup && !empty($other_vals_array['Average'])){ |
|
408 |
$full_markup = $exact_markup . ($exact_markup ? ' ' : '') . $min_max_markup; |
|
409 |
|
|
410 |
if(!$full_markup && !empty($other_vals_array['Average'])){ |
|
413 | 411 |
// this could be the case in which we only have one value for Average |
414 | 412 |
// this trivial case needs to be displayed a simpler way |
415 |
$min_max_markup = str_replace($xbar_equals, '' , $other_vals_array['Average']);
|
|
413 |
$full_markup = str_replace($xbar_equals, '' , $other_vals_array['Average']);
|
|
416 | 414 |
unset($other_vals_array['Average']); |
417 | 415 |
} |
418 | 416 |
if($unit){ |
419 |
$min_max_markup .= ' ' . $unit;
|
|
417 |
$full_markup .= ' ' . $unit;
|
|
420 | 418 |
} |
421 | 419 |
if(count($other_vals_array)){ |
422 |
$min_max_markup .= ' [' . join(';', $other_vals_array) . ']';
|
|
420 |
$full_markup .= ' [' . join(';', $other_vals_array) . ']';
|
|
423 | 421 |
} |
424 | 422 |
|
425 |
return $min_max_markup;
|
|
423 |
return $full_markup;
|
|
426 | 424 |
} |
427 | 425 |
|
428 | 426 |
/** |
Also available in: Unified diff
ref #8945 improved support for statistical value type ExactValue