public function buildFetch(OCClassSearchFormFetcher $fetcher, $requestKey, $requestValue, &$filters) { $className = $this->getBoundsClassName(); $fieldName = ezfSolrDocumentFieldBase::getFieldName($this->contentClassAttribute, null, 'search'); /** @var OCClassSearchFormFieldBoundsInterface $bounds */ $bounds = $className::fromString($requestValue); $filters[] = $fieldName . ':[' . $bounds->attribute('start_solr') . ' TO ' . $bounds->attribute('end_solr') . ']'; $fetcher->addFetchField(array('name' => $this->contentClassAttribute->attribute('name'), 'value' => $bounds->humanString(), 'remove_view_parameters' => $fetcher->getViewParametersString(array($requestKey)))); }
public function buildFetch(OCClassSearchFormFetcher $fetcher, $requestKey, $requestValue, &$filters) { if (is_array($requestValue) && count($requestValue) == 1) { $requestValue = array_shift($requestValue); } $fieldName = ezfSolrDocumentFieldBase::getFieldName($this->contentClassAttribute, null, 'search'); if (is_array($requestValue)) { $values = array('or'); foreach ($requestValue as $v) { $values[] = $fieldName . ':' . $fetcher->encode($v, true); } $filters[] = $values; } else { $filters[] = $fieldName . ':' . $fetcher->encode($requestValue, true); } $fetcher->addFetchField(array('name' => $this->contentClassAttribute->attribute('name'), 'value' => $requestValue, 'remove_view_parameters' => $fetcher->getViewParametersString(array($requestKey)))); }
/** * Trasforma le variabili $_GET in view_parameters e redirige la richiesta in base al parametro $_GET['RedirectUrlAlias'] * * @see modules/ocsearch/action.php * @param array $requestFields * @param eZModule $module */ public static function redirect(array $requestFields, eZModule $module = null) { $result = new OCClassSearchFormFetcher(); $result->setRequestFields($requestFields); if ($module) { $redirect = '/'; if (isset($requestFields['RedirectUrlAlias'])) { $redirect = $requestFields['RedirectUrlAlias']; } elseif (isset($requestFields['RedirectNodeID'])) { $node = eZContentObjectTreeNode::fetch($requestFields['RedirectNodeID']); if ($node instanceof eZContentObjectTreeNode) { $redirect = $node->attribute('url_alias'); } } $redirect = rtrim($redirect, '/') . $result->getViewParametersString(); $module->redirectTo($redirect); } }
public function buildFetch(OCClassSearchFormFetcher $fetcher, $requestKey, $requestValue, &$filters) { if (is_array($requestValue) && count($requestValue) == 1) { $requestValue = array_shift($requestValue); } //@todo errore nella definzione del nome del sottoattributo? verifaicare vedi anceh in self::getValues //$fieldName = ezfSolrDocumentFieldBase::getFieldName( $this->contentClassAttribute, 'name', 'search' ); $fieldName = ezfSolrDocumentFieldBase::$DocumentFieldName->lookupSchemaName(ezfSolrDocumentFieldBase::SUBATTR_FIELD_PREFIX . $this->contentClassAttribute->attribute('identifier') . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR . 'name' . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR, 'string'); if (is_array($requestValue)) { $values = array('or'); foreach ($requestValue as $v) { $values[] = $fieldName . ':' . $fetcher->encode($v, true); } $filters[] = $values; } else { $filters[] = $fieldName . ':' . $fetcher->encode($requestValue, true); } $fetcher->addFetchField(array('name' => $this->contentClassAttribute->attribute('name'), 'value' => $requestValue, 'remove_view_parameters' => $fetcher->getViewParametersString(array($requestKey)))); }
public function buildFetch(OCClassSearchFormFetcher $fetcher, $requestValue, &$filters) { $bounds = OCClassSearchFormPublishedFieldBounds::fromString($this->attributes['value']); $filters[] = eZSolr::getMetaFieldName('published') . ':[' . $bounds->attribute('start_solr') . ' TO ' . $bounds->attribute('end_solr') . ']'; $fetcher->addFetchField(array('name' => $this->attributes['label'], 'value' => $bounds->humanString(), 'remove_view_parameters' => $fetcher->getViewParametersString(array('publish_date')))); }
public function buildFetch(OCClassSearchFormFetcher $fetcher, $requestValue) { $this->attributes['query'] = $requestValue; $fetcher->addFetchField(array('name' => $this->attributes['label'], 'value' => $this->attributes['query'], 'remove_view_parameters' => $fetcher->getViewParametersString(array('query')))); }