/**
  * @param Parameters $parameters The server parameters used for the current
  *                               request.
  */
 public function __construct(\FACTFinder\Util\Parameters $parameters)
 {
     $this->query = isset($parameters['query']) ? $parameters['query'] : '';
     $this->seoPath = isset($parameters['seoPath']) ? $parameters['seoPath'] : '';
     // Properly prepared server parameters will always have a channel set
     $this->channel = $parameters['channel'];
     $this->advisorStatus = isset($parameters['advisorStatus']) ? $parameters['advisorStatus'] : '';
     $this->productsPerPage = isset($parameters['productsPerPage']) ? $parameters['productsPerPage'] : -1;
     $this->currentPage = isset($parameters['page']) ? $parameters['page'] : 1;
     $this->followSearch = isset($parameters['followSearch']) ? $parameters['followSearch'] : 0;
     $this->navigationEnabled = isset($parameters['catalog']) && $parameters['catalog'] == 'true' || isset($parameters['navigation']) && $parameters['navigation'] == 'true';
     $this->filters = array();
     $this->sortings = array();
     // TODO: Let Parameters implement the necessary interface so that it
     //       can be used directly in foreach.
     foreach ($parameters->getArray() as $key => $value) {
         if (strpos($key, 'filter') === 0) {
             $this->filters[substr($key, strlen('filter'))] = $value;
         } else {
             if (strpos($key, 'sort') === 0 && ($value == 'asc' || $value == 'desc')) {
                 $this->sortings[substr($key, strlen('sort'))] = $value;
             }
         }
     }
 }
예제 #2
0
 /**
  * Get URL with simple authentication encryption.
  *
  * @param string $action The action to be targeted on the FACT-Finder
  *        server.
  * @param FACTFinder\Util\Parameters $parameters The parameters object from
  *        which to build the URL.
  *
  * @return string The full URL.
  */
 protected function getSimpleAuthenticationUrl($action, \FACTFinder\Util\Parameters $parameters)
 {
     $configuration = $this->configuration;
     $ts = time() . '000';
     //milliseconds needed but won't be considered
     $authenticationParameters = "timestamp=" . $ts . '&username='******'&password='******'?' . $parameters->toJavaQueryString() . (count($parameters) ? '&' : '') . $authenticationParameters;
     $this->log->info("Request Url: " . $url);
     return $url;
 }