/**
  * Reads a backtrackoptions element and adds the content to the result object.
  * @param DOMNode $backTrackOptionsNode the node being inspected
  * @param GetSearchPageRecommendationResult $resultObj the result object to fill
  */
 private function readBackTrackOptions(DOMNode $backTrackOptionsNode, GetSearchPageRecommendationResult $resultObj)
 {
     foreach ($backTrackOptionsNode->childNodes as $domainNode) {
         if ($domainNode->nodeName == "backtrackoption") {
             $option = new CancellableOption();
             $option->setTextValue($domainNode->textContent);
             //read attributes
             foreach ($domainNode->attributes as $attribute) {
                 switch ($attribute->name) {
                     case "attname":
                         $option->setFilteredAttributeName($attribute->value);
                         break;
                     case "searchRefiningOptions":
                         $option->setSearchRefiningOption($attribute->value);
                         break;
                     case "discreteVal":
                         $option->setDiscreteValue($attribute->value);
                         break;
                     case "minVal":
                         $option->setRangeValueMin($attribute->value);
                         break;
                     case "maxVal":
                         $option->setRangeValueMax($attribute->value);
                         break;
                 }
             }
             $group = NULL;
             if (!array_key_exists($option->getFilteredAttributeName(), $this->backTrackHashed)) {
                 $group = new CancellableOptionGroup();
                 $group->setFilteredAttributeName($option->getFilteredAttributeName());
                 $resultObj->addCancellableFiltersGroup($group);
                 $this->backTrackHashed[$option->getFilteredAttributeName()] = $group;
             } else {
                 $group = $this->backTrackHashed[$option->getFilteredAttributeName()];
             }
             $group->addFilteringOption($option);
         }
     }
 }
コード例 #2
0
 /**
  * Reads a backtrackoptions element and adds the content to the result object.
  * @param DOMNode $backTrackOptionsNode the node being inspected
  * @param Result $resultObj the result object to fill
  */
 private function readBackTrackOptions(DOMNode $backTrackOptionsNode, Result $resultObj)
 {
     foreach ($backTrackOptionsNode->childNodes as $domainNode) {
         if ($domainNode->nodeName == "backtrackoption") {
             $option = new CancellableOption();
             $option->setTextValue($domainNode->textContent);
             $groupFilteredName = '';
             $groupMultiSelection = false;
             //read attributes
             foreach ($domainNode->attributes as $attribute) {
                 switch ($attribute->name) {
                     case "attname":
                         $groupFilteredName = $attribute->value;
                         break;
                     case "searchRefiningOptions":
                         $option->setSearchRefiningOption($attribute->value);
                         break;
                     case "discreteVal":
                         $option->setDiscreteValue($attribute->value);
                         break;
                     case "minVal":
                         $option->setRangeValueMin($attribute->value);
                         break;
                     case "maxVal":
                         $option->setRangeValueMax($attribute->value);
                         break;
                     case "multiplevaluesselection":
                         if ($attribute->value == true) {
                             $groupMultiSelection = true;
                         }
                         break;
                 }
             }
             $group = null;
             if (!array_key_exists($groupFilteredName, $this->backTrackHashed)) {
                 $group = new CancellableOptionGroup();
                 $group->setFilteredAttributeName($groupFilteredName);
                 $group->setMultiSelect($groupMultiSelection);
                 $resultObj->addCancellableFiltersGroup($group);
                 $this->backTrackHashed[$groupFilteredName] = $group;
             } else {
                 $group = $this->backTrackHashed[$groupFilteredName];
             }
             $group->addFilteringOption($option);
         }
     }
 }