Revision c079337e
Added by Andreas Kohlbecker over 7 years ago
modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
2535 | 2535 |
return strcmp($term1->representation_L10n, $term2->representation_L10n); |
2536 | 2536 |
} |
2537 | 2537 |
|
2538 |
function compare_terms_by_order_index($term1, $term2) { |
|
2539 |
|
|
2540 |
|
|
2541 |
if (!isset($term1->orderIndex)) { |
|
2542 |
$a = 0; |
|
2543 |
} else { |
|
2544 |
$a = $term1->orderIndex; |
|
2545 |
} |
|
2546 |
if (!isset($term2->orderIndex)) { |
|
2547 |
$b = 0; |
|
2548 |
} else { |
|
2549 |
$b = $term2->orderIndex; |
|
2550 |
} |
|
2551 |
|
|
2552 |
if ($a == $b) { |
|
2553 |
return 0; |
|
2554 |
} |
|
2555 |
return ($a < $b) ? -1 : 1; |
|
2556 |
|
|
2557 |
} |
|
2558 |
|
|
2538 | 2559 |
|
2539 | 2560 |
/** |
2540 | 2561 |
* Make a 'deep copy' of an array. |
modules/cdm_dataportal/cdm_dataportal.search.php | ||
---|---|---|
676 | 676 |
*/ |
677 | 677 |
function term_tree_as_options($term_dto_tree, &$options = array(), $prefix = '') { |
678 | 678 |
|
679 |
uasort($term_dto_tree, 'compare_terms_by_representationL10n');
|
|
679 |
uasort($term_dto_tree, 'compare_terms_by_order_index');
|
|
680 | 680 |
foreach ($term_dto_tree as $uuid => $dto) { |
681 | 681 |
$label = $prefix . '<span class="child-label">' |
682 | 682 |
. $dto->representation_L10n |
Also available in: Unified diff
fix #6087 sorting areas by orderIndex