Project

General

Profile

« Previous | Next » 

Revision 644a7b6e

Added by Andreas Kohlbecker over 5 years ago

fixing typeDesignation sort order

View differences:

modules/cdm_dataportal/theme/cdm_dataportal.name.theme
112 112
  if (!empty($specimen_type_designations)) {
113 113
    // Sorting might be different for dataportals so this has to be
114 114
    // parameterized.
115
    usort($specimen_type_designations, "compare_specimenTypeDesignationStatus");
115
    usort($specimen_type_designations, "compare_specimen_type_designation");
116 116
    foreach ($specimen_type_designations as $type_designation) {
117 117
      $typeReference = '';
118 118

  
......
201 201
 * just didn't know where to put it right now.
202 202
 * Compares the status of two SpecimenTypeDesignations
203 203
 *
204
 * @param string $a
205
 *   A SpecimenTypeDesignations.
206
 * @param string $b
207
 *   SpecimenTypeDesignations.
204
 * @param object $a
205
 *   A SpecimenTypeDesignation.
206
 * @param object $b
207
 *   SpecimenTypeDesignation.
208 208
 */
209
function compare_specimenTypeDesignationStatus($a, $b) {
209
function compare_specimen_type_designation($a, $b) {
210 210
  /*
211 211
  This is the desired sort order as of now: Holotype Isotype Lectotype
212 212
  Isolectotype Syntype.
......
232 232
  }
233 233
  if ($aQuantifier == $bQuantifier) {
234 234
    // Sort alphabetically.
235
    return (isset($a->typeStatus->label) && isset($b->typeStatus->label) && $a->typeStatus->label < $b->typeStatus->label) ? -1 : 1;
235
    $a_text =  isset($a->typeSpecimen->titleCache) ? preg_replace('/[\[\]\"]/', '', $a->typeSpecimen->titleCache) : '';
236
    $b_text =  isset($b->typeSpecimen->titleCache) ? preg_replace('/[\[\]\"]/', '', $b->typeSpecimen->titleCache) : '';
237
    return strcasecmp($a_text, $b_text);
236 238
  }
237 239
  return ($aQuantifier < $bQuantifier) ? -1 : 1;
238 240
}

Also available in: Unified diff