Example #1
0
 /**
  * Add labels to ResultSet
  * 
  * Primarily for formats, facets, and other 'data'-based labels
  *
  * @param ResultSet $results 
  */
 public function addResultsLabels(ResultSet &$results)
 {
     // format in record
     foreach ($results->getRecords() as $result) {
         $format = $result->getXerxesRecord()->format();
         $label_id = $format->getLabel();
         $label = $this->labels->getLabel($label_id);
         if ($label != $label_id) {
             $format->setPublicFormat($label);
         }
     }
     // facets
     foreach ($results->getFacets()->getGroups() as $group) {
         $label_group_name = $this->config->getFacetAttribute($group->name, 'label');
         if ($label_group_name == "") {
             $label_group_name = $this->config->getFacetAttribute($group->name, 'public');
         }
         $group->public = $this->labels->getLabel($label_group_name);
         // format values in facets
         foreach ($group->getFacets() as $facet) {
             $facet->display = $facet->name;
             $label_id = Format::createLabelIdentifier($facet->name);
             $label = $this->labels->getLabel($label_id);
             if ($label != $label_id) {
                 $facet->display = $label;
             }
         }
     }
 }